ail: Add get_wsi_stride_B helper
Centralize the logic around WSI strides, which are a software convention made into UAPI rather than something set in silicon. Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19606>
This commit is contained in:
committed by
Marge Bot
parent
2d04206673
commit
e9dbbddf43
@@ -116,6 +116,25 @@ ail_get_linear_stride_B(struct ail_layout *layout, ASSERTED uint8_t level)
|
||||
return layout->linear_stride_B;
|
||||
}
|
||||
|
||||
/*
|
||||
* For WSI purposes, we need to associate a stride with all layouts. In the
|
||||
* hardware, only strided linear images have an associated stride, there is no
|
||||
* natural stride associated with twiddled images. However, various clients
|
||||
* assert that the stride is valid for the image if it were linear (even if it
|
||||
* is in fact not linear). In those cases, by convention we use the minimum
|
||||
* valid such stride.
|
||||
*/
|
||||
static inline uint32_t
|
||||
ail_get_wsi_stride_B(struct ail_layout *layout, unsigned level)
|
||||
{
|
||||
assert(level == 0 && "Mipmaps cannot be shared as WSI");
|
||||
|
||||
if (layout->tiling == AIL_TILING_LINEAR)
|
||||
return ail_get_linear_stride_B(layout, level);
|
||||
else
|
||||
return util_format_get_stride(layout->format, layout->width_px);
|
||||
}
|
||||
|
||||
static inline uint32_t
|
||||
ail_get_layer_offset_B(struct ail_layout *layout, unsigned z_px)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user