mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-31 20:40:09 +01:00
pan/lib: introduce row_align_B and array_align_B constraints
To implement sparse partially-resident images, we need to be able to express mapping in terms of rectangles of texel blocks. With row_align_B we can constrain the rows of ordered blocks to start at mapping boundary (i.e. page size) and using array_align_B we can ensure that each subresource starts at a multiple of whatever sparse block size we decide to use. Not setting each of these fields is the same as setting them to 1. Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37483>
This commit is contained in:
parent
dbf20eb49f
commit
bd9aeeec0a
3 changed files with 23 additions and 0 deletions
|
|
@ -160,6 +160,12 @@ pan_image_layout_init(
|
|||
/* Arrays and cubemaps have the entire miptree duplicated */
|
||||
layout->array_stride_B =
|
||||
ALIGN_POT(layout_constraints.offset_B - layout->slices[0].offset_B, 64);
|
||||
|
||||
if (layout_constraints.array_align_B) {
|
||||
layout->array_stride_B =
|
||||
ALIGN_POT(layout->array_stride_B, layout_constraints.array_align_B);
|
||||
}
|
||||
|
||||
if (use_explicit_layout) {
|
||||
layout->data_size_B =
|
||||
layout_constraints.offset_B - explicit_layout_constraints->offset_B;
|
||||
|
|
|
|||
|
|
@ -132,9 +132,20 @@ struct pan_image_layout_constraints {
|
|||
*/
|
||||
uint64_t offset_B;
|
||||
|
||||
/* Minimal aligment for an array layer. Used to implement sparse residency. */
|
||||
uint32_t array_align_B;
|
||||
|
||||
/* Row pitch in bytes. Non-zero if layout is explicit. */
|
||||
uint32_t wsi_row_pitch_B;
|
||||
|
||||
union {
|
||||
struct {
|
||||
/* Minimal alignment for a row of ordered blocks. Used to implement sparse
|
||||
* residency. */
|
||||
uint32_t row_align_B;
|
||||
} u_tiled;
|
||||
};
|
||||
|
||||
/* When true, AFBC/AFRC imports are stricter than they were when those
|
||||
* modifiers where introduced. */
|
||||
bool strict;
|
||||
|
|
|
|||
|
|
@ -546,6 +546,12 @@ pan_mod_u_tiled_init_slice_layout(
|
|||
align_mask + 1);
|
||||
}
|
||||
|
||||
if (layout_constraints && layout_constraints->u_tiled.row_align_B) {
|
||||
slayout->tiled_or_linear.row_stride_B =
|
||||
ALIGN_POT(slayout->tiled_or_linear.row_stride_B,
|
||||
layout_constraints->u_tiled.row_align_B);
|
||||
}
|
||||
|
||||
uint64_t surf_stride_B =
|
||||
(uint64_t)slayout->tiled_or_linear.row_stride_B *
|
||||
DIV_ROUND_UP(mip_extent_el.height, tile_extent_el.height);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue