Skip to content

Commit 0cc8824

Browse files
Jocelyn FalempeMaarten Lankhorst
authored andcommitted
drm/i915/display: Add drm_panic support for 4-tiling with DPT
On Alder Lake and later, it's not possible to disable tiling when DPT is enabled. So this commit implements 4-Tiling support, to still be able to draw the panic screen. Signed-off-by: Jocelyn Falempe <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Maarten Lankhorst <[email protected]>
1 parent 116d86d commit 0cc8824

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

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

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1298,6 +1298,25 @@ static unsigned int intel_ytile_get_offset(unsigned int width, unsigned int x, u
12981298
return offset;
12991299
}
13001300

1301+
static unsigned int intel_4tile_get_offset(unsigned int width, unsigned int x, unsigned int y)
1302+
{
1303+
u32 offset;
1304+
unsigned int swizzle;
1305+
unsigned int width_in_blocks = DIV_ROUND_UP(width, 32);
1306+
1307+
/* Block offset */
1308+
offset = ((y / YTILE_HEIGHT) * width_in_blocks + (x / YTILE_WIDTH)) * YTILE_SIZE;
1309+
1310+
x = x % YTILE_WIDTH;
1311+
y = y % YTILE_HEIGHT;
1312+
1313+
/* bit order inside a block is y4 y3 x4 y2 x3 x2 y1 y0 x1 x0 */
1314+
swizzle = (x & 3) | ((y & 3) << 2) | ((x & 0xc) << 2) | (y & 4) << 4 |
1315+
((x & 0x10) << 3) | ((y & 0x18) << 5);
1316+
offset += swizzle * 4;
1317+
return offset;
1318+
}
1319+
13011320
static void intel_panic_flush(struct drm_plane *plane)
13021321
{
13031322
struct intel_plane_state *plane_state = to_intel_plane_state(plane->state);
@@ -1341,6 +1360,7 @@ static unsigned int (*intel_get_tiling_func(u64 fb_modifier))(unsigned int width
13411360
case I915_FORMAT_MOD_4_TILED_MTL_MC_CCS:
13421361
case I915_FORMAT_MOD_4_TILED_BMG_CCS:
13431362
case I915_FORMAT_MOD_4_TILED_LNL_CCS:
1363+
return intel_4tile_get_offset;
13441364
case I915_FORMAT_MOD_X_TILED:
13451365
case I915_FORMAT_MOD_Yf_TILED:
13461366
case I915_FORMAT_MOD_Yf_TILED_CCS:

0 commit comments

Comments
 (0)