From fe7c67cdc0a3b25f7381d3208f418a05c462f04e Mon Sep 17 00:00:00 2001 From: jsg Date: Thu, 21 Dec 2023 03:49:28 +0000 Subject: [PATCH] drm/i915: Fix remapped stride with CCS on ADL+ From Ville Syrjala 7b0faa541f15af170607e565ceca1ae44e6daa35 in linux-6.1.y/6.1.69 0ccd963fe555451b1f84e6d14d2b3ef03dd5c947 in mainline linux --- sys/dev/pci/drm/i915/display/intel_fb.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/sys/dev/pci/drm/i915/display/intel_fb.c b/sys/dev/pci/drm/i915/display/intel_fb.c index 3afd2906312..8605bbfa6cb 100644 --- a/sys/dev/pci/drm/i915/display/intel_fb.c +++ b/sys/dev/pci/drm/i915/display/intel_fb.c @@ -1441,8 +1441,20 @@ static u32 calc_plane_remap_info(const struct intel_framebuffer *fb, int color_p size += remap_info->size; } else { - unsigned int dst_stride = plane_view_dst_stride_tiles(fb, color_plane, - remap_info->width); + unsigned int dst_stride; + + /* + * The hardware automagically calculates the CCS AUX surface + * stride from the main surface stride so can't really remap a + * smaller subset (unless we'd remap in whole AUX page units). + */ + if (intel_fb_needs_pot_stride_remap(fb) && + intel_fb_is_ccs_modifier(fb->base.modifier)) + dst_stride = remap_info->src_stride; + else + dst_stride = remap_info->width; + + dst_stride = plane_view_dst_stride_tiles(fb, color_plane, dst_stride); assign_chk_ovf(i915, remap_info->dst_stride, dst_stride); color_plane_info->mapping_stride = dst_stride * -- 2.20.1