drm/i915: Do not create a new max_bpc prop for MST connectors
diff mbox series

Message ID 20190820161657.9658-1-ville.syrjala@linux.intel.com
State New
Headers show
Series
  • drm/i915: Do not create a new max_bpc prop for MST connectors
Related show

Commit Message

Ville Syrjälä Aug. 20, 2019, 4:16 p.m. UTC
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

We're not allowed to create new properties after device registration
so for MST connectors we need to either create the max_bpc property
earlier, or we reuse one we already have. Let's do the latter apporach
since the corresponding SST connector already has the prop and its
min/max are correct also for the MST connector.

The problem was highlighted by commit 4f5368b5541a ("drm/kms:
Catch mode_object lifetime errors") which results in the following
spew:
[ 1330.878941] WARNING: CPU: 2 PID: 1554 at drivers/gpu/drm/drm_mode_object.c:45 __drm_mode_object_add+0xa0/0xb0 [drm]
...
[ 1330.879008] Call Trace:
[ 1330.879023]  drm_property_create+0xba/0x180 [drm]
[ 1330.879036]  drm_property_create_range+0x15/0x30 [drm]
[ 1330.879048]  drm_connector_attach_max_bpc_property+0x62/0x80 [drm]
[ 1330.879086]  intel_dp_add_mst_connector+0x11f/0x140 [i915]
[ 1330.879094]  drm_dp_add_port.isra.20+0x20b/0x440 [drm_kms_helper]
...

Cc: stable@vger.kernel.org
Cc: Lyude Paul <lyude@redhat.com>
Cc: sunpeng.li@amd.com
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Sean Paul <sean@poorly.run>
Fixes: 5ca0ef8a56b8 ("drm/i915: Add max_bpc property for DP MST")
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/display/intel_dp_mst.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

Comments

Souza, Jose Aug. 20, 2019, 4:57 p.m. UTC | #1
On Tue, 2019-08-20 at 19:16 +0300, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> We're not allowed to create new properties after device registration
> so for MST connectors we need to either create the max_bpc property
> earlier, or we reuse one we already have. Let's do the latter
> apporach
> since the corresponding SST connector already has the prop and its
> min/max are correct also for the MST connector.
> 
> The problem was highlighted by commit 4f5368b5541a ("drm/kms:
> Catch mode_object lifetime errors") which results in the following
> spew:
> [ 1330.878941] WARNING: CPU: 2 PID: 1554 at
> drivers/gpu/drm/drm_mode_object.c:45 __drm_mode_object_add+0xa0/0xb0
> [drm]
> ...
> [ 1330.879008] Call Trace:
> [ 1330.879023]  drm_property_create+0xba/0x180 [drm]
> [ 1330.879036]  drm_property_create_range+0x15/0x30 [drm]
> [ 1330.879048]  drm_connector_attach_max_bpc_property+0x62/0x80 [drm]
> [ 1330.879086]  intel_dp_add_mst_connector+0x11f/0x140 [i915]
> [ 1330.879094]  drm_dp_add_port.isra.20+0x20b/0x440 [drm_kms_helper]
> ...
> 
> Cc: stable@vger.kernel.org
> Cc: Lyude Paul <lyude@redhat.com>
> Cc: sunpeng.li@amd.com
> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> Cc: Sean Paul <sean@poorly.run>
> Fixes: 5ca0ef8a56b8 ("drm/i915: Add max_bpc property for DP MST")
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_dp_mst.c | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_dp_mst.c
> b/drivers/gpu/drm/i915/display/intel_dp_mst.c
> index 83faa246e361..9748581c1d62 100644
> --- a/drivers/gpu/drm/i915/display/intel_dp_mst.c
> +++ b/drivers/gpu/drm/i915/display/intel_dp_mst.c
> @@ -536,7 +536,15 @@ static struct drm_connector
> *intel_dp_add_mst_connector(struct drm_dp_mst_topolo
>  
>  	intel_attach_force_audio_property(connector);
>  	intel_attach_broadcast_rgb_property(connector);
> -	drm_connector_attach_max_bpc_property(connector, 6, 12);
> +
> +	/*
> +	 * Reuse the prop from the SST connector because we're
> +	 * not allowed to create new props after device registration.
> +	 */
> +	connector->max_bpc_property =
> +		intel_dp->attached_connector->base.max_bpc_property;
> +	if (connector->max_bpc_property)
> +		drm_connector_attach_max_bpc_property(connector, 6,
> 12);

I was looking to the same issue and thinking if do something similar to
intel_attach_force_audio_property()/intel_attach_broadcast_rgb_propert(
) would be the right approach but this looks even better.

Reviewed-by: José Roberto de Souza <jose.souza@intel.com>

>  
>  	return connector;
>
Sasha Levin Aug. 20, 2019, 5:25 p.m. UTC | #2
Hi,

[This is an automated email]

This commit has been processed because it contains a "Fixes:" tag,
fixing commit: 5ca0ef8a56b8 drm/i915: Add max_bpc property for DP MST.

The bot has tested the following trees: v5.2.9.

v5.2.9: Failed to apply! Possible dependencies:
    Unable to calculate


NOTE: The patch will not be queued to stable trees until it is upstream.

How should we proceed with this patch?

--
Thanks,
Sasha
Lyude Paul Aug. 20, 2019, 11:01 p.m. UTC | #3
Reviewed-by: Lyude Paul <lyude@redhat.com>

On Tue, 2019-08-20 at 19:16 +0300, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> We're not allowed to create new properties after device registration
> so for MST connectors we need to either create the max_bpc property
> earlier, or we reuse one we already have. Let's do the latter apporach
> since the corresponding SST connector already has the prop and its
> min/max are correct also for the MST connector.
> 
> The problem was highlighted by commit 4f5368b5541a ("drm/kms:
> Catch mode_object lifetime errors") which results in the following
> spew:
> [ 1330.878941] WARNING: CPU: 2 PID: 1554 at
> drivers/gpu/drm/drm_mode_object.c:45 __drm_mode_object_add+0xa0/0xb0 [drm]
> ...
> [ 1330.879008] Call Trace:
> [ 1330.879023]  drm_property_create+0xba/0x180 [drm]
> [ 1330.879036]  drm_property_create_range+0x15/0x30 [drm]
> [ 1330.879048]  drm_connector_attach_max_bpc_property+0x62/0x80 [drm]
> [ 1330.879086]  intel_dp_add_mst_connector+0x11f/0x140 [i915]
> [ 1330.879094]  drm_dp_add_port.isra.20+0x20b/0x440 [drm_kms_helper]
> ...
> 
> Cc: stable@vger.kernel.org
> Cc: Lyude Paul <lyude@redhat.com>
> Cc: sunpeng.li@amd.com
> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> Cc: Sean Paul <sean@poorly.run>
> Fixes: 5ca0ef8a56b8 ("drm/i915: Add max_bpc property for DP MST")
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_dp_mst.c | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_dp_mst.c
> b/drivers/gpu/drm/i915/display/intel_dp_mst.c
> index 83faa246e361..9748581c1d62 100644
> --- a/drivers/gpu/drm/i915/display/intel_dp_mst.c
> +++ b/drivers/gpu/drm/i915/display/intel_dp_mst.c
> @@ -536,7 +536,15 @@ static struct drm_connector
> *intel_dp_add_mst_connector(struct drm_dp_mst_topolo
>  
>  	intel_attach_force_audio_property(connector);
>  	intel_attach_broadcast_rgb_property(connector);
> -	drm_connector_attach_max_bpc_property(connector, 6, 12);
> +
> +	/*
> +	 * Reuse the prop from the SST connector because we're
> +	 * not allowed to create new props after device registration.
> +	 */
> +	connector->max_bpc_property =
> +		intel_dp->attached_connector->base.max_bpc_property;
> +	if (connector->max_bpc_property)
> +		drm_connector_attach_max_bpc_property(connector, 6, 12);
>  
>  	return connector;
>
Li, Sun peng (Leo) Aug. 21, 2019, 5:33 p.m. UTC | #4
On 2019-08-20 12:16 p.m., Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> We're not allowed to create new properties after device registration
> so for MST connectors we need to either create the max_bpc property
> earlier, or we reuse one we already have. Let's do the latter apporach
> since the corresponding SST connector already has the prop and its
> min/max are correct also for the MST connector.
> 
> The problem was highlighted by commit 4f5368b5541a ("drm/kms:
> Catch mode_object lifetime errors") which results in the following
> spew:
> [ 1330.878941] WARNING: CPU: 2 PID: 1554 at drivers/gpu/drm/drm_mode_object.c:45 __drm_mode_object_add+0xa0/0xb0 [drm]
> ...
> [ 1330.879008] Call Trace:
> [ 1330.879023]  drm_property_create+0xba/0x180 [drm]
> [ 1330.879036]  drm_property_create_range+0x15/0x30 [drm]
> [ 1330.879048]  drm_connector_attach_max_bpc_property+0x62/0x80 [drm]
> [ 1330.879086]  intel_dp_add_mst_connector+0x11f/0x140 [i915]
> [ 1330.879094]  drm_dp_add_port.isra.20+0x20b/0x440 [drm_kms_helper]
> ...
> 
> Cc: stable@vger.kernel.org
> Cc: Lyude Paul <lyude@redhat.com>
> Cc: sunpeng.li@amd.com
> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> Cc: Sean Paul <sean@poorly.run>
> Fixes: 5ca0ef8a56b8 ("drm/i915: Add max_bpc property for DP MST")
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

Thanks for following up, I had forgotten about this issue.
Reviewed-by: Leo Li <sunpeng.li@amd.com>

> ---
>  drivers/gpu/drm/i915/display/intel_dp_mst.c | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_dp_mst.c b/drivers/gpu/drm/i915/display/intel_dp_mst.c
> index 83faa246e361..9748581c1d62 100644
> --- a/drivers/gpu/drm/i915/display/intel_dp_mst.c
> +++ b/drivers/gpu/drm/i915/display/intel_dp_mst.c
> @@ -536,7 +536,15 @@ static struct drm_connector *intel_dp_add_mst_connector(struct drm_dp_mst_topolo
>  
>  	intel_attach_force_audio_property(connector);
>  	intel_attach_broadcast_rgb_property(connector);
> -	drm_connector_attach_max_bpc_property(connector, 6, 12);
> +
> +	/*
> +	 * Reuse the prop from the SST connector because we're
> +	 * not allowed to create new props after device registration.
> +	 */
> +	connector->max_bpc_property =
> +		intel_dp->attached_connector->base.max_bpc_property;
> +	if (connector->max_bpc_property)
> +		drm_connector_attach_max_bpc_property(connector, 6, 12);
>  
>  	return connector;
>  
>

Patch
diff mbox series

diff --git a/drivers/gpu/drm/i915/display/intel_dp_mst.c b/drivers/gpu/drm/i915/display/intel_dp_mst.c
index 83faa246e361..9748581c1d62 100644
--- a/drivers/gpu/drm/i915/display/intel_dp_mst.c
+++ b/drivers/gpu/drm/i915/display/intel_dp_mst.c
@@ -536,7 +536,15 @@  static struct drm_connector *intel_dp_add_mst_connector(struct drm_dp_mst_topolo
 
 	intel_attach_force_audio_property(connector);
 	intel_attach_broadcast_rgb_property(connector);
-	drm_connector_attach_max_bpc_property(connector, 6, 12);
+
+	/*
+	 * Reuse the prop from the SST connector because we're
+	 * not allowed to create new props after device registration.
+	 */
+	connector->max_bpc_property =
+		intel_dp->attached_connector->base.max_bpc_property;
+	if (connector->max_bpc_property)
+		drm_connector_attach_max_bpc_property(connector, 6, 12);
 
 	return connector;