diff mbox series

drm/i915: Add PLANE_CUS_CTL restriction in max_width

Message ID 20211130160534.7983-1-vidya.srinivas@intel.com (mailing list archive)
State New, archived
Headers show
Series drm/i915: Add PLANE_CUS_CTL restriction in max_width | expand

Commit Message

Srinivas, Vidya Nov. 30, 2021, 4:05 p.m. UTC
PLANE_CUS_CTL has a restriction of 4096 width even though
PLANE_SIZE and scaler size registers supports max 5120.
Take care of this restriction in max_width.

Without this patch, when 5k content is sent on HDR plane
with NV12 content, FIFO underrun is seen and screen blanks
out.

Signed-off-by: Vidya Srinivas <vidya.srinivas@intel.com>
Signed-off-by: Yashashvi Shantam <shantam.yashashvi@intel.com>
Change-Id: If629c478ba044c8bde633de9f0fc638aa6c44233
---
 .../gpu/drm/i915/display/intel_display_types.h  |  3 ++-
 .../gpu/drm/i915/display/skl_universal_plane.c  | 17 +++++++++++++----
 2 files changed, 15 insertions(+), 5 deletions(-)

Comments

Ville Syrjala Nov. 30, 2021, 4:30 p.m. UTC | #1
On Tue, Nov 30, 2021 at 09:35:34PM +0530, Vidya Srinivas wrote:
> PLANE_CUS_CTL has a restriction of 4096 width even though
> PLANE_SIZE and scaler size registers supports max 5120.
> Take care of this restriction in max_width.
> 
> Without this patch, when 5k content is sent on HDR plane
> with NV12 content, FIFO underrun is seen and screen blanks
> out.
> 
> Signed-off-by: Vidya Srinivas <vidya.srinivas@intel.com>
> Signed-off-by: Yashashvi Shantam <shantam.yashashvi@intel.com>
> Change-Id: If629c478ba044c8bde633de9f0fc638aa6c44233
> ---
>  .../gpu/drm/i915/display/intel_display_types.h  |  3 ++-
>  .../gpu/drm/i915/display/skl_universal_plane.c  | 17 +++++++++++++----
>  2 files changed, 15 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h b/drivers/gpu/drm/i915/display/intel_display_types.h
> index ea1e8a6e10b0..0455ea340329 100644
> --- a/drivers/gpu/drm/i915/display/intel_display_types.h
> +++ b/drivers/gpu/drm/i915/display/intel_display_types.h
> @@ -1358,7 +1358,8 @@ struct intel_plane {
>  	int (*min_width)(const struct drm_framebuffer *fb,
>  			 int color_plane,
>  			 unsigned int rotation);
> -	int (*max_width)(const struct drm_framebuffer *fb,
> +	int (*max_width)(struct intel_plane *plane,
> +			 const struct drm_framebuffer *fb,
>  			 int color_plane,
>  			 unsigned int rotation);
>  	int (*max_height)(const struct drm_framebuffer *fb,
> diff --git a/drivers/gpu/drm/i915/display/skl_universal_plane.c b/drivers/gpu/drm/i915/display/skl_universal_plane.c
> index 28890876bdeb..a49829c5a863 100644
> --- a/drivers/gpu/drm/i915/display/skl_universal_plane.c
> +++ b/drivers/gpu/drm/i915/display/skl_universal_plane.c
> @@ -313,7 +313,8 @@ static int skl_plane_min_cdclk(const struct intel_crtc_state *crtc_state,
>  	return DIV_ROUND_UP(pixel_rate * num, den);
>  }
>  
> -static int skl_plane_max_width(const struct drm_framebuffer *fb,
> +static int skl_plane_max_width(struct intel_plane *plane,
> +				const struct drm_framebuffer *fb,
>  			       int color_plane,
>  			       unsigned int rotation)
>  {
> @@ -352,7 +353,8 @@ static int skl_plane_max_width(const struct drm_framebuffer *fb,
>  	}
>  }
>  
> -static int glk_plane_max_width(const struct drm_framebuffer *fb,
> +static int glk_plane_max_width(struct intel_plane *plane,
> +				const struct drm_framebuffer *fb,
>  			       int color_plane,
>  			       unsigned int rotation)
>  {
> @@ -420,10 +422,17 @@ static int icl_plane_min_width(const struct drm_framebuffer *fb,
>  	}
>  }
>  
> -static int icl_plane_max_width(const struct drm_framebuffer *fb,
> +static int icl_plane_max_width(struct intel_plane *plane,
> +				const struct drm_framebuffer *fb,
>  			       int color_plane,
>  			       unsigned int rotation)
>  {
> +	struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
> +
> +	if (icl_is_hdr_plane(dev_priv, plane->id) &&

We could just have separate functions for hdr and sdr planes instead.

> +	    intel_format_info_is_yuv_semiplanar(fb->format, fb->modifier))
> +		return 4096;
> +
>  	return 5120;
>  }
>  
> @@ -1377,7 +1386,7 @@ static int intel_plane_max_width(struct intel_plane *plane,
>  				 unsigned int rotation)
>  {
>  	if (plane->max_width)
> -		return plane->max_width(fb, color_plane, rotation);
> +		return plane->max_width(plane, fb, color_plane, rotation);
>  	else
>  		return INT_MAX;
>  }
> -- 
> 2.33.0
Srinivas, Vidya Nov. 30, 2021, 5:25 p.m. UTC | #2
> -----Original Message-----
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Sent: Tuesday, November 30, 2021 10:00 PM
> To: Srinivas, Vidya <vidya.srinivas@intel.com>
> Cc: intel-gfx@lists.freedesktop.org; Shankar, Uma
> <uma.shankar@intel.com>; Yashashvi, Shantam
> <shantam.yashashvi@intel.com>
> Subject: Re: [PATCH] drm/i915: Add PLANE_CUS_CTL restriction in max_width
> 
> On Tue, Nov 30, 2021 at 09:35:34PM +0530, Vidya Srinivas wrote:
> > PLANE_CUS_CTL has a restriction of 4096 width even though PLANE_SIZE
> > and scaler size registers supports max 5120.
> > Take care of this restriction in max_width.
> >
> > Without this patch, when 5k content is sent on HDR plane with NV12
> > content, FIFO underrun is seen and screen blanks out.
> >
> > Signed-off-by: Vidya Srinivas <vidya.srinivas@intel.com>
> > Signed-off-by: Yashashvi Shantam <shantam.yashashvi@intel.com>
> > Change-Id: If629c478ba044c8bde633de9f0fc638aa6c44233
> > ---
> >  .../gpu/drm/i915/display/intel_display_types.h  |  3 ++-
> > .../gpu/drm/i915/display/skl_universal_plane.c  | 17 +++++++++++++----
> >  2 files changed, 15 insertions(+), 5 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h
> > b/drivers/gpu/drm/i915/display/intel_display_types.h
> > index ea1e8a6e10b0..0455ea340329 100644
> > --- a/drivers/gpu/drm/i915/display/intel_display_types.h
> > +++ b/drivers/gpu/drm/i915/display/intel_display_types.h
> > @@ -1358,7 +1358,8 @@ struct intel_plane {
> >  	int (*min_width)(const struct drm_framebuffer *fb,
> >  			 int color_plane,
> >  			 unsigned int rotation);
> > -	int (*max_width)(const struct drm_framebuffer *fb,
> > +	int (*max_width)(struct intel_plane *plane,
> > +			 const struct drm_framebuffer *fb,
> >  			 int color_plane,
> >  			 unsigned int rotation);
> >  	int (*max_height)(const struct drm_framebuffer *fb, diff --git
> > a/drivers/gpu/drm/i915/display/skl_universal_plane.c
> > b/drivers/gpu/drm/i915/display/skl_universal_plane.c
> > index 28890876bdeb..a49829c5a863 100644
> > --- a/drivers/gpu/drm/i915/display/skl_universal_plane.c
> > +++ b/drivers/gpu/drm/i915/display/skl_universal_plane.c
> > @@ -313,7 +313,8 @@ static int skl_plane_min_cdclk(const struct
> intel_crtc_state *crtc_state,
> >  	return DIV_ROUND_UP(pixel_rate * num, den);  }
> >
> > -static int skl_plane_max_width(const struct drm_framebuffer *fb,
> > +static int skl_plane_max_width(struct intel_plane *plane,
> > +				const struct drm_framebuffer *fb,
> >  			       int color_plane,
> >  			       unsigned int rotation)
> >  {
> > @@ -352,7 +353,8 @@ static int skl_plane_max_width(const struct
> drm_framebuffer *fb,
> >  	}
> >  }
> >
> > -static int glk_plane_max_width(const struct drm_framebuffer *fb,
> > +static int glk_plane_max_width(struct intel_plane *plane,
> > +				const struct drm_framebuffer *fb,
> >  			       int color_plane,
> >  			       unsigned int rotation)
> >  {
> > @@ -420,10 +422,17 @@ static int icl_plane_min_width(const struct
> drm_framebuffer *fb,
> >  	}
> >  }
> >
> > -static int icl_plane_max_width(const struct drm_framebuffer *fb,
> > +static int icl_plane_max_width(struct intel_plane *plane,
> > +				const struct drm_framebuffer *fb,
> >  			       int color_plane,
> >  			       unsigned int rotation)
> >  {
> > +	struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
> > +
> > +	if (icl_is_hdr_plane(dev_priv, plane->id) &&
> 
> We could just have separate functions for hdr and sdr planes instead.

Thank you very much Ville, for the patch review. Have added two different functions as suggested.
Can you kindly have a check.
Sorry - Not sure why, I don't see the change reflect in patchwork website although I am seeing the mail. 

Regards
Vidya

> 
> > +	    intel_format_info_is_yuv_semiplanar(fb->format, fb->modifier))
> > +		return 4096;
> > +
> >  	return 5120;
> >  }
> >
> > @@ -1377,7 +1386,7 @@ static int intel_plane_max_width(struct
> intel_plane *plane,
> >  				 unsigned int rotation)
> >  {
> >  	if (plane->max_width)
> > -		return plane->max_width(fb, color_plane, rotation);
> > +		return plane->max_width(plane, fb, color_plane, rotation);
> >  	else
> >  		return INT_MAX;
> >  }
> > --
> > 2.33.0
> 
> --
> Ville Syrjälä
> Intel
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h b/drivers/gpu/drm/i915/display/intel_display_types.h
index ea1e8a6e10b0..0455ea340329 100644
--- a/drivers/gpu/drm/i915/display/intel_display_types.h
+++ b/drivers/gpu/drm/i915/display/intel_display_types.h
@@ -1358,7 +1358,8 @@  struct intel_plane {
 	int (*min_width)(const struct drm_framebuffer *fb,
 			 int color_plane,
 			 unsigned int rotation);
-	int (*max_width)(const struct drm_framebuffer *fb,
+	int (*max_width)(struct intel_plane *plane,
+			 const struct drm_framebuffer *fb,
 			 int color_plane,
 			 unsigned int rotation);
 	int (*max_height)(const struct drm_framebuffer *fb,
diff --git a/drivers/gpu/drm/i915/display/skl_universal_plane.c b/drivers/gpu/drm/i915/display/skl_universal_plane.c
index 28890876bdeb..a49829c5a863 100644
--- a/drivers/gpu/drm/i915/display/skl_universal_plane.c
+++ b/drivers/gpu/drm/i915/display/skl_universal_plane.c
@@ -313,7 +313,8 @@  static int skl_plane_min_cdclk(const struct intel_crtc_state *crtc_state,
 	return DIV_ROUND_UP(pixel_rate * num, den);
 }
 
-static int skl_plane_max_width(const struct drm_framebuffer *fb,
+static int skl_plane_max_width(struct intel_plane *plane,
+				const struct drm_framebuffer *fb,
 			       int color_plane,
 			       unsigned int rotation)
 {
@@ -352,7 +353,8 @@  static int skl_plane_max_width(const struct drm_framebuffer *fb,
 	}
 }
 
-static int glk_plane_max_width(const struct drm_framebuffer *fb,
+static int glk_plane_max_width(struct intel_plane *plane,
+				const struct drm_framebuffer *fb,
 			       int color_plane,
 			       unsigned int rotation)
 {
@@ -420,10 +422,17 @@  static int icl_plane_min_width(const struct drm_framebuffer *fb,
 	}
 }
 
-static int icl_plane_max_width(const struct drm_framebuffer *fb,
+static int icl_plane_max_width(struct intel_plane *plane,
+				const struct drm_framebuffer *fb,
 			       int color_plane,
 			       unsigned int rotation)
 {
+	struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
+
+	if (icl_is_hdr_plane(dev_priv, plane->id) &&
+	    intel_format_info_is_yuv_semiplanar(fb->format, fb->modifier))
+		return 4096;
+
 	return 5120;
 }
 
@@ -1377,7 +1386,7 @@  static int intel_plane_max_width(struct intel_plane *plane,
 				 unsigned int rotation)
 {
 	if (plane->max_width)
-		return plane->max_width(fb, color_plane, rotation);
+		return plane->max_width(plane, fb, color_plane, rotation);
 	else
 		return INT_MAX;
 }