diff mbox series

[4/7] drm/i915: Make sure plane dims are correct for UV CCS planes

Message ID 20191231233756.18753-5-imre.deak@intel.com (mailing list archive)
State New, archived
Headers show
Series drm/i915/tgl: Media decompression support | expand

Commit Message

Imre Deak Dec. 31, 2019, 11:37 p.m. UTC
As intel_fb_plane_get_subsampling() returns the subsampling factor wrt.
its main plane, for a CCS plane we need to apply both the main and the
CCS plane's subsampling factor on the FB's dimensions to get the CCS
plane's dimensions.

Cc: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
Cc: Mika Kahola <mika.kahola@intel.com>
Cc: Radhakrishna Sripada <radhakrishna.sripada@intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Matt Roper <matthew.d.roper@intel.com>
Signed-off-by: Imre Deak <imre.deak@intel.com>
---
 drivers/gpu/drm/i915/display/intel_display.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Comments

Kahola, Mika Jan. 2, 2020, 1:48 p.m. UTC | #1
On Wed, 2020-01-01 at 01:37 +0200, Imre Deak wrote:
> As intel_fb_plane_get_subsampling() returns the subsampling factor
> wrt.
> its main plane, for a CCS plane we need to apply both the main and
> the
> CCS plane's subsampling factor on the FB's dimensions to get the CCS
> plane's dimensions.
> 
> Cc: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
> Cc: Mika Kahola <mika.kahola@intel.com>
> Cc: Radhakrishna Sripada <radhakrishna.sripada@intel.com>
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Cc: Matt Roper <matthew.d.roper@intel.com>
> Signed-off-by: Imre Deak <imre.deak@intel.com>

Reviewed-by: Mika Kahola <mika.kahola@intel.com>

> ---
>  drivers/gpu/drm/i915/display/intel_display.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_display.c
> b/drivers/gpu/drm/i915/display/intel_display.c
> index 2c2450d3469b..d5128e900660 100644
> --- a/drivers/gpu/drm/i915/display/intel_display.c
> +++ b/drivers/gpu/drm/i915/display/intel_display.c
> @@ -2913,11 +2913,15 @@ intel_fb_check_ccs_xy(struct drm_framebuffer
> *fb, int ccs_plane, int x, int y)
>  static void
>  intel_fb_plane_dims(int *w, int *h, struct drm_framebuffer *fb, int
> color_plane)
>  {
> +	int main_plane = is_ccs_plane(fb, color_plane) ?
> +			 ccs_to_main_plane(fb, color_plane) : 0;
> +	int main_hsub, main_vsub;
>  	int hsub, vsub;
>  
> +	intel_fb_plane_get_subsampling(&main_hsub, &main_vsub, fb,
> main_plane);
>  	intel_fb_plane_get_subsampling(&hsub, &vsub, fb, color_plane);
> -	*w = fb->width / hsub;
> -	*h = fb->height / vsub;
> +	*w = fb->width / main_hsub / hsub;
> +	*h = fb->height / main_vsub / vsub;
>  }
>  
>  /*
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
index 2c2450d3469b..d5128e900660 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -2913,11 +2913,15 @@  intel_fb_check_ccs_xy(struct drm_framebuffer *fb, int ccs_plane, int x, int y)
 static void
 intel_fb_plane_dims(int *w, int *h, struct drm_framebuffer *fb, int color_plane)
 {
+	int main_plane = is_ccs_plane(fb, color_plane) ?
+			 ccs_to_main_plane(fb, color_plane) : 0;
+	int main_hsub, main_vsub;
 	int hsub, vsub;
 
+	intel_fb_plane_get_subsampling(&main_hsub, &main_vsub, fb, main_plane);
 	intel_fb_plane_get_subsampling(&hsub, &vsub, fb, color_plane);
-	*w = fb->width / hsub;
-	*h = fb->height / vsub;
+	*w = fb->width / main_hsub / hsub;
+	*h = fb->height / main_vsub / vsub;
 }
 
 /*