lima,panfrost: Use row stride for tiling routines
This makes more sense. Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com> Reviewed-by: Erico Nunes <nunes.erico@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16201>
This commit is contained in:
parent
c4241a831f
commit
61100e7011
|
@ -677,6 +677,10 @@ lima_transfer_map(struct pipe_context *pctx,
|
|||
trans->staging = malloc(ptrans->stride * ptrans->box.height * ptrans->box.depth);
|
||||
|
||||
if (usage & PIPE_MAP_READ) {
|
||||
unsigned line_stride = res->levels[level].stride;
|
||||
unsigned row_height = util_format_is_compressed(pres->format) ? 4 : 16;
|
||||
unsigned row_stride = line_stride * row_height;
|
||||
|
||||
unsigned i;
|
||||
for (i = 0; i < ptrans->box.depth; i++)
|
||||
panfrost_load_tiled_image(
|
||||
|
@ -685,7 +689,7 @@ lima_transfer_map(struct pipe_context *pctx,
|
|||
ptrans->box.x, ptrans->box.y,
|
||||
ptrans->box.width, ptrans->box.height,
|
||||
ptrans->stride,
|
||||
res->levels[level].stride,
|
||||
row_stride,
|
||||
pres->format);
|
||||
}
|
||||
|
||||
|
@ -783,13 +787,17 @@ lima_transfer_unmap_inner(struct lima_context *ctx,
|
|||
/* Update texture descriptor */
|
||||
ctx->dirty |= LIMA_CONTEXT_DIRTY_TEXTURES;
|
||||
} else {
|
||||
unsigned line_stride = res->levels[ptrans->level].stride;
|
||||
unsigned row_height = util_format_is_compressed(pres->format) ? 4 : 16;
|
||||
unsigned row_stride = line_stride * row_height;
|
||||
|
||||
for (i = 0; i < trans->base.box.depth; i++)
|
||||
panfrost_store_tiled_image(
|
||||
bo->map + res->levels[trans->base.level].offset + (i + trans->base.box.z) * res->levels[trans->base.level].layer_stride,
|
||||
trans->staging + i * ptrans->stride * ptrans->box.height,
|
||||
ptrans->box.x, ptrans->box.y,
|
||||
ptrans->box.width, ptrans->box.height,
|
||||
res->levels[ptrans->level].stride,
|
||||
row_stride,
|
||||
ptrans->stride,
|
||||
pres->format);
|
||||
}
|
||||
|
|
|
@ -876,7 +876,7 @@ panfrost_load_tiled_images(struct panfrost_transfer *transfer,
|
|||
panfrost_load_tiled_image(dst, map, ptrans->box.x,
|
||||
ptrans->box.y, ptrans->box.width,
|
||||
ptrans->box.height, ptrans->stride,
|
||||
rsrc->image.layout.slices[level].line_stride,
|
||||
rsrc->image.layout.slices[level].row_stride,
|
||||
rsrc->image.layout.format);
|
||||
}
|
||||
}
|
||||
|
@ -902,7 +902,7 @@ panfrost_store_tiled_images(struct panfrost_transfer *transfer,
|
|||
panfrost_store_tiled_image(map, src,
|
||||
ptrans->box.x, ptrans->box.y,
|
||||
ptrans->box.width, ptrans->box.height,
|
||||
rsrc->image.layout.slices[level].line_stride,
|
||||
rsrc->image.layout.slices[level].row_stride,
|
||||
ptrans->stride, rsrc->image.layout.format);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -175,8 +175,7 @@ panfrost_access_tiled_image_##pixel_t \
|
|||
{ \
|
||||
uint8_t *dest_start = dst + ((sx >> 4) * PIXELS_PER_TILE * sizeof(pixel_t)); \
|
||||
for (int y = sy, src_y = 0; src_y < h; ++y, ++src_y) { \
|
||||
uint16_t block_y = y & ~0x0f; \
|
||||
uint8_t *dest = (uint8_t *) (dest_start + (block_y * dst_stride)); \
|
||||
uint8_t *dest = (uint8_t *) (dest_start + ((y >> 4) * dst_stride)); \
|
||||
pixel_t *source = src + (src_y * src_stride); \
|
||||
pixel_t *source_end = source + w; \
|
||||
unsigned expanded_y = bit_duplication[y & 0xF] << shift; \
|
||||
|
@ -201,8 +200,7 @@ TILED_ACCESS_TYPE(pan_uint128_t, 4);
|
|||
#define TILED_UNALIGNED_TYPE(pixel_t, is_store, tile_shift) { \
|
||||
const unsigned mask = (1 << tile_shift) - 1; \
|
||||
for (int y = sy, src_y = 0; src_y < h; ++y, ++src_y) { \
|
||||
unsigned block_y = y & ~mask; \
|
||||
unsigned block_start_s = block_y * dst_stride; \
|
||||
unsigned block_start_s = (y >> tile_shift) * dst_stride; \
|
||||
unsigned source_start = src_y * src_stride; \
|
||||
unsigned expanded_y = bit_duplication[y & mask]; \
|
||||
\
|
||||
|
|
|
@ -44,7 +44,7 @@ extern "C" {
|
|||
* @z Region of interest of source in pixels, aligned to block size
|
||||
* @w Region of interest of source in pixels, aligned to block size
|
||||
* @dst_stride Stride in bytes of linear destination
|
||||
* @src_stride Stride in bytes of tiled source
|
||||
* @src_stride Number of bytes between adjacent rows of tiles in source.
|
||||
* @format Format of the source and destination image
|
||||
*/
|
||||
void panfrost_load_tiled_image(void *dst, const void *src,
|
||||
|
@ -63,7 +63,7 @@ void panfrost_load_tiled_image(void *dst, const void *src,
|
|||
* @y Region of interest of destination in pixels, aligned to block size
|
||||
* @z Region of interest of destination in pixels, aligned to block size
|
||||
* @w Region of interest of destination in pixels, aligned to block size
|
||||
* @dst_stride Stride in bytes of tiled destination
|
||||
* @dst_stride Number of bytes between adjacent rows of tiles in destination.
|
||||
* @src_stride Stride in bytes of linear source
|
||||
* @format Format of the source and destination image
|
||||
*/
|
||||
|
|
|
@ -61,7 +61,7 @@ tiled_offset(unsigned x, unsigned y, unsigned stride, unsigned tilesize, unsigne
|
|||
|
||||
unsigned index_in_tile = u_order(x_in_tile, y_in_tile);
|
||||
|
||||
unsigned row_offset = tile_y * (stride * tilesize);
|
||||
unsigned row_offset = tile_y * stride;
|
||||
unsigned col_offset = (tile_x * tilesize * tilesize) * blocksize;
|
||||
unsigned block_offset = index_in_tile * blocksize;
|
||||
|
||||
|
@ -128,10 +128,11 @@ test(unsigned width, unsigned height, unsigned rx, unsigned ry,
|
|||
enum pipe_format format, bool store)
|
||||
{
|
||||
unsigned bpp = util_format_get_blocksize(format);
|
||||
unsigned tile_height = util_format_is_compressed(format) ? 4 : 16;
|
||||
|
||||
unsigned tiled_width = ALIGN_POT(width, 16);
|
||||
unsigned tiled_height = ALIGN_POT(height, 16);
|
||||
unsigned tiled_stride = tiled_width * bpp;
|
||||
unsigned tiled_stride = tiled_width * tile_height * bpp;
|
||||
|
||||
unsigned dst_stride = store ? tiled_stride : linear_stride;
|
||||
unsigned src_stride = store ? linear_stride : tiled_stride;
|
||||
|
|
Loading…
Reference in New Issue