Skip to content

Commit 7652126

Browse files
committed
drm/i915: Update plane alignment requirements for TGL+
Currently we still use the SKL+ PLANE_SURF alignment even for TGL+ even though the hardware no longer needs it. Introduce a separate tgl_plane_min_alignment() and update it to more accurately reflect the hardware requirements. v2: Don't screw up DPT+semiplanar 2MiB alignment Reviewed-by: Imre Deak <[email protected]> Signed-off-by: Ville Syrjälä <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent ee3c3e3 commit 7652126

File tree

1 file changed

+56
-43
lines changed

1 file changed

+56
-43
lines changed

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

Lines changed: 56 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -503,75 +503,85 @@ skl_plane_max_stride(struct intel_plane *plane,
503503
max_pixels, max_bytes);
504504
}
505505

506-
static unsigned int skl_plane_min_alignment(struct intel_plane *plane,
507-
const struct drm_framebuffer *fb,
508-
int color_plane)
506+
static u32 tgl_plane_min_alignment(struct intel_plane *plane,
507+
const struct drm_framebuffer *fb,
508+
int color_plane)
509509
{
510-
struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
511-
512-
if (intel_fb_uses_dpt(fb)) {
513-
/* AUX_DIST needs only 4K alignment */
514-
if (intel_fb_is_ccs_aux_plane(fb, color_plane))
515-
return 512 * 4096;
516-
517-
/*
518-
* FIXME ADL sees GGTT/DMAR faults with async
519-
* flips unless we align to 16k at least.
520-
* Figure out what's going on here...
521-
*/
522-
if (IS_ALDERLAKE_P(dev_priv) &&
523-
!intel_fb_is_ccs_modifier(fb->modifier) &&
524-
HAS_ASYNC_FLIPS(dev_priv))
525-
return 512 * 16 * 1024;
526-
527-
return 512 * 4096;
528-
}
510+
struct drm_i915_private *i915 = to_i915(plane->base.dev);
511+
/* PLANE_SURF GGTT -> DPT alignment */
512+
int mult = intel_fb_uses_dpt(fb) ? 512 : 1;
529513

530514
/* AUX_DIST needs only 4K alignment */
531515
if (intel_fb_is_ccs_aux_plane(fb, color_plane))
532-
return 4096;
516+
return mult * 4 * 1024;
533517

534518
if (is_semiplanar_uv_plane(fb, color_plane)) {
519+
if (intel_fb_uses_dpt(fb))
520+
return 512 * 4 * 1024;
521+
535522
/*
536523
* TODO: cross-check wrt. the bspec stride in bytes * 64 bytes
537524
* alignment for linear UV planes on all platforms.
538525
*/
539-
if (DISPLAY_VER(dev_priv) >= 12) {
540-
if (fb->modifier == DRM_FORMAT_MOD_LINEAR)
541-
return 256 * 1024;
542-
543-
return intel_tile_row_size(fb, color_plane);
544-
}
526+
if (fb->modifier == DRM_FORMAT_MOD_LINEAR)
527+
return 256 * 1024;
545528

546-
return 4096;
529+
return intel_tile_row_size(fb, color_plane);
547530
}
548531

549-
drm_WARN_ON(&dev_priv->drm, color_plane != 0);
550-
551532
switch (fb->modifier) {
552533
case DRM_FORMAT_MOD_LINEAR:
553-
return 256 * 1024;
554534
case I915_FORMAT_MOD_X_TILED:
555-
if (HAS_ASYNC_FLIPS(dev_priv))
556-
return 256 * 1024;
557-
return 0;
535+
case I915_FORMAT_MOD_Y_TILED:
536+
case I915_FORMAT_MOD_4_TILED:
537+
/*
538+
* FIXME ADL sees GGTT/DMAR faults with async
539+
* flips unless we align to 16k at least.
540+
* Figure out what's going on here...
541+
*/
542+
if (IS_ALDERLAKE_P(i915) && HAS_ASYNC_FLIPS(i915))
543+
return mult * 16 * 1024;
544+
return mult * 4 * 1024;
558545
case I915_FORMAT_MOD_Y_TILED_GEN12_MC_CCS:
559546
case I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS:
560547
case I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS_CC:
561548
case I915_FORMAT_MOD_4_TILED_MTL_MC_CCS:
562549
case I915_FORMAT_MOD_4_TILED_MTL_RC_CCS:
563550
case I915_FORMAT_MOD_4_TILED_MTL_RC_CCS_CC:
564-
return 16 * 1024;
551+
case I915_FORMAT_MOD_4_TILED_DG2_RC_CCS:
552+
case I915_FORMAT_MOD_4_TILED_DG2_RC_CCS_CC:
553+
case I915_FORMAT_MOD_4_TILED_DG2_MC_CCS:
554+
/*
555+
* Align to at least 4x1 main surface
556+
* tiles (16K) to match 64B of AUX.
557+
*/
558+
return max(mult * 4 * 1024, 16 * 1024);
559+
default:
560+
MISSING_CASE(fb->modifier);
561+
return 0;
562+
}
563+
}
564+
565+
static u32 skl_plane_min_alignment(struct intel_plane *plane,
566+
const struct drm_framebuffer *fb,
567+
int color_plane)
568+
{
569+
/*
570+
* AUX_DIST needs only 4K alignment,
571+
* as does ICL UV PLANE_SURF.
572+
*/
573+
if (color_plane != 0)
574+
return 4 * 1024;
575+
576+
switch (fb->modifier) {
577+
case DRM_FORMAT_MOD_LINEAR:
578+
case I915_FORMAT_MOD_X_TILED:
579+
return 256 * 1024;
565580
case I915_FORMAT_MOD_Y_TILED_CCS:
566581
case I915_FORMAT_MOD_Yf_TILED_CCS:
567582
case I915_FORMAT_MOD_Y_TILED:
568-
case I915_FORMAT_MOD_4_TILED:
569583
case I915_FORMAT_MOD_Yf_TILED:
570584
return 1 * 1024 * 1024;
571-
case I915_FORMAT_MOD_4_TILED_DG2_RC_CCS:
572-
case I915_FORMAT_MOD_4_TILED_DG2_RC_CCS_CC:
573-
case I915_FORMAT_MOD_4_TILED_DG2_MC_CCS:
574-
return 16 * 1024;
575585
default:
576586
MISSING_CASE(fb->modifier);
577587
return 0;
@@ -2506,7 +2516,10 @@ skl_universal_plane_create(struct drm_i915_private *dev_priv,
25062516
else
25072517
plane->max_stride = skl_plane_max_stride;
25082518

2509-
plane->min_alignment = skl_plane_min_alignment;
2519+
if (DISPLAY_VER(dev_priv) >= 12)
2520+
plane->min_alignment = tgl_plane_min_alignment;
2521+
else
2522+
plane->min_alignment = skl_plane_min_alignment;
25102523

25112524
if (DISPLAY_VER(dev_priv) >= 11) {
25122525
plane->update_noarm = icl_plane_update_noarm;

0 commit comments

Comments
 (0)