Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Ville Syrjala <ville.syrjala@linux.intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: intel-xe@lists.freedesktop.org
Subject: [PATCH 1/9] drm/i915: Introduce intel_dumb_fb_max_stride()
Date: Fri,  7 Nov 2025 20:11:18 +0200	[thread overview]
Message-ID: <20251107181126.5743-2-ville.syrjala@linux.intel.com> (raw)
In-Reply-To: <20251107181126.5743-1-ville.syrjala@linux.intel.com>

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

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>
---
 drivers/gpu/drm/i915/display/intel_display.c | 17 ++++++++++++-----
 drivers/gpu/drm/i915/display/intel_display.h |  4 +++-
 drivers/gpu/drm/i915/display/intel_fb.c      |  4 ++--
 drivers/gpu/drm/i915/gem/i915_gem_create.c   |  4 ++--
 4 files changed, 19 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
index 25986bd8fbdd..c5ce481b26b1 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -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)
diff --git a/drivers/gpu/drm/i915/display/intel_display.h b/drivers/gpu/drm/i915/display/intel_display.h
index fc2ef92ccf68..9e3fe0bcf62e 100644
--- a/drivers/gpu/drm/i915/display/intel_display.h
+++ b/drivers/gpu/drm/i915/display/intel_display.h
@@ -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,
diff --git a/drivers/gpu/drm/i915/display/intel_fb.c b/drivers/gpu/drm/i915/display/intel_fb.c
index f9e0333e2674..19e3dc008caf 100644
--- a/drivers/gpu/drm/i915/display/intel_fb.c
+++ b/drivers/gpu/drm/i915/display/intel_fb.c
@@ -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);
 
diff --git a/drivers/gpu/drm/i915/gem/i915_gem_create.c b/drivers/gpu/drm/i915/gem/i915_gem_create.c
index cd9686a7ded2..189ecdd0a9c1 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_create.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_create.c
@@ -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)
-- 
2.49.1


  reply	other threads:[~2025-11-07 18:11 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-07 18:11 [PATCH 0/9] drm/i915: Further drm_get_format_info() stuff Ville Syrjala
2025-11-07 18:11 ` Ville Syrjala [this message]
2025-11-07 18:11 ` [PATCH 2/9] drm/i915: Pass drm_format_info into plane->max_stride() Ville Syrjala
2025-11-07 18:11 ` [PATCH 3/9] drm/i915: Populate fb->format accurately in BIOS FB readout Ville Syrjala
2025-11-07 18:11 ` [PATCH 4/9] drm/i915: Nuke intel_plane_config.tiling Ville Syrjala
2025-11-07 18:11 ` [PATCH 5/9] drm/i915/fb: Init 'ret' in each error branch in intel_framebuffer_init() Ville Syrjala
2025-11-10 11:07   ` Jani Nikula
2025-11-07 18:11 ` [PATCH 6/9] drm/i915/wm: Use drm_get_format_info() in SKL+ cursor DDB allocation Ville Syrjala
2025-11-10 11:08   ` Jani Nikula
2025-11-07 18:11 ` [PATCH 7/9] drm/i915: Use mode_config->cursor_width for " Ville Syrjala
2025-11-10 11:09   ` Jani Nikula
2025-11-07 18:11 ` [PATCH 8/9] drm/i915/cursor: Extract intel_cursor_mode_config_init() Ville Syrjala
2025-11-07 18:11 ` [PATCH 9/9] drm/i915/cursor: Initialize 845 vs 865 cursor size separately Ville Syrjala
2025-11-07 21:04 ` ✓ i915.CI.BAT: success for drm/i915: Further drm_get_format_info() stuff Patchwork
2025-11-08 20:43 ` ✗ i915.CI.Full: failure " Patchwork
2025-11-10 11:10 ` [PATCH 0/9] " Jani Nikula

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251107181126.5743-2-ville.syrjala@linux.intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox