drm/i915: Introduce intel_dumb_fb_max_stride()

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>
This commit is contained in:
Ville Syrjälä
2025-11-07 20:11:18 +02:00
parent 1e396bbf13
commit 854efdc7ef
4 changed files with 19 additions and 10 deletions

View 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)

View 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,

View 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);

View 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)