Skip to content

Commit

Permalink
drm/asahi: render, buffer: Fix layered rendering on G13X (again)
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
asahilina committed Nov 17, 2023
1 parent 9bf7175 commit 0a19d0f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 2 additions & 0 deletions drivers/gpu/drm/asahi/buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ pub(crate) struct TileInfo {
pub(crate) tilemap_size: usize,
/// Size of the Tail Pointer Cache, in bytes (for all layers * clusters).
pub(crate) tpc_size: usize,
/// Number of blocks in the clustering meta buffer (for clustering) per layer.
pub(crate) meta1_layer_stride: u32,
/// Number of blocks in the clustering meta buffer (for clustering).
pub(crate) meta1_blocks: u32,
/// Layering metadata size.
Expand Down
11 changes: 7 additions & 4 deletions drivers/gpu/drm/asahi/queue/render.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,7 @@ impl super::Queue::ver {
// No idea where this comes from, but it fits what macOS does...
// GUESS: Number of 32K heap blocks to fit a 5-byte region header/pointer per tile?
// That would make a ton of sense...
// TODO: Layers? Why the sample count factor here?
let meta1_blocks = if num_clusters > 1 {
let meta1_layer_stride = if num_clusters > 1 {
div_ceil(
align(tiles_x, 2) * align(tiles_y, 4) * utiles_per_tile,
0x1980,
Expand Down Expand Up @@ -177,7 +176,11 @@ impl super::Queue::ver {
//utiles_per_mtile: tiles_per_mtile * utiles_per_tile,
tilemap_size,
tpc_size,
meta1_blocks,
meta1_layer_stride,
#[ver(G < G14X)]
meta1_blocks: meta1_layer_stride * cmdbuf.layers,
#[ver(G >= G14X)]
meta1_blocks: meta1_layer_stride,
layermeta_size: if layers > 1 { 0x100 } else { 0 },
min_tvb_blocks: min_tvb_blocks as usize,
params: fw::vertex::raw::TilingParameters {
Expand Down Expand Up @@ -1305,7 +1308,7 @@ impl super::Queue::ver {
tvb_cluster_meta1: inner
.scene
.meta_1_pointer()
.map(|x| x.or((tile_info.meta1_blocks as u64) << 50)),
.map(|x| x.or((tile_info.meta1_layer_stride as u64) << 50)),
utile_config,
unk_4c: 0,
ppp_multisamplectl: U64(cmdbuf.ppp_multisamplectl), // fixed
Expand Down

0 comments on commit 0a19d0f

Please sign in to comment.