diff mbox series

drm/probe-helper: Call drm_mode_validate_ycbcr420() before connector->mode_valid()

Message ID 20240516173324.18149-1-ville.syrjala@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series drm/probe-helper: Call drm_mode_validate_ycbcr420() before connector->mode_valid() | expand

Commit Message

Ville Syrjala May 16, 2024, 5:33 p.m. UTC
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Make life easier for drivers by filtering out unwanted YCbCr 4:2:0
only modes prior to calling the connector->mode_valid() hook.
Currently drivers will still see YCbCr 4:2:0 only modes in said
hook, which will likely come as a suprise when the driver has
declared no support for such modes (via setting
connector->ycbcr_420_allowed to false).

Closes: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/10992
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/drm_probe_helper.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Daniel Vetter May 21, 2024, 12:09 p.m. UTC | #1
On Thu, May 16, 2024 at 08:33:24PM +0300, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Make life easier for drivers by filtering out unwanted YCbCr 4:2:0
> only modes prior to calling the connector->mode_valid() hook.
> Currently drivers will still see YCbCr 4:2:0 only modes in said
> hook, which will likely come as a suprise when the driver has
> declared no support for such modes (via setting
> connector->ycbcr_420_allowed to false).
> 
> Closes: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/10992
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

Sounds reasonable.

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

> ---
>  drivers/gpu/drm/drm_probe_helper.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_probe_helper.c b/drivers/gpu/drm/drm_probe_helper.c
> index 4f75a1cfd820..249c8c2cb319 100644
> --- a/drivers/gpu/drm/drm_probe_helper.c
> +++ b/drivers/gpu/drm/drm_probe_helper.c
> @@ -474,6 +474,10 @@ static int __drm_helper_update_and_validate(struct drm_connector *connector,
>  		if (mode->status != MODE_OK)
>  			continue;
>  
> +		mode->status = drm_mode_validate_ycbcr420(mode, connector);
> +		if (mode->status != MODE_OK)
> +			continue;
> +
>  		ret = drm_mode_validate_pipeline(mode, connector, ctx,
>  						 &mode->status);
>  		if (ret) {
> @@ -486,10 +490,6 @@ static int __drm_helper_update_and_validate(struct drm_connector *connector,
>  			else
>  				return -EDEADLK;
>  		}
> -
> -		if (mode->status != MODE_OK)
> -			continue;
> -		mode->status = drm_mode_validate_ycbcr420(mode, connector);
>  	}
>  
>  	return 0;
> -- 
> 2.44.1
>
Ville Syrjala May 21, 2024, 7:09 p.m. UTC | #2
On Tue, May 21, 2024 at 02:09:19PM +0200, Daniel Vetter wrote:
> On Thu, May 16, 2024 at 08:33:24PM +0300, Ville Syrjala wrote:
> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > 
> > Make life easier for drivers by filtering out unwanted YCbCr 4:2:0
> > only modes prior to calling the connector->mode_valid() hook.
> > Currently drivers will still see YCbCr 4:2:0 only modes in said
> > hook, which will likely come as a suprise when the driver has
> > declared no support for such modes (via setting
> > connector->ycbcr_420_allowed to false).
> > 
> > Closes: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/10992
> > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Sounds reasonable.
> 
> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

Thanks. Pushed to drm-misc-next.

> 
> > ---
> >  drivers/gpu/drm/drm_probe_helper.c | 8 ++++----
> >  1 file changed, 4 insertions(+), 4 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/drm_probe_helper.c b/drivers/gpu/drm/drm_probe_helper.c
> > index 4f75a1cfd820..249c8c2cb319 100644
> > --- a/drivers/gpu/drm/drm_probe_helper.c
> > +++ b/drivers/gpu/drm/drm_probe_helper.c
> > @@ -474,6 +474,10 @@ static int __drm_helper_update_and_validate(struct drm_connector *connector,
> >  		if (mode->status != MODE_OK)
> >  			continue;
> >  
> > +		mode->status = drm_mode_validate_ycbcr420(mode, connector);
> > +		if (mode->status != MODE_OK)
> > +			continue;
> > +
> >  		ret = drm_mode_validate_pipeline(mode, connector, ctx,
> >  						 &mode->status);
> >  		if (ret) {
> > @@ -486,10 +490,6 @@ static int __drm_helper_update_and_validate(struct drm_connector *connector,
> >  			else
> >  				return -EDEADLK;
> >  		}
> > -
> > -		if (mode->status != MODE_OK)
> > -			continue;
> > -		mode->status = drm_mode_validate_ycbcr420(mode, connector);
> >  	}
> >  
> >  	return 0;
> > -- 
> > 2.44.1
> > 
> 
> -- 
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch
diff mbox series

Patch

diff --git a/drivers/gpu/drm/drm_probe_helper.c b/drivers/gpu/drm/drm_probe_helper.c
index 4f75a1cfd820..249c8c2cb319 100644
--- a/drivers/gpu/drm/drm_probe_helper.c
+++ b/drivers/gpu/drm/drm_probe_helper.c
@@ -474,6 +474,10 @@  static int __drm_helper_update_and_validate(struct drm_connector *connector,
 		if (mode->status != MODE_OK)
 			continue;
 
+		mode->status = drm_mode_validate_ycbcr420(mode, connector);
+		if (mode->status != MODE_OK)
+			continue;
+
 		ret = drm_mode_validate_pipeline(mode, connector, ctx,
 						 &mode->status);
 		if (ret) {
@@ -486,10 +490,6 @@  static int __drm_helper_update_and_validate(struct drm_connector *connector,
 			else
 				return -EDEADLK;
 		}
-
-		if (mode->status != MODE_OK)
-			continue;
-		mode->status = drm_mode_validate_ycbcr420(mode, connector);
 	}
 
 	return 0;