]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/i915: Introduce intel_dumb_fb_max_stride()
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Fri, 7 Nov 2025 18:11:18 +0000 (20:11 +0200)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Wed, 12 Nov 2025 20:57:29 +0000 (22:57 +0200)
Wrap intel_plane_fb_max_stride() in intel_dumb_fb_max_stride()
for the purposes of dumb fb creation. I want to change
intel_plane_fb_max_stride() to take a 'struct drm_format_info'
instead of the 'u32 pixel_format' so we need an excplicit format
info lookup in the dumb fb path and I don't really want to have
that in i915_gem_dumb_create() directly.

This makes intel_plane_fb_max_stride() internal to the display
code again, and thus we can pass in struct intel_display instead
of struct drm_device.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patch.msgid.link/20251107181126.5743-2-ville.syrjala@linux.intel.com
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
drivers/gpu/drm/i915/display/intel_display.c
drivers/gpu/drm/i915/display/intel_display.h
drivers/gpu/drm/i915/display/intel_fb.c
drivers/gpu/drm/i915/gem/i915_gem_create.c

index 6bca186608ce8cd68e522b7290f6f6d04c4283c3..6e1ed075cbeaee6c4622523f9b2f0c6299664f7c 100644 (file)
@@ -547,16 +547,12 @@ void intel_disable_transcoder(const struct intel_crtc_state *old_crtc_state)
                intel_wait_for_pipe_off(old_crtc_state);
 }
 
-u32 intel_plane_fb_max_stride(struct drm_device *drm,
+u32 intel_plane_fb_max_stride(struct intel_display *display,
                              u32 pixel_format, u64 modifier)
 {
-       struct intel_display *display = to_intel_display(drm);
        struct intel_crtc *crtc;
        struct intel_plane *plane;
 
-       if (!HAS_DISPLAY(display))
-               return 0;
-
        /*
         * We assume the primary plane for pipe A has
         * the highest stride limits of them all,
@@ -572,6 +568,17 @@ u32 intel_plane_fb_max_stride(struct drm_device *drm,
                                 DRM_MODE_ROTATE_0);
 }
 
+u32 intel_dumb_fb_max_stride(struct drm_device *drm,
+                            u32 pixel_format, u64 modifier)
+{
+       struct intel_display *display = to_intel_display(drm);
+
+       if (!HAS_DISPLAY(display))
+               return 0;
+
+       return intel_plane_fb_max_stride(display, pixel_format, modifier);
+}
+
 void intel_set_plane_visible(struct intel_crtc_state *crtc_state,
                             struct intel_plane_state *plane_state,
                             bool visible)
index fc2ef92ccf6835198cd220f2a748e1dfd0c5ffe7..9e3fe0bcf62ef48dbf94b4e70c24e3a7ff56d220 100644 (file)
@@ -402,8 +402,10 @@ void intel_link_compute_m_n(u16 bpp, int nlanes,
                            int pixel_clock, int link_clock,
                            int bw_overhead,
                            struct intel_link_m_n *m_n);
-u32 intel_plane_fb_max_stride(struct drm_device *drm,
+u32 intel_plane_fb_max_stride(struct intel_display *display,
                              u32 pixel_format, u64 modifier);
+u32 intel_dumb_fb_max_stride(struct drm_device *drm,
+                            u32 pixel_format, u64 modifier);
 enum drm_mode_status
 intel_mode_valid_max_plane_size(struct intel_display *display,
                                const struct drm_display_mode *mode,
index f9e0333e2674e9168c287ac152535dcd9614ff01..19e3dc008caf37af7854e7030ed95deeebd9c0dc 100644 (file)
@@ -1982,7 +1982,7 @@ u32 intel_fb_max_stride(struct intel_display *display,
         */
        if (DISPLAY_VER(display) < 4 || intel_fb_is_ccs_modifier(modifier) ||
            intel_fb_modifier_uses_dpt(display, modifier))
-               return intel_plane_fb_max_stride(display->drm, pixel_format, modifier);
+               return intel_plane_fb_max_stride(display, pixel_format, modifier);
        else if (DISPLAY_VER(display) >= 7)
                return 256 * 1024;
        else
@@ -1996,7 +1996,7 @@ intel_fb_stride_alignment(const struct drm_framebuffer *fb, int color_plane)
        unsigned int tile_width;
 
        if (is_surface_linear(fb, color_plane)) {
-               unsigned int max_stride = intel_plane_fb_max_stride(display->drm,
+               unsigned int max_stride = intel_plane_fb_max_stride(display,
                                                                    fb->format->format,
                                                                    fb->modifier);
 
index cd9686a7ded24957ea1eccbb36fc7973d7d178ad..189ecdd0a9c1555b7642cd57190a9ca5e27a67f4 100644 (file)
@@ -194,8 +194,8 @@ i915_gem_dumb_create(struct drm_file *file,
        args->pitch = ALIGN(args->width * cpp, 64);
 
        /* align stride to page size so that we can remap */
-       if (args->pitch > intel_plane_fb_max_stride(dev, format,
-                                                   DRM_FORMAT_MOD_LINEAR))
+       if (args->pitch > intel_dumb_fb_max_stride(dev, format,
+                                                  DRM_FORMAT_MOD_LINEAR))
                args->pitch = ALIGN(args->pitch, 4096);
 
        if (args->pitch < args->width)