Intel-XE 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, Jani Nikula <jani.nikula@intel.com>
Subject: [PATCH v2 02/12] drm/i915: Decouple i915_gem_dumb_create() from the display a bit
Date: Thu,  6 Feb 2025 20:55:23 +0200	[thread overview]
Message-ID: <20250206185533.32306-3-ville.syrjala@linux.intel.com> (raw)
In-Reply-To: <20250206185533.32306-1-ville.syrjala@linux.intel.com>

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

Pass the device argument as drm_device to intel_plane_fb_max_stride()
to decouple i915_gem_dumb_create() vs. the display code a bit.

xe currently doesn't even call this, but it probably should...

v2: s/dev/drm/ (Jani)

Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/display/intel_display.c | 6 ++++--
 drivers/gpu/drm/i915/display/intel_display.h | 2 +-
 drivers/gpu/drm/i915/display/intel_fb.c      | 4 ++--
 drivers/gpu/drm/i915/gem/i915_gem_create.c   | 2 +-
 4 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
index 0f4d4a86cb98..a04eeaf6f819 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -713,13 +713,15 @@ void intel_add_fb_offsets(int *x, int *y,
 	*y += state->view.color_plane[color_plane].y;
 }
 
-u32 intel_plane_fb_max_stride(struct drm_i915_private *dev_priv,
+u32 intel_plane_fb_max_stride(struct drm_device *drm,
 			      u32 pixel_format, u64 modifier)
 {
+	struct intel_display *display = to_intel_display(drm);
+	struct drm_i915_private *dev_priv = to_i915(drm);
 	struct intel_crtc *crtc;
 	struct intel_plane *plane;
 
-	if (!HAS_DISPLAY(dev_priv))
+	if (!HAS_DISPLAY(display))
 		return 0;
 
 	/*
diff --git a/drivers/gpu/drm/i915/display/intel_display.h b/drivers/gpu/drm/i915/display/intel_display.h
index 793c9d30c582..e594492bade7 100644
--- a/drivers/gpu/drm/i915/display/intel_display.h
+++ b/drivers/gpu/drm/i915/display/intel_display.h
@@ -421,7 +421,7 @@ 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_i915_private *dev_priv,
+u32 intel_plane_fb_max_stride(struct drm_device *drm,
 			      u32 pixel_format, u64 modifier);
 enum drm_mode_status
 intel_mode_valid_max_plane_size(struct drm_i915_private *dev_priv,
diff --git a/drivers/gpu/drm/i915/display/intel_fb.c b/drivers/gpu/drm/i915/display/intel_fb.c
index d9328877cc6d..42c46376daae 100644
--- a/drivers/gpu/drm/i915/display/intel_fb.c
+++ b/drivers/gpu/drm/i915/display/intel_fb.c
@@ -1895,7 +1895,7 @@ u32 intel_fb_max_stride(struct drm_i915_private *dev_priv,
 	 */
 	if (DISPLAY_VER(dev_priv) < 4 || intel_fb_is_ccs_modifier(modifier) ||
 	    intel_fb_modifier_uses_dpt(dev_priv, modifier))
-		return intel_plane_fb_max_stride(dev_priv, pixel_format, modifier);
+		return intel_plane_fb_max_stride(&dev_priv->drm, pixel_format, modifier);
 	else if (DISPLAY_VER(dev_priv) >= 7)
 		return 256 * 1024;
 	else
@@ -1909,7 +1909,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(dev_priv,
+		unsigned int max_stride = intel_plane_fb_max_stride(&dev_priv->drm,
 								    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 19156ba4b9ef..c3e6a325872d 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_create.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_create.c
@@ -193,7 +193,7 @@ 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(to_i915(dev), format,
+	if (args->pitch > intel_plane_fb_max_stride(dev, format,
 						    DRM_FORMAT_MOD_LINEAR))
 		args->pitch = ALIGN(args->pitch, 4096);
 
-- 
2.45.3


  parent reply	other threads:[~2025-02-06 18:55 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-06 18:55 [PATCH v2 00/12] drm/i915: intel_display conversions and some debug improvements Ville Syrjala
2025-02-06 18:55 ` [PATCH v2 01/12] drm/i915: Pass intel_display to intel_scanout_needs_vtd_wa() Ville Syrjala
2025-02-07 11:08   ` Jani Nikula
2025-02-06 18:55 ` Ville Syrjala [this message]
2025-02-06 18:55 ` [PATCH v2 03/12] drm/i915: Decouple intel_fb_bo.h interfaces from driver specific types Ville Syrjala
2025-02-06 18:55 ` [PATCH v2 04/12] drm/i915: Convert intel_crtc.c to struct intel_display Ville Syrjala
2025-02-06 18:55 ` [PATCH v2 05/12] drm/i915: Convert intel_fb.c " Ville Syrjala
2025-02-06 18:55 ` [PATCH v2 06/12] drm/i915: Convert intel_display_power_{get, put}*() to intel_display Ville Syrjala
2025-02-06 18:55 ` [PATCH v2 07/12] drm/i915: Convert i9xx_plane.c to struct intel_display Ville Syrjala
2025-02-06 18:55 ` [PATCH v2 08/12] drm/i915: Finish intel_sprite.c struct intel_display conversion Ville Syrjala
2025-02-06 18:55 ` [PATCH v2 09/12] drm/i915: Convert intel_cursor.c to struct intel_display Ville Syrjala
2025-02-06 18:55 ` [PATCH v2 10/12] drm/i915: Convert skl_univeral_plane.c " Ville Syrjala
2025-02-06 18:55 ` [PATCH v2 11/12] drm/i915: Use DRM_RECT_FMT & co. for plane debugs Ville Syrjala
2025-02-06 18:55 ` [PATCH v2 12/12] drm/i915: Pimp " Ville Syrjala
2025-02-06 21:03 ` ✓ CI.Patch_applied: success for drm/i915: intel_display conversions and some debug improvements (rev2) Patchwork
2025-02-06 21:04 ` ✗ CI.checkpatch: warning " Patchwork
2025-02-06 21:05 ` ✓ CI.KUnit: success " Patchwork
2025-02-06 21:21 ` ✓ CI.Build: " Patchwork
2025-02-06 21:23 ` ✗ CI.Hooks: failure " Patchwork
2025-02-06 21:25 ` ✗ CI.checksparse: warning " Patchwork
2025-02-06 21:44 ` ✓ Xe.CI.BAT: success " Patchwork
2025-02-07  3:39 ` ✗ Xe.CI.Full: failure " Patchwork

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=20250206185533.32306-3-ville.syrjala@linux.intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=jani.nikula@intel.com \
    /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