Skip to content

Commit 0a19d0f

Browse files
committed
drm/asahi: render, buffer: Fix layered rendering on G13X (again)
The meta1 buffer needs to be multiplied by the layer count. This does not seem to be needed on G14X (where even the stride is not specified anywhere and no other registers are affected by the layer count). Signed-off-by: Asahi Lina <lina@asahilina.net>
1 parent 9bf7175 commit 0a19d0f

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

drivers/gpu/drm/asahi/buffer.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ pub(crate) struct TileInfo {
8989
pub(crate) tilemap_size: usize,
9090
/// Size of the Tail Pointer Cache, in bytes (for all layers * clusters).
9191
pub(crate) tpc_size: usize,
92+
/// Number of blocks in the clustering meta buffer (for clustering) per layer.
93+
pub(crate) meta1_layer_stride: u32,
9294
/// Number of blocks in the clustering meta buffer (for clustering).
9395
pub(crate) meta1_blocks: u32,
9496
/// Layering metadata size.

drivers/gpu/drm/asahi/queue/render.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,7 @@ impl super::Queue::ver {
145145
// No idea where this comes from, but it fits what macOS does...
146146
// GUESS: Number of 32K heap blocks to fit a 5-byte region header/pointer per tile?
147147
// That would make a ton of sense...
148-
// TODO: Layers? Why the sample count factor here?
149-
let meta1_blocks = if num_clusters > 1 {
148+
let meta1_layer_stride = if num_clusters > 1 {
150149
div_ceil(
151150
align(tiles_x, 2) * align(tiles_y, 4) * utiles_per_tile,
152151
0x1980,
@@ -177,7 +176,11 @@ impl super::Queue::ver {
177176
//utiles_per_mtile: tiles_per_mtile * utiles_per_tile,
178177
tilemap_size,
179178
tpc_size,
180-
meta1_blocks,
179+
meta1_layer_stride,
180+
#[ver(G < G14X)]
181+
meta1_blocks: meta1_layer_stride * cmdbuf.layers,
182+
#[ver(G >= G14X)]
183+
meta1_blocks: meta1_layer_stride,
181184
layermeta_size: if layers > 1 { 0x100 } else { 0 },
182185
min_tvb_blocks: min_tvb_blocks as usize,
183186
params: fw::vertex::raw::TilingParameters {
@@ -1305,7 +1308,7 @@ impl super::Queue::ver {
13051308
tvb_cluster_meta1: inner
13061309
.scene
13071310
.meta_1_pointer()
1308-
.map(|x| x.or((tile_info.meta1_blocks as u64) << 50)),
1311+
.map(|x| x.or((tile_info.meta1_layer_stride as u64) << 50)),
13091312
utile_config,
13101313
unk_4c: 0,
13111314
ppp_multisamplectl: U64(cmdbuf.ppp_multisamplectl), // fixed

0 commit comments

Comments
 (0)