Skip to content

Commit 854efdc

Browse files
committed
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>
1 parent 1e396bb commit 854efdc

4 files changed

Lines changed: 19 additions & 10 deletions

File tree

drivers/gpu/drm/i915/display/intel_display.c

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -547,16 +547,12 @@ void intel_disable_transcoder(const struct intel_crtc_state *old_crtc_state)
547547
intel_wait_for_pipe_off(old_crtc_state);
548548
}
549549

550-
u32 intel_plane_fb_max_stride(struct drm_device *drm,
550+
u32 intel_plane_fb_max_stride(struct intel_display *display,
551551
u32 pixel_format, u64 modifier)
552552
{
553-
struct intel_display *display = to_intel_display(drm);
554553
struct intel_crtc *crtc;
555554
struct intel_plane *plane;
556555

557-
if (!HAS_DISPLAY(display))
558-
return 0;
559-
560556
/*
561557
* We assume the primary plane for pipe A has
562558
* the highest stride limits of them all,
@@ -572,6 +568,17 @@ u32 intel_plane_fb_max_stride(struct drm_device *drm,
572568
DRM_MODE_ROTATE_0);
573569
}
574570

571+
u32 intel_dumb_fb_max_stride(struct drm_device *drm,
572+
u32 pixel_format, u64 modifier)
573+
{
574+
struct intel_display *display = to_intel_display(drm);
575+
576+
if (!HAS_DISPLAY(display))
577+
return 0;
578+
579+
return intel_plane_fb_max_stride(display, pixel_format, modifier);
580+
}
581+
575582
void intel_set_plane_visible(struct intel_crtc_state *crtc_state,
576583
struct intel_plane_state *plane_state,
577584
bool visible)

drivers/gpu/drm/i915/display/intel_display.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,8 +402,10 @@ void intel_link_compute_m_n(u16 bpp, int nlanes,
402402
int pixel_clock, int link_clock,
403403
int bw_overhead,
404404
struct intel_link_m_n *m_n);
405-
u32 intel_plane_fb_max_stride(struct drm_device *drm,
405+
u32 intel_plane_fb_max_stride(struct intel_display *display,
406406
u32 pixel_format, u64 modifier);
407+
u32 intel_dumb_fb_max_stride(struct drm_device *drm,
408+
u32 pixel_format, u64 modifier);
407409
enum drm_mode_status
408410
intel_mode_valid_max_plane_size(struct intel_display *display,
409411
const struct drm_display_mode *mode,

drivers/gpu/drm/i915/display/intel_fb.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1982,7 +1982,7 @@ u32 intel_fb_max_stride(struct intel_display *display,
19821982
*/
19831983
if (DISPLAY_VER(display) < 4 || intel_fb_is_ccs_modifier(modifier) ||
19841984
intel_fb_modifier_uses_dpt(display, modifier))
1985-
return intel_plane_fb_max_stride(display->drm, pixel_format, modifier);
1985+
return intel_plane_fb_max_stride(display, pixel_format, modifier);
19861986
else if (DISPLAY_VER(display) >= 7)
19871987
return 256 * 1024;
19881988
else
@@ -1996,7 +1996,7 @@ intel_fb_stride_alignment(const struct drm_framebuffer *fb, int color_plane)
19961996
unsigned int tile_width;
19971997

19981998
if (is_surface_linear(fb, color_plane)) {
1999-
unsigned int max_stride = intel_plane_fb_max_stride(display->drm,
1999+
unsigned int max_stride = intel_plane_fb_max_stride(display,
20002000
fb->format->format,
20012001
fb->modifier);
20022002

drivers/gpu/drm/i915/gem/i915_gem_create.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,8 @@ i915_gem_dumb_create(struct drm_file *file,
194194
args->pitch = ALIGN(args->width * cpp, 64);
195195

196196
/* align stride to page size so that we can remap */
197-
if (args->pitch > intel_plane_fb_max_stride(dev, format,
198-
DRM_FORMAT_MOD_LINEAR))
197+
if (args->pitch > intel_dumb_fb_max_stride(dev, format,
198+
DRM_FORMAT_MOD_LINEAR))
199199
args->pitch = ALIGN(args->pitch, 4096);
200200

201201
if (args->pitch < args->width)

0 commit comments

Comments
 (0)