Add display sharing support in tidss
Subsystems (6)
cover Add display sharing support in tidss
This adds display sharing support in tidss display driver along with an example overlay devicetree file using which can be used to enable display sharing on AM62x devices with device manager core i.e. R5F expected to run a custom firmware which supports corresponding display sharing configuration.
As resources can be partitioned at different levels a flexible scheme is followed while designing devicetree bindings and driver changes keeping in mind possible scenarios in which resources can be partitioned and various DSS hardware IP's supported across different devices.
A rebased version of this patch has been tested on AM62P SoC which also supports same DSS IP as AM62x and the patch with display sharing functionality is already available in vendor-specific kernel source tree
[1] along with documentation which explains the design [2] and DM firmware support [3].
NOTE1: This is marked as RFC for upstream since AM62P is not yet supported in upstream tree and for AM62x SoC which is the target SoC for this patch, the dss sharing functionality is not validated on upstream tree due to missing OLDI support and display sharing DM firmware support, but we still wanted to get some feedback on this.
NOTE2: This series depends on :
https://lore.kernel.org/all/[email protected]/
[1] :
https://git.ti.com/cgit/ti-linux-kernel/ti-linux-kernel/commit/?h=09.01.00.007&id=d805270609cfb6b2e67bd2fd5959d71f48393196
https://git.ti.com/cgit/ti-linux-kernel/ti-linux-kernel/commit/?h=09.01.00.007&id=93d751a94cbf9ad07c7f658e78aa510d919d7cd6
https://git.ti.com/cgit/ti-linux-kernel/ti-linux-kernel/commit/?h=09.01.00.007&id=665c17837dc8bed27e8d63388f8f7f7a85c0cd94
https://git.ti.com/cgit/ti-linux-kernel/ti-linux-kernel/commit/?h=ti-linux-6.1.y-cicd&id=f8d7f1a9617862af922c6bc10e0765ba4f4857d6
[2] :
https://software-dl.ti.com/processor-sdk-linux/esd/AM62PX/09_01_00_08/exports/docs/linux/Foundational_Components/Kernel/Kernel_Drivers/Display/DSS7.html#driver-features
(Display Sharing mode feature description)
https://software-dl.ti.com/processor-sdk-linux/esd/AM62PX/09_01_00_08/exports/docs/linux/How_to_Guides/Target/How_to_enable_display_sharing_between_remotecore_and_Linux.html
(How To Guide)
https://software-dl.ti.com/processor-sdk-linux/esd/AM62PX/09_01_00_08/exports/docs/system/Demo_User_Guides/Display_Cluster_User_Guide.html
(Display Cluster user guide with demo details)
Devarsh Thakkar (3):
dt-bindings: display: ti,am65x-dss: Add support for display sharing
mode
drm/tidss: Add support for display sharing
arm64: dts: ti: k3-am62x: Add overlay to use DSS in display sharing
mode
.../bindings/display/ti/ti,am65x-dss.yaml | 82 ++++++ arch/arm64/boot/dts/ti/Makefile | 1 + .../dts/ti/k3-am62x-sk-dss-shared-mode.dtso | 23 ++ drivers/gpu/drm/tidss/tidss_crtc.c | 120 ++++++++- drivers/gpu/drm/tidss/tidss_dispc.c | 254 ++++++++++++++++-- drivers/gpu/drm/tidss/tidss_dispc.h | 2 +- drivers/gpu/drm/tidss/tidss_drv.c | 33 ++- drivers/gpu/drm/tidss/tidss_drv.h | 6 + 8 files changed, 481 insertions(+), 40 deletions(-) create mode 100644 arch/arm64/boot/dts/ti/k3-am62x-sk-dss-shared-mode.dtso
Signature · 1 line
2.34.1
RFC PATCH 1/3 dt-bindings: display: ti,am65x-dss: Add support for display sharing mode
Add support for using TI Keystone DSS hardware present in display sharing mode.
TI Keystone DSS hardware supports partitioning of resources between multiple hosts as it provides separate register space and unique interrupt line to each host.
The DSS hardware can be used in shared mode in such a way that one or more of video planes can be owned by Linux wherease other planes can be owned by remote cores.
One or more of the video ports can be dedicated exclusively to a processing core, wherease some of the video ports can be shared between two hosts too with only one of them having write access.
--- .../bindings/display/ti/ti,am65x-dss.yaml | 82 +++++++++++++++++++ 1 file changed, 82 insertions(+)
Documentation/devicetree/bindings/display/ti/ti,am65x-dss.yaml +82 -0
@@ -112,6 +112,86 @@ properties: Input memory (from main memory to dispc) bandwidth limit in bytes per second + ti,dss-shared-mode: + type: boolean + description: + TI DSS7 supports sharing of display between multiple hosts + as it provides separate register space for display configuration and + unique interrupt line to each host. + One of the host is provided access to the global display + configuration labelled as "common" region of DSS allows that host + exclusive access to global registers of DSS while other host can + configure the display for it's usage using a separate register + space labelled as "common1". + The DSS resources can be partitioned in such a way that one or more + of the video planes are owned by Linux whereas other video planes + can be owned by a remote core. + The video port controlling these planes acts as a shared video port + and it can be configured with write access either by Linux or the + remote core in which case Linux only has read-only access to that + video port. + + ti,dss-shared-mode-planes: + description: + The video layer that is owned by processing core running Linux. + The display driver running from Linux has exclusive write access to + this video layer. + $ref: /schemas/types.yaml#/definitions/string + enum: [vidl, vid] + + ti,dss-shared-mode-vp: + description: + The video port that is being used in context of processing core + running Linux with display susbsytem being used in shared mode. + This can be owned either by the processing core running Linux in + which case Linux has the write access and the responsibility to + configure this video port and the associated overlay manager or + it can be shared between core running Linux and a remote core + with remote core provided with write access to this video port and + associated overlay managers and remote core configures and drives + this video port also feeding data from one or more of the + video planes owned by Linux, with Linux only having read-only access + to this video port and associated overlay managers. + + $ref: /schemas/types.yaml#/definitions/string + enum: [vp1, vp2] + + ti,dss-shared-mode-common: + description: + The DSS register region owned by processing core running Linux. + $ref: /schemas/types.yaml#/definitions/string + enum: [common, common1] + + ti,dss-shared-mode-vp-owned: + description: + This tells whether processing core running Linux has write access to + the video ports enlisted in ti,dss-shared-mode-vps. + $ref: /schemas/types.yaml#/definitions/uint32 + enum: [0, 1] + + ti,dss-shared-mode-plane-zorder: + description: + The zorder of the planes owned by Linux. + For the scenario where Linux is not having write access to associated + video port, this field is just for + informational purpose to enumerate the zorder configuration + being used by remote core. + + $ref: /schemas/types.yaml#/definitions/uint32 + enum: [0, 1] + +dependencies: + ti,dss-shared-mode: [ 'ti,dss-shared-mode-planes', 'ti,dss-shared-mode-vp', + 'ti,dss-shared-mode-plane-zorder', 'ti,dss-shared-mode-vp-owned'] + ti,dss-shared-mode-vp: ['ti,dss-shared-mode', 'ti,dss-shared-mode-planes', + 'ti,dss-shared-mode-plane-zorder', 'ti,dss-shared-mode-vp-owned'] + ti,dss-shared-mode-planes: ['ti,dss-shared-mode', 'ti,dss-shared-mode-vp', + 'ti,dss-shared-mode-plane-zorder', 'ti,dss-shared-mode-vp-owned'] + ti,dss-shared-mode-plane-zorder: ['ti,dss-shared-mode-planes', 'ti,dss-shared-mode-vp', + 'ti,dss-shared-mode', 'ti,dss-shared-mode-vp-owned'] + ti,dss-shared-mode-vp-owned: ['ti,dss-shared-mode-planes', 'ti,dss-shared-mode-vp', + 'ti,dss-shared-mode', 'ti,dss-shared-mode-plane-zorder'] + allOf: - if: properties:
@@ -123,6 +203,8 @@ allOf: ports: properties: port@0: false + ti,dss-shared-mode-vp: + enum: [vp2] required: - compatible
Signature · 1 line
2.34.1
Rob Herring
maintainerRe: [RFC PATCH 1/3] dt-bindings: display: ti,am65x-dss: Add support for display sharing mode
Quoted 25 lines · Devarsh Thakkar
Add support for using TI Keystone DSS hardware present in display sharing mode.
TI Keystone DSS hardware supports partitioning of resources between multiple hosts as it provides separate register space and unique interrupt line to each host.
The DSS hardware can be used in shared mode in such a way that one or more of video planes can be owned by Linux wherease other planes can be owned by remote cores.
One or more of the video ports can be dedicated exclusively to a processing core, wherease some of the video ports can be shared between two hosts too with only one of them having write access.
Signed-off-by Devarsh Thakkar <[email protected]>--- .../bindings/display/ti/ti,am65x-dss.yaml | 82 +++++++++++++++++++ 1 file changed, 82 insertions(+)Documentation/devicetree/bindings/display/ti/ti,am65x-dss.yaml +0
-0
Documentation/devicetree/bindings/display/ti/ti,am65x-dss.yaml properties: · line 120
Quoted 9 lines
Documentation/devicetree/bindings/display/ti/ti,am65x-dss.yaml +6
-0@@ -112,6 +112,86 @@ properties: Input memory (from main memory to dispc) bandwidth limit in bytes per second + ti,dss-shared-mode: + type: boolean + description: + TI DSS7 supports sharing of display between multiple hosts + as it provides separate register space for display configuration and + unique interrupt line to each host.
If you care about line breaks, you need '|'.
Documentation/devicetree/bindings/display/ti/ti,am65x-dss.yaml properties: · line 127
Quoted 7 lines
Documentation/devicetree/bindings/display/ti/ti,am65x-dss.yaml +7
-0+ One of the host is provided access to the global display + configuration labelled as "common" region of DSS allows that host + exclusive access to global registers of DSS while other host can + configure the display for it's usage using a separate register + space labelled as "common1". + The DSS resources can be partitioned in such a way that one or more + of the video planes are owned by Linux whereas other video planes
Your h/w can only run Linux?
What if you want to use this same binding to define the configuration to the 'remote processor'? You can easily s/Linux/the OS/, but it all should be reworded to describe things in terms of the local processor.
Documentation/devicetree/bindings/display/ti/ti,am65x-dss.yaml properties: · line 132
Quoted 5 lines
Documentation/devicetree/bindings/display/ti/ti,am65x-dss.yaml +5
-0+ can be owned by a remote core. + The video port controlling these planes acts as a shared video port + and it can be configured with write access either by Linux or the + remote core in which case Linux only has read-only access to that + video port.
What is the purpose of this property when all the other properties are required?
Quoted 28 lines
Documentation/devicetree/bindings/display/ti/ti,am65x-dss.yaml +28
-0+ + ti,dss-shared-mode-planes: + description: + The video layer that is owned by processing core running Linux. + The display driver running from Linux has exclusive write access to + this video layer. + $ref: /schemas/types.yaml#/definitions/string + enum: [vidl, vid] + + ti,dss-shared-mode-vp: + description: + The video port that is being used in context of processing core + running Linux with display susbsytem being used in shared mode. + This can be owned either by the processing core running Linux in + which case Linux has the write access and the responsibility to + configure this video port and the associated overlay manager or + it can be shared between core running Linux and a remote core + with remote core provided with write access to this video port and + associated overlay managers and remote core configures and drives + this video port also feeding data from one or more of the + video planes owned by Linux, with Linux only having read-only access + to this video port and associated overlay managers. + + $ref: /schemas/types.yaml#/definitions/string + enum: [vp1, vp2] + + ti,dss-shared-mode-common: + description:
Documentation/devicetree/bindings/display/ti/ti,am65x-dss.yaml properties: · line 170
Quoted 10 lines
Documentation/devicetree/bindings/display/ti/ti,am65x-dss.yaml +10
-0+ The DSS register region owned by processing core running Linux. + $ref: /schemas/types.yaml#/definitions/string + enum: [common, common1] + + ti,dss-shared-mode-vp-owned: + description: + This tells whether processing core running Linux has write access to + the video ports enlisted in ti,dss-shared-mode-vps. + $ref: /schemas/types.yaml#/definitions/uint32 + enum: [0, 1]
This can be boolean. Do writes abort or just get ignored? The latter can be probed and doesn't need a property.
Documentation/devicetree/bindings/display/ti/ti,am65x-dss.yaml properties: · line 181
Quoted 11 lines
Documentation/devicetree/bindings/display/ti/ti,am65x-dss.yaml +11
-0+ + ti,dss-shared-mode-plane-zorder: + description: + The zorder of the planes owned by Linux. + For the scenario where Linux is not having write access to associated + video port, this field is just for + informational purpose to enumerate the zorder configuration + being used by remote core. + + $ref: /schemas/types.yaml#/definitions/uint32 + enum: [0, 1]
I don't understand how 0 or 1 defines Z-order.
Quoted 17 lines
Documentation/devicetree/bindings/display/ti/ti,am65x-dss.yaml +13
-0+ +dependencies: + ti,dss-shared-mode: [ 'ti,dss-shared-mode-planes', 'ti,dss-shared-mode-vp', + 'ti,dss-shared-mode-plane-zorder', 'ti,dss-shared-mode-vp-owned'] + ti,dss-shared-mode-vp: ['ti,dss-shared-mode', 'ti,dss-shared-mode-planes', + 'ti,dss-shared-mode-plane-zorder', 'ti,dss-shared-mode-vp-owned'] + ti,dss-shared-mode-planes: ['ti,dss-shared-mode', 'ti,dss-shared-mode-vp', + 'ti,dss-shared-mode-plane-zorder', 'ti,dss-shared-mode-vp-owned'] + ti,dss-shared-mode-plane-zorder: ['ti,dss-shared-mode-planes', 'ti,dss-shared-mode-vp', + 'ti,dss-shared-mode', 'ti,dss-shared-mode-vp-owned'] + ti,dss-shared-mode-vp-owned: ['ti,dss-shared-mode-planes', 'ti,dss-shared-mode-vp', + 'ti,dss-shared-mode', 'ti,dss-shared-mode-plane-zorder'] + allOf: - if: properties:
Documentation/devicetree/bindings/display/ti/ti,am65x-dss.yaml allOf: · line 207
Quoted 5 lines
Documentation/devicetree/bindings/display/ti/ti,am65x-dss.yaml +2
-0@@ -123,6 +203,8 @@ allOf: ports: properties: port@0: false + ti,dss-shared-mode-vp: + enum: [vp2]
This should throw a warning. You just defined a property called 'enum'.
Rob
Rob Herring
maintainerRe: [RFC PATCH 1/3] dt-bindings: display: ti,am65x-dss: Add support for display sharing mode
Quoted 133 lines · Rob Herring
Quoted 25 lines · Devarsh Thakkar
Add support for using TI Keystone DSS hardware present in display sharing mode.
TI Keystone DSS hardware supports partitioning of resources between multiple hosts as it provides separate register space and unique interrupt line to each host.
The DSS hardware can be used in shared mode in such a way that one or more of video planes can be owned by Linux wherease other planes can be owned by remote cores.
One or more of the video ports can be dedicated exclusively to a processing core, wherease some of the video ports can be shared between two hosts too with only one of them having write access.
Signed-off-by Devarsh Thakkar <[email protected]>--- .../bindings/display/ti/ti,am65x-dss.yaml | 82 +++++++++++++++++++ 1 file changed, 82 insertions(+)Documentation/devicetree/bindings/display/ti/ti,am65x-dss.yaml +0
-0Documentation/devicetree/bindings/display/ti/ti,am65x-dss.yaml properties: · line 120
Quoted 9 lines
Documentation/devicetree/bindings/display/ti/ti,am65x-dss.yaml +6
-0@@ -112,6 +112,86 @@ properties: Input memory (from main memory to dispc) bandwidth limit in bytes per second + ti,dss-shared-mode: + type: boolean + description: + TI DSS7 supports sharing of display between multiple hosts + as it provides separate register space for display configuration and + unique interrupt line to each host.If you care about line breaks, you need '|'.
Documentation/devicetree/bindings/display/ti/ti,am65x-dss.yaml properties: · line 127
Quoted 7 lines
Documentation/devicetree/bindings/display/ti/ti,am65x-dss.yaml +7
-0+ One of the host is provided access to the global display + configuration labelled as "common" region of DSS allows that host + exclusive access to global registers of DSS while other host can + configure the display for it's usage using a separate register + space labelled as "common1". + The DSS resources can be partitioned in such a way that one or more + of the video planes are owned by Linux whereas other video planesYour h/w can only run Linux?
What if you want to use this same binding to define the configuration to the 'remote processor'? You can easily s/Linux/the OS/, but it all should be reworded to describe things in terms of the local processor.
Documentation/devicetree/bindings/display/ti/ti,am65x-dss.yaml properties: · line 132
Quoted 5 lines
Documentation/devicetree/bindings/display/ti/ti,am65x-dss.yaml +5
-0+ can be owned by a remote core. + The video port controlling these planes acts as a shared video port + and it can be configured with write access either by Linux or the + remote core in which case Linux only has read-only access to that + video port.What is the purpose of this property when all the other properties are required?
Quoted 28 lines
Documentation/devicetree/bindings/display/ti/ti,am65x-dss.yaml +28
-0+ + ti,dss-shared-mode-planes: + description: + The video layer that is owned by processing core running Linux. + The display driver running from Linux has exclusive write access to + this video layer. + $ref: /schemas/types.yaml#/definitions/string + enum: [vidl, vid] + + ti,dss-shared-mode-vp: + description: + The video port that is being used in context of processing core + running Linux with display susbsytem being used in shared mode. + This can be owned either by the processing core running Linux in + which case Linux has the write access and the responsibility to + configure this video port and the associated overlay manager or + it can be shared between core running Linux and a remote core + with remote core provided with write access to this video port and + associated overlay managers and remote core configures and drives + this video port also feeding data from one or more of the + video planes owned by Linux, with Linux only having read-only access + to this video port and associated overlay managers. + + $ref: /schemas/types.yaml#/definitions/string + enum: [vp1, vp2] + + ti,dss-shared-mode-common: + description:Documentation/devicetree/bindings/display/ti/ti,am65x-dss.yaml properties: · line 170
Quoted 10 lines
Documentation/devicetree/bindings/display/ti/ti,am65x-dss.yaml +10
-0+ The DSS register region owned by processing core running Linux. + $ref: /schemas/types.yaml#/definitions/string + enum: [common, common1] + + ti,dss-shared-mode-vp-owned: + description: + This tells whether processing core running Linux has write access to + the video ports enlisted in ti,dss-shared-mode-vps. + $ref: /schemas/types.yaml#/definitions/uint32 + enum: [0, 1]This can be boolean. Do writes abort or just get ignored? The latter can be probed and doesn't need a property.
Documentation/devicetree/bindings/display/ti/ti,am65x-dss.yaml properties: · line 181
Quoted 11 lines
Documentation/devicetree/bindings/display/ti/ti,am65x-dss.yaml +11
-0+ + ti,dss-shared-mode-plane-zorder: + description: + The zorder of the planes owned by Linux. + For the scenario where Linux is not having write access to associated + video port, this field is just for + informational purpose to enumerate the zorder configuration + being used by remote core. + + $ref: /schemas/types.yaml#/definitions/uint32 + enum: [0, 1]I don't understand how 0 or 1 defines Z-order.
Quoted 16 lines
Documentation/devicetree/bindings/display/ti/ti,am65x-dss.yaml +13
-0+ +dependencies: + ti,dss-shared-mode: [ 'ti,dss-shared-mode-planes', 'ti,dss-shared-mode-vp', + 'ti,dss-shared-mode-plane-zorder', 'ti,dss-shared-mode-vp-owned'] + ti,dss-shared-mode-vp: ['ti,dss-shared-mode', 'ti,dss-shared-mode-planes', + 'ti,dss-shared-mode-plane-zorder', 'ti,dss-shared-mode-vp-owned'] + ti,dss-shared-mode-planes: ['ti,dss-shared-mode', 'ti,dss-shared-mode-vp', + 'ti,dss-shared-mode-plane-zorder', 'ti,dss-shared-mode-vp-owned'] + ti,dss-shared-mode-plane-zorder: ['ti,dss-shared-mode-planes', 'ti,dss-shared-mode-vp', + 'ti,dss-shared-mode', 'ti,dss-shared-mode-vp-owned'] + ti,dss-shared-mode-vp-owned: ['ti,dss-shared-mode-planes', 'ti,dss-shared-mode-vp', + 'ti,dss-shared-mode', 'ti,dss-shared-mode-plane-zorder'] + allOf: - if: properties:
Quoted 8 lines
Documentation/devicetree/bindings/display/ti/ti,am65x-dss.yaml allOf: · line 207
Quoted 6 lines
Documentation/devicetree/bindings/display/ti/ti,am65x-dss.yaml +2
-0@@ -123,6 +203,8 @@ allOf: ports: properties: port@0: false + ti,dss-shared-mode-vp: + enum: [vp2]This should throw a warning. You just defined a property called 'enum'.
Indeed it does. Test your bindings before sending.
../Documentation/devicetree/bindings/display/ti/ti,am65x-dss.yaml:204:35: [error] empty value in block mapp ing (empty-values)
CHKDT Documentation/devicetree/bindings/processed-schema.json/home/rob/proj/linux-dt/Documentation/devicetree/bindings/display/ti/ti,am65x-dss.yaml: allOf:0:then:proper ties:ports:properties:ti,dss-shared-mode-vp: None is not of type 'object', 'boolean'
from schema $id: http://json-schema.org/draft-07/schema#/home/rob/proj/linux-dt/Documentation/devicetree/bindings/display/ti/ti,am65x-dss.yaml: allOf:0:then:proper ties:ports:properties:enum: ['vp2'] is not of type 'object', 'boolean'
from schema $id: http://json-schema.org/draft-07/schema#/home/rob/proj/linux-dt/Documentation/devicetree/bindings/display/ti/ti,am65x-dss.yaml: allOf:0:then:proper ties:ports:properties: 'enum' should not be valid under {'$ref': '#/definitions/json-schema-prop-names'}
hint: A json-schema keyword was found instead of a DT property name.
from schema $id: http://devicetree.org/meta-schemas/keywords.yaml#/home/rob/proj/linux-dt/Documentation/devicetree/bindings/display/ti/ti,am65x-dss.yaml: allOf:0:then:proper ties:ports:properties:ti,dss-shared-mode-vp: None is not of type 'object', 'boolean'
from schema $id: http://devicetree.org/meta-schemas/keywords.yaml#/home/rob/proj/linux-dt/Documentation/devicetree/bindings/display/ti/ti,am65x-dss.yaml: allOf:0:then:proper ties:ports:properties:enum: ['vp2'] is not of type 'object', 'boolean'
from schema $id: http://devicetree.org/meta-schemas/keywords.yaml#
Re: [RFC PATCH 1/3] dt-bindings: display: ti,am65x-dss: Add support for display sharing mode
In reply to Rob HerringHi Rob,
Thanks for the quick review.
Quoted 29 lines · Rob Herring
Quoted 28 lines · Devarsh Thakkar
Add support for using TI Keystone DSS hardware present in display sharing mode.
TI Keystone DSS hardware supports partitioning of resources between multiple hosts as it provides separate register space and unique interrupt line to each host.
The DSS hardware can be used in shared mode in such a way that one or more of video planes can be owned by Linux wherease other planes can be owned by remote cores.
One or more of the video ports can be dedicated exclusively to a processing core, wherease some of the video ports can be shared between two hosts too with only one of them having write access.
Signed-off-by Devarsh Thakkar <[email protected]>--- .../bindings/display/ti/ti,am65x-dss.yaml | 82 +++++++++++++++++++ 1 file changed, 82 insertions(+)Documentation/devicetree/bindings/display/ti/ti,am65x-dss.yaml +0
-0@@ -112,6 +112,86 @@ properties: Input memory (from main memory to dispc) bandwidth limit in bytes per second
Quoted 9 lines
Documentation/devicetree/bindings/display/ti/ti,am65x-dss.yaml properties: · line 120
Quoted 6 lines
Documentation/devicetree/bindings/display/ti/ti,am65x-dss.yaml +6
-0+ ti,dss-shared-mode: + type: boolean + description: + TI DSS7 supports sharing of display between multiple hosts + as it provides separate register space for display configuration and + unique interrupt line to each host.If you care about line breaks, you need '|'.
Noted.
Quoted 8 lines
Documentation/devicetree/bindings/display/ti/ti,am65x-dss.yaml properties: · line 127
Quoted 7 lines
Documentation/devicetree/bindings/display/ti/ti,am65x-dss.yaml +7
-0+ One of the host is provided access to the global display + configuration labelled as "common" region of DSS allows that host + exclusive access to global registers of DSS while other host can + configure the display for it's usage using a separate register + space labelled as "common1". + The DSS resources can be partitioned in such a way that one or more + of the video planes are owned by Linux whereas other video planes
Quoted 6 lines
Your h/w can only run Linux?
What if you want to use this same binding to define the configuration to the 'remote processor'? You can easily s/Linux/the OS/, but it all should be reworded to describe things in terms of the local processor.
It can run both Linux and RTOS or for that matter any other OS too. But yes I got your point, will reword accordingly.
Quoted 9 lines
Documentation/devicetree/bindings/display/ti/ti,am65x-dss.yaml properties: · line 132
Quoted 5 lines
Documentation/devicetree/bindings/display/ti/ti,am65x-dss.yaml +5
-0+ can be owned by a remote core. + The video port controlling these planes acts as a shared video port + and it can be configured with write access either by Linux or the + remote core in which case Linux only has read-only access to that + video port.What is the purpose of this property when all the other properties are required?
The ti,dss-shared-mode and below group of properties are optional. But if ti,dss-shared-mode is set then only driver should parse below set of properties.
Quoted 33 lines
Quoted 33 lines
Documentation/devicetree/bindings/display/ti/ti,am65x-dss.yaml +33
-0+ + ti,dss-shared-mode-planes: + description: + The video layer that is owned by processing core running Linux. + The display driver running from Linux has exclusive write access to + this video layer. + $ref: /schemas/types.yaml#/definitions/string + enum: [vidl, vid] + + ti,dss-shared-mode-vp: + description: + The video port that is being used in context of processing core + running Linux with display susbsytem being used in shared mode. + This can be owned either by the processing core running Linux in + which case Linux has the write access and the responsibility to + configure this video port and the associated overlay manager or + it can be shared between core running Linux and a remote core + with remote core provided with write access to this video port and + associated overlay managers and remote core configures and drives + this video port also feeding data from one or more of the + video planes owned by Linux, with Linux only having read-only access + to this video port and associated overlay managers. + + $ref: /schemas/types.yaml#/definitions/string + enum: [vp1, vp2] + + ti,dss-shared-mode-common: + description: + The DSS register region owned by processing core running Linux. + $ref: /schemas/types.yaml#/definitions/string + enum: [common, common1] + + ti,dss-shared-mode-vp-owned:
Quoted 9 lines
Documentation/devicetree/bindings/display/ti/ti,am65x-dss.yaml properties: · line 170
Quoted 5 lines
Documentation/devicetree/bindings/display/ti/ti,am65x-dss.yaml +5
-0+ description: + This tells whether processing core running Linux has write access to + the video ports enlisted in ti,dss-shared-mode-vps. + $ref: /schemas/types.yaml#/definitions/uint32 + enum: [0, 1]This can be boolean. Do writes abort or just get ignored? The latter can be probed and doesn't need a property.
Although we have kept all these properties as enums, but actually in driver we are treating them as array of enums and using device_property_read_u32_array.
The reason being that for SoCs using am65x-dss bindings they can only have single entry either vp1 or vp2 or 0 or 1 as there are only two video ports. So for them the device tree overlay would look like :
&dss0 {
ti,dss-shared-mode;
ti,dss-shared-mode-vp = "vp1";
ti,dss-shared-mode-vp-owned = <0>;
ti,dss-shared-mode-common = "common1";
ti,dss-shared-mode-planes = "vid";
ti,dss-shared-mode-plane-zorder = <0>;
interrupts = <GIC_SPI 85 IRQ_TYPE_LEVEL_>;
}But we also plan to extend these bindings to SoCs using Documentation/devicetree/bindings/display/ti/ti,j721e-dss.yaml where there are multiple video ports. So in that the driver and bindings should support below configuration :
&dss0 {
ti,dss-shared-mode;
ti,dss-shared-mode-vp = "vp1 vp2";
ti,dss-shared-mode-vp-owned = <0 1>;
ti,dss-shared-mode-common = "common_s1";
ti,dss-shared-mode-planes = "vid1 vidl1";
ti,dss-shared-mode-plane-zorder = <0 1>;
interrupts = <GIC_SPI 85 IRQ_TYPE_LEVEL_>;
}As I am using device_property_read_u32_array in driver I thought to keep this as uint32 in enum for am65x.yaml which works well with the driver.
Quoted 5 lines
Quoted 5 lines
Documentation/devicetree/bindings/display/ti/ti,am65x-dss.yaml +5
-0+ + ti,dss-shared-mode-plane-zorder: + description: + The zorder of the planes owned by Linux. + For the scenario where Linux is not having write access to associated
Quoted 9 lines
Documentation/devicetree/bindings/display/ti/ti,am65x-dss.yaml properties: · line 181
Quoted 6 lines
Documentation/devicetree/bindings/display/ti/ti,am65x-dss.yaml +6
-0+ video port, this field is just for + informational purpose to enumerate the zorder configuration + being used by remote core. + + $ref: /schemas/types.yaml#/definitions/uint32 + enum: [0, 1]I don't understand how 0 or 1 defines Z-order.
As there are only two planes in total so z-order can be either 0 or 1 for the shared mode plane as there is only a single entry of plane.
For e.g. if ti,dss-shared-mode-plane-zorder is 1 then it means the plane owned by Linux is programmed as topmost plane wherease the plane owned by remote core is programmed as the underneath one.
Quoted 16 lines
Quoted 16 lines
Documentation/devicetree/bindings/display/ti/ti,am65x-dss.yaml +13
-0+ +dependencies: + ti,dss-shared-mode: [ 'ti,dss-shared-mode-planes', 'ti,dss-shared-mode-vp', + 'ti,dss-shared-mode-plane-zorder', 'ti,dss-shared-mode-vp-owned'] + ti,dss-shared-mode-vp: ['ti,dss-shared-mode', 'ti,dss-shared-mode-planes', + 'ti,dss-shared-mode-plane-zorder', 'ti,dss-shared-mode-vp-owned'] + ti,dss-shared-mode-planes: ['ti,dss-shared-mode', 'ti,dss-shared-mode-vp', + 'ti,dss-shared-mode-plane-zorder', 'ti,dss-shared-mode-vp-owned'] + ti,dss-shared-mode-plane-zorder: ['ti,dss-shared-mode-planes', 'ti,dss-shared-mode-vp', + 'ti,dss-shared-mode', 'ti,dss-shared-mode-vp-owned'] + ti,dss-shared-mode-vp-owned: ['ti,dss-shared-mode-planes', 'ti,dss-shared-mode-vp', + 'ti,dss-shared-mode', 'ti,dss-shared-mode-plane-zorder'] + allOf: - if: properties:
Quoted 9 lines
Documentation/devicetree/bindings/display/ti/ti,am65x-dss.yaml allOf: · line 207
Quoted 6 lines
Documentation/devicetree/bindings/display/ti/ti,am65x-dss.yaml +2
-0@@ -123,6 +203,8 @@ allOf: ports: properties: port@0: false + ti,dss-shared-mode-vp: + enum: [vp2]This should throw a warning. You just defined a property called 'enum'.
Oops will fix this.
Regards
Devarsh
Quoted 1 line
Rob
Rob Herring
maintainerRe: [RFC PATCH 1/3] dt-bindings: display: ti,am65x-dss: Add support for display sharing mode
Quoted 71 lines · Devarsh Thakkar
Hi Rob,
Thanks for the quick review.
Quoted 29 lines · Rob Herring
Quoted 28 lines · Devarsh Thakkar
Add support for using TI Keystone DSS hardware present in display sharing mode.
TI Keystone DSS hardware supports partitioning of resources between multiple hosts as it provides separate register space and unique interrupt line to each host.
The DSS hardware can be used in shared mode in such a way that one or more of video planes can be owned by Linux wherease other planes can be owned by remote cores.
One or more of the video ports can be dedicated exclusively to a processing core, wherease some of the video ports can be shared between two hosts too with only one of them having write access.
Signed-off-by Devarsh Thakkar <[email protected]>--- .../bindings/display/ti/ti,am65x-dss.yaml | 82 +++++++++++++++++++ 1 file changed, 82 insertions(+)Documentation/devicetree/bindings/display/ti/ti,am65x-dss.yaml +0
-0@@ -112,6 +112,86 @@ properties: Input memory (from main memory to dispc) bandwidth limit in bytes per secondQuoted 9 lines
Documentation/devicetree/bindings/display/ti/ti,am65x-dss.yaml properties: · line 120
Quoted 6 lines
Documentation/devicetree/bindings/display/ti/ti,am65x-dss.yaml +6
-0+ ti,dss-shared-mode: + type: boolean + description: + TI DSS7 supports sharing of display between multiple hosts + as it provides separate register space for display configuration and + unique interrupt line to each host.If you care about line breaks, you need '|'.
Noted.
Quoted 8 lines
Documentation/devicetree/bindings/display/ti/ti,am65x-dss.yaml properties: · line 127
Quoted 7 lines
Documentation/devicetree/bindings/display/ti/ti,am65x-dss.yaml +7
-0+ One of the host is provided access to the global display + configuration labelled as "common" region of DSS allows that host + exclusive access to global registers of DSS while other host can + configure the display for it's usage using a separate register + space labelled as "common1". + The DSS resources can be partitioned in such a way that one or more + of the video planes are owned by Linux whereas other video planesQuoted 6 lines
Your h/w can only run Linux?
What if you want to use this same binding to define the configuration to the 'remote processor'? You can easily s/Linux/the OS/, but it all should be reworded to describe things in terms of the local processor.
It can run both Linux and RTOS or for that matter any other OS too. But yes I got your point, will reword accordingly.
Quoted 6 lines
Quoted 5 lines
Documentation/devicetree/bindings/display/ti/ti,am65x-dss.yaml +5
-0+ can be owned by a remote core. + The video port controlling these planes acts as a shared video port + and it can be configured with write access either by Linux or the + remote core in which case Linux only has read-only access to that + video port.
Quoted 7 lines
Quoted 3 lines
What is the purpose of this property when all the other properties are required?
The ti,dss-shared-mode and below group of properties are optional. But if ti,dss-shared-mode is set then only driver should parse below set of properties.
Let me re-phrase. Drop this property. It serves no purpose since all the properties have to be present anyway.
Quoted 65 lines
Quoted 32 lines
Quoted 32 lines
Documentation/devicetree/bindings/display/ti/ti,am65x-dss.yaml +32
-0+ ti,dss-shared-mode-planes: + description: + The video layer that is owned by processing core running Linux. + The display driver running from Linux has exclusive write access to + this video layer. + $ref: /schemas/types.yaml#/definitions/string + enum: [vidl, vid] + + ti,dss-shared-mode-vp: + description: + The video port that is being used in context of processing core + running Linux with display susbsytem being used in shared mode. + This can be owned either by the processing core running Linux in + which case Linux has the write access and the responsibility to + configure this video port and the associated overlay manager or + it can be shared between core running Linux and a remote core + with remote core provided with write access to this video port and + associated overlay managers and remote core configures and drives + this video port also feeding data from one or more of the + video planes owned by Linux, with Linux only having read-only access + to this video port and associated overlay managers. + + $ref: /schemas/types.yaml#/definitions/string + enum: [vp1, vp2] + + ti,dss-shared-mode-common: + description: + The DSS register region owned by processing core running Linux. + $ref: /schemas/types.yaml#/definitions/string + enum: [common, common1] + + ti,dss-shared-mode-vp-owned:Quoted 9 lines
Documentation/devicetree/bindings/display/ti/ti,am65x-dss.yaml properties: · line 170
Quoted 5 lines
Documentation/devicetree/bindings/display/ti/ti,am65x-dss.yaml +5
-0+ description: + This tells whether processing core running Linux has write access to + the video ports enlisted in ti,dss-shared-mode-vps. + $ref: /schemas/types.yaml#/definitions/uint32 + enum: [0, 1]This can be boolean. Do writes abort or just get ignored? The latter can be probed and doesn't need a property.
Although we have kept all these properties as enums, but actually in driver we are treating them as array of enums and using
device_property_read_u32_array.The reason being that for SoCs using am65x-dss bindings they can only have single entry either vp1 or vp2 or 0 or 1 as there are only two video ports. So for them the device tree overlay would look like :
&dss0 {ti,dss-shared-mode; ti,dss-shared-mode-vp = "vp1"; ti,dss-shared-mode-vp-owned = <0>; ti,dss-shared-mode-common = "common1"; ti,dss-shared-mode-planes = "vid"; ti,dss-shared-mode-plane-zorder = <0>; interrupts = <GIC_SPI 85 IRQ_TYPE_LEVEL_>; }
Quoted 4 lines
But we also plan to extend these bindings to SoCs using
Documentation/devicetree/bindings/display/ti/ti,j721e-dss.yamlwhere there are multiple video ports. So in that the driver and bindings should support below configuration :
What are you waiting for? In that case, all these properties need to be in a shared schema file and referenced here. Otherwise you will be defining their types twice (and different types too if some are changed to arrays).
Quoted 17 lines
&dss0 {
ti,dss-shared-mode; ti,dss-shared-mode-vp = "vp1 vp2"; ti,dss-shared-mode-vp-owned = <0 1>; ti,dss-shared-mode-common = "common_s1"; ti,dss-shared-mode-planes = "vid1 vidl1"; ti,dss-shared-mode-plane-zorder = <0 1>; interrupts = <GIC_SPI 85 IRQ_TYPE_LEVEL_>; }
Quoted 2 lines
As I am using
device_property_read_u32_arrayin driver I thought to keep this as uint32 in enum foram65x.yamlwhich works well with the driver.
The type and what accessor functions the kernel uses should match. I plan to add (debug) checking on this. Debug only because as there's no type info in the DTB, it all has to be extracted from schemas and put into the kernel.
Quoted 15 lines
Quoted 5 lines
Quoted 5 lines
Documentation/devicetree/bindings/display/ti/ti,am65x-dss.yaml +5
-0+ + ti,dss-shared-mode-plane-zorder: + description: + The zorder of the planes owned by Linux. + For the scenario where Linux is not having write access to associatedQuoted 9 lines
Documentation/devicetree/bindings/display/ti/ti,am65x-dss.yaml properties: · line 181
Quoted 6 lines
Documentation/devicetree/bindings/display/ti/ti,am65x-dss.yaml +6
-0+ video port, this field is just for + informational purpose to enumerate the zorder configuration + being used by remote core. + + $ref: /schemas/types.yaml#/definitions/uint32 + enum: [0, 1]I don't understand how 0 or 1 defines Z-order.
Quoted 5 lines
As there are only two planes in total so z-order can be either 0 or 1 for the shared mode plane as there is only a single entry of plane.
For e.g. if ti,dss-shared-mode-plane-zorder is 1 then it means the plane owned by Linux is programmed as topmost plane wherease the plane owned by remote core is programmed as the underneath one.
Please reword the description to make all this clear. The index is the plane number and value is the z-order with 0 being bottom and N being the top. I guess this should be an array as well.
Rob
Re: [RFC PATCH 1/3] dt-bindings: display: ti,am65x-dss: Add support for display sharing mode
Hi Rob,
Thanks for the review.
Quoted 76 lines · Rob Herring
Quoted 75 lines · Devarsh Thakkar
Hi Rob,
Thanks for the quick review.
Quoted 29 lines · Rob Herring
Quoted 28 lines · Devarsh Thakkar
Add support for using TI Keystone DSS hardware present in display sharing mode.
TI Keystone DSS hardware supports partitioning of resources between multiple hosts as it provides separate register space and unique interrupt line to each host.
The DSS hardware can be used in shared mode in such a way that one or more of video planes can be owned by Linux wherease other planes can be owned by remote cores.
One or more of the video ports can be dedicated exclusively to a processing core, wherease some of the video ports can be shared between two hosts too with only one of them having write access.
Signed-off-by Devarsh Thakkar <[email protected]>--- .../bindings/display/ti/ti,am65x-dss.yaml | 82 +++++++++++++++++++ 1 file changed, 82 insertions(+)Documentation/devicetree/bindings/display/ti/ti,am65x-dss.yaml +0
-0@@ -112,6 +112,86 @@ properties: Input memory (from main memory to dispc) bandwidth limit in bytes per secondQuoted 9 lines
Documentation/devicetree/bindings/display/ti/ti,am65x-dss.yaml properties: · line 120
Quoted 6 lines
Documentation/devicetree/bindings/display/ti/ti,am65x-dss.yaml +6
-0+ ti,dss-shared-mode: + type: boolean + description: + TI DSS7 supports sharing of display between multiple hosts + as it provides separate register space for display configuration and + unique interrupt line to each host.If you care about line breaks, you need '|'.
Noted.
Quoted 8 lines
Documentation/devicetree/bindings/display/ti/ti,am65x-dss.yaml properties: · line 127
Quoted 7 lines
Documentation/devicetree/bindings/display/ti/ti,am65x-dss.yaml +7
-0+ One of the host is provided access to the global display + configuration labelled as "common" region of DSS allows that host + exclusive access to global registers of DSS while other host can + configure the display for it's usage using a separate register + space labelled as "common1". + The DSS resources can be partitioned in such a way that one or more + of the video planes are owned by Linux whereas other video planesQuoted 6 lines
Your h/w can only run Linux?
What if you want to use this same binding to define the configuration to the 'remote processor'? You can easily s/Linux/the OS/, but it all should be reworded to describe things in terms of the local processor.
It can run both Linux and RTOS or for that matter any other OS too. But yes I got your point, will reword accordingly.
Quoted 9 lines
Documentation/devicetree/bindings/display/ti/ti,am65x-dss.yaml properties: · line 132
Quoted 5 lines
Documentation/devicetree/bindings/display/ti/ti,am65x-dss.yaml +5
-0+ can be owned by a remote core. + The video port controlling these planes acts as a shared video port + and it can be configured with write access either by Linux or the + remote core in which case Linux only has read-only access to that + video port.What is the purpose of this property when all the other properties are required?
Quoted 7 lines
Quoted 3 lines
The ti,dss-shared-mode and below group of properties are optional. But if ti,dss-shared-mode is set then only driver should parse below set of properties.
Let me re-phrase. Drop this property. It serves no purpose since all the properties have to be present anyway.
Noted.
Quoted 70 lines
Quoted 65 lines
Quoted 32 lines
Quoted 32 lines
Documentation/devicetree/bindings/display/ti/ti,am65x-dss.yaml +32
-0+ ti,dss-shared-mode-planes: + description: + The video layer that is owned by processing core running Linux. + The display driver running from Linux has exclusive write access to + this video layer. + $ref: /schemas/types.yaml#/definitions/string + enum: [vidl, vid] + + ti,dss-shared-mode-vp: + description: + The video port that is being used in context of processing core + running Linux with display susbsytem being used in shared mode. + This can be owned either by the processing core running Linux in + which case Linux has the write access and the responsibility to + configure this video port and the associated overlay manager or + it can be shared between core running Linux and a remote core + with remote core provided with write access to this video port and + associated overlay managers and remote core configures and drives + this video port also feeding data from one or more of the + video planes owned by Linux, with Linux only having read-only access + to this video port and associated overlay managers. + + $ref: /schemas/types.yaml#/definitions/string + enum: [vp1, vp2] + + ti,dss-shared-mode-common: + description: + The DSS register region owned by processing core running Linux. + $ref: /schemas/types.yaml#/definitions/string + enum: [common, common1] + + ti,dss-shared-mode-vp-owned:Quoted 9 lines
Documentation/devicetree/bindings/display/ti/ti,am65x-dss.yaml properties: · line 170
Quoted 5 lines
Documentation/devicetree/bindings/display/ti/ti,am65x-dss.yaml +5
-0+ description: + This tells whether processing core running Linux has write access to + the video ports enlisted in ti,dss-shared-mode-vps. + $ref: /schemas/types.yaml#/definitions/uint32 + enum: [0, 1]This can be boolean. Do writes abort or just get ignored? The latter can be probed and doesn't need a property.
Although we have kept all these properties as enums, but actually in driver we are treating them as array of enums and using
device_property_read_u32_array.The reason being that for SoCs using am65x-dss bindings they can only have single entry either vp1 or vp2 or 0 or 1 as there are only two video ports. So for them the device tree overlay would look like :
&dss0 {ti,dss-shared-mode; ti,dss-shared-mode-vp = "vp1"; ti,dss-shared-mode-vp-owned = <0>; ti,dss-shared-mode-common = "common1"; ti,dss-shared-mode-planes = "vid"; ti,dss-shared-mode-plane-zorder = <0>; interrupts = <GIC_SPI 85 IRQ_TYPE_LEVEL_>; }Quoted 4 lines
But we also plan to extend these bindings to SoCs using
Documentation/devicetree/bindings/display/ti/ti,j721e-dss.yamlwhere there are multiple video ports. So in that the driver and bindings should support below configuration :
Quoted 5 lines
What are you waiting for? In that case, all these properties need to be in a shared schema file and referenced here. Otherwise you will be defining their types twice (and different types too if some are changed to arrays).
Noted, thanks for suggesting this, shared schema file indeed looks like a better idea.
Quoted 17 lines
Quoted 17 lines
&dss0 {
ti,dss-shared-mode; ti,dss-shared-mode-vp = "vp1 vp2"; ti,dss-shared-mode-vp-owned = <0 1>; ti,dss-shared-mode-common = "common_s1"; ti,dss-shared-mode-planes = "vid1 vidl1"; ti,dss-shared-mode-plane-zorder = <0 1>; interrupts = <GIC_SPI 85 IRQ_TYPE_LEVEL_>; }
Quoted 8 lines
Quoted 2 lines
As I am using
device_property_read_u32_arrayin driver I thought to keep this as uint32 in enum foram65x.yamlwhich works well with the driver.The type and what accessor functions the kernel uses should match. I plan to add (debug) checking on this. Debug only because as there's no type info in the DTB, it all has to be extracted from schemas and put into the kernel.
Yes, with the shared schema it should be array instead of integer.
Quoted 21 lines
Quoted 15 lines
Quoted 5 lines
Quoted 5 lines
Documentation/devicetree/bindings/display/ti/ti,am65x-dss.yaml +5
-0+ + ti,dss-shared-mode-plane-zorder: + description: + The zorder of the planes owned by Linux. + For the scenario where Linux is not having write access to associatedQuoted 9 lines
Documentation/devicetree/bindings/display/ti/ti,am65x-dss.yaml properties: · line 181
Quoted 6 lines
Documentation/devicetree/bindings/display/ti/ti,am65x-dss.yaml +6
-0+ video port, this field is just for + informational purpose to enumerate the zorder configuration + being used by remote core. + + $ref: /schemas/types.yaml#/definitions/uint32 + enum: [0, 1]I don't understand how 0 or 1 defines Z-order.
Quoted 5 lines
As there are only two planes in total so z-order can be either 0 or 1 for the shared mode plane as there is only a single entry of plane.
For e.g. if ti,dss-shared-mode-plane-zorder is 1 then it means the plane owned by Linux is programmed as topmost plane wherease the plane owned by remote core is programmed as the underneath one.
Quoted 4 lines
Please reword the description to make all this clear. The index is the plane number and value is the z-order with 0 being bottom and N being the top. I guess this should be an array as well.
Yes, this was kept as uint32 since with am65x-dss only one plane was available for sharing, but with the shared schema this too should be an array instead of integer.
Regards
Devarsh
Quoted 2 lines
Rob
RFC PATCH 2/3 drm/tidss: Add support for display sharing
In reply to Devarsh ThakkarDisplay subsystem present in TI Keystone family of devices supports sharing of display between multiple hosts as it provides separate register space (common* region) for each host to programming display controller and also a unique interrupt line for each host.
This adds support for display sharing, by allowing partitioning of resources either at video port level or at video plane level as described below :
1) Linux can own (i.e have write access) completely one or more of video ports along with corresponding resources (viz. overlay managers, video planes) used by Linux in context of those video ports. Even if Linux is owning
these video ports it can still share this video port with a remote core which can own one or more video planes associated with this video port.
2) Linux owns one or more of the video planes with video port (along with corresponding overlay manager) associated with these planes being owned and controlled by a remote core. Linux still has read-only access to the associated video port and overlay managers so that it can parse the settings made by remote core.
For both the cases, the resources used in context of processing core running Linux along with ownership information are exposed by user as part of device-tree blob and driver uses an updated feature list tailored for this shared mode accordingly. The driver also auto-populates matching overlay managers and output types from shared video port list provided in device-tree blob.
In dispc_feature struct remove const access specfier for output_type array as it is required to be updated dynamically in run-time for shared mode.
For 2) where Linux is only owning a set of video planes with corresponding video port and overlay manager controlled by a remote core, separate set of CRTC callbacks are used which just latch on to the preset mode set by remote core, thus avoiding any reconfiguration of associated video ports, overlay managers and clocks.
For this case, it is also checked that Linux controlled video planes don't exceed screen size set by remote core while running the display. Display clocks and OLDI related fields are also not populated for this scenario as remote core is owning those resources.
For 1), where Linux owns only a set of video port and associated planes with rest of resources owned completely by remote cores, only those set of resources are exposed to Linux and programmed using traditional CRTC helpers and rest of video ports and associated resources are removed from feature list accordingly.
--- drivers/gpu/drm/tidss/tidss_crtc.c | 120 ++++++++++++- drivers/gpu/drm/tidss/tidss_dispc.c | 254 +++++++++++++++++++++++++--- drivers/gpu/drm/tidss/tidss_dispc.h | 2 +- drivers/gpu/drm/tidss/tidss_drv.c | 33 ++-- drivers/gpu/drm/tidss/tidss_drv.h | 6 + 5 files changed, 375 insertions(+), 40 deletions(-)
drivers/gpu/drm/tidss/tidss_crtc.c +113 -7
@@ -31,13 +31,19 @@ static void tidss_crtc_finish_page_flip(struct tidss_crtc *tcrtc)/* * New settings are taken into use at VFP, and GO bit is cleared at * the same time. This happens before the vertical blank interrupt. -* So there is a small change that the driver sets GO bit after VFP, but +* So there is a small chance that the driver sets GO bit after VFP, but * before vblank, and we have to check for that case here. +* +* For a video port shared between Linux and remote core but owned by remote core, +* this is not required since Linux just attaches to mode that was preset by remote +* core with which display is being shared. */ - busy =dispc_vp_go_busy (tidss->dispc, tcrtc->hw_videoport); -if (busy) { -spin_unlock_irqrestore (&ddev->event_lock, flags); -return ; +if (!tidss->shared_mode || tidss->shared_mode_owned_vps[tcrtc->hw_videoport]) { + busy =dispc_vp_go_busy (tidss->dispc, tcrtc->hw_videoport); +if (busy) { +spin_unlock_irqrestore (&ddev->event_lock, flags); +return ; + } } event = tcrtc->event;
@@ -208,6 +214,44 @@ static void tidss_crtc_atomic_flush(struct drm_crtc *crtc,spin_unlock_irqrestore (&ddev->event_lock, flags); } +static void tidss_shared_vp_crtc_atomic_flush (struct drm_crtc *crtc, +struct drm_atomic_state *state) +{ +struct tidss_crtc *tcrtc =to_tidss_crtc (crtc); +struct drm_device *ddev = crtc->dev; +unsigned long flags; + +dev_dbg (ddev->dev, +"%s: %s enabled %d, needs modeset %d, event %p\n" , __func__, + crtc->name,drm_atomic_crtc_needs_modeset (crtc->state), + crtc->state->enable, crtc->state->event); + +/* There is nothing to do if CRTC is not going to be enabled. */ +if (!crtc->state->enable) +return ; +/* +* Flush CRTC changes with go bit only if new modeset is not +* coming, so CRTC is enabled trough out the commit. +*/ +if (drm_atomic_crtc_needs_modeset (crtc->state)) +return ; + +/* We should have event if CRTC is enabled through out this commit. */ +if (WARN_ON (!crtc->state->event)) +return ; + +WARN_ON (drm_crtc_vblank_get (crtc) !=0 ); + +spin_lock_irqsave (&ddev->event_lock, flags); + +WARN_ON (tcrtc->event); + + tcrtc->event = crtc->state->event; + crtc->state->event =NULL ; + +spin_unlock_irqrestore (&ddev->event_lock, flags); +} +static void tidss_crtc_atomic_enable (struct drm_crtc *crtc,struct drm_atomic_state *state) {
@@ -253,6 +297,27 @@ static void tidss_crtc_atomic_enable(struct drm_crtc *crtc,spin_unlock_irqrestore (&ddev->event_lock, flags); } +static void tidss_shared_vp_crtc_atomic_enable (struct drm_crtc *crtc, +struct drm_atomic_state *state) +{ +struct drm_device *ddev = crtc->dev; +unsigned long flags; + +dev_dbg (ddev->dev,"%s, event %p\n" , __func__, crtc->state->event); + +/* Turn vertical blanking interrupt reporting on. */ +drm_crtc_vblank_on (crtc); + +spin_lock_irqsave (&ddev->event_lock, flags); + +if (crtc->state->event) { +drm_crtc_send_vblank_event (crtc, crtc->state->event); + crtc->state->event =NULL ; + } + +spin_unlock_irqrestore (&ddev->event_lock, flags); +} +static void tidss_crtc_atomic_disable (struct drm_crtc *crtc,struct drm_atomic_state *state) {
@@ -288,6 +353,27 @@ static void tidss_crtc_atomic_disable(struct drm_crtc *crtc,tidss_runtime_put (tidss); } +static void tidss_shared_vp_crtc_atomic_disable (struct drm_crtc *crtc, +struct drm_atomic_state *state) +{ +struct tidss_crtc *tcrtc =to_tidss_crtc (crtc); +struct drm_device *ddev = crtc->dev; +unsigned long flags; + +dev_dbg (ddev->dev,"%s, event %p\n" , __func__, crtc->state->event); + +reinit_completion (&tcrtc->framedone_completion); + +spin_lock_irqsave (&ddev->event_lock, flags); +if (crtc->state->event) { +drm_crtc_send_vblank_event (crtc, crtc->state->event); + crtc->state->event =NULL ; + } +spin_unlock_irqrestore (&ddev->event_lock, flags); + +drm_crtc_vblank_off (crtc); +} +static enum drm_mode_status tidss_crtc_mode_valid (struct drm_crtc *crtc,const struct drm_display_mode *mode)
@@ -304,7 +390,14 @@ static const struct drm_crtc_helper_funcs tidss_crtc_helper_funcs = { .atomic_flush = tidss_crtc_atomic_flush, .atomic_enable = tidss_crtc_atomic_enable, .atomic_disable = tidss_crtc_atomic_disable, + .mode_valid = tidss_crtc_mode_valid, +}; +static const struct drm_crtc_helper_funcs tidss_shared_vp_crtc_helper_funcs = { + .atomic_check = tidss_crtc_atomic_check, + .atomic_flush = tidss_shared_vp_crtc_atomic_flush, + .atomic_enable = tidss_shared_vp_crtc_atomic_enable, + .atomic_disable = tidss_shared_vp_crtc_atomic_disable, .mode_valid = tidss_crtc_mode_valid, };
@@ -406,6 +499,10 @@ struct tidss_crtc *tidss_crtc_create(struct tidss_device *tidss,bool has_ctm = tidss->feat->vp_feat.color.has_ctm;int ret; +dev_dbg (tidss->dev,"%s: tidss->shared_mode: %d tidss->shared_mode_owned_vps[%d] = %d\n" , + __func__, tidss->shared_mode, hw_videoport, + tidss->shared_mode_owned_vps[hw_videoport]); + tcrtc =kzalloc (sizeof (*tcrtc),GFP_KERNEL );if (!tcrtc)return ERR_PTR (-ENOMEM );
@@ -422,8 +519,17 @@ struct tidss_crtc *tidss_crtc_create(struct tidss_device *tidss,return ERR_PTR (ret); } -drm_crtc_helper_add (crtc, &tidss_crtc_helper_funcs); - +/* Use shared video port CRTC helpers which don't access associated +* video port and overlay register spaces when Linux is not owning the +* video port. +*/ +if (tidss->shared_mode && !tidss->shared_mode_owned_vps[hw_videoport]) { +drm_crtc_helper_add (crtc, &tidss_shared_vp_crtc_helper_funcs); +dev_dbg (tidss->dev,"%s: vp%d is being shared with Linux\n" , __func__, + hw_videoport +1 ); + }else { +drm_crtc_helper_add (crtc, &tidss_crtc_helper_funcs); + }/* * The dispc gamma functions adapt to what ever size we ask * from it no matter what HW supports. X-server assumes 256
drivers/gpu/drm/tidss/tidss_dispc.c +232 -22
308 lines not on this page · raw message
drivers/gpu/drm/tidss/tidss_dispc.h +1 -1
@@ -80,7 +80,7 @@ struct dispc_features {const char *vp_name[TIDSS_MAX_PORTS ];/* Should match dt reg names */ const char *ovr_name[TIDSS_MAX_PORTS ];/* Should match dt reg names */ const char *vpclk_name[TIDSS_MAX_PORTS ];/* Should match dt clk names */ -const enum dispc_vp_bus_type vp_bus_type[TIDSS_MAX_PORTS ]; +enum dispc_vp_bus_type vp_bus_type[TIDSS_MAX_PORTS ];struct tidss_vp_feat vp_feat;u32 num_planes;const char *vid_name[TIDSS_MAX_PLANES ];/* Should match dt reg names */
drivers/gpu/drm/tidss/tidss_drv.c +23 -10
@@ -32,6 +32,10 @@ int tidss_runtime_get(struct tidss_device *tidss)dev_dbg (tidss->dev,"%s\n" , __func__); +/* No PM in display sharing mode */ +if (tidss->shared_mode) +return 0 ; + r =pm_runtime_resume_and_get (tidss->dev);WARN_ON (r <0 );return r;
@@ -43,6 +47,9 @@ void tidss_runtime_put(struct tidss_device *tidss)dev_dbg (tidss->dev,"%s\n" , __func__); +if (tidss->shared_mode) +return ; +pm_runtime_mark_last_busy (tidss->dev); r =pm_runtime_put_autosuspend (tidss->dev);
@@ -140,21 +147,23 @@ static int tidss_probe(struct platform_device *pdev)spin_lock_init (&tidss->wait_lock); + tidss->shared_mode =device_property_read_bool (dev,"ti,dss-shared-mode" ); ret =dispc_init (tidss);if (ret) {dev_err (dev,"failed to initialize dispc: %d\n" , ret);return ret; } -pm_runtime_enable (dev); - -pm_runtime_set_autosuspend_delay (dev,1000 ); -pm_runtime_use_autosuspend (dev); +if (!tidss->shared_mode) { +pm_runtime_enable (dev); +pm_runtime_set_autosuspend_delay (dev,1000 ); +pm_runtime_use_autosuspend (dev);#ifndef CONFIG_PM -/* If we don't have PM, we need to call resume manually */ -dispc_runtime_resume (tidss->dispc); +/* If we don't have PM, we need to call resume manually */ +dispc_runtime_resume (tidss->dispc);#endif + } ret =tidss_modeset_init (tidss);if (ret <0 ) {
@@ -196,6 +205,8 @@ static int tidss_probe(struct platform_device *pdev)tidss_irq_uninstall (ddev); err_runtime_suspend: +if (tidss->shared_mode) +return ret;#ifndef CONFIG_PM dispc_runtime_suspend (tidss->dispc);#endif
@@ -219,12 +230,14 @@ static void tidss_remove(struct platform_device *pdev)tidss_irq_uninstall (ddev); +if (!tidss->shared_mode) {#ifndef CONFIG_PM -/* If we don't have PM, we need to call suspend manually */ -dispc_runtime_suspend (tidss->dispc); +/* If we don't have PM, we need to call suspend manually */ +dispc_runtime_suspend (tidss->dispc);#endif -pm_runtime_dont_use_autosuspend (dev); -pm_runtime_disable (dev); +pm_runtime_dont_use_autosuspend (dev); +pm_runtime_disable (dev); + }/* devm allocated dispc goes away with the dev so mark it NULL */ dispc_remove (tidss);
drivers/gpu/drm/tidss/tidss_drv.h +6 -0
@@ -31,6 +31,12 @@ struct tidss_device {spinlock_t wait_lock;/* protects the irq masks */ dispc_irq_t irq_mask;/* enabled irqs in addition to wait_list */ + +bool shared_mode;/* DSS resources shared between remote core and Linux */ + +/* 1: VP owned by Linux 0: VP is owned by remote and shared with Linux */ +u32 shared_mode_owned_vps[TIDSS_MAX_PORTS ]; +bool shared_mode_own_oldi;/* Linux needs to configure OLDI in shared mode */ };#define to_tidss (__dev) container_of(__dev, struct tidss_device, ddev)
Signature · 1 line
2.34.1
Tomi Valkeinen
maintainerRe: [RFC PATCH 2/3] drm/tidss: Add support for display sharing
Hi,
Quoted 68 lines · Devarsh Thakkar
Display subsystem present in TI Keystone family of devices supports sharing of display between multiple hosts as it provides separate register space (common* region) for each host to programming display controller and also a unique interrupt line for each host.
This adds support for display sharing, by allowing partitioning of resources either at video port level or at video plane level as described below :
1) Linux can own (i.e have write access) completely one or more of video ports along with corresponding resources (viz. overlay managers, video planes) used by Linux in context of those video ports. Even if Linux is owning
these video ports it can still share this video port with a remote core which can own one or more video planes associated with this video port.2) Linux owns one or more of the video planes with video port (along with corresponding overlay manager) associated with these planes being owned and controlled by a remote core. Linux still has read-only access to the associated video port and overlay managers so that it can parse the settings made by remote core.
For both the cases, the resources used in context of processing core running Linux along with ownership information are exposed by user as part of device-tree blob and driver uses an updated feature list tailored for this shared mode accordingly. The driver also auto-populates matching overlay managers and output types from shared video port list provided in device-tree blob.
Indispc_featurestruct remove const access specfier foroutput_typearray as it is required to be updated dynamically in run-time for shared mode.For 2) where Linux is only owning a set of video planes with corresponding video port and overlay manager controlled by a remote core, separate set of CRTC callbacks are used which just latch on to the preset mode set by remote core, thus avoiding any reconfiguration of associated video ports, overlay managers and clocks.
For this case, it is also checked that Linux controlled video planes don't exceed screen size set by remote core while running the display. Display clocks and OLDI related fields are also not populated for this scenario as remote core is owning those resources.For 1), where Linux owns only a set of video port and associated planes with rest of resources owned completely by remote cores, only those set of resources are exposed to Linux and programmed using traditional CRTC helpers and rest of video ports and associated resources are removed from feature list accordingly.
Signed-off-by Devarsh Thakkar <[email protected]>--- drivers/gpu/drm/tidss/tidss_crtc.c | 120 ++++++++++++- drivers/gpu/drm/tidss/tidss_dispc.c | 254 +++++++++++++++++++++++++--- drivers/gpu/drm/tidss/tidss_dispc.h | 2 +- drivers/gpu/drm/tidss/tidss_drv.c | 33 ++-- drivers/gpu/drm/tidss/tidss_drv.h | 6 + 5 files changed, 375 insertions(+), 40 deletions(-)drivers/gpu/drm/tidss/tidss_crtc.c +1
-1@@ -31,13 +31,19 @@ static void tidss_crtc_finish_page_flip(struct tidss_crtc *tcrtc)/* * New settings are taken into use at VFP, and GO bit is cleared at * the same time. This happens before the vertical blank interrupt. -* So there is a small change that the driver sets GO bit after VFP, but +* So there is a small chance that the driver sets GO bit after VFP, but * before vblank, and we have to check for that case here.
drivers/gpu/drm/tidss/tidss_crtc.c static void tidss_crtc_finish_page_flip(struct tidss_crtc *tcrtc) · line 41
Quoted 10 lines
drivers/gpu/drm/tidss/tidss_crtc.c +5
-4+* +* For a video port shared between Linux and remote core but owned by remote core, +* this is not required since Linux just attaches to mode that was preset by remote +* core with which display is being shared. */ - busy =dispc_vp_go_busy (tidss->dispc, tcrtc->hw_videoport); -if (busy) { -spin_unlock_irqrestore (&ddev->event_lock, flags); -return ; +if (!tidss->shared_mode || tidss->shared_mode_owned_vps[tcrtc->hw_videoport]) {
You test this in multiple places. I think it would be better to combine those, in one way or another. Either a helper function, or maybe invert the shared_mode_owned_vps, i.e. rather have something like "foreign_vps" (better name needed), so that when !shared_mode, the default of False in foreign_vps array will just work. Then the above test will be just if (!tidss->foreign_vps[tcrtc->hw_videoport])
Quoted 188 lines
drivers/gpu/drm/tidss/tidss_crtc.c +107
-2+ busy =dispc_vp_go_busy (tidss->dispc, tcrtc->hw_videoport); +if (busy) { +spin_unlock_irqrestore (&ddev->event_lock, flags); +return ; + } } event = tcrtc->event;@@ -208,6 +214,44 @@ static void tidss_crtc_atomic_flush(struct drm_crtc *crtc,spin_unlock_irqrestore (&ddev->event_lock, flags); } +static void tidss_shared_vp_crtc_atomic_flush (struct drm_crtc *crtc, +struct drm_atomic_state *state) +{ +struct tidss_crtc *tcrtc =to_tidss_crtc (crtc); +struct drm_device *ddev = crtc->dev; +unsigned long flags; + +dev_dbg (ddev->dev, +"%s: %s enabled %d, needs modeset %d, event %p\n" , __func__, + crtc->name,drm_atomic_crtc_needs_modeset (crtc->state), + crtc->state->enable, crtc->state->event); + +/* There is nothing to do if CRTC is not going to be enabled. */ +if (!crtc->state->enable) +return ; +/* +* Flush CRTC changes with go bit only if new modeset is not +* coming, so CRTC is enabled trough out the commit. +*/ +if (drm_atomic_crtc_needs_modeset (crtc->state)) +return ; + +/* We should have event if CRTC is enabled through out this commit. */ +if (WARN_ON (!crtc->state->event)) +return ; + +WARN_ON (drm_crtc_vblank_get (crtc) !=0 ); + +spin_lock_irqsave (&ddev->event_lock, flags); + +WARN_ON (tcrtc->event); + + tcrtc->event = crtc->state->event; + crtc->state->event =NULL ; + +spin_unlock_irqrestore (&ddev->event_lock, flags); +} +static void tidss_crtc_atomic_enable (struct drm_crtc *crtc,struct drm_atomic_state *state) {@@ -253,6 +297,27 @@ static void tidss_crtc_atomic_enable(struct drm_crtc *crtc,spin_unlock_irqrestore (&ddev->event_lock, flags); } +static void tidss_shared_vp_crtc_atomic_enable (struct drm_crtc *crtc, +struct drm_atomic_state *state) +{ +struct drm_device *ddev = crtc->dev; +unsigned long flags; + +dev_dbg (ddev->dev,"%s, event %p\n" , __func__, crtc->state->event); + +/* Turn vertical blanking interrupt reporting on. */ +drm_crtc_vblank_on (crtc); + +spin_lock_irqsave (&ddev->event_lock, flags); + +if (crtc->state->event) { +drm_crtc_send_vblank_event (crtc, crtc->state->event); + crtc->state->event =NULL ; + } + +spin_unlock_irqrestore (&ddev->event_lock, flags); +} +static void tidss_crtc_atomic_disable (struct drm_crtc *crtc,struct drm_atomic_state *state) {@@ -288,6 +353,27 @@ static void tidss_crtc_atomic_disable(struct drm_crtc *crtc,tidss_runtime_put (tidss); } +static void tidss_shared_vp_crtc_atomic_disable (struct drm_crtc *crtc, +struct drm_atomic_state *state) +{ +struct tidss_crtc *tcrtc =to_tidss_crtc (crtc); +struct drm_device *ddev = crtc->dev; +unsigned long flags; + +dev_dbg (ddev->dev,"%s, event %p\n" , __func__, crtc->state->event); + +reinit_completion (&tcrtc->framedone_completion); + +spin_lock_irqsave (&ddev->event_lock, flags); +if (crtc->state->event) { +drm_crtc_send_vblank_event (crtc, crtc->state->event); + crtc->state->event =NULL ; + } +spin_unlock_irqrestore (&ddev->event_lock, flags); + +drm_crtc_vblank_off (crtc); +} +static enum drm_mode_status tidss_crtc_mode_valid (struct drm_crtc *crtc,const struct drm_display_mode *mode)@@ -304,7 +390,14 @@ static const struct drm_crtc_helper_funcs tidss_crtc_helper_funcs = { .atomic_flush = tidss_crtc_atomic_flush, .atomic_enable = tidss_crtc_atomic_enable, .atomic_disable = tidss_crtc_atomic_disable, + .mode_valid = tidss_crtc_mode_valid, +}; +static const struct drm_crtc_helper_funcs tidss_shared_vp_crtc_helper_funcs = { + .atomic_check = tidss_crtc_atomic_check, + .atomic_flush = tidss_shared_vp_crtc_atomic_flush, + .atomic_enable = tidss_shared_vp_crtc_atomic_enable, + .atomic_disable = tidss_shared_vp_crtc_atomic_disable, .mode_valid = tidss_crtc_mode_valid, };@@ -406,6 +499,10 @@ struct tidss_crtc *tidss_crtc_create(struct tidss_device *tidss,bool has_ctm = tidss->feat->vp_feat.color.has_ctm;int ret; +dev_dbg (tidss->dev,"%s: tidss->shared_mode: %d tidss->shared_mode_owned_vps[%d] = %d\n" , + __func__, tidss->shared_mode, hw_videoport, + tidss->shared_mode_owned_vps[hw_videoport]); + tcrtc =kzalloc (sizeof (*tcrtc),GFP_KERNEL );if (!tcrtc)return ERR_PTR (-ENOMEM );@@ -422,8 +519,17 @@ struct tidss_crtc *tidss_crtc_create(struct tidss_device *tidss,return ERR_PTR (ret); } -drm_crtc_helper_add (crtc, &tidss_crtc_helper_funcs); - +/* Use shared video port CRTC helpers which don't access associated +* video port and overlay register spaces when Linux is not owning the +* video port. +*/ +if (tidss->shared_mode && !tidss->shared_mode_owned_vps[hw_videoport]) { +drm_crtc_helper_add (crtc, &tidss_shared_vp_crtc_helper_funcs); +dev_dbg (tidss->dev,"%s: vp%d is being shared with Linux\n" , __func__, + hw_videoport +1 ); + }else { +drm_crtc_helper_add (crtc, &tidss_crtc_helper_funcs); + }/* * The dispc gamma functions adapt to what ever size we ask * from it no matter what HW supports. X-server assumes 256 drivers/gpu/drm/tidss/tidss_dispc.c +18
-0@@ -273,6 +273,18 @@ const struct dispc_features dispc_j721e_feats = { .vid_order = { 1, 3, 0, 2 }, }; +static const u16 tidss_am62_common1_regs[DISPC_COMMON_REG_TABLE_LEN] = { + [DISPC_IRQ_EOI_OFF] = 0x24, + [DISPC_IRQSTATUS_RAW_OFF] = 0x28, + [DISPC_IRQSTATUS_OFF] = 0x2c, + [DISPC_IRQENABLE_SET_OFF] = 0x30, + [DISPC_IRQENABLE_CLR_OFF] = 0x40, + [DISPC_VID_IRQENABLE_OFF] = 0x44, + [DISPC_VID_IRQSTATUS_OFF] = 0x58, + [DISPC_VP_IRQENABLE_OFF] = 0x70, + [DISPC_VP_IRQSTATUS_OFF] = 0x7c, +}; + const struct dispc_features dispc_am625_feats = { .max_pclk_khz = { [DISPC_VP_DPI] = 165000,@@ -1228,6 +1240,22 @@ enum drm_mode_status dispc_vp_mode_valid(struct dispc_device *dispc, max_pclk = dispc->feat->max_pclk_khz[bus_type]; +/* +* For shared mode, with remote core driving the video port, make sure that Linux +* controlled primary plane doesn't exceed video port screen size set by remote core +*/ +if (dispc->tidss->shared_mode && !dispc->tidss->shared_mode_owned_vps[hw_videoport]) { +int vp_hdisplay =VP_REG_GET (dispc, hw_videoport,DISPC_VP_SIZE_SCREEN ,11 ,0 ) +1 ;
drivers/gpu/drm/tidss/tidss_dispc.c enum drm_mode_status dispc_vp_mode_valid(struct dispc_device *dispc, · line 1258
Quoted 10 lines
drivers/gpu/drm/tidss/tidss_dispc.c +10
-0+int vp_vdisplay =VP_REG_GET (dispc, hw_videoport,DISPC_VP_SIZE_SCREEN ,27 ,16 ) +1 ; + +if (mode->hdisplay > vp_hdisplay || + mode->vdisplay > vp_vdisplay) { +dev_err (dispc->dev,"%dx%d exceeds VP screen size %dx%d in shared mode\n" , + mode->hdisplay, mode->vdisplay, vp_hdisplay, vp_vdisplay); +return MODE_BAD ; + } + } +
I'm not sure I understand this. If the VP is owned by someone else, isn't there just a single mode that can be allowed (the one that that "someone else" has set up?). The comment also talks about primary planes, but this code is about the video mode, not planes.
So my understanding of a VP that's controlled by RTOS is that at boot time RTOS figures out a video mode (either the native mode of an LCD, or picks a mode from a monitor's EDID), and then that one video mode will be used, and never changed.
Linux's tidss can, at probe time probably, look at the VP configuration and figure out the video mode details, which can then be exposed to the userspace.
Changing video modes at runtime would probably require some kind of IPC.
Quoted 40 lines
drivers/gpu/drm/tidss/tidss_dispc.c +17
-7if (WARN_ON (max_pclk ==0 ))return MODE_BAD ;@@ -1276,15 +1304,18 @@ enum drm_mode_status dispc_vp_mode_valid(struct dispc_device *dispc,return MODE_BAD_VVALUE ;if (dispc->memory_bandwidth_limit) { -const unsigned int bpp =4 ; -u64 bandwidth; +if (!dispc->tidss->shared_mode || + dispc->tidss->shared_mode_owned_vps[hw_videoport]) { +const unsigned int bpp =4 ; +u64 bandwidth; - bandwidth =1000 * mode->clock; - bandwidth = bandwidth * mode->hdisplay * mode->vdisplay * bpp; - bandwidth =div_u64 (bandwidth, mode->htotal * mode->vtotal); + bandwidth =1000 * mode->clock; + bandwidth = bandwidth * mode->hdisplay * mode->vdisplay * bpp; + bandwidth =div_u64 (bandwidth, mode->htotal * mode->vtotal); -if (dispc->memory_bandwidth_limit < bandwidth) -return MODE_BAD ; +if (dispc->memory_bandwidth_limit < bandwidth) +return MODE_BAD ; + } }return MODE_OK ;@@ -2655,6 +2686,147 @@ static void dispc_vp_set_color_mgmt(struct dispc_device *dispc,dispc_k3_vp_set_ctm (dispc, hw_videoport, ctm); } +static int get_vp_idx_from_vp (const char *vp_name) +{ +u32 vp_idx; + +if (!strcmp ("vp1" , vp_name)) + vp_idx =0 ; +else if (!strcmp ("vp2" , vp_name))
drivers/gpu/drm/tidss/tidss_dispc.c static void dispc_vp_set_color_mgmt(struct dispc_device *dispc, · line 2705
Quoted 10 lines
drivers/gpu/drm/tidss/tidss_dispc.c +10
-0+ vp_idx =1 ; + else if (!strcmp("vp3", vp_name)) + vp_idx =2 ; + else if (!strcmp("vp4", vp_name)) + vp_idx =3 ; + else + return 0; + +return vp_idx; +}
Any particular reason to use strings in the DT for all there? Using a index number in the DT would simplify the driver. We also have lists of vp names already in the driver.
I didn't go through the whole logic yet, but these two functions give me the feeling that this part could be better.
Quoted 181 lines
drivers/gpu/drm/tidss/tidss_dispc.c +124
-0+ +static const char *get_ovr_from_vp (const char *vp_name) +{ +const char *ovr_name =NULL ; + +if (!strcmp ("vp1" , vp_name)) + ovr_name ="ovr1" ; +else if (!strcmp ("vp2" , vp_name)) + ovr_name ="ovr2" ; +else if (!strcmp ("vp3" , vp_name)) + ovr_name ="ovr3" ; +else if (!strcmp ("vp4" , vp_name)) + ovr_name ="ovr4" ; +else +return NULL ; + +return ovr_name; +} + +static void dispc_shared_mode_update_bus_type (struct dispc_features *shared_mode_feat, +struct dispc_device *dispc) +{ +u32 i, vp_idx; +int num_vps = shared_mode_feat->num_vps; +enum dispc_vp_bus_type vp_bus_type[TIDSS_MAX_PORTS ]; + +memcpy ((void *)vp_bus_type, (void *)shared_mode_feat->vp_bus_type, +sizeof (vp_bus_type)); +memset (shared_mode_feat->vp_bus_type,0 ,sizeof (vp_bus_type)); + +for (i =0 ; i < num_vps; i++) { +/* +* Find corresponding vp bus type. +*/ + vp_idx =get_vp_idx_from_vp (shared_mode_feat->vp_name[i]); + shared_mode_feat->vp_bus_type[i] = vp_bus_type[vp_idx]; + } +} + +static int dispc_update_shared_mode_features (struct dispc_features *shared_mode_feat, +struct dispc_device *dispc) +{ +int r =0 , i =0 ; + +dev_dbg (dispc->dev,"Start updating dispc feature list for shared mode:\n" ); + +/* +* Start with a shallow copy from existing features and prune the list +* as per what is actually made available to Linux +*/ +memcpy ((void *)shared_mode_feat, (void *)dispc->feat,sizeof (*shared_mode_feat)); + shared_mode_feat->num_vps =device_property_string_array_count (dispc->dev, +"ti,dss-shared-mode-vp" ); + shared_mode_feat->num_planes =device_property_string_array_count (dispc->dev, +"ti,dss-shared-mode-planes" ); + + r =device_property_read_string (dispc->dev,"ti,dss-shared-mode-common" , + (const char **)&shared_mode_feat->common); +if (r) { +dev_err (dispc->dev,"failed to read shared video port name: %d\n" , r); +return r; + } + +memset (shared_mode_feat->vid_name,0 ,sizeof (shared_mode_feat->vid_name)); + r =device_property_read_string_array (dispc->dev,"ti,dss-shared-mode-planes" , + shared_mode_feat->vid_name,TIDSS_MAX_PLANES ); +if (r <0 ) { +dev_err (dispc->dev,"failed to read client vid layer name: %d\n" , r); +return r; + } + + r =device_property_read_u32_array (dispc->dev,"ti,dss-shared-mode-vp-owned" , + dispc->tidss->shared_mode_owned_vps, + shared_mode_feat->num_vps); +if (r <0 ) { +dev_err (dispc->dev,"failed to read owned vp list: %d\n" , r); +return r; + } + +memset (shared_mode_feat->vp_name,0 ,sizeof (shared_mode_feat->vp_name)); + r =device_property_read_string_array (dispc->dev,"ti,dss-shared-mode-vp" , + shared_mode_feat->vp_name,TIDSS_MAX_PORTS ); +if (r <0 ) { +dev_err (dispc->dev,"failed to read shared video port name: %d\n" , r); +return r; + } + +memset (shared_mode_feat->vid_order,0 ,sizeof (shared_mode_feat->vid_order)); + r =device_property_read_u32_array (dispc->dev,"ti,dss-shared-mode-plane-zorder" , + shared_mode_feat->vid_order, + shared_mode_feat->num_planes); +if (r <0 ) { +dev_err (dispc->dev,"failed to read vid_order array name: %d\n" , r); +return r; + } +memcpy ((void *)shared_mode_feat->vpclk_name, (void *)shared_mode_feat->vp_name, +sizeof (shared_mode_feat->vpclk_name)); +memset (shared_mode_feat->ovr_name,0 ,sizeof (shared_mode_feat->ovr_name)); + +for (i =0 ; i < shared_mode_feat->num_vps; i++) { + shared_mode_feat->ovr_name[i] =get_ovr_from_vp (shared_mode_feat->vp_name[i]); +dev_dbg (dispc->dev,"vp[%d] = %s, ovr[%d] = %s vpclk[%d] = %s vp_owned[%d] = %d\n" , + i, shared_mode_feat->vp_name[i], i, shared_mode_feat->ovr_name[i], i, + shared_mode_feat->vpclk_name[i], i, dispc->tidss->shared_mode_owned_vps[i]); + } + +for (i =0 ; i < shared_mode_feat->num_planes; i++) { +if (!strncmp ("vidl" , shared_mode_feat->vid_name[i],4 )) + shared_mode_feat->vid_lite[i] = true; +dev_dbg (dispc->dev,"vid[%d] = %s, vid_order[%d] = %u vid_lite[%d] = %u\n" , i, + shared_mode_feat->vid_name[i], i, shared_mode_feat->vid_order[i], i, + shared_mode_feat->vid_lite[i]); + } + +if (!strcmp (shared_mode_feat->common,"common1" )) + shared_mode_feat->common_regs = tidss_am62_common1_regs; + +dev_dbg (dispc->dev,"common : %s\n" , shared_mode_feat->common); +dispc_shared_mode_update_bus_type (shared_mode_feat, dispc); +dev_dbg (dispc->dev,"Feature list updated for shared mode\n" ); + +return 0 ; +} +void dispc_vp_setup (struct dispc_device *dispc,u32 hw_videoport,const struct drm_crtc_state *state,bool newmodeset){drivers/gpu/drm/tidss/tidss_dispc.c +26
-2@@ -2662,6 +2834,16 @@ void dispc_vp_setup(struct dispc_device *dispc, u32 hw_videoport,dispc_vp_set_color_mgmt (dispc, hw_videoport, state, newmodeset); } +static bool dispc_owns_global_common_in_shared_mode (struct dispc_device *dispc) +{ +if ((!strcmp (dispc->feat->common,"common" ) || + !strcmp (dispc->feat->common,"common_m" )) && + dispc->tidss->shared_mode) +return true; +else +return false; +} +int dispc_runtime_suspend (struct dispc_device *dispc) {dev_dbg (dispc->dev,"suspend\n" );@@ -2846,6 +3028,7 @@ int dispc_init(struct tidss_device *tidss)struct platform_device *pdev =to_platform_device (dev);struct dispc_device *dispc;const struct dispc_features *feat; +struct dispc_features *shared_mode_feat;unsigned int i, num_fourccs;int r =0 ;@@ -2887,6 +3070,21 @@ int dispc_init(struct tidss_device *tidss) dispc->num_fourccs = num_fourccs; +if (tidss->shared_mode) { +dev_dbg (dev,"%s : DSS is being shared with remote core\n" , __func__); + shared_mode_feat =devm_kzalloc (dev,sizeof (*shared_mode_feat),GFP_KERNEL ); +if (!shared_mode_feat) +return -ENOMEM ; + + r =dispc_update_shared_mode_features (shared_mode_feat, dispc); +if (r) +return r; + + tidss->feat = (const struct dispc_features *)shared_mode_feat; + feat = tidss->feat; + dispc->feat = feat; + } + dispc_common_regmap = dispc->feat->common_regs; r = dispc_iomap_resource(pdev, dispc->feat->common,@@ -2933,25 +3131,37 @@ int dispc_init(struct tidss_device *tidss) }if (feat->subrev ==DISPC_AM65X ) { - r =dispc_init_am65x_oldi_io_ctrl (dev, dispc); -if (r)
drivers/gpu/drm/tidss/tidss_dispc.c int dispc_init(struct tidss_device *tidss) · line 3142
Quoted 10 lines
drivers/gpu/drm/tidss/tidss_dispc.c +9
-1-return r; +/* +* For shared mode, Initialize the OLDI IO control only if we own +* the OLDI Tx ports +*/ +if (!tidss->shared_mode || tidss->shared_mode_own_oldi) { + r =dispc_init_am65x_oldi_io_ctrl (dev, dispc); +if (r) +return r; + }
I haven't studied this, but the shared_mode_own_oldi feels like very SoC specific. Will we need something similar on other SoC, maybe for other outputs too? Maybe this needs something more generic.
And it's not clear to me how to manage the whole pipeline. Let's say we have a board with DSS and an external bridge, like SiI9022, and a HDMI connector. I assume RTOS must control the SiI9022 and the connector (HPD, HDMI +5V line). Does that mean that the DT for Linux will be special in that case? Will we even have anything connected to the DSS port in the DT?
Quoted 55 lines
drivers/gpu/drm/tidss/tidss_dispc.c +18
-12} - dispc->fclk =devm_clk_get (dev,"fck" ); -if (IS_ERR (dispc->fclk)) { -dev_err (dev,"%s: Failed to get fclk: %ld\n" , - __func__,PTR_ERR (dispc->fclk)); -return PTR_ERR (dispc->fclk); - } -dev_dbg (dev,"DSS fclk %lu Hz\n" ,clk_get_rate (dispc->fclk)); +/* +* For shared mode, Initialize the hardware and clocking only if processing core running +* Linux has ownership of DSS global register space +*/ +if (!tidss->shared_mode ||dispc_owns_global_common_in_shared_mode (dispc)) { + dispc->fclk =devm_clk_get (dev,"fck" ); +if (IS_ERR (dispc->fclk)) { +dev_err (dev,"%s: Failed to get fclk: %ld\n" , + __func__,PTR_ERR (dispc->fclk)); +return PTR_ERR (dispc->fclk); + } +dev_dbg (dev,"DSS fclk %lu Hz\n" ,clk_get_rate (dispc->fclk)); -of_property_read_u32 (dispc->dev->of_node,"max-memory-bandwidth" , - &dispc->memory_bandwidth_limit); +of_property_read_u32 (dispc->dev->of_node,"max-memory-bandwidth" , + &dispc->memory_bandwidth_limit); - r =dispc_init_hw (dispc); -if (r) -return r; + r =dispc_init_hw (dispc); +if (r) +return r; + } tidss->dispc = dispc;drivers/gpu/drm/tidss/tidss_dispc.h +1
-1@@ -80,7 +80,7 @@ struct dispc_features {const char *vp_name[TIDSS_MAX_PORTS ];/* Should match dt reg names */ const char *ovr_name[TIDSS_MAX_PORTS ];/* Should match dt reg names */ const char *vpclk_name[TIDSS_MAX_PORTS ];/* Should match dt clk names */ -const enum dispc_vp_bus_type vp_bus_type[TIDSS_MAX_PORTS ]; +enum dispc_vp_bus_type vp_bus_type[TIDSS_MAX_PORTS ];struct tidss_vp_feat vp_feat;u32 num_planes;const char *vid_name[TIDSS_MAX_PLANES ];/* Should match dt reg names */ drivers/gpu/drm/tidss/tidss_drv.c +0
-0
drivers/gpu/drm/tidss/tidss_drv.c int tidss_runtime_get(struct tidss_device *tidss) · line 38
Quoted 7 lines
drivers/gpu/drm/tidss/tidss_drv.c +4
-0@@ -32,6 +32,10 @@ int tidss_runtime_get(struct tidss_device *tidss)dev_dbg (tidss->dev,"%s\n" , __func__); +/* No PM in display sharing mode */ +if (tidss->shared_mode) +return 0 ; +
I'm not sure how to implement it, but I think it would be much nicer if the PM code in the driver stayed at least mostly the same. The driver can't suspend the hardware, but the meaning of the pm function calls would still make sense, i.e. pm_runtime_get() means that tidss wants the hardware to be enabled. If the HW already is enabled (is it would be as RTOS controls it), nothing would happen.
Quoted 76 lines
drivers/gpu/drm/tidss/tidss_drv.c +19
-10r =pm_runtime_resume_and_get (tidss->dev);WARN_ON (r <0 );return r;@@ -43,6 +47,9 @@ void tidss_runtime_put(struct tidss_device *tidss)dev_dbg (tidss->dev,"%s\n" , __func__); +if (tidss->shared_mode) +return ; +pm_runtime_mark_last_busy (tidss->dev); r =pm_runtime_put_autosuspend (tidss->dev);@@ -140,21 +147,23 @@ static int tidss_probe(struct platform_device *pdev)spin_lock_init (&tidss->wait_lock); + tidss->shared_mode =device_property_read_bool (dev,"ti,dss-shared-mode" ); ret =dispc_init (tidss);if (ret) {dev_err (dev,"failed to initialize dispc: %d\n" , ret);return ret; } -pm_runtime_enable (dev); - -pm_runtime_set_autosuspend_delay (dev,1000 ); -pm_runtime_use_autosuspend (dev); +if (!tidss->shared_mode) { +pm_runtime_enable (dev); +pm_runtime_set_autosuspend_delay (dev,1000 ); +pm_runtime_use_autosuspend (dev);#ifndef CONFIG_PM -/* If we don't have PM, we need to call resume manually */ -dispc_runtime_resume (tidss->dispc); +/* If we don't have PM, we need to call resume manually */ +dispc_runtime_resume (tidss->dispc);#endif + } ret =tidss_modeset_init (tidss);if (ret <0 ) {@@ -196,6 +205,8 @@ static int tidss_probe(struct platform_device *pdev)tidss_irq_uninstall (ddev); err_runtime_suspend: +if (tidss->shared_mode) +return ret;#ifndef CONFIG_PM dispc_runtime_suspend (tidss->dispc);#endif @@ -219,12 +230,14 @@ static void tidss_remove(struct platform_device *pdev)tidss_irq_uninstall (ddev); +if (!tidss->shared_mode) {#ifndef CONFIG_PM -/* If we don't have PM, we need to call suspend manually */ -dispc_runtime_suspend (tidss->dispc); +/* If we don't have PM, we need to call suspend manually */ +dispc_runtime_suspend (tidss->dispc);#endif -pm_runtime_dont_use_autosuspend (dev); -pm_runtime_disable (dev); +pm_runtime_dont_use_autosuspend (dev); +pm_runtime_disable (dev); + }/* devm allocated dispc goes away with the dev so mark it NULL */ dispc_remove (tidss);drivers/gpu/drm/tidss/tidss_drv.h +0
-0
drivers/gpu/drm/tidss/tidss_drv.h struct tidss_device { · line 38
Quoted 8 lines
drivers/gpu/drm/tidss/tidss_drv.h +5
-0@@ -31,6 +31,12 @@ struct tidss_device {spinlock_t wait_lock;/* protects the irq masks */ dispc_irq_t irq_mask;/* enabled irqs in addition to wait_list */ + +bool shared_mode;/* DSS resources shared between remote core and Linux */ + +/* 1: VP owned by Linux 0: VP is owned by remote and shared with Linux */ +u32 shared_mode_owned_vps[TIDSS_MAX_PORTS ];
Boolean, I think?
Quoted 4 lines
drivers/gpu/drm/tidss/tidss_drv.h +1
-0+bool shared_mode_own_oldi;/* Linux needs to configure OLDI in shared mode */ };#define to_tidss (__dev) container_of(__dev, struct tidss_device, ddev)
Maxime Ripard
maintainerRe: [RFC PATCH 2/3] drm/tidss: Add support for display sharing
In reply to Devarsh ThakkarHi,
Thanks a lot for working on that.
Quoted 16 lines · Devarsh Thakkar
Display subsystem present in TI Keystone family of devices supports sharing of display between multiple hosts as it provides separate register space (common* region) for each host to programming display controller and also a unique interrupt line for each host.
This adds support for display sharing, by allowing partitioning of resources either at video port level or at video plane level as described below :
1) Linux can own (i.e have write access) completely one or more of video ports along with corresponding resources (viz. overlay managers, video planes) used by Linux in context of those video ports. Even if Linux is owning
these video ports it can still share this video port with a remote core which can own one or more video planes associated with this video port.
Quoted 5 lines
2) Linux owns one or more of the video planes with video port (along with corresponding overlay manager) associated with these planes being owned and controlled by a remote core. Linux still has read-only access to the associated video port and overlay managers so that it can parse the settings made by remote core.
So, just to make sure we're on the same page. 1) means Linux drives the whole display engine, but can lend planes to the R5? How does that work, is Linux aware of the workload being there (plane size, format, etc) ?
And 2) would mean that the display engine is under the R5 control and Linux only gets to fill the plane and let the firmware know of what it wants?
If so, do we even need the tidss driver in the second case? We could just write a fwkms driver of some sorts that could be used by multiple implementations of the same "defer to firmware" logic.
Quoted 9 lines
For both the cases, the resources used in context of processing core running Linux along with ownership information are exposed by user as part of device-tree blob and driver uses an updated feature list tailored for this shared mode accordingly. The driver also auto-populates matching overlay managers and output types from shared video port list provided in device-tree blob.
Indispc_featurestruct remove const access specfier foroutput_typearray as it is required to be updated dynamically in run-time for shared mode.
I'm also not entirely sure that the device tree is the right path there. Surely the firmware capabilities will evolve over time, while the device tree won't. Is there some way to make it discoverable at probe time by the driver?
Maxime
Re: [RFC PATCH 2/3] drm/tidss: Add support for display sharing
Hi Maxime,
Thanks a lot for checking on this.
Quoted 27 lines · Maxime Ripard
Hi,
Thanks a lot for working on that.
Quoted 16 lines · Devarsh Thakkar
Display subsystem present in TI Keystone family of devices supports sharing of display between multiple hosts as it provides separate register space (common* region) for each host to programming display controller and also a unique interrupt line for each host.
This adds support for display sharing, by allowing partitioning of resources either at video port level or at video plane level as described below :
1) Linux can own (i.e have write access) completely one or more of video ports along with corresponding resources (viz. overlay managers, video planes) used by Linux in context of those video ports. Even if Linux is owning
these video ports it can still share this video port with a remote core which can own one or more video planes associated with this video port.Quoted 5 lines
2) Linux owns one or more of the video planes with video port (along with corresponding overlay manager) associated with these planes being owned and controlled by a remote core. Linux still has read-only access to the associated video port and overlay managers so that it can parse the settings made by remote core.
Quoted 4 lines
So, just to make sure we're on the same page. 1) means Linux drives the whole display engine, but can lend planes to the R5? How does that work, is Linux aware of the workload being there (plane size, format, etc) ?
Well, there is no dynamic procedure being followed for lending. The partitioning scheme is decided and known before hand, and the remote core firmware updated and compiled accordingly, and similarly the device-tree overlay for Linux is also updated with partitioning information before bootup.
What would happen here is that Linux will know before-hand this partitioning information via device-tree properties and won't enumerate the plane owned by RTOS, but it will enumerate the rest of the display components and initialize the DSS, after which user can load the DSS firmware on remote core and this firmware will only have control of plane as it was compiled with that configuration.
Quoted 4 lines
And 2) would mean that the display engine is under the R5 control and Linux only gets to fill the plane and let the firmware know of what it wants?
Here too the partitioning information is pre-decided and remote core firmware and device-tree overlay for Linux updated accordingly. But in this case as remote core firmware owns the display (minus the plane owned by Linux) it is started and initialized during the bootloader phase itself where it initializes the DSS and starts rendering using the plane owned by it and Linux just latches to the DSS without re-initializing it, with write access only to the plane that is owned by Linux. You can refer [1] for more details on this.
Quoted 4 lines
If so, do we even need the tidss driver in the second case? We could just write a fwkms driver of some sorts that could be used by multiple implementations of the same "defer to firmware" logic.
This feature of static partitioning of DSS resources is specific to DSS7 hardware (which is controlled by tidss driver) which supports dedicated register space and interrupt line for each of the hosts [0], so that multiple hosts can drive the display controller simultaneously as per the desired static partitioning of resources, and so I don't think a separate driver is required here and tidss seems the right place to support this, where using this device-tree approach different resource partitioning schemas can be achieved as described here [1]. This was also aligned with Tomi too where we discussed that tidss is the right place to support this as we are simply leveraging the DSS hardware capabilities of static partitioning here.
Quoted 10 lines
Quoted 9 lines
For both the cases, the resources used in context of processing core running Linux along with ownership information are exposed by user as part of device-tree blob and driver uses an updated feature list tailored for this shared mode accordingly. The driver also auto-populates matching overlay managers and output types from shared video port list provided in device-tree blob.
Indispc_featurestruct remove const access specfier foroutput_typearray as it is required to be updated dynamically in run-time for shared mode.
Quoted 5 lines
I'm also not entirely sure that the device tree is the right path there. Surely the firmware capabilities will evolve over time, while the device tree won't. Is there some way to make it discoverable at probe time by the driver?
I think the main highlight of the sharing feature is the hardware capability where each host is provided separate irq and register space to program display for their display context independently and without any sort of inter-processor communication and the current implementation just mirrors by specifying the display context information in the form of device-tree properties instead of relying on any inter-processor communication or negotiation phase.
Having said that, for the second case Linux still has read access to display registers which can be read to infer some of the display configuration set by the RTOS and we are infact using that to infer some of the context like for e.g. what was the display mode set by RTOS, but we don't want to rely completely on register reads of RTOS programmed registers to gather full information regarding partitioning or even to infer that we are in sharing mode.
The remote core firmware is compiled with the partitioning information known before-hand and same is fed in the form of DT properties to Linux and this looks much cleaner, simple and reliable to us.
But yes we wanted to support firmwares with different partitioning schemes/capabilities as you said and so the tidss-shared-mode device-tree properties were designed keeping in mind that they should be adequate and flexible enough to define all different partition schemes which can be supported, this is also demonstrated with an example here [1]
Regards
Devarsh
Quoted 1 line
Maxime
Maxime Ripard
maintainerRe: Re: [RFC PATCH 2/3] drm/tidss: Add support for display sharing
Hi Devarsh,
Quoted 43 lines · Devarsh Thakkar
Hi Maxime,
Thanks a lot for checking on this.
Quoted 27 lines · Maxime Ripard
Hi,
Thanks a lot for working on that.
Quoted 16 lines · Devarsh Thakkar
Display subsystem present in TI Keystone family of devices supports sharing of display between multiple hosts as it provides separate register space (common* region) for each host to programming display controller and also a unique interrupt line for each host.
This adds support for display sharing, by allowing partitioning of resources either at video port level or at video plane level as described below :
1) Linux can own (i.e have write access) completely one or more of video ports along with corresponding resources (viz. overlay managers, video planes) used by Linux in context of those video ports. Even if Linux is owning
these video ports it can still share this video port with a remote core which can own one or more video planes associated with this video port.Quoted 5 lines
2) Linux owns one or more of the video planes with video port (along with corresponding overlay manager) associated with these planes being owned and controlled by a remote core. Linux still has read-only access to the associated video port and overlay managers so that it can parse the settings made by remote core.
Quoted 4 lines
So, just to make sure we're on the same page. 1) means Linux drives the whole display engine, but can lend planes to the R5? How does that work, is Linux aware of the workload being there (plane size, format, etc) ?
Well, there is no dynamic procedure being followed for lending. The partitioning scheme is decided and known before hand, and the remote core firmware updated and compiled accordingly, and similarly the device-tree overlay for Linux is also updated with partitioning information before bootup.
Quoted 6 lines
What would happen here is that Linux will know before-hand this partitioning information via device-tree properties and won't enumerate the plane owned by RTOS, but it will enumerate the rest of the display components and initialize the DSS, after which user can load the DSS firmware on remote core and this firmware will only have control of plane as it was compiled with that configuration.
Right. If the RTOS is in control of a single plane, how it is expected to deal with Linux shutting the CRTC down, or enforcing a configuration that isn't compatible with what the RTOS expects (like a plane with a higher zpos masking its plane), what is the mechanism to reconcile it?
Quoted 19 lines
Quoted 4 lines
And 2) would mean that the display engine is under the R5 control and Linux only gets to fill the plane and let the firmware know of what it wants?
Here too the partitioning information is pre-decided and remote core firmware and device-tree overlay for Linux updated accordingly. But in this case as remote core firmware owns the display (minus the plane owned by Linux) it is started and initialized during the bootloader phase itself where it initializes the DSS and starts rendering using the plane owned by it and Linux just latches to the DSS without re-initializing it, with write access only to the plane that is owned by Linux. You can refer [1] for more details on this.
Quoted 4 lines
If so, do we even need the tidss driver in the second case? We could just write a fwkms driver of some sorts that could be used by multiple implementations of the same "defer to firmware" logic.
Quoted 11 lines
This feature of static partitioning of DSS resources is specific to DSS7 hardware (which is controlled by tidss driver) which supports dedicated register space and interrupt line for each of the hosts [0], so that multiple hosts can drive the display controller simultaneously as per the desired static partitioning of resources, and so I don't think a separate driver is required here and tidss seems the right place to support this, where using this device-tree approach different resource partitioning schemas can be achieved as described here [1]. This was also aligned with Tomi too where we discussed that tidss is the right place to support this as we are simply leveraging the DSS hardware capabilities of static partitioning here.
If the only thing tidss does in the "owned by RTOS" is forwarding KMS atomic states to the RTOS, then I'm still not sure why we need to involve tidss at all.
It's not just about interrupts, it's also about how your arbitrate between what Linux wants and what the RTOS wants. Like if the RTOS still wants to output something but Linux wants to disable it, how do you reconcile the two?
You have to have something that reconciles both, and typically for firmware-based setup this will be the firmware's job.
That's very similar to what the RaspberryPi did with fkms, and I believe that having a generic KMS-on-remoteproc driver when the firmware has control over the display is the path forward.
Quoted 10 lines
Quoted 10 lines
Quoted 9 lines
For both the cases, the resources used in context of processing core running Linux along with ownership information are exposed by user as part of device-tree blob and driver uses an updated feature list tailored for this shared mode accordingly. The driver also auto-populates matching overlay managers and output types from shared video port list provided in device-tree blob.
Indispc_featurestruct remove const access specfier foroutput_typearray as it is required to be updated dynamically in run-time for shared mode.
Quoted 8 lines
Quoted 4 lines
I'm also not entirely sure that the device tree is the right path there. Surely the firmware capabilities will evolve over time, while the device tree won't. Is there some way to make it discoverable at probe time by the driver?
I think the main highlight of the sharing feature is the hardware capability where each host is provided separate irq and register space to program display for their display context independently
Wait, what do you mean by display context here?
Maxime
Re: [RFC PATCH 2/3] drm/tidss: Add support for display sharing
Hi Maxime,
Thanks for the quick reply.
Quoted 53 lines · Maxime Ripard
Hi Devarsh,
Quoted 43 lines · Devarsh Thakkar
Hi Maxime,
Thanks a lot for checking on this.
Quoted 27 lines · Maxime Ripard
Hi,
Thanks a lot for working on that.
Quoted 16 lines · Devarsh Thakkar
Display subsystem present in TI Keystone family of devices supports sharing of display between multiple hosts as it provides separate register space (common* region) for each host to programming display controller and also a unique interrupt line for each host.
This adds support for display sharing, by allowing partitioning of resources either at video port level or at video plane level as described below :
1) Linux can own (i.e have write access) completely one or more of video ports along with corresponding resources (viz. overlay managers, video planes) used by Linux in context of those video ports. Even if Linux is owning
these video ports it can still share this video port with a remote core which can own one or more video planes associated with this video port.Quoted 5 lines
2) Linux owns one or more of the video planes with video port (along with corresponding overlay manager) associated with these planes being owned and controlled by a remote core. Linux still has read-only access to the associated video port and overlay managers so that it can parse the settings made by remote core.
Quoted 4 lines
So, just to make sure we're on the same page. 1) means Linux drives the whole display engine, but can lend planes to the R5? How does that work, is Linux aware of the workload being there (plane size, format, etc) ?
Well, there is no dynamic procedure being followed for lending. The partitioning scheme is decided and known before hand, and the remote core firmware updated and compiled accordingly, and similarly the device-tree overlay for Linux is also updated with partitioning information before bootup.
Quoted 6 lines
What would happen here is that Linux will know before-hand this partitioning information via device-tree properties and won't enumerate the plane owned by RTOS, but it will enumerate the rest of the display components and initialize the DSS, after which user can load the DSS firmware on remote core and this firmware will only have control of plane as it was compiled with that configuration.
Quoted 5 lines
Right. If the RTOS is in control of a single plane, how it is expected to deal with Linux shutting the CRTC down, or enforcing a configuration that isn't compatible with what the RTOS expects (like a plane with a higher zpos masking its plane), what is the mechanism to reconcile it?
Just for the note, for this "RTOS control single plane" mode, we don't have a firmware available to test (right now we are only supporting example for "RTOS controlling the display mode" as shared here [1]) and hence this is not validated but the idea was to keep dt-bindings generic enough to support them in future and that's why I referred to it here.
Coming back to your questions, with the current scheme the Linux (tidss) would be expected to make sure the CRTC being shared with RTOS is never shutdown and the RTOS plane should never gets masked.
I think the IPC based scheme would have been mainly needed for the case where you have a single entity controlling the display for e.g you have a single display controller register space and a single IRQ but you have multiple planes and say you want to divide these planes to different host processors. In that case you want a single entity to act as a main entity and be in control of DSS and rest of the processors communicate with the "main entity" to request display resources and plane updates and main entity also programs dss on their behalf.
But unlike above, TI DSS7 is designed to support static partitioning of display resources among multiple hosts, where each host can program the display hardware independently using separate register space and having a separate irq and without requirement of any communication between the hosts. Now as this feature is unique to TI DSS7 we want to support this feature in tidss driver. The DSS resource partitioning feature is described in detail here [2]
Quoted 31 lines
Quoted 19 lines
Quoted 4 lines
And 2) would mean that the display engine is under the R5 control and Linux only gets to fill the plane and let the firmware know of what it wants?
Here too the partitioning information is pre-decided and remote core firmware and device-tree overlay for Linux updated accordingly. But in this case as remote core firmware owns the display (minus the plane owned by Linux) it is started and initialized during the bootloader phase itself where it initializes the DSS and starts rendering using the plane owned by it and Linux just latches to the DSS without re-initializing it, with write access only to the plane that is owned by Linux. You can refer [1] for more details on this.
Quoted 4 lines
If so, do we even need the tidss driver in the second case? We could just write a fwkms driver of some sorts that could be used by multiple implementations of the same "defer to firmware" logic.
Quoted 11 lines
This feature of static partitioning of DSS resources is specific to DSS7 hardware (which is controlled by tidss driver) which supports dedicated register space and interrupt line for each of the hosts [0], so that multiple hosts can drive the display controller simultaneously as per the desired static partitioning of resources, and so I don't think a separate driver is required here and tidss seems the right place to support this, where using this device-tree approach different resource partitioning schemas can be achieved as described here [1]. This was also aligned with Tomi too where we discussed that tidss is the right place to support this as we are simply leveraging the DSS hardware capabilities of static partitioning here.
Quoted 4 lines
If the only thing tidss does in the "owned by RTOS" is forwarding KMS atomic states to the RTOS, then I'm still not sure why we need to involve tidss at all.
I think maybe here is the point of misunderstanding. We are not forwarding atomic states to RTOS here. Linux (tidss) is infact, accessing the display register space assigned to it (common1 assigned to Linux, commmon0 assigned to RTOS) and also writing to DSS plane registers for the plane assigned to it (say VID assigned to Linux and VIDL assigned to RTOS).
Quoted 5 lines
It's not just about interrupts, it's also about how your arbitrate between what Linux wants and what the RTOS wants. Like if the RTOS still wants to output something but Linux wants to disable it, how do you reconcile the two?
The scheme involves static partitioning of display resource which are assigned compile-time to RTOS and Linux. Here the RTOS firmware is compiled with specific ownership/display resources as desired by user and this assignment stays intact.
If there is a more complex use-case which requires dynamic assignment/arbitration of resources then I agree those require some sort of IPC scheme but this is not what we target with these series. This series is simply to support static partitioning feature (separate register space, separate irq, firewalling support etc) of TI DSS hardware across the multiple hosts and there are use-cases too for which this scheme suffices.
Quoted 7 lines
You have to have something that reconciles both, and typically for firmware-based setup this will be the firmware's job.
That's very similar to what the RaspberryPi did with fkms, and I believe that having a generic KMS-on-remoteproc driver when the firmware has control over the display is the path forward.
The kms-on-remoteproc scheme is different and maybe more useful for those processors not supporting this static partitioning hardware feature. On the other hand, I believe there are still use-cases where this unique static partitioning hardware feature of TI DSS will suffice without any requirement of IPC. And it makes the firmware simpler (and the job of RTOS developer easier too) as no IPC is required.
I am curious to understand Rpi DSS hardware and take a look at fkms and it's firmware code though if it is public ?
Quoted 15 lines
Quoted 15 lines
Quoted 14 lines
Quoted 9 lines
For both the cases, the resources used in context of processing core running Linux along with ownership information are exposed by user as part of device-tree blob and driver uses an updated feature list tailored for this shared mode accordingly. The driver also auto-populates matching overlay managers and output types from shared video port list provided in device-tree blob.
Indispc_featurestruct remove const access specfier foroutput_typearray as it is required to be updated dynamically in run-time for shared mode.I'm also not entirely sure that the device tree is the right path there. Surely the firmware capabilities will evolve over time, while the device tree won't. Is there some way to make it discoverable at probe time by the driver?
Quoted 6 lines
Quoted 3 lines
I think the main highlight of the sharing feature is the hardware capability where each host is provided separate irq and register space to program display for their display context independently
Wait, what do you mean by display context here?
By context I mean to what that specific host wants to display. For e.g. if RTOS is owning a plane, then it can update it's framebuffer and update plane registers independently.
[1]
https://software-dl.ti.com/processor-sdk-linux/esd/AM62PX/09_01_00_08/exports/docs/system/Demo_User_Guides/Display_Cluster_User_Guide.html
[2] https://www.ti.com/lit/zip/spruj52 ((Section 12.6.3.14 DISPC Resources Sharing))
Regards
Devarsh
Quoted 1 line
Maxime
Maxime Ripard
maintainerRe: [RFC PATCH 2/3] drm/tidss: Add support for display sharing
Hi,
Quoted 60 lines · Devarsh Thakkar
Quoted 47 lines · Maxime Ripard
Quoted 39 lines · Devarsh Thakkar
Quoted 27 lines · Maxime Ripard
Hi,
Thanks a lot for working on that.
Quoted 16 lines · Devarsh Thakkar
Display subsystem present in TI Keystone family of devices supports sharing of display between multiple hosts as it provides separate register space (common* region) for each host to programming display controller and also a unique interrupt line for each host.
This adds support for display sharing, by allowing partitioning of resources either at video port level or at video plane level as described below :
1) Linux can own (i.e have write access) completely one or more of video ports along with corresponding resources (viz. overlay managers, video planes) used by Linux in context of those video ports. Even if Linux is owning
these video ports it can still share this video port with a remote core which can own one or more video planes associated with this video port.Quoted 5 lines
2) Linux owns one or more of the video planes with video port (along with corresponding overlay manager) associated with these planes being owned and controlled by a remote core. Linux still has read-only access to the associated video port and overlay managers so that it can parse the settings made by remote core.
Quoted 4 lines
So, just to make sure we're on the same page. 1) means Linux drives the whole display engine, but can lend planes to the R5? How does that work, is Linux aware of the workload being there (plane size, format, etc) ?
Well, there is no dynamic procedure being followed for lending. The partitioning scheme is decided and known before hand, and the remote core firmware updated and compiled accordingly, and similarly the device-tree overlay for Linux is also updated with partitioning information before bootup.
Quoted 6 lines
What would happen here is that Linux will know before-hand this partitioning information via device-tree properties and won't enumerate the plane owned by RTOS, but it will enumerate the rest of the display components and initialize the DSS, after which user can load the DSS firmware on remote core and this firmware will only have control of plane as it was compiled with that configuration.
Quoted 5 lines
Right. If the RTOS is in control of a single plane, how it is expected to deal with Linux shutting the CRTC down, or enforcing a configuration that isn't compatible with what the RTOS expects (like a plane with a higher zpos masking its plane), what is the mechanism to reconcile it?
Just for the note, for this "RTOS control single plane" mode, we don't have a firmware available to test (right now we are only supporting example for "RTOS controlling the display mode" as shared here [1]) and hence this is not validated but the idea was to keep dt-bindings generic enough to support them in future and that's why I referred to it here.
Quoted 3 lines
Coming back to your questions, with the current scheme the Linux (tidss) would be expected to make sure the CRTC being shared with RTOS is never shutdown and the RTOS plane should never gets masked.
I'm probably missing something then here, but if the Linux side of things is expected to keep the current configuration and keep it active for it to work, what use-case would it be useful for?
Quoted 4 lines
I think the IPC based scheme would have been mainly needed for the case where you have a single entity controlling the display for e.g you have a single display controller register space and a single IRQ but you have multiple planes and say you want to divide these planes to different host processors.
And with, I assume, different OS on those host processors? Otherwise why would we need to handle some planes at the firmware level?
Quoted 5 lines
In that case you want a single entity to act as a main entity and be in control of DSS and rest of the processors communicate with the "main entity" to request display resources and plane updates and main entity also programs dss on their behalf.
Quoted 7 lines
But unlike above, TI DSS7 is designed to support static partitioning of display resources among multiple hosts, where each host can program the display hardware independently using separate register space and having a separate irq and without requirement of any communication between the hosts. Now as this feature is unique to TI DSS7 we want to support this feature in tidss driver. The DSS resource partitioning feature is described in detail here [2]
So, if I understand this properly, and in KMS terms, DSS7 can assign the planes, CRTCs or encoders to a given VM or CPU, and you can segment the hardware that way. It looks like a good way to split encoders between VMs, but going back to the discussion about one plane being handled by the firmware, I don't really see how it can work with something else than splitting away the whole pipeline and having a VM claiming a CRTC and encoder, and another VM claiming another pipeline.
Like, if they share either a CRTC or encoder, we will still go back to the discussion about arbitration about who has the final word if the two have conflicting requirements, or if it changes something the other probably has to know about it.
Quoted 52 lines
Quoted 31 lines
Quoted 19 lines
Quoted 4 lines
And 2) would mean that the display engine is under the R5 control and Linux only gets to fill the plane and let the firmware know of what it wants?
Here too the partitioning information is pre-decided and remote core firmware and device-tree overlay for Linux updated accordingly. But in this case as remote core firmware owns the display (minus the plane owned by Linux) it is started and initialized during the bootloader phase itself where it initializes the DSS and starts rendering using the plane owned by it and Linux just latches to the DSS without re-initializing it, with write access only to the plane that is owned by Linux. You can refer [1] for more details on this.
Quoted 4 lines
If so, do we even need the tidss driver in the second case? We could just write a fwkms driver of some sorts that could be used by multiple implementations of the same "defer to firmware" logic.
Quoted 11 lines
This feature of static partitioning of DSS resources is specific to DSS7 hardware (which is controlled by tidss driver) which supports dedicated register space and interrupt line for each of the hosts [0], so that multiple hosts can drive the display controller simultaneously as per the desired static partitioning of resources, and so I don't think a separate driver is required here and tidss seems the right place to support this, where using this device-tree approach different resource partitioning schemas can be achieved as described here [1]. This was also aligned with Tomi too where we discussed that tidss is the right place to support this as we are simply leveraging the DSS hardware capabilities of static partitioning here.
Quoted 3 lines
If the only thing tidss does in the "owned by RTOS" is forwarding KMS atomic states to the RTOS, then I'm still not sure why we need to involve tidss at all.
I think maybe here is the point of misunderstanding. We are not forwarding atomic states to RTOS here. Linux (tidss) is infact, accessing the display register space assigned to it (common1 assigned to Linux, commmon0 assigned to RTOS) and also writing to DSS plane registers for the plane assigned to it (say VID assigned to Linux and VIDL assigned to RTOS).
Quoted 5 lines
It's not just about interrupts, it's also about how your arbitrate between what Linux wants and what the RTOS wants. Like if the RTOS still wants to output something but Linux wants to disable it, how do you reconcile the two?
The scheme involves static partitioning of display resource which are assigned compile-time to RTOS and Linux. Here the RTOS firmware is compiled with specific ownership/display resources as desired by user and this assignment stays intact.
Quoted 6 lines
If there is a more complex use-case which requires dynamic assignment/arbitration of resources then I agree those require some sort of IPC scheme but this is not what we target with these series. This series is simply to support static partitioning feature (separate register space, separate irq, firewalling support etc) of TI DSS hardware across the multiple hosts and there are use-cases too for which this scheme suffices.
I think you're right and we have a misunderstanding. My initial assumption was that it was to prevent the Linux side of sides from screwing up the output if it was to crash.
But it looks like it's not the main point of this series, so could you share some use-cases you're trying to address?
Thanks!
Maxime
Re: [RFC PATCH 2/3] drm/tidss: Add support for display sharing
Hi Maxime,
Quoted 63 lines · Maxime Ripard
Hi,
Quoted 60 lines · Devarsh Thakkar
Quoted 47 lines · Maxime Ripard
Quoted 39 lines · Devarsh Thakkar
Quoted 27 lines · Maxime Ripard
Hi,
Thanks a lot for working on that.
Quoted 16 lines · Devarsh Thakkar
Display subsystem present in TI Keystone family of devices supports sharing of display between multiple hosts as it provides separate register space (common* region) for each host to programming display controller and also a unique interrupt line for each host.
This adds support for display sharing, by allowing partitioning of resources either at video port level or at video plane level as described below :
1) Linux can own (i.e have write access) completely one or more of video ports along with corresponding resources (viz. overlay managers, video planes) used by Linux in context of those video ports. Even if Linux is owning
these video ports it can still share this video port with a remote core which can own one or more video planes associated with this video port.Quoted 5 lines
2) Linux owns one or more of the video planes with video port (along with corresponding overlay manager) associated with these planes being owned and controlled by a remote core. Linux still has read-only access to the associated video port and overlay managers so that it can parse the settings made by remote core.
Quoted 4 lines
So, just to make sure we're on the same page. 1) means Linux drives the whole display engine, but can lend planes to the R5? How does that work, is Linux aware of the workload being there (plane size, format, etc) ?
Well, there is no dynamic procedure being followed for lending. The partitioning scheme is decided and known before hand, and the remote core firmware updated and compiled accordingly, and similarly the device-tree overlay for Linux is also updated with partitioning information before bootup.
Quoted 6 lines
What would happen here is that Linux will know before-hand this partitioning information via device-tree properties and won't enumerate the plane owned by RTOS, but it will enumerate the rest of the display components and initialize the DSS, after which user can load the DSS firmware on remote core and this firmware will only have control of plane as it was compiled with that configuration.
Quoted 5 lines
Right. If the RTOS is in control of a single plane, how it is expected to deal with Linux shutting the CRTC down, or enforcing a configuration that isn't compatible with what the RTOS expects (like a plane with a higher zpos masking its plane), what is the mechanism to reconcile it?
Just for the note, for this "RTOS control single plane" mode, we don't have a firmware available to test (right now we are only supporting example for "RTOS controlling the display mode" as shared here [1]) and hence this is not validated but the idea was to keep dt-bindings generic enough to support them in future and that's why I referred to it here.
Quoted 8 lines
Quoted 3 lines
Coming back to your questions, with the current scheme the Linux (tidss) would be expected to make sure the CRTC being shared with RTOS is never shutdown and the RTOS plane should never gets masked.
I'm probably missing something then here, but if the Linux side of things is expected to keep the current configuration and keep it active for it to work, what use-case would it be useful for?
It's just one of the partitioning possibilities that I mentioned here, that Linux is in control of DSS as a whole and the user want the other host (be it RTOS or any other core) to control a single plane. For e.g it could be Linux (with GPU rendering) displaying the graphics and RTOS overlaying a real time clock or any other signs which need to be displayed in real-time. But more than the use-case this is inspired by the fact that we want to be flexible and support in the linux driver whatever partitioning scheme possibilities are there which are supported in hardware and we let user decide on the partitioning scheme.
Quoted 29 lines
Quoted 4 lines
I think the IPC based scheme would have been mainly needed for the case where you have a single entity controlling the display for e.g you have a single display controller register space and a single IRQ but you have multiple planes and say you want to divide these planes to different host processors.
And with, I assume, different OS on those host processors? Otherwise why would we need to handle some planes at the firmware level?
Quoted 5 lines
In that case you want a single entity to act as a main entity and be in control of DSS and rest of the processors communicate with the "main entity" to request display resources and plane updates and main entity also programs dss on their behalf.
Quoted 7 lines
But unlike above, TI DSS7 is designed to support static partitioning of display resources among multiple hosts, where each host can program the display hardware independently using separate register space and having a separate irq and without requirement of any communication between the hosts. Now as this feature is unique to TI DSS7 we want to support this feature in tidss driver. The DSS resource partitioning feature is described in detail here [2]
So, if I understand this properly, and in KMS terms, DSS7 can assign the planes, CRTCs or encoders to a given VM or CPU, and you can segment the hardware that way. It looks like a good way to split encoders between VMs, but going back to the discussion about one plane being handled by the firmware, I don't really see how it can work with something else than splitting away the whole pipeline and having a VM claiming a CRTC and encoder, and another VM claiming another pipeline.
Quoted 4 lines
Like, if they share either a CRTC or encoder, we will still go back to the discussion about arbitration about who has the final word if the two have conflicting requirements, or if it changes something the other probably has to know about it.
There should not be any conflicting requirements as this sharing scheme is a static one i.e. it is pre-negotiated or decided by the user before Linux kernel compilation or RTOS firmware compilation and resources are split statically and the sharing scheme is communicated to Linux via device-tree and RTOS side firmware configured and compiled accordingly, and this scheme stays intact without any change after device boots up. So for e.g. if Linux is assigned only one plane and RTOS is the DSS master controlling all other entities then this scheme will stay intact as long as device is up.
Also there could be only a single DSS master (the one in control of global common0 reg space, i.e. having access to global DSS registers and also in control of dss clock and power domains) and whichever core is acting as DSS master will be knowing which of the CRTC and encoders are shared with other hosts so that it doesn't power them off given other cores may still be using it.
Quoted 60 lines
Quoted 53 lines
Quoted 32 lines
Quoted 20 lines
Quoted 5 lines
And 2) would mean that the display engine is under the R5 control and Linux only gets to fill the plane and let the firmware know of what it wants?
Here too the partitioning information is pre-decided and remote core firmware and device-tree overlay for Linux updated accordingly. But in this case as remote core firmware owns the display (minus the plane owned by Linux) it is started and initialized during the bootloader phase itself where it initializes the DSS and starts rendering using the plane owned by it and Linux just latches to the DSS without re-initializing it, with write access only to the plane that is owned by Linux. You can refer [1] for more details on this.
Quoted 4 lines
If so, do we even need the tidss driver in the second case? We could just write a fwkms driver of some sorts that could be used by multiple implementations of the same "defer to firmware" logic.
Quoted 11 lines
This feature of static partitioning of DSS resources is specific to DSS7 hardware (which is controlled by tidss driver) which supports dedicated register space and interrupt line for each of the hosts [0], so that multiple hosts can drive the display controller simultaneously as per the desired static partitioning of resources, and so I don't think a separate driver is required here and tidss seems the right place to support this, where using this device-tree approach different resource partitioning schemas can be achieved as described here [1]. This was also aligned with Tomi too where we discussed that tidss is the right place to support this as we are simply leveraging the DSS hardware capabilities of static partitioning here.
Quoted 3 lines
If the only thing tidss does in the "owned by RTOS" is forwarding KMS atomic states to the RTOS, then I'm still not sure why we need to involve tidss at all.
I think maybe here is the point of misunderstanding. We are not forwarding atomic states to RTOS here. Linux (tidss) is infact, accessing the display register space assigned to it (common1 assigned to Linux, commmon0 assigned to RTOS) and also writing to DSS plane registers for the plane assigned to it (say VID assigned to Linux and VIDL assigned to RTOS).
Quoted 5 lines
It's not just about interrupts, it's also about how your arbitrate between what Linux wants and what the RTOS wants. Like if the RTOS still wants to output something but Linux wants to disable it, how do you reconcile the two?
The scheme involves static partitioning of display resource which are assigned compile-time to RTOS and Linux. Here the RTOS firmware is compiled with specific ownership/display resources as desired by user and this assignment stays intact.
Quoted 6 lines
If there is a more complex use-case which requires dynamic assignment/arbitration of resources then I agree those require some sort of IPC scheme but this is not what we target with these series. This series is simply to support static partitioning feature (separate register space, separate irq, firewalling support etc) of TI DSS hardware across the multiple hosts and there are use-cases too for which this scheme suffices.
Quoted 7 lines
I think you're right and we have a misunderstanding. My initial assumption was that it was to prevent the Linux side of sides from screwing up the output if it was to crash.
But it looks like it's not the main point of this series, so could you share some use-cases you're trying to address?
The end use-case we have demonstrated right now with this series is a proof-of-concept display cluster use-case where RTOS boots early on MCU core (launched at bootloader stage) and initializes the display (using the global common0 register space and irq) and starts displaying safety tell-tales on one plane, and once Linux boots up on application processor,
Linux (using common1 register space and irq) controls the other plane with GPU rendering using a QT based application. And yes, we also support the scenario where Linux crashes but RTOS being the DSS master and in control of DSS power, clock domain and global register space is not impacted by the crash. This is demonstrated in this video [1] and steps to simulate the same are also documented here [2].
[1]: https://www.youtube.com/watch?v=WIcds6HGeMI&t=884s
[2]:
https://software-dl.ti.com/processor-sdk-linux/esd/AM62PX/09_01_00_08/exports/docs/system/Demo_User_Guides/Display_Cluster_User_Guide.html
Regards
Devarsh
Quoted 2 lines
Thanks!
Maxime
Re: [RFC PATCH 2/3] drm/tidss: Add support for display sharing
Devarsh Thakkar <[email protected]> writes:
Hello Devarsh and Maxime,
Quoted 66 lines
Hi Maxime,
Quoted 63 lines · Maxime Ripard
Hi,
Quoted 60 lines · Devarsh Thakkar
Quoted 47 lines · Maxime Ripard
Quoted 39 lines · Devarsh Thakkar
Quoted 27 lines · Maxime Ripard
Hi,
Thanks a lot for working on that.
Quoted 16 lines · Devarsh Thakkar
Display subsystem present in TI Keystone family of devices supports sharing of display between multiple hosts as it provides separate register space (common* region) for each host to programming display controller and also a unique interrupt line for each host.
This adds support for display sharing, by allowing partitioning of resources either at video port level or at video plane level as described below :
1) Linux can own (i.e have write access) completely one or more of video ports along with corresponding resources (viz. overlay managers, video planes) used by Linux in context of those video ports. Even if Linux is owning
these video ports it can still share this video port with a remote core which can own one or more video planes associated with this video port.Quoted 5 lines
2) Linux owns one or more of the video planes with video port (along with corresponding overlay manager) associated with these planes being owned and controlled by a remote core. Linux still has read-only access to the associated video port and overlay managers so that it can parse the settings made by remote core.
Quoted 4 lines
So, just to make sure we're on the same page. 1) means Linux drives the whole display engine, but can lend planes to the R5? How does that work, is Linux aware of the workload being there (plane size, format, etc) ?
Well, there is no dynamic procedure being followed for lending. The partitioning scheme is decided and known before hand, and the remote core firmware updated and compiled accordingly, and similarly the device-tree overlay for Linux is also updated with partitioning information before bootup.
Quoted 6 lines
What would happen here is that Linux will know before-hand this partitioning information via device-tree properties and won't enumerate the plane owned by RTOS, but it will enumerate the rest of the display components and initialize the DSS, after which user can load the DSS firmware on remote core and this firmware will only have control of plane as it was compiled with that configuration.
Quoted 5 lines
Right. If the RTOS is in control of a single plane, how it is expected to deal with Linux shutting the CRTC down, or enforcing a configuration that isn't compatible with what the RTOS expects (like a plane with a higher zpos masking its plane), what is the mechanism to reconcile it?
Just for the note, for this "RTOS control single plane" mode, we don't have a firmware available to test (right now we are only supporting example for "RTOS controlling the display mode" as shared here [1]) and hence this is not validated but the idea was to keep dt-bindings generic enough to support them in future and that's why I referred to it here.
If I understand you correctly, for now the only real use case is when the the RTOS owns / manages the complete display pipeline and Linux can only own video planes.
The opposite is supported by the DSS hardware (thanks to its feature that allows partitioning the register space and having multiple per-host IRQs) but it's not a real use case yet. The reason why this case is added to the DT binding is as you said for flexiblity and make the design future-proof.
Quoted 10 lines
Quoted 9 lines
Quoted 4 lines
separate irq
Coming back to your questions, with the current scheme the Linux (tidss) would be expected to make sure the CRTC being shared with RTOS is never shutdown and the RTOS plane should never gets masked.I'm probably missing something then here, but if the Linux side of things is expected to keep the current configuration and keep it active for it to work, what use-case would it be useful for?
Quoted 10 lines
It's just one of the partitioning possibilities that I mentioned here, that Linux is in control of DSS as a whole and the user want the other host (be it RTOS or any other core) to control a single plane. For e.g it could be Linux (with GPU rendering) displaying the graphics and RTOS overlaying a real time clock or any other signs which need to be displayed in real-time. But more than the use-case this is inspired by the fact that we want to be flexible and support in the linux driver whatever partitioning scheme possibilities are there which are supported in hardware and we let user decide on the partitioning scheme.
A possible use case here could be if Linux is safer than the other host owning a single plane, right? Then in that case the RTOS could fail but the display pipeline won't be teared down.
That is, if your safety tell-tales would be driven by Linux and having other OS dislay the GPU-rendered QT based application on another plane.
But as said, for now that's a theorethical use case since the one you mentioned is the opposite.
[....]
Quoted 27 lines
Quoted 19 lines
Quoted 12 lines
Quoted 6 lines
It's not just about interrupts, it's also about how your arbitrate between what Linux wants and what the RTOS wants. Like if the RTOS still wants to output something but Linux wants to disable it, how do you reconcile the two?
The scheme involves static partitioning of display resource which are assigned compile-time to RTOS and Linux. Here the RTOS firmware is compiled with specific ownership/display resources as desired by user and this assignment stays intact.
Quoted 6 lines
If there is a more complex use-case which requires dynamic assignment/arbitration of resources then I agree those require some sort of IPC scheme but this is not what we target with these series. This series is simply to support static partitioning feature (separate register space, separate irq, firewalling support etc) of TI DSS hardware across the multiple hosts and there are use-cases too for which this scheme suffices.
Quoted 7 lines
I think you're right and we have a misunderstanding. My initial assumption was that it was to prevent the Linux side of sides from screwing up the output if it was to crash.
But it looks like it's not the main point of this series, so could you share some use-cases you're trying to address?
Quoted 9 lines
The end use-case we have demonstrated right now with this series is a proof-of-concept display cluster use-case where RTOS boots early on MCU core (launched at bootloader stage) and initializes the display (using the global common0 register space and irq) and starts displaying safety tell-tales on one plane, and once Linux boots up on application processor,
Linux (using common1 register space and irq) controls the other plane with GPU rendering using a QT based application. And yes, we also support the scenario where Linux crashes but RTOS being the DSS master and in control of DSS power, clock domain and global register space is not impacted by the crash.
You mention 2 scenarios but are actually the same? Or did I misunderstand?
In both cases the RTOS own the display pipeline and Linux can just display using a single plane.
That's why I think that agree with Maxime, that a fwkms could be a simpler solution to your use case instead of adding all this complexity to the DSS driver. Yes, I understand the HW supports all this flexibility but there's no real use case yet (you mentioned that don't even have firmware for this single plane owned by the RTOS in the R5F case).
The DT binding for a fwkms driver would be trivial, in fact maybe we might even leverage simpledrm for this case and not require a new driver at all.
Signature · 5 lines
Best regards, Javier Martinez Canillas Core Platforms Red Hat
Re: [RFC PATCH 2/3] drm/tidss: Add support for display sharing
Quoted 156 lines · Javier Martinez Canillas
Devarsh Thakkar <[email protected]> writes:
Hello Devarsh and Maxime,
Quoted 66 lines
Hi Maxime,
Quoted 63 lines · Maxime Ripard
Hi,
Quoted 60 lines · Devarsh Thakkar
Quoted 47 lines · Maxime Ripard
Quoted 39 lines · Devarsh Thakkar
Quoted 27 lines · Maxime Ripard
Hi,
Thanks a lot for working on that.
Quoted 16 lines · Devarsh Thakkar
Display subsystem present in TI Keystone family of devices supports sharing of display between multiple hosts as it provides separate register space (common* region) for each host to programming display controller and also a unique interrupt line for each host.
This adds support for display sharing, by allowing partitioning of resources either at video port level or at video plane level as described below :
1) Linux can own (i.e have write access) completely one or more of video ports along with corresponding resources (viz. overlay managers, video planes) used by Linux in context of those video ports. Even if Linux is owning
these video ports it can still share this video port with a remote core which can own one or more video planes associated with this video port.Quoted 5 lines
2) Linux owns one or more of the video planes with video port (along with corresponding overlay manager) associated with these planes being owned and controlled by a remote core. Linux still has read-only access to the associated video port and overlay managers so that it can parse the settings made by remote core.
Quoted 4 lines
So, just to make sure we're on the same page. 1) means Linux drives the whole display engine, but can lend planes to the R5? How does that work, is Linux aware of the workload being there (plane size, format, etc) ?
Well, there is no dynamic procedure being followed for lending. The partitioning scheme is decided and known before hand, and the remote core firmware updated and compiled accordingly, and similarly the device-tree overlay for Linux is also updated with partitioning information before bootup.
Quoted 6 lines
What would happen here is that Linux will know before-hand this partitioning information via device-tree properties and won't enumerate the plane owned by RTOS, but it will enumerate the rest of the display components and initialize the DSS, after which user can load the DSS firmware on remote core and this firmware will only have control of plane as it was compiled with that configuration.
Quoted 5 lines
Right. If the RTOS is in control of a single plane, how it is expected to deal with Linux shutting the CRTC down, or enforcing a configuration that isn't compatible with what the RTOS expects (like a plane with a higher zpos masking its plane), what is the mechanism to reconcile it?
Just for the note, for this "RTOS control single plane" mode, we don't have a firmware available to test (right now we are only supporting example for "RTOS controlling the display mode" as shared here [1]) and hence this is not validated but the idea was to keep dt-bindings generic enough to support them in future and that's why I referred to it here.
If I understand you correctly, for now the only real use case is when the the RTOS owns / manages the complete display pipeline and Linux can only own video planes.
The opposite is supported by the DSS hardware (thanks to its feature that allows partitioning the register space and having multiple per-host IRQs) but it's not a real use case yet. The reason why this case is added to the DT binding is as you said for flexiblity and make the design future-proof.
Quoted 10 lines
Quoted 9 lines
Quoted 4 lines
separate irq
Coming back to your questions, with the current scheme the Linux (tidss) would be expected to make sure the CRTC being shared with RTOS is never shutdown and the RTOS plane should never gets masked.I'm probably missing something then here, but if the Linux side of things is expected to keep the current configuration and keep it active for it to work, what use-case would it be useful for?
Quoted 10 lines
It's just one of the partitioning possibilities that I mentioned here, that Linux is in control of DSS as a whole and the user want the other host (be it RTOS or any other core) to control a single plane. For e.g it could be Linux (with GPU rendering) displaying the graphics and RTOS overlaying a real time clock or any other signs which need to be displayed in real-time. But more than the use-case this is inspired by the fact that we want to be flexible and support in the linux driver whatever partitioning scheme possibilities are there which are supported in hardware and we let user decide on the partitioning scheme.
A possible use case here could be if Linux is safer than the other host owning a single plane, right? Then in that case the RTOS could fail but the display pipeline won't be teared down.
That is, if your safety tell-tales would be driven by Linux and having other OS dislay the GPU-rendered QT based application on another plane.
But as said, for now that's a theorethical use case since the one you mentioned is the opposite.
[....]
Quoted 27 lines
Quoted 19 lines
Quoted 12 lines
Quoted 6 lines
It's not just about interrupts, it's also about how your arbitrate between what Linux wants and what the RTOS wants. Like if the RTOS still wants to output something but Linux wants to disable it, how do you reconcile the two?
The scheme involves static partitioning of display resource which are assigned compile-time to RTOS and Linux. Here the RTOS firmware is compiled with specific ownership/display resources as desired by user and this assignment stays intact.
Quoted 6 lines
If there is a more complex use-case which requires dynamic assignment/arbitration of resources then I agree those require some sort of IPC scheme but this is not what we target with these series. This series is simply to support static partitioning feature (separate register space, separate irq, firewalling support etc) of TI DSS hardware across the multiple hosts and there are use-cases too for which this scheme suffices.
Quoted 7 lines
I think you're right and we have a misunderstanding. My initial assumption was that it was to prevent the Linux side of sides from screwing up the output if it was to crash.
But it looks like it's not the main point of this series, so could you share some use-cases you're trying to address?
Quoted 9 lines
The end use-case we have demonstrated right now with this series is a proof-of-concept display cluster use-case where RTOS boots early on MCU core (launched at bootloader stage) and initializes the display (using the global common0 register space and irq) and starts displaying safety tell-tales on one plane, and once Linux boots up on application processor,
Linux (using common1 register space and irq) controls the other plane with GPU rendering using a QT based application. And yes, we also support the scenario where Linux crashes but RTOS being the DSS master and in control of DSS power, clock domain and global register space is not impacted by the crash.You mention 2 scenarios but are actually the same? Or did I misunderstand?
In both cases the RTOS own the display pipeline and Linux can just display using a single plane.
Quoted 8 lines
That's why I think that agree with Maxime, that a fwkms could be a simpler solution to your use case instead of adding all this complexity to the DSS driver. Yes, I understand the HW supports all this flexibility but there's no real use case yet (you mentioned that don't even have firmware for this single plane owned by the RTOS in the R5F case).
The DT binding for a fwkms driver would be trivial, in fact maybe we might even leverage simpledrm for this case and not require a new driver at all.
I guess you can still do things like pageflipping and maybe use some of the color/blending hardware? Maybe even have more than one plane available? fwkms/simpledrm conceptually cannot really support pageflipping even, so that's a much, much reduced feature set.
That all aside I do think we should limit the support to just the first case, where linux gets a few pieces assigned to it and is not the DSS master. From what I'm understanding you could assign entire crtc with planes and everything to linux, so this shouldn't really constraint real-world usage?
At least until there's support in firmware for this it's all way too theoretical, and I agree with Maxime and Javier that there's some serious design questions about how this kind of static leasing should work with drm sitting on top.
-Sima
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch
Re: [RFC PATCH 2/3] drm/tidss: Add support for display sharing
Hi Javier, Maxime, Daniel,
Sorry for the delay. Please find response inline.
Quoted 2 lines · Daniel Vetter
Quoted 1 line · Javier Martinez Canillas
Devarsh Thakkar <[email protected]> writes:
[..]
Quoted 5 lines
Quoted 5 lines
If I understand you correctly, for now the only real use case is when the the RTOS owns / manages the complete display pipeline and Linux can only own video planes.
Not exactly, What I mean is that this is the default configuration/example we intend to provide to customer as an out-of-box demo . But flexibility is provided to customer to modify the display sharing configuration per their use-case, for e.g at RTOS side in place of device-tree, we have a sysconfig menu [1] using which they can select the desired configuration, furthermore they can go ahead and edit the code too, so Linux driver is expected to be flexible to support different configurations as supported by the HW.
I have a limited view of all possible use-cases which customer may try out with different configurations but few examples are shared below part from the one discussed earlier :
[Examples]:
1) Customer is running Linux as main OS but using RTOS to control some external peripherals like temperature sensor, motion sensor e.t.c. In that case if they want to display the sensor data too on the same monitor, then they can use the configuration where RTOS use single plane and Linux as the DSS master.
2) Another configuration could be where RTOS want to control one full end-to-end pipeline going to one connector and Linux want to control full end-to-end pipeline going to another connector, that can be supported too using this scheme (as shared in this series).
3) Also I think, this device-tree based scheme could be leveraged in virtualization too with static partitioning based scheme using Xen for e.g. we split the DSS resources between host (DOM0) and the guest (DOMU).
Quoted 5 lines
Quoted 5 lines
The opposite is supported by the DSS hardware (thanks to its feature that allows partitioning the register space and having multiple per-host IRQs) but it's not a real use case yet. The reason why this case is added to the DT binding is as you said for flexiblity and make the design future-proof.
Not really, as explained above we are documenting all possible configurations which hardware supports as supported in software in the SDK and that's what we are aiming for upstream too.
[..]>>>> I'm probably missing something then here, but if the Linux side of
Quoted 19 lines
Quoted 19 lines
Quoted 4 lines
Quoted 3 lines
things is expected to keep the current configuration and keep it active for it to work, what use-case would it be useful for?
Quoted 10 lines
It's just one of the partitioning possibilities that I mentioned here, that Linux is in control of DSS as a whole and the user want the other host (be it RTOS or any other core) to control a single plane. For e.g it could be Linux (with GPU rendering) displaying the graphics and RTOS overlaying a real time clock or any other signs which need to be displayed in real-time. But more than the use-case this is inspired by the fact that we want to be flexible and support in the linux driver whatever partitioning scheme possibilities are there which are supported in hardware and we let user decide on the partitioning scheme.
A possible use case here could be if Linux is safer than the other host owning a single plane, right? Then in that case the RTOS could fail but the display pipeline won't be teared down.
Quoted 8 lines
Quoted 8 lines
That is, if your safety tell-tales would be driven by Linux and having other OS dislay the GPU-rendered QT based application on another plane.
But as said, for now that's a theorethical use case since the one you mentioned is the opposite.
[....]
Yes that could be a possible use-case too, we want to provide customer the flexibility in their app design to select different configuration, as we say all these configurations as supported in the driver.
[..]
Quoted 25 lines
Quoted 25 lines
Quoted 24 lines
Quoted 7 lines
Quoted 6 lines
If there is a more complex use-case which requires dynamic assignment/arbitration of resources then I agree those require some sort of IPC scheme but this is not what we target with these series. This series is simply to support static partitioning feature (separate register space, separate irq, firewalling support etc) of TI DSS hardware across the multiple hosts and there are use-cases too for which this scheme suffices.
Quoted 7 lines
I think you're right and we have a misunderstanding. My initial assumption was that it was to prevent the Linux side of sides from screwing up the output if it was to crash.
But it looks like it's not the main point of this series, so could you share some use-cases you're trying to address?
The end use-case we have demonstrated right now with this series is a proof-of-concept display cluster use-case where RTOS boots early on MCU core (launched at bootloader stage) and initializes the display (using the global common0 register space and irq) and starts displaying safety tell-tales on one plane, and once Linux boots up on application processor,
Linux (using common1 register space and irq) controls the other plane with GPU rendering using a QT based application. And yes, we also support the scenario where Linux crashes but RTOS being the DSS master and in control of DSS power, clock domain and global register space is not impacted by the crash.
Quoted 2 lines
Quoted 2 lines
You mention 2 scenarios but are actually the same? Or did I misunderstand?
I have explained the other examples (where Linux is the master) above with tag [Examples].
Quoted 9 lines
Quoted 9 lines
In both cases the RTOS own the display pipeline and Linux can just display using a single plane.
That's why I think that agree with Maxime, that a fwkms could be a simpler solution to your use case instead of adding all this complexity to the DSS driver. Yes, I understand the HW supports all this flexibility but there's no real use case yet (you mentioned that don't even have firmware for this single plane owned by the RTOS in the R5F case).
I analyzed the fwkms driver [2] from the RPi repo (as seems like it is not upstream), here the firmware is the entity owning the display register space completely and the fwkms driver simply acts as a translating layer which translates the incoming DRM/KMS ioctls into IPC messages (having unique message tags) sent over mailbox which the firmware receives and programs corresponding registers accordingly, so there is no display sharing achieved here as there is only single display context as coming from Linux and no separate display context running at firmware side.
But yes, in general for simple display controllers having single register space and single IRQ, I think that a standard IPC based scheme would be required for sharing the display between Linux and RTOS where for e.g. RTOS would be in full control of display register space and the interrupt line. Linux would send messages to RTOS via IPC scheme (similar to RPi fwkms) to commit the framebuffer and RTOS would send a frame done message to LInux on receiving vblank irq which would eventually call drm_crtc_handle_vblank. Although the IPC layer would need to be standardized (virtio_kms?)
Quoted 8 lines
Quoted 2 lines
The DT binding for a fwkms driver would be trivial, in fact maybe we might even leverage simpledrm for this case and not require a new driver at all.
I guess you can still do things like pageflipping and maybe use some of the color/blending hardware? Maybe even have more than one plane available? fwkms/simpledrm conceptually cannot really support pageflipping even, so that's a much, much reduced feature set.
Yes exactly, fwkms, simpledrm are not related to display sharing.
Quoted 10 lines
That all aside I do think we should limit the support to just the first case, where linux gets a few pieces assigned to it and is not the DSS master. From what I'm understanding you could assign entire crtc with planes and everything to linux, so this shouldn't really constraint real-world usage?
At least until there's support in firmware for this it's all way too theoretical, and I agree with Maxime and Javier that there's some serious design questions about how this kind of static leasing should work with drm sitting on top.
To summarize, as per my understanding there are two schemes for display sharing possible
1) IPC based scheme -> This would be useful for simple display controllers having single register space and single irq line to one host)
2) Static partitioning scheme -> This would require some support in display controller (per host irq e.t.c) as explained below :
And I think each one has it's own uniqueness and holds on it's own and both solutions can be pursued independently and development for one scheme should not block development for another.
As TI display controller supports robust partitioning of DSS processing blocks (Pipelines, overlays, interrupts etc) among multiple processors allowing parallel and independent control of the DSS resources in an interference free environment, the static partitioning scheme was possible to implement and it sufficed the requirements of display sharing use-case without incurring any extra overhead and complexity of IPC.
And If there is another display controller having similar feature-set as above then the bindings for the static partitioning scheme (or at-least some of them) could be generalized.
drm,shared-mode; drm,shared-mode-crtc = ".."; drm,shared-mode-crtc-owned = ".."; drm,shared-mode-planes = "..";
But I could not find any other display controller support above static partitioning feature and hence I put the bindings as specific to TI.
I still feel the static partitioning approach as adopted in this series still holds on its own achieving the sharing without extra complexity/overhead of IPC by utilizing the above mentioned HW features, and all it aims is to simply add software support for the flexibility of sharing the display resources.
Kindly let me know if we are aligned on this or any further thoughts or queries.
[1]:
https://software-dl.ti.com/mcu-plus-sdk/esd/AM62PX/latest/exports/docs/api_guide_am62px/DRIVERS_DSS_PAGE.html#autotoc_md311
[2]:
https://github.com/raspberrypi/linux/blob/rpi-6.6.y/drivers/gpu/drm/vc4/vc4_firmware_kms.c
Regards
Devarsh
Maxime Ripard
maintainerRe: [RFC PATCH 2/3] drm/tidss: Add support for display sharing
Quoted 16 lines · Devarsh Thakkar
Hi Javier, Maxime, Daniel,
Sorry for the delay. Please find response inline.
Quoted 2 lines · Daniel Vetter
Quoted 1 line · Javier Martinez Canillas
Devarsh Thakkar <[email protected]> writes:
[..]
Quoted 5 lines
Quoted 5 lines
If I understand you correctly, for now the only real use case is when the the RTOS owns / manages the complete display pipeline and Linux can only own video planes.
Quoted 7 lines
Not exactly, What I mean is that this is the default configuration/example we intend to provide to customer as an out-of-box demo . But flexibility is provided to customer to modify the display sharing configuration per their use-case, for e.g at RTOS side in place of device-tree, we have a sysconfig menu [1] using which they can select the desired configuration, furthermore they can go ahead and edit the code too, so Linux driver is expected to be flexible to support different configurations as supported by the HW.
Everything you stated above can be achieved with the solutions we've been suggesting too.
Quoted 2 lines
I have a limited view of all possible use-cases which customer may try out with different configurations
I think that's a problem in itself. In order to properly reflect and discuss a solution, we first need to have a problem. "Flexible solutions" in practice never really work because you always end up not flexible enough and still have to rework the whole thing. Except it's now harder to do since you created something complicated first.
Quoted 8 lines
few examples are shared below part from the one discussed earlier :
[Examples]:
1) Customer is running Linux as main OS but using RTOS to control some external peripherals like temperature sensor, motion sensore.t.c. In that case if they want to display the sensor data too on the same monitor, then they can use the configuration where RTOS use single plane and Linux as the DSS master.
How would that work in real-world? If Linux is in charge of the display, it can shut down the output whenever it wants too, including shutting down the clocks or power domains, which then would probably make the firmware crash?
A much more robust solution here would be to have either the firmware in charge of the display and delegate a few planes, or provide some way for Linux to access those sensors while being fully in charge of the display.
Quoted 4 lines
2) Another configuration could be where RTOS want to control one full end-to-end pipeline going to one connector and Linux want to control full end-to-end pipeline going to another connector, that can be supported too using this scheme (as shared in this series).
That one is easy: you make the firmware adjust the DT when it boots Linux and thus restrict the part of the display controller it can use.
It's mostly a DT binding issue.
Quoted 3 lines
3) Also I think, this device-tree based scheme could be leveraged in virtualization too with static partitioning based scheme using Xen for e.g. we split the DSS resources between host (DOM0) and the guest (DOMU).
I'm not sure you can leverage virtio at the firmware level, but otherwise, it's pretty much what we've been suggesting the whole time:
make a generic interface between the firmware and Linux, and then write a KMS driver for that interface.
Then the firmware can delegate planes to Linux, just like the hypervisor would to a guest VM.
Quoted 8 lines
Quoted 4 lines
Quoted 4 lines
The opposite is supported by the DSS hardware (thanks to its feature that allows partitioning the register space and having multiple per-host IRQs) but it's not a real use case yet. The reason why this case is added to the DT binding is as you said for flexiblity and make the design future-proof.
Not really, as explained above we are documenting all possible configurations which hardware supports as supported in software in the SDK and that's what we are aiming for upstream too.
Generally speaking, not all hardware configurations make sense to run with in Linux, and there's tons of drivers were we support only a limited set of capabilities precisely because some simply don't work well with Linux. I'm glad you're (and your organization) is that committed to Linux, but I don't think having that as an absolute goal is reasonable.
Let's work on usecases, and make the most of it instead. In your examples, 2 and 3 make total sense to be supported in Linux. I'm not sure 1) does.
Quoted 75 lines
[..]>>>> I'm probably missing something then here, but if the Linux side of
Quoted 19 lines
Quoted 19 lines
Quoted 4 lines
Quoted 3 lines
things is expected to keep the current configuration and keep it active for it to work, what use-case would it be useful for?
Quoted 10 lines
It's just one of the partitioning possibilities that I mentioned here, that Linux is in control of DSS as a whole and the user want the other host (be it RTOS or any other core) to control a single plane. For e.g it could be Linux (with GPU rendering) displaying the graphics and RTOS overlaying a real time clock or any other signs which need to be displayed in real-time. But more than the use-case this is inspired by the fact that we want to be flexible and support in the linux driver whatever partitioning scheme possibilities are there which are supported in hardware and we let user decide on the partitioning scheme.
A possible use case here could be if Linux is safer than the other host owning a single plane, right? Then in that case the RTOS could fail but the display pipeline won't be teared down.
Quoted 8 lines
Quoted 8 lines
That is, if your safety tell-tales would be driven by Linux and having other OS dislay the GPU-rendered QT based application on another plane.
But as said, for now that's a theorethical use case since the one you mentioned is the opposite.
[....]
Yes that could be a possible use-case too, we want to provide customer the flexibility in their app design to select different configuration, as we say all these configurations as supported in the driver.
[..]
Quoted 25 lines
Quoted 25 lines
Quoted 24 lines
Quoted 7 lines
Quoted 6 lines
If there is a more complex use-case which requires dynamic assignment/arbitration of resources then I agree those require some sort of IPC scheme but this is not what we target with these series. This series is simply to support static partitioning feature (separate register space, separate irq, firewalling support etc) of TI DSS hardware across the multiple hosts and there are use-cases too for which this scheme suffices.
Quoted 7 lines
I think you're right and we have a misunderstanding. My initial assumption was that it was to prevent the Linux side of sides from screwing up the output if it was to crash.
But it looks like it's not the main point of this series, so could you share some use-cases you're trying to address?
The end use-case we have demonstrated right now with this series is a proof-of-concept display cluster use-case where RTOS boots early on MCU core (launched at bootloader stage) and initializes the display (using the global common0 register space and irq) and starts displaying safety tell-tales on one plane, and once Linux boots up on application processor,
Linux (using common1 register space and irq) controls the other plane with GPU rendering using a QT based application. And yes, we also support the scenario where Linux crashes but RTOS being the DSS master and in control of DSS power, clock domain and global register space is not impacted by the crash.Quoted 2 lines
Quoted 2 lines
You mention 2 scenarios but are actually the same? Or did I misunderstand?
I have explained the other examples (where Linux is the master) above with tag [Examples].
Quoted 9 lines
Quoted 9 lines
In both cases the RTOS own the display pipeline and Linux can just display using a single plane.
That's why I think that agree with Maxime, that a fwkms could be a simpler solution to your use case instead of adding all this complexity to the DSS driver. Yes, I understand the HW supports all this flexibility but there's no real use case yet (you mentioned that don't even have firmware for this single plane owned by the RTOS in the R5F case).
Quoted 8 lines
I analyzed the fwkms driver [2] from the RPi repo (as seems like it is not upstream), here the firmware is the entity owning the display register space completely and the fwkms driver simply acts as a translating layer which translates the incoming DRM/KMS ioctls into IPC messages (having unique message tags) sent over mailbox which the firmware receives and programs corresponding registers accordingly, so there is no display sharing achieved here as there is only single display context as coming from Linux and no separate display context running at firmware side.
That's somewhat correct, but also a simplification: while the driver and firmware indeed never do any kind of segmentation (iirc), the protocol between the firmware and the kernel leaves that door opened so you could very well do that with some work on the firmware.
And now that I think about it, I think the RPi firmware can in some situations (like overheating) add an overlay on top of the current output.
Also, we're not advocating for you to use the RPi driver as is: we suggested to use a similar solution, but we can totally use a different transport mechanism or protocol (and we probably should if we want to make it somewhat generic).
Quoted 8 lines
But yes, in general for simple display controllers having single register space and single IRQ, I think that a standard IPC based scheme would be required for sharing the display between Linux and RTOS where for e.g. RTOS would be in full control of display register space and the interrupt line. Linux would send messages to RTOS via IPC scheme (similar to RPi fwkms) to commit the framebuffer and RTOS would send a frame done message to LInux on receiving vblank irq which would eventually call
drm_crtc_handle_vblank. Although the IPC layer would need to be standardized (virtio_kms?)
rpmsg is another candidate, but yeah, that's what in mind too (I think?).
Quoted 25 lines
Quoted 8 lines
Quoted 2 lines
The DT binding for a fwkms driver would be trivial, in fact maybe we might even leverage simpledrm for this case and not require a new driver at all.
I guess you can still do things like pageflipping and maybe use some of the color/blending hardware? Maybe even have more than one plane available? fwkms/simpledrm conceptually cannot really support pageflipping even, so that's a much, much reduced feature set.
Yes exactly, fwkms, simpledrm are not related to display sharing.
Quoted 10 lines
That all aside I do think we should limit the support to just the first case, where linux gets a few pieces assigned to it and is not the DSS master. From what I'm understanding you could assign entire crtc with planes and everything to linux, so this shouldn't really constraint real-world usage?
At least until there's support in firmware for this it's all way too theoretical, and I agree with Maxime and Javier that there's some serious design questions about how this kind of static leasing should work with drm sitting on top.
To summarize, as per my understanding there are two schemes for display sharing possible
Quoted 8 lines
1) IPC based scheme -> This would be useful for simple display controllers having single register space and single irq line to one host)
2) Static partitioning scheme -> This would require some support in display controller (per host irqe.t.c) as explained below :And I think each one has it's own uniqueness and holds on it's own and both solutions can be pursued independently and development for one scheme should not block development for another.
Agreed.
Quoted 11 lines
As TI display controller supports robust partitioning of DSS processing blocks (Pipelines, overlays, interrupts etc) among multiple processors allowing parallel and independent control of the DSS resources in an interference free environment, the static partitioning scheme was possible to implement and it sufficed the requirements of display sharing use-case without incurring any extra overhead and complexity of IPC.
And If there is another display controller having similar feature-set as above then the bindings for the static partitioning scheme (or at-least some of them) could be generalized.
Quoted 7 lines
drm,shared-mode; drm,shared-mode-crtc = ".."; drm,shared-mode-crtc-owned = ".."; drm,shared-mode-planes = "..";But I could not find any other display controller support above static partitioning feature and hence I put the bindings as specific to TI.
I think the binding would make more sense to me using child nodes to describe the available planes, CRTCs, etc.
But that's something to discuss with the DT maintainers.
Maxime
RFC PATCH 3/3 arm64: dts: ti: k3-am62x: Add overlay to use DSS in display sharing mode
In reply to Devarsh ThakkarThis overlay needs to be used with display sharing supported device manager firmware only.
Remote core running this firmware has write access to "common" register space, VIDL pipeline, OVR1 overlay and VP1 videoport.
The processing core running Linux is provided write access to VID pipeline and "common1" register space.
The VP1 video port is shared between Linux and remote core with remote core configuring the overlay manager to set Zorder 1 for VID pipeline and Zorder 2 for VIDL pipeline.
Add reserved memory region for framebuffer region used by remote core in dss shared mode overlay file so that Linux does not re-use the same while allocating memory.
Also add a label for reserved memory region in base device-tree file so that it can be referred back in overlay file.
--- arch/arm64/boot/dts/ti/Makefile | 1 + .../arm64/boot/dts/ti/k3-am62x-sk-common.dtsi | 2 +- .../dts/ti/k3-am62x-sk-dss-shared-mode.dtso | 33 +++++++++++++++++++ 3 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 arch/arm64/boot/dts/ti/k3-am62x-sk-dss-shared-mode.dtso
arch/arm64/boot/dts/ti/Makefile +1 -0
@@ -35,6 +35,7 @@ dtb-$(CONFIG_ARCH_K3) += k3-am62x-sk-csi2-ov5640.dtbo dtb-$(CONFIG_ARCH_K3) += k3-am62x-sk-csi2-tevi-ov5640.dtbo dtb-$(CONFIG_ARCH_K3) += k3-am62x-sk-csi2-imx219.dtbo dtb-$(CONFIG_ARCH_K3) += k3-am62x-sk-hdmi-audio.dtbo +dtb-$(CONFIG_ARCH_K3) += k3-am62x-sk-dss-shared-mode.dtbo # Boards with AM64x SoC dtb-$(CONFIG_ARCH_K3) += k3-am642-evm.dtb
arch/arm64/boot/dts/ti/k3-am62x-sk-common.dtsi +1 -1
@@ -34,7 +34,7 @@ memory@80000000 { reg = <0x00000000 0x80000000 0x00000000 0x80000000>; }; - reserved-memory { + reserved_memory: reserved-memory { #address-cells = <2>; #size-cells = <2>; ranges;
arch/arm64/boot/dts/ti/k3-am62x-sk-dss-shared-mode.dtso new file +33 -0
@@ -0,0 +1,33 @@ +// SPDX-License-Identifier: GPL-2.0 +/** + * DT overlay to enable display sharing mode for AM62P DSS0 + * This is compatible with custom AM62 Device Manager firmware + * + * Copyright (C) 2023 Texas Instruments Incorporated - http://www.ti.com/ + */ + +/dts-v1/; +/plugin/; + +#include <dt-bindings/interrupt-controller/irq.h> +#include <dt-bindings/interrupt-controller/arm-gic.h> + +&dss0 { + ti,dss-shared-mode; + ti,dss-shared-mode-vp = "vp1"; + ti,dss-shared-mode-vp-owned = <0>; + ti,dss-shared-mode-common = "common1"; + ti,dss-shared-mode-planes = "vid"; + ti,dss-shared-mode-plane-zorder = <0>; + interrupts = <GIC_SPI 85 IRQ_TYPE_LEVEL_HIGH>; +}; + +&reserved_memory { + #address-cells = <2>; + #size-cells = <2>; + rtos_framebuffer_memory_region: rtos-framebuffer-memory@94800000 { + compatible = "shared-dma-pool"; + reg = <0x00 0x94800000 0x00 0x08000000>; + no-map; + }; +};
Signature · 1 line
2.34.1
Tomi Valkeinen
maintainerRe: [RFC PATCH 3/3] arm64: dts: ti: k3-am62x: Add overlay to use DSS in display sharing mode
Hi,
Quoted 9 lines · Devarsh Thakkar
This overlay needs to be used with display sharing supported device manager firmware only.
Remote core running this firmware has write access to "common" register space, VIDL pipeline, OVR1 overlay and VP1 videoport.
The processing core running Linux is provided write access to VID pipeline and "common1" register space.
Quoted 7 lines
The VP1 video port is shared between Linux and remote core with remote core configuring the overlay manager to set Zorder 1 for VID pipeline and Zorder 2 for VIDL pipeline.
Add reserved memory region for framebuffer region used by remote core in dss shared mode overlay file so that Linux does not re-use the same while allocating memory.
I don't understand this one. Why is RAM used by RTOS accessible by Linux in the first place?
Tomi
Quoted 75 lines
Also add a label for reserved memory region in base device-tree file so that it can be referred back in overlay file.
Signed-off-by Devarsh Thakkar <[email protected]>--- arch/arm64/boot/dts/ti/Makefile | 1 + .../arm64/boot/dts/ti/k3-am62x-sk-common.dtsi | 2 +- .../dts/ti/k3-am62x-sk-dss-shared-mode.dtso | 33 +++++++++++++++++++ 3 files changed, 35 insertions(+), 1 deletion(-)create mode 100644
arch/arm64/boot/dts/ti/k3-am62x-sk-dss-shared-mode.dtsoarch/arm64/boot/dts/ti/Makefile +1
-0@@ -35,6 +35,7 @@ dtb-$(CONFIG_ARCH_K3) += k3-am62x-sk-csi2-ov5640.dtbo dtb-$(CONFIG_ARCH_K3) += k3-am62x-sk-csi2-tevi-ov5640.dtbo dtb-$(CONFIG_ARCH_K3) += k3-am62x-sk-csi2-imx219.dtbo dtb-$(CONFIG_ARCH_K3) += k3-am62x-sk-hdmi-audio.dtbo +dtb-$(CONFIG_ARCH_K3) += k3-am62x-sk-dss-shared-mode.dtbo # Boards with AM64x SoC dtb-$(CONFIG_ARCH_K3) += k3-am642-evm.dtbarch/arm64/boot/dts/ti/k3-am62x-sk-common.dtsi +1
-1@@ -34,7 +34,7 @@ memory@80000000 { reg = <0x00000000 0x80000000 0x00000000 0x80000000>; }; - reserved-memory { + reserved_memory: reserved-memory { #address-cells = <2>; #size-cells = <2>; ranges;arch/arm64/boot/dts/ti/k3-am62x-sk-dss-shared-mode.dtso new file +33
-0@@ -0,0 +1,33 @@ +// SPDX-License-Identifier: GPL-2.0 +/** + * DT overlay to enable display sharing mode for AM62P DSS0 + * This is compatible with custom AM62 Device Manager firmware + * + * Copyright (C) 2023 Texas Instruments Incorporated - http://www.ti.com/ + */ + +/dts-v1/; +/plugin/; + +#include <dt-bindings/interrupt-controller/irq.h> +#include <dt-bindings/interrupt-controller/arm-gic.h> + +&dss0 { + ti,dss-shared-mode; + ti,dss-shared-mode-vp = "vp1"; + ti,dss-shared-mode-vp-owned = <0>; + ti,dss-shared-mode-common = "common1"; + ti,dss-shared-mode-planes = "vid"; + ti,dss-shared-mode-plane-zorder = <0>; + interrupts = <GIC_SPI 85 IRQ_TYPE_LEVEL_HIGH>; +}; + +&reserved_memory { + #address-cells = <2>; + #size-cells = <2>; + rtos_framebuffer_memory_region: rtos-framebuffer-memory@94800000 { + compatible = "shared-dma-pool"; + reg = <0x00 0x94800000 0x00 0x08000000>; + no-map; + }; +};
Re: [RFC PATCH 3/3] arm64: dts: ti: k3-am62x: Add overlay to use DSS in display sharing mode
Hi Tomi,
Thanks for the review.
Quoted 16 lines · Tomi Valkeinen
Hi,
Quoted 13 lines · Devarsh Thakkar
This overlay needs to be used with display sharing supported device manager firmware only.
Remote core running this firmware has write access to "common" register space, VIDL pipeline, OVR1 overlay and VP1 videoport.
The processing core running Linux is provided write access to VID pipeline and "common1" register space.
The VP1 video port is shared between Linux and remote core with remote core configuring the overlay manager to set Zorder 1 for VID pipeline and Zorder 2 for VIDL pipeline.
Quoted 7 lines
Quoted 3 lines
Add reserved memory region for framebuffer region used by remote core in dss shared mode overlay file so that Linux does not re-use the same while allocating memory.
I don't understand this one. Why is RAM used by RTOS accessible by Linux in the first place?
Well, I think the R5 SPL initializes full DDR before starting firmwares on remote cores and the regions used by this remote cores be it for IPC or Code/data are marked as reserved both in Linux as well as U-boot so that Linux/U-boot does not use it [1].
Same scheme is followed here w.r. t RTOS framebuffer too.
Regards
Devarsh
Quoted 82 lines
Tomi
Quoted 78 lines
Also add a label for reserved memory region in base device-tree file so that it can be referred back in overlay file.
Signed-off-by Devarsh Thakkar <[email protected]>---
arch/arm64/boot/dts/ti/Makefile | 1 +.../arm64/boot/dts/ti/k3-am62x-sk-common.dtsi| 2 +- .../dts/ti/k3-am62x-sk-dss-shared-mode.dtso | 33 +++++++++++++++++++3 files changed, 35 insertions(+), 1 deletion(-)create mode 100644
arch/arm64/boot/dts/ti/k3-am62x-sk-dss-shared-mode.dtsoarch/arm64/boot/dts/ti/Makefile +0
-0@@ -35,6 +35,7 @@ dtb-$(CONFIG_ARCH_K3) += k3-am62x-sk-csi2-ov5640.dtbodtb-$(CONFIG_ARCH_K3) += k3-am62x-sk-csi2-tevi-ov5640.dtbo dtb-$(CONFIG_ARCH_K3) += k3-am62x-sk-csi2-imx219.dtbo dtb-$(CONFIG_ARCH_K3) += k3-am62x-sk-hdmi-audio.dtbo +dtb-$(CONFIG_ARCH_K3) += k3-am62x-sk-dss-shared-mode.dtbo # Boards with AM64x SoC
dtb-$(CONFIG_ARCH_K3) += k3-am642-evm.dtbarch/arm64/boot/dts/ti/k3-am62x-sk-common.dtsi +1
-0@@ -34,7 +34,7 @@ memory@80000000 { reg = <0x00000000 0x80000000 0x00000000 0x80000000>; }; - reserved-memory { + reserved_memory: reserved-memory { #address-cells = <2>; #size-cells = <2>; ranges;arch/arm64/boot/dts/ti/k3-am62x-sk-dss-shared-mode.dtso new file +6
-0@@ -0,0 +1,33 @@ +// SPDX-License-Identifier: GPL-2.0 +/** + * DT overlay to enable display sharing mode for AM62P DSS0 + * This is compatible with custom AM62 Device Manager firmware + * + * Copyright (C) 2023 Texas Instruments Incorporated -arch/arm64/boot/dts/ti/k3-am62x-sk-dss-shared-mode.dtso new file +26
-0+ +/dts-v1/; +/plugin/; + +#include <dt-bindings/interrupt-controller/irq.h> +#include <dt-bindings/interrupt-controller/arm-gic.h> + +&dss0 { + ti,dss-shared-mode; + ti,dss-shared-mode-vp = "vp1"; + ti,dss-shared-mode-vp-owned = <0>; + ti,dss-shared-mode-common = "common1"; + ti,dss-shared-mode-planes = "vid"; + ti,dss-shared-mode-plane-zorder = <0>; + interrupts = <GIC_SPI 85 IRQ_TYPE_LEVEL_HIGH>; +}; + +&reserved_memory { + #address-cells = <2>; + #size-cells = <2>; + rtos_framebuffer_memory_region: rtos-framebuffer-memory@94800000 { + compatible = "shared-dma-pool"; + reg = <0x00 0x94800000 0x00 0x08000000>; + no-map; + }; +};