drm/i915: Fix remapped stride with CCS on ADL+
authorjsg <jsg@openbsd.org>
Thu, 21 Dec 2023 03:49:28 +0000 (03:49 +0000)
committerjsg <jsg@openbsd.org>
Thu, 21 Dec 2023 03:49:28 +0000 (03:49 +0000)
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

index 3afd290..8605bbf 100644 (file)
@@ -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 *