]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/{i915,xe}/fbdev: add intel_fbdev_fb_pitch_align()
authorJani Nikula <jani.nikula@intel.com>
Wed, 22 Oct 2025 16:10:54 +0000 (19:10 +0300)
committerJani Nikula <jani.nikula@intel.com>
Fri, 24 Oct 2025 08:31:43 +0000 (11:31 +0300)
For reasons still unknown, xe appears to require a stride alignment of
XE_PAGE_SIZE, and using 64 leads to sporadic failures. Go back to having
separate stride alignment for i915 and xe, until the issue is root
caused.

v2: Add FIXME comment, reference issue with Link (Ville)

Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Jouni Högander <jouni.hogander@intel.com>
Cc: Maarten Lankhorst <maarten@lankhorst.se>
Link: https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/6220
Fixes: 4a36b339a14a ("drm/xe/fbdev: use the same 64-byte stride alignment as i915")
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://lore.kernel.org/r/ae51d1e224048bdc87bf7a56d8f5ebd0fbb6a383.1756931441.git.jani.nikula@intel.com
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://lore.kernel.org/r/20251022161054.708388-1-jani.nikula@intel.com
drivers/gpu/drm/i915/display/intel_fbdev.c
drivers/gpu/drm/i915/display/intel_fbdev_fb.c
drivers/gpu/drm/i915/display/intel_fbdev_fb.h
drivers/gpu/drm/xe/display/intel_fbdev_fb.c

index 51d3d87caf43a346788e914d693f0fe2a71e071b..d5c001761aa061f7d6fadb2921da111a459030ae 100644 (file)
@@ -218,7 +218,7 @@ static void intel_fbdev_fill_mode_cmd(struct drm_fb_helper_surface_size *sizes,
        mode_cmd->width = sizes->surface_width;
        mode_cmd->height = sizes->surface_height;
 
-       mode_cmd->pitches[0] = ALIGN(mode_cmd->width * DIV_ROUND_UP(sizes->surface_bpp, 8), 64);
+       mode_cmd->pitches[0] = intel_fbdev_fb_pitch_align(mode_cmd->width * DIV_ROUND_UP(sizes->surface_bpp, 8));
        mode_cmd->pixel_format = drm_mode_legacy_fb_format(sizes->surface_bpp,
                                                           sizes->surface_depth);
        mode_cmd->modifier[0] = DRM_FORMAT_MOD_LINEAR;
index 56b1458414738950699d178d379a3a62369b5eaf..0838fdd3725468a736331192f929bf42a6ce6555 100644 (file)
 #include "i915_drv.h"
 #include "intel_fbdev_fb.h"
 
+u32 intel_fbdev_fb_pitch_align(u32 stride)
+{
+       return ALIGN(stride, 64);
+}
+
 struct drm_gem_object *intel_fbdev_fb_bo_create(struct drm_device *drm, int size)
 {
        struct drm_i915_private *dev_priv = to_i915(drm);
index 1fa44ed28543dd6f52c07a8d3f3e8ff1ddd500b6..fd0b3775dc1f2012f2bda607e3e161396a9f243f 100644 (file)
@@ -6,12 +6,15 @@
 #ifndef __INTEL_FBDEV_FB_H__
 #define __INTEL_FBDEV_FB_H__
 
+#include <linux/types.h>
+
 struct drm_device;
 struct drm_gem_object;
 struct drm_mode_fb_cmd2;
 struct fb_info;
 struct i915_vma;
 
+u32 intel_fbdev_fb_pitch_align(u32 stride);
 struct drm_gem_object *intel_fbdev_fb_bo_create(struct drm_device *drm, int size);
 void intel_fbdev_fb_bo_destroy(struct drm_gem_object *obj);
 int intel_fbdev_fb_fill_info(struct drm_device *drm, struct fb_info *info,
index 35a5b07eeba46ff6967817c9ca2738f2b8aeff6a..83eaf9263c6b2b10856dd242ee03cb7bba42c350 100644 (file)
 
 #include <generated/xe_wa_oob.h>
 
+/*
+ * FIXME: There shouldn't be any reason to have XE_PAGE_SIZE stride
+ * alignment. The same 64 as i915 uses should be fine, and we shouldn't need to
+ * have driver specific values. However, dropping the stride alignment to 64
+ * leads to underflowing the bo pin count in the atomic cleanup work.
+ */
+u32 intel_fbdev_fb_pitch_align(u32 stride)
+{
+       return ALIGN(stride, XE_PAGE_SIZE);
+}
+
 struct drm_gem_object *intel_fbdev_fb_bo_create(struct drm_device *drm, int size)
 {
        struct xe_device *xe = to_xe_device(drm);