drm/connector: hdmi: Add a link bpc property
Subsystems (2)
PATCH 1/1 drm/connector: hdmi: Add a link bpc property
From: Derek Foreman <[email protected]>
Add a way to know the actual bpc of a running link.
Drivers might change the current bpc link value due to changes in mode line or refresh rates. For example when enabling VRR the underlying hardware might not be able sustain the same bandwidth for a particular mode line, and it might attempt to lower the bpc. Another example can be found when switching the color output format, part of YUV420 fallback.
This means we might be displaying a stale bpc value although it was modified for different reasons -- like a refresh rate or an output color format.
This patch introduces a new property 'link bpc' that user-space can use to get the current bpc value of a running link. In the same time this would allow user-space set up bpc using 'max_bpc' property.
--- drivers/gpu/drm/drm_atomic_uapi.c | 5 +++++ drivers/gpu/drm/drm_connector.c | 26 ++++++++++++++++++++++++++ include/drm/drm_connector.h | 8 ++++++++ 3 files changed, 39 insertions(+)
drivers/gpu/drm/drm_atomic_uapi.c +5 -0
@@ -776,6 +776,9 @@ static int drm_atomic_connector_set_property(struct drm_connector *connector, fence_ptr); }else if (property == connector->max_bpc_property) { state->max_requested_bpc = val; + }else if (property == connector->link_bpc_property) { +drm_dbg_kms (dev,"only drivers can set link bpc property. Use max_bpc instead\n" ); +return -EINVAL ; }else if (property == connector->privacy_screen_sw_state_property) { state->privacy_screen_sw_state = val; }else if (property == connector->broadcast_rgb_property) {
@@ -861,6 +864,8 @@ drm_atomic_connector_get_property(struct drm_connector *connector, *val =0 ; }else if (property == connector->max_bpc_property) { *val = state->max_requested_bpc; + }else if (property == connector->link_bpc_property) { + *val = state->hdmi.output_bpc; }else if (property == connector->privacy_screen_sw_state_property) { *val = state->privacy_screen_sw_state; }else if (property == connector->broadcast_rgb_property) {
drivers/gpu/drm/drm_connector.c +26 -0
@@ -542,6 +542,28 @@ int drmm_connector_init(struct drm_device *dev, }EXPORT_SYMBOL (drmm_connector_init); +static int +drm_connector_attach_link_bpc_property (struct drm_connector *connector, +int min,int max) +{ +struct drm_device *dev = connector->dev; +struct drm_property *prop; + + prop = connector->link_bpc_property; +if (prop) +return 0 ; + + prop =drm_property_create_range (dev,0 ,"link bpc" , min, max); +if (!prop) +return -ENOMEM ; + + connector->link_bpc_property = prop; + +drm_object_attach_property (&connector->base, prop, max); + +return 0 ; +} +/** * drmm_connector_hdmi_init - Init a preallocated HDMI connector * @dev: DRM device
@@ -618,6 +640,10 @@ int drmm_connector_hdmi_init(struct drm_device *dev,drm_connector_attach_max_bpc_property (connector,8 , max_bpc); connector->max_bpc = max_bpc; + ret =drm_connector_attach_link_bpc_property (connector,8 , max_bpc); +if (ret) +return ret; +if (max_bpc >8 )drm_connector_attach_hdr_output_metadata_property (connector);
include/drm/drm_connector.h +8 -0
@@ -2079,6 +2079,14 @@ struct drm_connector {*/ struct drm_property *max_bpc_property; +/** +* @link_bpc_property: Current connector link bpc set by the driver +* +* This property can be used to retrieve the current link bpc from +* connector_state::hdmi:output_bpc +*/ +struct drm_property *link_bpc_property; +/** @privacy_screen: drm_privacy_screen for this connector, or NULL. */ struct drm_privacy_screen *privacy_screen;
Signature · 1 line
2.47.2
Quoted 10 lines · Marius Vlad
From: Derek Foreman <[email protected]>
Add a way to know the actual bpc of a running link.
Drivers might change the current bpc link value due to changes in mode line or refresh rates. For example when enabling VRR the underlying hardware might not be able sustain the same bandwidth for a particular mode line, and it might attempt to lower the bpc. Another example can be found when switching the color output format, part of YUV420 fallback.
Quoted 5 lines
This means we might be displaying a stale bpc value although it was modified for different reasons -- like a refresh rate or an output color format.
This patch introduces a new property 'link bpc' that user-space can
Nitpick, s/This patch introduces/Introduce/.
Quoted 83 lines
use to get the current bpc value of a running link. In the same time this would allow user-space set up bpc using '
max_bpc' property.Signed-off-by Derek Foreman <[email protected]>Signed-off-by Marius Vlad <[email protected]>--- drivers/gpu/drm/drm_atomic_uapi.c | 5 +++++ drivers/gpu/drm/drm_connector.c | 26 ++++++++++++++++++++++++++ include/drm/drm_connector.h | 8 ++++++++ 3 files changed, 39 insertions(+)drivers/gpu/drm/drm_atomic_uapi.c +5
-0@@ -776,6 +776,9 @@ static int drm_atomic_connector_set_property(struct drm_connector *connector, fence_ptr); }else if (property == connector->max_bpc_property) { state->max_requested_bpc = val; + }else if (property == connector->link_bpc_property) { +drm_dbg_kms (dev,"only drivers can set link bpc property. Use max_bpc instead\n" ); +return -EINVAL ; }else if (property == connector->privacy_screen_sw_state_property) { state->privacy_screen_sw_state = val; }else if (property == connector->broadcast_rgb_property) {@@ -861,6 +864,8 @@ drm_atomic_connector_get_property(struct drm_connector *connector, *val =0 ; }else if (property == connector->max_bpc_property) { *val = state->max_requested_bpc; + }else if (property == connector->link_bpc_property) { + *val = state->hdmi.output_bpc; }else if (property == connector->privacy_screen_sw_state_property) { *val = state->privacy_screen_sw_state; }else if (property == connector->broadcast_rgb_property) {drivers/gpu/drm/drm_connector.c +26
-0@@ -542,6 +542,28 @@ int drmm_connector_init(struct drm_device *dev, }EXPORT_SYMBOL (drmm_connector_init); +static int +drm_connector_attach_link_bpc_property (struct drm_connector *connector, +int min,int max) +{ +struct drm_device *dev = connector->dev; +struct drm_property *prop; + + prop = connector->link_bpc_property; +if (prop) +return 0 ; + + prop =drm_property_create_range (dev,0 ,"link bpc" , min, max); +if (!prop) +return -ENOMEM ; + + connector->link_bpc_property = prop; + +drm_object_attach_property (&connector->base, prop, max); + +return 0 ; +} +/** * drmm_connector_hdmi_init - Init a preallocated HDMI connector * @dev: DRM device @@ -618,6 +640,10 @@ int drmm_connector_hdmi_init(struct drm_device *dev,drm_connector_attach_max_bpc_property (connector,8 , max_bpc); connector->max_bpc = max_bpc; + ret =drm_connector_attach_link_bpc_property (connector,8 , max_bpc); +if (ret) +return ret; +if (max_bpc >8 )drm_connector_attach_hdr_output_metadata_property (connector);include/drm/drm_connector.h +0
-0
include/drm/drm_connector.h struct drm_connector { · line 2086
Quoted 8 lines
include/drm/drm_connector.h +5
-0@@ -2079,6 +2079,14 @@ struct drm_connector {*/ struct drm_property *max_bpc_property; +/** +* @link_bpc_property: Current connector link bpc set by the driver +* +* This property can be used to retrieve the current link bpc from +* connector_state::hdmi:output_bpc
It doesn't have to be just HDMI, does it?
Quoted 5 lines
include/drm/drm_connector.h +3
-0+*/ +struct drm_property *link_bpc_property; +/** @privacy_screen: drm_privacy_screen for this connector, or NULL. */ struct drm_privacy_screen *privacy_screen;
Signature · 1 line
Jani Nikula, Intel
Hi Jani,
Thanks for the feedback, sorry the late reply.
Quoted 11 lines · Jani Nikula
Quoted 10 lines · Marius Vlad
From: Derek Foreman <[email protected]>
Add a way to know the actual bpc of a running link.
Drivers might change the current bpc link value due to changes in mode line or refresh rates. For example when enabling VRR the underlying hardware might not be able sustain the same bandwidth for a particular mode line, and it might attempt to lower the bpc. Another example can be found when switching the color output format, part of YUV420 fallback.
Quoted 7 lines
Quoted 5 lines
This means we might be displaying a stale bpc value although it was modified for different reasons -- like a refresh rate or an output color format.
This patch introduces a new property 'link bpc' that user-space can
Nitpick, s/This patch introduces/Introduce/.
Sure, will mend.
Quoted 87 lines
Quoted 87 lines
use to get the current bpc value of a running link. In the same time this would allow user-space set up bpc using '
max_bpc' property.Signed-off-by Derek Foreman <[email protected]>Signed-off-by Marius Vlad <[email protected]>--- drivers/gpu/drm/drm_atomic_uapi.c | 5 +++++ drivers/gpu/drm/drm_connector.c | 26 ++++++++++++++++++++++++++ include/drm/drm_connector.h | 8 ++++++++ 3 files changed, 39 insertions(+)drivers/gpu/drm/drm_atomic_uapi.c +5
-0@@ -776,6 +776,9 @@ static int drm_atomic_connector_set_property(struct drm_connector *connector, fence_ptr); }else if (property == connector->max_bpc_property) { state->max_requested_bpc = val; + }else if (property == connector->link_bpc_property) { +drm_dbg_kms (dev,"only drivers can set link bpc property. Use max_bpc instead\n" ); +return -EINVAL ; }else if (property == connector->privacy_screen_sw_state_property) { state->privacy_screen_sw_state = val; }else if (property == connector->broadcast_rgb_property) {@@ -861,6 +864,8 @@ drm_atomic_connector_get_property(struct drm_connector *connector, *val =0 ; }else if (property == connector->max_bpc_property) { *val = state->max_requested_bpc; + }else if (property == connector->link_bpc_property) { + *val = state->hdmi.output_bpc; }else if (property == connector->privacy_screen_sw_state_property) { *val = state->privacy_screen_sw_state; }else if (property == connector->broadcast_rgb_property) {drivers/gpu/drm/drm_connector.c +26
-0@@ -542,6 +542,28 @@ int drmm_connector_init(struct drm_device *dev, }EXPORT_SYMBOL (drmm_connector_init); +static int +drm_connector_attach_link_bpc_property (struct drm_connector *connector, +int min,int max) +{ +struct drm_device *dev = connector->dev; +struct drm_property *prop; + + prop = connector->link_bpc_property; +if (prop) +return 0 ; + + prop =drm_property_create_range (dev,0 ,"link bpc" , min, max); +if (!prop) +return -ENOMEM ; + + connector->link_bpc_property = prop; + +drm_object_attach_property (&connector->base, prop, max); + +return 0 ; +} +/** * drmm_connector_hdmi_init - Init a preallocated HDMI connector * @dev: DRM device @@ -618,6 +640,10 @@ int drmm_connector_hdmi_init(struct drm_device *dev,drm_connector_attach_max_bpc_property (connector,8 , max_bpc); connector->max_bpc = max_bpc; + ret =drm_connector_attach_link_bpc_property (connector,8 , max_bpc); +if (ret) +return ret; +if (max_bpc >8 )drm_connector_attach_hdr_output_metadata_property (connector);include/drm/drm_connector.h +0
-0@@ -2079,6 +2079,14 @@ struct drm_connector {*/ struct drm_property *max_bpc_property;
Quoted 7 lines
include/drm/drm_connector.h struct drm_connector { · line 2086
Quoted 5 lines
include/drm/drm_connector.h +5
-0+/** +* @link_bpc_property: Current connector link bpc set by the driver +* +* This property can be used to retrieve the current link bpc from +* connector_state::hdmi:output_bpc It doesn't have to be just HDMI, does it?
For sure it doesn't, just that I didn't found anything else that would expose this independently of/for the connector type.
I'm under the impression that only HDMI -- and those drivers that actually call the available helpers update this value accordingly.
For code that was inspired from i915, i915 doesn't seem to use those helpers (intel_hdmi_mode_clock_valid) nor it does actually update connector_state::hdmi:output_bpc when picking the best available bpc. I suppose doing this now wouldn't be that hard, but having something similar for DP/MST seems like an quest on its own.
Is that something you'd like to see pursued with this patch/series?
Quoted 9 lines
Quoted 6 lines
include/drm/drm_connector.h +3
-0+*/ +struct drm_property *link_bpc_property; +/** @privacy_screen: drm_privacy_screen for this connector, or NULL. */ struct drm_privacy_screen *privacy_screen;Signature · 1 line
Jani Nikula, Intel
Quoted 10 lines · Marius Vlad
From: Derek Foreman <[email protected]>
Add a way to know the actual bpc of a running link.
Drivers might change the current bpc link value due to changes in mode line or refresh rates. For example when enabling VRR the underlying hardware might not be able sustain the same bandwidth for a particular mode line, and it might attempt to lower the bpc. Another example can be found when switching the color output format, part of YUV420 fallback.
Quoted 7 lines
This means we might be displaying a stale bpc value although it was modified for different reasons -- like a refresh rate or an output color format.
This patch introduces a new property 'link bpc' that user-space can use to get the current bpc value of a running link. In the same time this would allow user-space set up bpc using '
max_bpc' property.
Could you please point out the userspace implementation which uses this property?
Quoted 40 lines
Signed-off-by Derek Foreman <[email protected]>Signed-off-by Marius Vlad <[email protected]>--- drivers/gpu/drm/drm_atomic_uapi.c | 5 +++++ drivers/gpu/drm/drm_connector.c | 26 ++++++++++++++++++++++++++ include/drm/drm_connector.h | 8 ++++++++ 3 files changed, 39 insertions(+)drivers/gpu/drm/drm_atomic_uapi.c +5
-0@@ -776,6 +776,9 @@ static int drm_atomic_connector_set_property(struct drm_connector *connector, fence_ptr); }else if (property == connector->max_bpc_property) { state->max_requested_bpc = val; + }else if (property == connector->link_bpc_property) { +drm_dbg_kms (dev,"only drivers can set link bpc property. Use max_bpc instead\n" ); +return -EINVAL ; }else if (property == connector->privacy_screen_sw_state_property) { state->privacy_screen_sw_state = val; }else if (property == connector->broadcast_rgb_property) {@@ -861,6 +864,8 @@ drm_atomic_connector_get_property(struct drm_connector *connector, *val =0 ; }else if (property == connector->max_bpc_property) { *val = state->max_requested_bpc; + }else if (property == connector->link_bpc_property) { + *val = state->hdmi.output_bpc; }else if (property == connector->privacy_screen_sw_state_property) { *val = state->privacy_screen_sw_state; }else if (property == connector->broadcast_rgb_property) {drivers/gpu/drm/drm_connector.c +0
-0@@ -542,6 +542,28 @@ int drmm_connector_init(struct drm_device *dev, }EXPORT_SYMBOL (drmm_connector_init);
drivers/gpu/drm/drm_connector.c int drmm_connector_init(struct drm_device *dev, · line 554
Quoted 10 lines
drivers/gpu/drm/drm_connector.c +10
-0+static int +drm_connector_attach_link_bpc_property (struct drm_connector *connector, +int min,int max) +{ +struct drm_device *dev = connector->dev; +struct drm_property *prop; + + prop = connector->link_bpc_property; +if (prop) +return 0 ;
Shouldn't it be:
if (connector->link_bpc_property)
return -EBUSY;
Quoted 16 lines
drivers/gpu/drm/drm_connector.c +12
-0+ + prop =drm_property_create_range (dev,0 ,"link bpc" , min, max); +if (!prop) +return -ENOMEM ; + + connector->link_bpc_property = prop; + +drm_object_attach_property (&connector->base, prop, max); + +return 0 ; +} +/** * drmm_connector_hdmi_init - Init a preallocated HDMI connector * @dev: DRM device
drivers/gpu/drm/drm_connector.c int drmm_connector_hdmi_init(struct drm_device *dev, · line 645
Quoted 6 lines
drivers/gpu/drm/drm_connector.c +3
-0@@ -618,6 +640,10 @@ int drmm_connector_hdmi_init(struct drm_device *dev,drm_connector_attach_max_bpc_property (connector,8 , max_bpc); connector->max_bpc = max_bpc; + ret =drm_connector_attach_link_bpc_property (connector,8 , max_bpc); +if (ret) +return ret;
Is there a code which sets this property?
Quoted 26 lines
drivers/gpu/drm/drm_connector.c +1
-0+if (max_bpc >8 )drm_connector_attach_hdr_output_metadata_property (connector);include/drm/drm_connector.h +8
-0@@ -2079,6 +2079,14 @@ struct drm_connector {*/ struct drm_property *max_bpc_property; +/** +* @link_bpc_property: Current connector link bpc set by the driver +* +* This property can be used to retrieve the current link bpc from +* connector_state::hdmi:output_bpc +*/ +struct drm_property *link_bpc_property; +/** @privacy_screen: drm_privacy_screen for this connector, or NULL. */ struct drm_privacy_screen *privacy_screen;Signature · 1 line
2.47.2
Signature · 2 lines
With best wishes Dmitry
Hi Dmitry,
Quoted 15 lines · Dmitry Baryshkov
Quoted 14 lines · Marius Vlad
From: Derek Foreman <[email protected]>
Add a way to know the actual bpc of a running link.
Drivers might change the current bpc link value due to changes in mode line or refresh rates. For example when enabling VRR the underlying hardware might not be able sustain the same bandwidth for a particular mode line, and it might attempt to lower the bpc. Another example can be found when switching the color output format, part of YUV420 fallback.
This means we might be displaying a stale bpc value although it was modified for different reasons -- like a refresh rate or an output color format.
Quoted 6 lines
Quoted 3 lines
This patch introduces a new property 'link bpc' that user-space can use to get the current bpc value of a running link. In the same time this would allow user-space set up bpc using '
max_bpc' property.Could you please point out the userspace implementation which uses this property?
I'll be adding a MR for Weston for retriving this property. It will compare it with 'max bpc' and inform the users that we've noticed a link change.
Quoted 54 lines
Quoted 41 lines
Signed-off-by Derek Foreman <[email protected]>Signed-off-by Marius Vlad <[email protected]>--- drivers/gpu/drm/drm_atomic_uapi.c | 5 +++++ drivers/gpu/drm/drm_connector.c | 26 ++++++++++++++++++++++++++ include/drm/drm_connector.h | 8 ++++++++ 3 files changed, 39 insertions(+)drivers/gpu/drm/drm_atomic_uapi.c +5
-0@@ -776,6 +776,9 @@ static int drm_atomic_connector_set_property(struct drm_connector *connector, fence_ptr); }else if (property == connector->max_bpc_property) { state->max_requested_bpc = val; + }else if (property == connector->link_bpc_property) { +drm_dbg_kms (dev,"only drivers can set link bpc property. Use max_bpc instead\n" ); +return -EINVAL ; }else if (property == connector->privacy_screen_sw_state_property) { state->privacy_screen_sw_state = val; }else if (property == connector->broadcast_rgb_property) {@@ -861,6 +864,8 @@ drm_atomic_connector_get_property(struct drm_connector *connector, *val =0 ; }else if (property == connector->max_bpc_property) { *val = state->max_requested_bpc; + }else if (property == connector->link_bpc_property) { + *val = state->hdmi.output_bpc; }else if (property == connector->privacy_screen_sw_state_property) { *val = state->privacy_screen_sw_state; }else if (property == connector->broadcast_rgb_property) {drivers/gpu/drm/drm_connector.c +0
-0@@ -542,6 +542,28 @@ int drmm_connector_init(struct drm_device *dev, }EXPORT_SYMBOL (drmm_connector_init);drivers/gpu/drm/drm_connector.c int drmm_connector_init(struct drm_device *dev, · line 554
Quoted 10 lines
drivers/gpu/drm/drm_connector.c +10
-0+static int +drm_connector_attach_link_bpc_property (struct drm_connector *connector, +int min,int max) +{ +struct drm_device *dev = connector->dev; +struct drm_property *prop; + + prop = connector->link_bpc_property; +if (prop) +return 0 ;Shouldn't it be:
Quoted 2 lines
if (
connector->link_bpc_property)return -EBUSY;
Yeah.
Quoted 20 lines
Quoted 20 lines
drivers/gpu/drm/drm_connector.c +12
-0+ + prop =drm_property_create_range (dev,0 ,"link bpc" , min, max); +if (!prop) +return -ENOMEM ; + + connector->link_bpc_property = prop; + +drm_object_attach_property (&connector->base, prop, max); + +return 0 ; +} +/** * drmm_connector_hdmi_init - Init a preallocated HDMI connector * @dev: DRM device @@ -618,6 +640,10 @@ int drmm_connector_hdmi_init(struct drm_device *dev,drm_connector_attach_max_bpc_property (connector,8 , max_bpc); connector->max_bpc = max_bpc;
Quoted 5 lines
drivers/gpu/drm/drm_connector.c int drmm_connector_hdmi_init(struct drm_device *dev, · line 645
Quoted 3 lines
drivers/gpu/drm/drm_connector.c +3
-0+ ret =drm_connector_attach_link_bpc_property (connector,8 , max_bpc); +if (ret) +return ret;Is there a code which sets this property?
Hmm, the idea is/was that userspace will just read out this property and compare with the 'max bpc' one. In my mind it should be immutable. Is that what you're implying here?
Quoted 31 lines
Quoted 27 lines
drivers/gpu/drm/drm_connector.c +1
-0+if (max_bpc >8 )drm_connector_attach_hdr_output_metadata_property (connector);include/drm/drm_connector.h +8
-0@@ -2079,6 +2079,14 @@ struct drm_connector {*/ struct drm_property *max_bpc_property; +/** +* @link_bpc_property: Current connector link bpc set by the driver +* +* This property can be used to retrieve the current link bpc from +* connector_state::hdmi:output_bpc +*/ +struct drm_property *link_bpc_property; +/** @privacy_screen: drm_privacy_screen for this connector, or NULL. */ struct drm_privacy_screen *privacy_screen;Signature · 1 line
2.47.2Signature · 2 lines
With best wishes Dmitry
Quoted 17 lines · Marius Vlad
Hi Dmitry,
Quoted 15 lines · Dmitry Baryshkov
Quoted 14 lines · Marius Vlad
From: Derek Foreman <[email protected]>
Add a way to know the actual bpc of a running link.
Drivers might change the current bpc link value due to changes in mode line or refresh rates. For example when enabling VRR the underlying hardware might not be able sustain the same bandwidth for a particular mode line, and it might attempt to lower the bpc. Another example can be found when switching the color output format, part of YUV420 fallback.
This means we might be displaying a stale bpc value although it was modified for different reasons -- like a refresh rate or an output color format.
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
This patch introduces a new property 'link bpc' that user-space can use to get the current bpc value of a running link. In the same time this would allow user-space set up bpc using '
max_bpc' property.Could you please point out the userspace implementation which uses this property?
I'll be adding a MR for Weston for retriving this property. It will compare it with 'max bpc' and inform the users that we've noticed a link change.
Thanks!
Quoted 77 lines
Quoted 54 lines
Quoted 41 lines
Signed-off-by Derek Foreman <[email protected]>Signed-off-by Marius Vlad <[email protected]>--- drivers/gpu/drm/drm_atomic_uapi.c | 5 +++++ drivers/gpu/drm/drm_connector.c | 26 ++++++++++++++++++++++++++ include/drm/drm_connector.h | 8 ++++++++ 3 files changed, 39 insertions(+)drivers/gpu/drm/drm_atomic_uapi.c +5
-0@@ -776,6 +776,9 @@ static int drm_atomic_connector_set_property(struct drm_connector *connector, fence_ptr); }else if (property == connector->max_bpc_property) { state->max_requested_bpc = val; + }else if (property == connector->link_bpc_property) { +drm_dbg_kms (dev,"only drivers can set link bpc property. Use max_bpc instead\n" ); +return -EINVAL ; }else if (property == connector->privacy_screen_sw_state_property) { state->privacy_screen_sw_state = val; }else if (property == connector->broadcast_rgb_property) {@@ -861,6 +864,8 @@ drm_atomic_connector_get_property(struct drm_connector *connector, *val =0 ; }else if (property == connector->max_bpc_property) { *val = state->max_requested_bpc; + }else if (property == connector->link_bpc_property) { + *val = state->hdmi.output_bpc; }else if (property == connector->privacy_screen_sw_state_property) { *val = state->privacy_screen_sw_state; }else if (property == connector->broadcast_rgb_property) {drivers/gpu/drm/drm_connector.c +0
-0@@ -542,6 +542,28 @@ int drmm_connector_init(struct drm_device *dev, }EXPORT_SYMBOL (drmm_connector_init);drivers/gpu/drm/drm_connector.c int drmm_connector_init(struct drm_device *dev, · line 554
Quoted 10 lines
drivers/gpu/drm/drm_connector.c +10
-0+static int +drm_connector_attach_link_bpc_property (struct drm_connector *connector, +int min,int max) +{ +struct drm_device *dev = connector->dev; +struct drm_property *prop; + + prop = connector->link_bpc_property; +if (prop) +return 0 ;Shouldn't it be:
Quoted 2 lines
if (
connector->link_bpc_property)return -EBUSY;Yeah.
Quoted 20 lines
Quoted 20 lines
drivers/gpu/drm/drm_connector.c +12
-0+ + prop =drm_property_create_range (dev,0 ,"link bpc" , min, max); +if (!prop) +return -ENOMEM ; + + connector->link_bpc_property = prop; + +drm_object_attach_property (&connector->base, prop, max); + +return 0 ; +} +/** * drmm_connector_hdmi_init - Init a preallocated HDMI connector * @dev: DRM device @@ -618,6 +640,10 @@ int drmm_connector_hdmi_init(struct drm_device *dev,drm_connector_attach_max_bpc_property (connector,8 , max_bpc); connector->max_bpc = max_bpc;
Quoted 8 lines
Quoted 5 lines
drivers/gpu/drm/drm_connector.c int drmm_connector_hdmi_init(struct drm_device *dev, · line 645
Quoted 3 lines
drivers/gpu/drm/drm_connector.c +3
-0+ ret =drm_connector_attach_link_bpc_property (connector,8 , max_bpc); +if (ret) +return ret;Is there a code which sets this property?
Hmm, the idea is/was that userspace will just read out this property and compare with the 'max bpc' one. In my mind it should be immutable. Is that what you're implying here?
Yes. Also plese point out the IGT tests for the prop.
Quoted 31 lines
Quoted 31 lines
Quoted 27 lines
drivers/gpu/drm/drm_connector.c +1
-0+if (max_bpc >8 )drm_connector_attach_hdr_output_metadata_property (connector);include/drm/drm_connector.h +8
-0@@ -2079,6 +2079,14 @@ struct drm_connector {*/ struct drm_property *max_bpc_property; +/** +* @link_bpc_property: Current connector link bpc set by the driver +* +* This property can be used to retrieve the current link bpc from +* connector_state::hdmi:output_bpc +*/ +struct drm_property *link_bpc_property; +/** @privacy_screen: drm_privacy_screen for this connector, or NULL. */ struct drm_privacy_screen *privacy_screen;Signature · 1 line
2.47.2Signature · 2 lines
With best wishes Dmitry
Signature · 2 lines
With best wishes Dmitry
Quoted 10 lines · Marius Vlad
From: Derek Foreman <[email protected]>
Add a way to know the actual bpc of a running link.
Drivers might change the current bpc link value due to changes in mode line or refresh rates. For example when enabling VRR the underlying hardware might not be able sustain the same bandwidth for a particular mode line, and it might attempt to lower the bpc. Another example can be found when switching the color output format, part of YUV420 fallback.
Quoted 7 lines
This means we might be displaying a stale bpc value although it was modified for different reasons -- like a refresh rate or an output color format.
This patch introduces a new property 'link bpc' that user-space can use to get the current bpc value of a running link. In the same time this would allow user-space set up bpc using '
max_bpc' property.
With my Wayland compositor developer hat on, what I want to know the most isn't the physical link bpc but the "effective" bpc, i.e. how many bits of information can actually be transferred to the display, taking things like dithering into account.
(Not saying the physical link bpc couldn't also be useful for something, I'm not aware of any use for it offhand though)
Signature · 2 lines
Earthling Michel Dänzer \ GNOME / Xwayland / Mesa developer https://redhat.com \ Libre software enthusiast