mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-09 06:48:06 +02:00
pan/layout: Use _{B,el,px,sb} suffixes to clarify things
Improve the layout code, based in part on the Asahi/Intel layout. Suffixes like `_px` (for pixel), `_B` (for byte), `_el` (for element) and `_sb` (for superblock) make some of the sizes of items within the layout more explicit. Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com> Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com> Acked-by: Daniel Stone <daniels@collabora.com> Reviewed-by: Ryan Mckeever <ryan.mckeever@collabora.com> Reviewed-by: Olivia Lee <olivia.lee@collabora.com> Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34767>
This commit is contained in:
parent
97e0fdbd4d
commit
bb999ae466
11 changed files with 461 additions and 407 deletions
|
|
@ -1714,7 +1714,7 @@ panfrost_create_sampler_view_bo(struct panfrost_sampler_view *so,
|
|||
}
|
||||
|
||||
so->texture_bo = prsrc->image.data.base;
|
||||
so->texture_size = prsrc->image.layout.data_size;
|
||||
so->texture_size = prsrc->image.layout.data_size_B;
|
||||
so->modifier = prsrc->image.layout.modifier;
|
||||
|
||||
/* MSAA only supported for 2D textures */
|
||||
|
|
@ -1737,8 +1737,8 @@ panfrost_create_sampler_view_bo(struct panfrost_sampler_view *so,
|
|||
buf_size = MIN2(buf_size, PAN_MAX_TEXEL_BUFFER_ELEMENTS);
|
||||
|
||||
if (so->base.target == PIPE_TEXTURE_3D) {
|
||||
first_layer /= prsrc->image.layout.depth;
|
||||
last_layer /= prsrc->image.layout.depth;
|
||||
first_layer /= prsrc->image.layout.extent_px.depth;
|
||||
last_layer /= prsrc->image.layout.extent_px.depth;
|
||||
assert(!first_layer && !last_layer);
|
||||
}
|
||||
|
||||
|
|
@ -1823,7 +1823,7 @@ panfrost_update_sampler_view(struct panfrost_sampler_view *view,
|
|||
{
|
||||
struct panfrost_resource *rsrc = pan_resource(view->base.texture);
|
||||
if (view->texture_bo != rsrc->image.data.base ||
|
||||
view->texture_size != rsrc->image.layout.data_size ||
|
||||
view->texture_size != rsrc->image.layout.data_size_B ||
|
||||
view->modifier != rsrc->image.layout.modifier) {
|
||||
panfrost_bo_unreference(view->state.bo);
|
||||
panfrost_create_sampler_view_bo(view, pctx, &rsrc->base);
|
||||
|
|
@ -2057,10 +2057,11 @@ emit_image_bufs(struct panfrost_batch *batch, enum pipe_shader_type shader,
|
|||
|
||||
cfg.s_dimension = u_minify(rsrc->base.width0, level);
|
||||
cfg.t_dimension = u_minify(rsrc->base.height0, level);
|
||||
cfg.r_dimension = is_3d ? u_minify(rsrc->image.layout.depth, level)
|
||||
: (image->u.tex.last_layer - image->u.tex.first_layer + 1);
|
||||
cfg.r_dimension =
|
||||
is_3d ? u_minify(rsrc->image.layout.extent_px.depth, level)
|
||||
: (image->u.tex.last_layer - image->u.tex.first_layer + 1);
|
||||
|
||||
cfg.row_stride = rsrc->image.layout.slices[level].row_stride;
|
||||
cfg.row_stride = rsrc->image.layout.slices[level].row_stride_B;
|
||||
if (cfg.r_dimension > 1) {
|
||||
cfg.slice_stride =
|
||||
pan_image_surface_stride(&rsrc->image.layout, level);
|
||||
|
|
@ -3575,40 +3576,41 @@ panfrost_afbc_size(struct panfrost_batch *batch, struct panfrost_resource *src,
|
|||
|
||||
struct pan_image_slice_layout *slice = &src->image.layout.slices[level];
|
||||
struct panfrost_afbc_size_info consts = {
|
||||
.src = src->image.data.base + slice->offset,
|
||||
.src = src->image.data.base + slice->offset_B,
|
||||
.metadata = metadata->ptr.gpu + offset,
|
||||
};
|
||||
|
||||
panfrost_batch_read_rsrc(batch, src, PIPE_SHADER_COMPUTE);
|
||||
panfrost_batch_write_bo(batch, metadata, PIPE_SHADER_COMPUTE);
|
||||
|
||||
LAUNCH_CONVERT_SHADER(afbc_size, batch, src, consts, slice->afbc.nr_blocks);
|
||||
LAUNCH_CONVERT_SHADER(afbc_size, batch, src, consts, slice->afbc.nr_sblocks);
|
||||
}
|
||||
|
||||
static void
|
||||
panfrost_afbc_pack(struct panfrost_batch *batch, struct panfrost_resource *src,
|
||||
struct panfrost_bo *dst,
|
||||
struct pan_image_slice_layout *dst_slice,
|
||||
struct panfrost_bo *metadata, unsigned metadata_offset,
|
||||
struct panfrost_bo *metadata, unsigned metadata_offset_B,
|
||||
unsigned level)
|
||||
{
|
||||
MESA_TRACE_FUNC();
|
||||
|
||||
struct pan_image_slice_layout *src_slice = &src->image.layout.slices[level];
|
||||
struct panfrost_afbc_pack_info consts = {
|
||||
.src = src->image.data.base + src_slice->offset,
|
||||
.dst = dst->ptr.gpu + dst_slice->offset,
|
||||
.metadata = metadata->ptr.gpu + metadata_offset,
|
||||
.header_size = dst_slice->afbc.header_size,
|
||||
.src_stride = src_slice->afbc.stride,
|
||||
.dst_stride = dst_slice->afbc.stride,
|
||||
.src = src->image.data.base + src_slice->offset_B,
|
||||
.dst = dst->ptr.gpu + dst_slice->offset_B,
|
||||
.metadata = metadata->ptr.gpu + metadata_offset_B,
|
||||
.header_size = dst_slice->afbc.header_size_B,
|
||||
.src_stride = src_slice->afbc.stride_sb,
|
||||
.dst_stride = dst_slice->afbc.stride_sb,
|
||||
};
|
||||
|
||||
panfrost_batch_read_rsrc(batch, src, PIPE_SHADER_COMPUTE);
|
||||
panfrost_batch_write_bo(batch, dst, PIPE_SHADER_COMPUTE);
|
||||
panfrost_batch_add_bo(batch, metadata, PIPE_SHADER_COMPUTE);
|
||||
|
||||
LAUNCH_CONVERT_SHADER(afbc_pack, batch, src, consts, dst_slice->afbc.nr_blocks);
|
||||
LAUNCH_CONVERT_SHADER(afbc_pack, batch, src, consts,
|
||||
dst_slice->afbc.nr_sblocks);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -3624,8 +3626,10 @@ panfrost_mtk_detile_compute(struct panfrost_context *ctx, struct pipe_blit_info
|
|||
|
||||
unsigned width = info->src.box.width;
|
||||
unsigned height = info->src.box.height;
|
||||
unsigned src_stride = pan_resource(y_src)->image.layout.slices[0].row_stride;
|
||||
unsigned dst_stride = pan_resource(y_dst)->image.layout.slices[0].row_stride;
|
||||
unsigned src_stride =
|
||||
pan_resource(y_src)->image.layout.slices[0].row_stride_B;
|
||||
unsigned dst_stride =
|
||||
pan_resource(y_dst)->image.layout.slices[0].row_stride_B;
|
||||
|
||||
/* 4 images: y_src, uv_src, y_dst, uv_dst */
|
||||
struct pipe_image_view image[4] = { 0 };
|
||||
|
|
|
|||
|
|
@ -130,9 +130,11 @@ panfrost_resource_from_handle(struct pipe_screen *pscreen,
|
|||
.modifier = mod,
|
||||
.format = templat->format,
|
||||
.dim = dim,
|
||||
.width = prsc->width0,
|
||||
.height = prsc->height0,
|
||||
.depth = prsc->depth0,
|
||||
.extent_px = {
|
||||
.width = prsc->width0,
|
||||
.height = prsc->height0,
|
||||
.depth = prsc->depth0,
|
||||
},
|
||||
.array_size = prsc->array_size,
|
||||
.nr_samples = MAX2(prsc->nr_samples, 1),
|
||||
.nr_slices = 1,
|
||||
|
|
@ -567,9 +569,11 @@ panfrost_resource_setup(struct pipe_screen *screen,
|
|||
.modifier = chosen_mod,
|
||||
.format = fmt,
|
||||
.dim = dim,
|
||||
.width = pres->base.width0,
|
||||
.height = pres->base.height0,
|
||||
.depth = pres->base.depth0,
|
||||
.extent_px = {
|
||||
.width = pres->base.width0,
|
||||
.height = pres->base.height0,
|
||||
.depth = pres->base.depth0,
|
||||
},
|
||||
.array_size = pres->base.array_size,
|
||||
.nr_samples = MAX2(pres->base.nr_samples, 1),
|
||||
.nr_slices = pres->base.last_level + 1,
|
||||
|
|
@ -599,14 +603,14 @@ panfrost_resource_init_afbc_headers(struct panfrost_resource *pres)
|
|||
|
||||
for (unsigned s = 0; s < nr_samples; ++s) {
|
||||
void *ptr = pres->bo->ptr.cpu +
|
||||
(i * pres->image.layout.array_stride) + slice->offset +
|
||||
(s * slice->afbc.surface_stride);
|
||||
(i * pres->image.layout.array_stride_B) +
|
||||
slice->offset_B + (s * slice->afbc.surface_stride_B);
|
||||
|
||||
/* Zero-ed AFBC headers seem to encode a plain
|
||||
* black. Let's use this pattern to keep the
|
||||
* initialization simple.
|
||||
*/
|
||||
memset(ptr, 0, slice->afbc.header_size);
|
||||
memset(ptr, 0, slice->afbc.header_size_B);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -722,7 +726,7 @@ panfrost_can_create_resource(struct pipe_screen *screen,
|
|||
/* Limit maximum texture size to a quarter of the system memory, to avoid
|
||||
* allocating huge textures on systems with little memory.
|
||||
*/
|
||||
return tmp.image.layout.data_size <= system_memory / 4;
|
||||
return tmp.image.layout.data_size_B <= system_memory / 4;
|
||||
}
|
||||
|
||||
struct pipe_resource *
|
||||
|
|
@ -783,7 +787,7 @@ panfrost_resource_create_with_modifier(struct pipe_screen *screen,
|
|||
if (dev->ro && (template->bind & PIPE_BIND_SCANOUT)) {
|
||||
struct winsys_handle handle;
|
||||
struct pan_image_block_size blocksize =
|
||||
pan_image_renderblock_size(modifier, template->format);
|
||||
pan_image_renderblock_size_el(modifier, template->format);
|
||||
|
||||
/* Block-based texture formats are only used for texture
|
||||
* compression (not framebuffer compression!), which doesn't
|
||||
|
|
@ -810,7 +814,7 @@ panfrost_resource_create_with_modifier(struct pipe_screen *screen,
|
|||
unsigned width = ALIGN_POT(template->width0, blocksize.width);
|
||||
unsigned stride = ALIGN_POT(template->width0, blocksize.width) *
|
||||
util_format_get_blocksize(template->format);
|
||||
unsigned size = so->image.layout.data_size;
|
||||
unsigned size = so->image.layout.data_size_B;
|
||||
unsigned effective_rows = DIV_ROUND_UP(size, stride);
|
||||
|
||||
struct pipe_resource scanout_tmpl = {
|
||||
|
|
@ -850,7 +854,7 @@ panfrost_resource_create_with_modifier(struct pipe_screen *screen,
|
|||
flags |= PAN_BO_SHAREABLE;
|
||||
|
||||
so->bo =
|
||||
panfrost_bo_create(dev, so->image.layout.data_size, flags, label);
|
||||
panfrost_bo_create(dev, so->image.layout.data_size_B, flags, label);
|
||||
|
||||
if (!so->bo) {
|
||||
FREE(so);
|
||||
|
|
@ -1034,13 +1038,13 @@ panfrost_load_tiled_images(struct panfrost_transfer *transfer,
|
|||
*/
|
||||
for (unsigned z = 0; z < ptrans->box.depth; ++z) {
|
||||
void *dst = transfer->map + (ptrans->layer_stride * z);
|
||||
uint8_t *map = bo->ptr.cpu + rsrc->image.layout.slices[level].offset +
|
||||
uint8_t *map = bo->ptr.cpu + rsrc->image.layout.slices[level].offset_B +
|
||||
(z + ptrans->box.z) * stride;
|
||||
|
||||
pan_load_tiled_image(dst, map, ptrans->box.x, ptrans->box.y,
|
||||
ptrans->box.width, ptrans->box.height,
|
||||
ptrans->stride,
|
||||
rsrc->image.layout.slices[level].row_stride,
|
||||
rsrc->image.layout.slices[level].row_stride_B,
|
||||
rsrc->image.layout.format);
|
||||
}
|
||||
}
|
||||
|
|
@ -1151,7 +1155,7 @@ pan_dump_resource(struct panfrost_context *ctx, struct panfrost_resource *rsc)
|
|||
|
||||
debug_dump_image(buffer, rsc->base.format, 0 /* UNUSED */, rsc->base.width0,
|
||||
rsc->base.height0,
|
||||
linear->image.layout.slices[0].row_stride,
|
||||
linear->image.layout.slices[0].row_stride_B,
|
||||
linear->bo->ptr.cpu);
|
||||
} else {
|
||||
mesa_loge("failed to mmap, not dumping resource");
|
||||
|
|
@ -1187,12 +1191,12 @@ panfrost_store_tiled_images(struct panfrost_transfer *transfer,
|
|||
*/
|
||||
for (unsigned z = 0; z < ptrans->box.depth; ++z) {
|
||||
void *src = transfer->map + (ptrans->layer_stride * z);
|
||||
uint8_t *map = bo->ptr.cpu + rsrc->image.layout.slices[level].offset +
|
||||
uint8_t *map = bo->ptr.cpu + rsrc->image.layout.slices[level].offset_B +
|
||||
(z + ptrans->box.z) * stride;
|
||||
|
||||
pan_store_tiled_image(map, src, ptrans->box.x, ptrans->box.y,
|
||||
ptrans->box.width, ptrans->box.height,
|
||||
rsrc->image.layout.slices[level].row_stride,
|
||||
rsrc->image.layout.slices[level].row_stride_B,
|
||||
ptrans->stride, rsrc->image.layout.format);
|
||||
}
|
||||
}
|
||||
|
|
@ -1261,7 +1265,7 @@ panfrost_ptr_map(struct pipe_context *pctx, struct pipe_resource *resource,
|
|||
/* Staging resources have one LOD: level 0. Query the strides
|
||||
* on this LOD.
|
||||
*/
|
||||
transfer->base.stride = staging->image.layout.slices[0].row_stride;
|
||||
transfer->base.stride = staging->image.layout.slices[0].row_stride_B;
|
||||
transfer->base.layer_stride =
|
||||
pan_image_surface_stride(&staging->image.layout, 0);
|
||||
|
||||
|
|
@ -1437,7 +1441,7 @@ panfrost_ptr_map(struct pipe_context *pctx, struct pipe_resource *resource,
|
|||
if ((usage & dpw) == dpw && rsrc->index_cache)
|
||||
return NULL;
|
||||
|
||||
transfer->base.stride = rsrc->image.layout.slices[level].row_stride;
|
||||
transfer->base.stride = rsrc->image.layout.slices[level].row_stride_B;
|
||||
transfer->base.layer_stride =
|
||||
pan_image_surface_stride(&rsrc->image.layout, level);
|
||||
|
||||
|
|
@ -1451,9 +1455,9 @@ panfrost_ptr_map(struct pipe_context *pctx, struct pipe_resource *resource,
|
|||
transfer->base.box.x, transfer->base.box.width);
|
||||
}
|
||||
|
||||
return bo->ptr.cpu + rsrc->image.layout.slices[level].offset +
|
||||
return bo->ptr.cpu + rsrc->image.layout.slices[level].offset_B +
|
||||
box->z * transfer->base.layer_stride +
|
||||
box_blocks.y * rsrc->image.layout.slices[level].row_stride +
|
||||
box_blocks.y * rsrc->image.layout.slices[level].row_stride_B +
|
||||
box_blocks.x * bytes_per_block;
|
||||
}
|
||||
}
|
||||
|
|
@ -1498,7 +1502,7 @@ pan_resource_modifier_convert(struct panfrost_context *ctx,
|
|||
next_tmp_rsrc = pan_resource(next_tmp_prsrc);
|
||||
if (fix_stride) {
|
||||
next_tmp_rsrc->base.width0 /= 2;
|
||||
next_tmp_rsrc->image.layout.width /= 2;
|
||||
next_tmp_rsrc->image.layout.extent_px.width /= 2;
|
||||
}
|
||||
}
|
||||
tmp_prsrc = panfrost_resource_create_with_modifier(
|
||||
|
|
@ -1673,7 +1677,7 @@ panfrost_get_afbc_superblock_sizes(struct panfrost_context *ctx,
|
|||
|
||||
for (int level = first_level; level <= last_level; ++level) {
|
||||
struct pan_image_slice_layout *slice = &rsrc->image.layout.slices[level];
|
||||
unsigned sz = slice->afbc.nr_blocks * sizeof(struct pan_afbc_block_info);
|
||||
unsigned sz = slice->afbc.nr_sblocks * sizeof(struct pan_afbc_block_info);
|
||||
out_offsets[level - first_level] = metadata_size;
|
||||
metadata_size += sz;
|
||||
}
|
||||
|
|
@ -1738,7 +1742,7 @@ panfrost_pack_afbc(struct panfrost_context *ctx,
|
|||
&prsrc->image.layout.slices[level];
|
||||
struct pan_image_slice_layout *dst_slice = &slice_infos[level];
|
||||
unsigned src_stride =
|
||||
pan_afbc_stride_blocks(src_modifier, src_slice->row_stride);
|
||||
pan_afbc_stride_blocks(src_modifier, src_slice->row_stride_B);
|
||||
|
||||
uint32_t offset = 0;
|
||||
struct pan_afbc_block_info *meta =
|
||||
|
|
@ -1754,15 +1758,15 @@ panfrost_pack_afbc(struct panfrost_context *ctx,
|
|||
alignas(16) struct pan_afbc_block_info meta_chunk[64 * 16];
|
||||
unsigned nr_blocks_per_chunk = ARRAY_SIZE(meta_chunk);
|
||||
|
||||
for (unsigned i = 0; i < src_slice->afbc.nr_blocks;
|
||||
for (unsigned i = 0; i < src_slice->afbc.nr_sblocks;
|
||||
i += nr_blocks_per_chunk) {
|
||||
unsigned nr_blocks = MIN2(nr_blocks_per_chunk,
|
||||
src_slice->afbc.nr_blocks - i);
|
||||
unsigned nr_sblocks = MIN2(nr_blocks_per_chunk,
|
||||
src_slice->afbc.nr_sblocks - i);
|
||||
|
||||
util_streaming_load_memcpy(meta_chunk, &meta[i], nr_blocks
|
||||
util_streaming_load_memcpy(meta_chunk, &meta[i], nr_sblocks
|
||||
* sizeof(struct pan_afbc_block_info));
|
||||
|
||||
for (unsigned j = 0; j < nr_blocks; j++) {
|
||||
for (unsigned j = 0; j < nr_sblocks; j++) {
|
||||
unsigned idx = j;
|
||||
if (is_tiled) {
|
||||
idx &= ~63;
|
||||
|
|
@ -1782,25 +1786,26 @@ panfrost_pack_afbc(struct panfrost_context *ctx,
|
|||
unsigned dst_height =
|
||||
DIV_ROUND_UP(height, pan_afbc_superblock_height(dst_modifier));
|
||||
|
||||
dst_slice->afbc.stride = dst_stride;
|
||||
dst_slice->afbc.nr_blocks = dst_stride * dst_height;
|
||||
dst_slice->afbc.header_size =
|
||||
dst_slice->afbc.stride_sb = dst_stride;
|
||||
dst_slice->afbc.nr_sblocks = dst_stride * dst_height;
|
||||
dst_slice->afbc.header_size_B =
|
||||
ALIGN_POT(dst_stride * dst_height * AFBC_HEADER_BYTES_PER_TILE,
|
||||
pan_afbc_body_align(dev->arch, dst_modifier));
|
||||
dst_slice->afbc.body_size = offset;
|
||||
dst_slice->afbc.surface_stride = dst_slice->afbc.header_size + offset;
|
||||
dst_slice->afbc.body_size_B = offset;
|
||||
dst_slice->afbc.surface_stride_B =
|
||||
dst_slice->afbc.header_size_B + offset;
|
||||
|
||||
dst_slice->offset = total_size;
|
||||
dst_slice->row_stride = dst_stride * AFBC_HEADER_BYTES_PER_TILE;
|
||||
dst_slice->surface_stride = dst_slice->afbc.surface_stride;
|
||||
dst_slice->size = dst_slice->afbc.surface_stride;
|
||||
dst_slice->offset_B = total_size;
|
||||
dst_slice->row_stride_B = dst_stride * AFBC_HEADER_BYTES_PER_TILE;
|
||||
dst_slice->surface_stride_B = dst_slice->afbc.surface_stride_B;
|
||||
dst_slice->size_B = dst_slice->afbc.surface_stride_B;
|
||||
|
||||
/* We can't write to AFBC-packed resource, so there is no reason to
|
||||
* keep CRC data around */
|
||||
dst_slice->crc.offset = 0;
|
||||
dst_slice->crc.size = 0;
|
||||
dst_slice->crc.offset_B = 0;
|
||||
dst_slice->crc.size_B = 0;
|
||||
}
|
||||
total_size += dst_slice->afbc.surface_stride;
|
||||
total_size += dst_slice->afbc.surface_stride_B;
|
||||
}
|
||||
|
||||
unsigned new_size = ALIGN_POT(total_size, 4096); // FIXME
|
||||
|
|
@ -1832,8 +1837,8 @@ panfrost_pack_afbc(struct panfrost_context *ctx,
|
|||
metadata_offsets[level], level);
|
||||
prsrc->image.layout.slices[level] = *slice;
|
||||
}
|
||||
prsrc->image.layout.array_stride = new_size;
|
||||
prsrc->image.layout.data_size = new_size;
|
||||
prsrc->image.layout.array_stride_B = new_size;
|
||||
prsrc->image.layout.data_size_B = new_size;
|
||||
|
||||
panfrost_flush_batches_accessing_rsrc(ctx, prsrc, "AFBC compaction flush");
|
||||
|
||||
|
|
@ -1916,12 +1921,13 @@ panfrost_ptr_unmap(struct pipe_context *pctx, struct pipe_transfer *transfer)
|
|||
/* converting the resource from tiled to linear and back
|
||||
* shouldn't increase memory usage...
|
||||
*/
|
||||
assert(prsrc->image.layout.data_size <= panfrost_bo_size(bo));
|
||||
assert(prsrc->image.layout.data_size_B <= panfrost_bo_size(bo));
|
||||
|
||||
util_copy_rect(
|
||||
bo->ptr.cpu + prsrc->image.layout.slices[0].offset,
|
||||
prsrc->base.format, prsrc->image.layout.slices[0].row_stride,
|
||||
0, 0, transfer->box.width, transfer->box.height, trans->map,
|
||||
bo->ptr.cpu + prsrc->image.layout.slices[0].offset_B,
|
||||
prsrc->base.format,
|
||||
prsrc->image.layout.slices[0].row_stride_B, 0, 0,
|
||||
transfer->box.width, transfer->box.height, trans->map,
|
||||
transfer->stride, 0, 0);
|
||||
} else {
|
||||
panfrost_store_tiled_images(trans, prsrc);
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ mali_sampling_mode(const struct pan_image_view *view)
|
|||
pan_image_view_get_first_plane(view);
|
||||
|
||||
assert(view->nr_samples == nr_samples);
|
||||
assert(first_plane->layout.slices[0].surface_stride != 0);
|
||||
assert(first_plane->layout.slices[0].surface_stride_B != 0);
|
||||
return MALI_MSAA_LAYERED;
|
||||
}
|
||||
|
||||
|
|
@ -224,10 +224,10 @@ pan_prepare_s(const struct pan_fb_info *fb, unsigned layer_idx,
|
|||
DRM_FORMAT_MOD_ARM_16X16_BLOCK_U_INTERLEAVED ||
|
||||
image->layout.modifier == DRM_FORMAT_MOD_LINEAR);
|
||||
ext->s_writeback_base = surf.data;
|
||||
ext->s_writeback_row_stride = image->layout.slices[level].row_stride;
|
||||
ext->s_writeback_row_stride = image->layout.slices[level].row_stride_B;
|
||||
ext->s_writeback_surface_stride =
|
||||
(pan_image_view_get_nr_samples(s) > 1)
|
||||
? image->layout.slices[level].surface_stride
|
||||
? image->layout.slices[level].surface_stride_B
|
||||
: 0;
|
||||
ext->s_block_format = mod_to_block_fmt(image->layout.modifier);
|
||||
ext->s_write_format = translate_s_format(s->format);
|
||||
|
|
@ -255,7 +255,7 @@ pan_prepare_zs(const struct pan_fb_info *fb, unsigned layer_idx,
|
|||
if (drm_is_afbc(image->layout.modifier)) {
|
||||
#if PAN_ARCH >= 9
|
||||
ext->zs_writeback_base = surf.afbc.header;
|
||||
ext->zs_writeback_row_stride = slice->row_stride;
|
||||
ext->zs_writeback_row_stride = slice->row_stride_B;
|
||||
/* TODO: surface stride? */
|
||||
ext->zs_afbc_body_offset = surf.afbc.body - surf.afbc.header;
|
||||
|
||||
|
|
@ -263,7 +263,7 @@ pan_prepare_zs(const struct pan_fb_info *fb, unsigned layer_idx,
|
|||
#else
|
||||
#if PAN_ARCH >= 6
|
||||
ext->zs_afbc_row_stride =
|
||||
pan_afbc_stride_blocks(image->layout.modifier, slice->row_stride);
|
||||
pan_afbc_stride_blocks(image->layout.modifier, slice->row_stride_B);
|
||||
#else
|
||||
ext->zs_block_format = MALI_BLOCK_FORMAT_AFBC;
|
||||
ext->zs_afbc_body_size = 0x1000;
|
||||
|
|
@ -282,10 +282,10 @@ pan_prepare_zs(const struct pan_fb_info *fb, unsigned layer_idx,
|
|||
/* TODO: Z32F(S8) support, which is always linear */
|
||||
|
||||
ext->zs_writeback_base = surf.data;
|
||||
ext->zs_writeback_row_stride = image->layout.slices[level].row_stride;
|
||||
ext->zs_writeback_row_stride = image->layout.slices[level].row_stride_B;
|
||||
ext->zs_writeback_surface_stride =
|
||||
(pan_image_view_get_nr_samples(zs) > 1)
|
||||
? image->layout.slices[level].surface_stride
|
||||
? image->layout.slices[level].surface_stride_B
|
||||
: 0;
|
||||
}
|
||||
|
||||
|
|
@ -309,8 +309,8 @@ pan_prepare_crc(const struct pan_fb_info *fb, int rt_crc,
|
|||
const struct pan_image_slice_layout *slice =
|
||||
&image->layout.slices[rt->first_level];
|
||||
|
||||
ext->crc_base = image->data.base + slice->crc.offset;
|
||||
ext->crc_row_stride = slice->crc.stride;
|
||||
ext->crc_base = image->data.base + slice->crc.offset_B;
|
||||
ext->crc_row_stride = slice->crc.stride_B;
|
||||
|
||||
#if PAN_ARCH >= 7
|
||||
ext->crc_render_target = rt_crc;
|
||||
|
|
@ -588,19 +588,19 @@ pan_prepare_rt(const struct pan_fb_info *fb, unsigned layer_idx,
|
|||
const struct pan_image *first_plane = pan_image_view_get_first_plane(rt);
|
||||
unsigned level = rt->first_level;
|
||||
ASSERTED unsigned layer_count = rt->dim == MALI_TEXTURE_DIMENSION_3D
|
||||
? first_plane->layout.depth
|
||||
? first_plane->layout.extent_px.depth
|
||||
: rt->last_layer - rt->first_layer + 1;
|
||||
|
||||
assert(rt->last_level == rt->first_level);
|
||||
assert(layer_idx < layer_count);
|
||||
|
||||
int row_stride = image->layout.slices[level].row_stride;
|
||||
int row_stride_B = image->layout.slices[level].row_stride_B;
|
||||
|
||||
/* Only set layer_stride for layered MSAA rendering */
|
||||
|
||||
unsigned layer_stride = (pan_image_view_get_nr_samples(rt) > 1)
|
||||
? image->layout.slices[level].surface_stride
|
||||
: 0;
|
||||
unsigned layer_stride_B = (pan_image_view_get_nr_samples(rt) > 1)
|
||||
? image->layout.slices[level].surface_stride_B
|
||||
: 0;
|
||||
|
||||
cfg->writeback_msaa = mali_sampling_mode(rt);
|
||||
|
||||
|
|
@ -624,13 +624,13 @@ pan_prepare_rt(const struct pan_fb_info *fb, unsigned layer_idx,
|
|||
assert(surf.afbc.body >= surf.afbc.header);
|
||||
|
||||
cfg->afbc.compression_mode = pan_afbc_compression_mode(rt->format);
|
||||
cfg->afbc.row_stride = row_stride;
|
||||
cfg->afbc.row_stride = row_stride_B;
|
||||
#else
|
||||
const struct pan_image_slice_layout *slice = &image->layout.slices[level];
|
||||
|
||||
#if PAN_ARCH >= 6
|
||||
cfg->afbc.row_stride =
|
||||
pan_afbc_stride_blocks(image->layout.modifier, slice->row_stride);
|
||||
pan_afbc_stride_blocks(image->layout.modifier, slice->row_stride_B);
|
||||
cfg->afbc.afbc_wide_block_enable =
|
||||
pan_afbc_is_wide(image->layout.modifier);
|
||||
cfg->afbc.afbc_split_block_enable =
|
||||
|
|
@ -638,7 +638,7 @@ pan_prepare_rt(const struct pan_fb_info *fb, unsigned layer_idx,
|
|||
#else
|
||||
cfg->afbc.chunk_size = 9;
|
||||
cfg->afbc.sparse = true;
|
||||
cfg->afbc.body_size = slice->afbc.body_size;
|
||||
cfg->afbc.body_size = slice->afbc.body_size_B;
|
||||
#endif
|
||||
|
||||
cfg->afbc.header = surf.afbc.header;
|
||||
|
|
@ -657,16 +657,16 @@ pan_prepare_rt(const struct pan_fb_info *fb, unsigned layer_idx,
|
|||
cfg->afrc.format = pan_afrc_format(finfo, image->layout.modifier, 0);
|
||||
|
||||
cfg->rgb.base = surf.data;
|
||||
cfg->rgb.row_stride = row_stride;
|
||||
cfg->rgb.surface_stride = layer_stride;
|
||||
cfg->rgb.row_stride = row_stride_B;
|
||||
cfg->rgb.surface_stride = layer_stride_B;
|
||||
#endif
|
||||
} else {
|
||||
assert(image->layout.modifier == DRM_FORMAT_MOD_LINEAR ||
|
||||
image->layout.modifier ==
|
||||
DRM_FORMAT_MOD_ARM_16X16_BLOCK_U_INTERLEAVED);
|
||||
cfg->rgb.base = surf.data;
|
||||
cfg->rgb.row_stride = row_stride;
|
||||
cfg->rgb.surface_stride = layer_stride;
|
||||
cfg->rgb.row_stride = row_stride_B;
|
||||
cfg->rgb.surface_stride = layer_stride_B;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
@ -1084,7 +1084,7 @@ GENX(pan_emit_fbd)(const struct pan_fb_info *fb, unsigned layer_idx,
|
|||
cfg.color_write_enable = !fb->rts[0].discard;
|
||||
cfg.color_writeback.base = surf.data;
|
||||
cfg.color_writeback.row_stride =
|
||||
image->layout.slices[level].row_stride;
|
||||
image->layout.slices[level].row_stride_B;
|
||||
|
||||
cfg.color_block_format = mod_to_block_fmt(image->layout.modifier);
|
||||
assert(cfg.color_block_format == MALI_BLOCK_FORMAT_LINEAR ||
|
||||
|
|
@ -1095,8 +1095,8 @@ GENX(pan_emit_fbd)(const struct pan_fb_info *fb, unsigned layer_idx,
|
|||
const struct pan_image_slice_layout *slice =
|
||||
&image->layout.slices[level];
|
||||
|
||||
cfg.crc_buffer.row_stride = slice->crc.stride;
|
||||
cfg.crc_buffer.base = image->data.base + slice->crc.offset;
|
||||
cfg.crc_buffer.row_stride = slice->crc.stride_B;
|
||||
cfg.crc_buffer.base = image->data.base + slice->crc.offset_B;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1110,7 +1110,7 @@ GENX(pan_emit_fbd)(const struct pan_fb_info *fb, unsigned layer_idx,
|
|||
|
||||
cfg.zs_write_enable = !fb->zs.discard.z;
|
||||
cfg.zs_writeback.base = surf.data;
|
||||
cfg.zs_writeback.row_stride = image->layout.slices[level].row_stride;
|
||||
cfg.zs_writeback.row_stride = image->layout.slices[level].row_stride_B;
|
||||
cfg.zs_block_format = mod_to_block_fmt(image->layout.modifier);
|
||||
assert(cfg.zs_block_format == MALI_BLOCK_FORMAT_LINEAR ||
|
||||
cfg.zs_block_format == MALI_BLOCK_FORMAT_TILED_U_INTERLEAVED);
|
||||
|
|
|
|||
|
|
@ -195,17 +195,18 @@ pan_iview_get_surface(const struct pan_image_view *iview, unsigned level,
|
|||
assert(!sample);
|
||||
|
||||
if (is_3d) {
|
||||
ASSERTED unsigned depth = u_minify(image->layout.depth, level);
|
||||
ASSERTED unsigned depth =
|
||||
u_minify(image->layout.extent_px.depth, level);
|
||||
assert(layer < depth);
|
||||
surf->afbc.header =
|
||||
base + slice->offset + (layer * slice->afbc.surface_stride);
|
||||
surf->afbc.body = base + slice->offset + slice->afbc.header_size +
|
||||
(slice->surface_stride * layer);
|
||||
base + slice->offset_B + (layer * slice->afbc.surface_stride_B);
|
||||
surf->afbc.body = base + slice->offset_B + slice->afbc.header_size_B +
|
||||
(slice->surface_stride_B * layer);
|
||||
} else {
|
||||
assert(layer < image->layout.array_size);
|
||||
surf->afbc.header =
|
||||
base + pan_image_surface_offset(&image->layout, level, layer, 0);
|
||||
surf->afbc.body = surf->afbc.header + slice->afbc.header_size;
|
||||
surf->afbc.body = surf->afbc.header + slice->afbc.header_size_B;
|
||||
}
|
||||
} else {
|
||||
unsigned array_idx = is_3d ? 0 : layer;
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@
|
|||
* is 16x16, hence the modifier name.
|
||||
*/
|
||||
static inline struct pan_image_block_size
|
||||
pan_u_interleaved_tile_size(enum pipe_format format)
|
||||
pan_u_interleaved_tile_size_el(enum pipe_format format)
|
||||
{
|
||||
if (util_format_is_compressed(format))
|
||||
return (struct pan_image_block_size){4, 4};
|
||||
|
|
@ -51,10 +51,10 @@ pan_u_interleaved_tile_size(enum pipe_format format)
|
|||
* paging tile size. For linear textures, this is trivially 1x1.
|
||||
*/
|
||||
struct pan_image_block_size
|
||||
pan_image_block_size(uint64_t modifier, enum pipe_format format)
|
||||
pan_image_block_size_el(uint64_t modifier, enum pipe_format format)
|
||||
{
|
||||
if (modifier == DRM_FORMAT_MOD_ARM_16X16_BLOCK_U_INTERLEAVED)
|
||||
return pan_u_interleaved_tile_size(format);
|
||||
return pan_u_interleaved_tile_size_el(format);
|
||||
else if (drm_is_afbc(modifier))
|
||||
return pan_afbc_superblock_size(modifier);
|
||||
else if (drm_is_afrc(modifier))
|
||||
|
|
@ -68,10 +68,10 @@ pan_image_block_size(uint64_t modifier, enum pipe_format format)
|
|||
* to be 16 pixels high.
|
||||
*/
|
||||
struct pan_image_block_size
|
||||
pan_image_renderblock_size(uint64_t modifier, enum pipe_format format)
|
||||
pan_image_renderblock_size_el(uint64_t modifier, enum pipe_format format)
|
||||
{
|
||||
if (!drm_is_afbc(modifier))
|
||||
return pan_image_block_size(modifier, format);
|
||||
return pan_image_block_size_el(modifier, format);
|
||||
|
||||
return pan_afbc_renderblock_size(modifier);
|
||||
}
|
||||
|
|
@ -120,86 +120,87 @@ format_minimum_alignment(unsigned arch, enum pipe_format format, uint64_t mod)
|
|||
|
||||
static void
|
||||
init_slice_crc_info(unsigned arch, struct pan_image_slice_layout *slice,
|
||||
unsigned width, unsigned height, unsigned offset)
|
||||
unsigned width_px, unsigned height_px, unsigned offset_B)
|
||||
{
|
||||
unsigned checksum_region_size = pan_meta_tile_size(arch);
|
||||
unsigned checksum_region_size_px = pan_meta_tile_size(arch);
|
||||
unsigned checksum_x_tile_per_region =
|
||||
(checksum_region_size / CHECKSUM_TILE_WIDTH);
|
||||
(checksum_region_size_px / CHECKSUM_TILE_WIDTH);
|
||||
unsigned checksum_y_tile_per_region =
|
||||
(checksum_region_size / CHECKSUM_TILE_HEIGHT);
|
||||
(checksum_region_size_px / CHECKSUM_TILE_HEIGHT);
|
||||
|
||||
unsigned tile_count_x =
|
||||
checksum_x_tile_per_region * DIV_ROUND_UP(width, checksum_region_size);
|
||||
unsigned tile_count_y =
|
||||
checksum_y_tile_per_region * DIV_ROUND_UP(height, checksum_region_size);
|
||||
unsigned tile_count_x = checksum_x_tile_per_region *
|
||||
DIV_ROUND_UP(width_px, checksum_region_size_px);
|
||||
unsigned tile_count_y = checksum_y_tile_per_region *
|
||||
DIV_ROUND_UP(height_px, checksum_region_size_px);
|
||||
|
||||
slice->crc.offset = offset;
|
||||
slice->crc.stride = tile_count_x * CHECKSUM_BYTES_PER_TILE;
|
||||
slice->crc.size = slice->crc.stride * tile_count_y;
|
||||
slice->crc.offset_B = offset_B;
|
||||
slice->crc.stride_B = tile_count_x * CHECKSUM_BYTES_PER_TILE;
|
||||
slice->crc.size_B = slice->crc.stride_B * tile_count_y;
|
||||
}
|
||||
|
||||
unsigned
|
||||
pan_image_surface_stride(const struct pan_image_layout *layout, unsigned level)
|
||||
{
|
||||
if (layout->dim != MALI_TEXTURE_DIMENSION_3D)
|
||||
return layout->array_stride;
|
||||
return layout->array_stride_B;
|
||||
else if (drm_is_afbc(layout->modifier))
|
||||
return layout->slices[level].afbc.surface_stride;
|
||||
return layout->slices[level].afbc.surface_stride_B;
|
||||
else
|
||||
return layout->slices[level].surface_stride;
|
||||
return layout->slices[level].surface_stride_B;
|
||||
}
|
||||
|
||||
struct pan_image_wsi_layout
|
||||
pan_image_layout_get_wsi_layout(const struct pan_image_layout *layout,
|
||||
unsigned level)
|
||||
{
|
||||
unsigned row_stride = layout->slices[level].row_stride;
|
||||
struct pan_image_block_size block_size =
|
||||
pan_image_renderblock_size(layout->modifier, layout->format);
|
||||
unsigned row_stride_B = layout->slices[level].row_stride_B;
|
||||
struct pan_image_block_size block_size_el =
|
||||
pan_image_renderblock_size_el(layout->modifier, layout->format);
|
||||
|
||||
if (drm_is_afbc(layout->modifier)) {
|
||||
unsigned width = u_minify(layout->width, level);
|
||||
unsigned alignment =
|
||||
block_size.width * pan_afbc_tile_size(layout->modifier);
|
||||
unsigned width_px = u_minify(layout->extent_px.width, level);
|
||||
unsigned alignment_B =
|
||||
block_size_el.width * pan_afbc_tile_size(layout->modifier);
|
||||
|
||||
width = ALIGN_POT(width, alignment);
|
||||
width_px = ALIGN_POT(width_px, alignment_B);
|
||||
return (struct pan_image_wsi_layout){
|
||||
.offset_B = layout->slices[level].offset,
|
||||
.row_pitch_B = width * util_format_get_blocksize(layout->format),
|
||||
.offset_B = layout->slices[level].offset_B,
|
||||
.row_pitch_B = width_px * util_format_get_blocksize(layout->format),
|
||||
};
|
||||
} else if (drm_is_afrc(layout->modifier)) {
|
||||
struct pan_image_block_size tile_size =
|
||||
struct pan_image_block_size tile_size_px =
|
||||
pan_afrc_tile_size(layout->format, layout->modifier);
|
||||
|
||||
return (struct pan_image_wsi_layout){
|
||||
.offset_B = layout->slices[level].offset,
|
||||
.row_pitch_B = row_stride / tile_size.height,
|
||||
.offset_B = layout->slices[level].offset_B,
|
||||
.row_pitch_B = row_stride_B / tile_size_px.height,
|
||||
};
|
||||
} else {
|
||||
return (struct pan_image_wsi_layout){
|
||||
.offset_B = layout->slices[level].offset,
|
||||
.row_pitch_B = row_stride / block_size.height,
|
||||
.offset_B = layout->slices[level].offset_B,
|
||||
.row_pitch_B = row_stride_B / block_size_el.height,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
static unsigned
|
||||
wsi_row_pitch_to_row_stride(unsigned wsi_row_pitch, enum pipe_format format,
|
||||
wsi_row_pitch_to_row_stride(unsigned wsi_row_pitch_B, enum pipe_format format,
|
||||
uint64_t modifier)
|
||||
{
|
||||
struct pan_image_block_size block_size =
|
||||
pan_image_renderblock_size(modifier, format);
|
||||
|
||||
if (drm_is_afbc(modifier)) {
|
||||
unsigned width = wsi_row_pitch / util_format_get_blocksize(format);
|
||||
unsigned width_px = wsi_row_pitch_B / util_format_get_blocksize(format);
|
||||
|
||||
return pan_afbc_row_stride(modifier, width);
|
||||
return pan_afbc_row_stride(modifier, width_px);
|
||||
} else if (drm_is_afrc(modifier)) {
|
||||
struct pan_image_block_size tile_size = pan_afrc_tile_size(format, modifier);
|
||||
struct pan_image_block_size tile_size_px =
|
||||
pan_afrc_tile_size(format, modifier);
|
||||
|
||||
return wsi_row_pitch * tile_size.height;
|
||||
return wsi_row_pitch_B * tile_size_px.height;
|
||||
} else {
|
||||
return wsi_row_pitch * block_size.height;
|
||||
struct pan_image_block_size block_size_el =
|
||||
pan_image_renderblock_size_el(modifier, format);
|
||||
|
||||
return wsi_row_pitch_B * block_size_el.height;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -210,8 +211,9 @@ unsigned
|
|||
pan_image_surface_offset(const struct pan_image_layout *layout, unsigned level,
|
||||
unsigned array_idx, unsigned surface_idx)
|
||||
{
|
||||
return layout->slices[level].offset + (array_idx * layout->array_stride) +
|
||||
(surface_idx * layout->slices[level].surface_stride);
|
||||
return layout->slices[level].offset_B +
|
||||
(array_idx * layout->array_stride_B) +
|
||||
(surface_idx * layout->slices[level].surface_stride_B);
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
@ -222,32 +224,32 @@ pan_image_layout_init(unsigned arch, struct pan_image_layout *layout,
|
|||
* 2D image without CRC.
|
||||
*/
|
||||
if (wsi_layout &&
|
||||
(layout->depth > 1 || layout->nr_samples > 1 || layout->array_size > 1 ||
|
||||
layout->dim != MALI_TEXTURE_DIMENSION_2D || layout->nr_slices > 1 ||
|
||||
layout->crc))
|
||||
(layout->extent_px.depth > 1 || layout->nr_samples > 1 ||
|
||||
layout->array_size > 1 || layout->dim != MALI_TEXTURE_DIMENSION_2D ||
|
||||
layout->nr_slices > 1 || layout->crc))
|
||||
return false;
|
||||
|
||||
bool afbc = drm_is_afbc(layout->modifier);
|
||||
bool afrc = drm_is_afrc(layout->modifier);
|
||||
int align_req =
|
||||
int align_req_B =
|
||||
format_minimum_alignment(arch, layout->format, layout->modifier);
|
||||
uint64_t offset = 0, wsi_row_stride = 0;
|
||||
uint64_t offset_B = 0, wsi_row_stride_B = 0;
|
||||
|
||||
/* Mandate alignment */
|
||||
if (wsi_layout) {
|
||||
bool rejected = false;
|
||||
|
||||
int align_mask = align_req - 1;
|
||||
int align_mask = align_req_B - 1;
|
||||
|
||||
offset = wsi_layout->offset_B;
|
||||
wsi_row_stride = wsi_row_pitch_to_row_stride(
|
||||
offset_B = wsi_layout->offset_B;
|
||||
wsi_row_stride_B = wsi_row_pitch_to_row_stride(
|
||||
wsi_layout->row_pitch_B, layout->format, layout->modifier);
|
||||
|
||||
if (arch >= 7) {
|
||||
rejected = ((offset & align_mask) ||
|
||||
(wsi_row_stride & align_mask));
|
||||
rejected =
|
||||
((offset_B & align_mask) || (wsi_row_stride_B & align_mask));
|
||||
} else {
|
||||
rejected = (offset & align_mask);
|
||||
rejected = (offset_B & align_mask);
|
||||
}
|
||||
|
||||
if (rejected) {
|
||||
|
|
@ -258,142 +260,144 @@ pan_image_layout_init(unsigned arch, struct pan_image_layout *layout,
|
|||
}
|
||||
}
|
||||
|
||||
unsigned fmt_blocksize = util_format_get_blocksize(layout->format);
|
||||
unsigned fmt_blocksize_B = util_format_get_blocksize(layout->format);
|
||||
|
||||
/* MSAA is implemented as a 3D texture with z corresponding to the
|
||||
* sample #, horrifyingly enough */
|
||||
|
||||
assert(layout->depth == 1 || layout->nr_samples == 1);
|
||||
assert(layout->extent_px.depth == 1 || layout->nr_samples == 1);
|
||||
|
||||
bool linear = layout->modifier == DRM_FORMAT_MOD_LINEAR;
|
||||
bool is_3d = layout->dim == MALI_TEXTURE_DIMENSION_3D;
|
||||
|
||||
struct pan_image_block_size renderblk_size =
|
||||
pan_image_renderblock_size(layout->modifier, layout->format);
|
||||
struct pan_image_block_size block_size =
|
||||
pan_image_block_size(layout->modifier, layout->format);
|
||||
struct pan_image_block_size renderblk_size_el =
|
||||
pan_image_renderblock_size_el(layout->modifier, layout->format);
|
||||
struct pan_image_block_size block_size_el =
|
||||
pan_image_block_size_el(layout->modifier, layout->format);
|
||||
|
||||
unsigned width = layout->width;
|
||||
unsigned height = layout->height;
|
||||
unsigned depth = layout->depth;
|
||||
unsigned width_px = layout->extent_px.width;
|
||||
unsigned height_px = layout->extent_px.height;
|
||||
unsigned depth_px = layout->extent_px.depth;
|
||||
|
||||
unsigned align_w = renderblk_size.width;
|
||||
unsigned align_h = renderblk_size.height;
|
||||
unsigned align_w_el = renderblk_size_el.width;
|
||||
unsigned align_h_el = renderblk_size_el.height;
|
||||
|
||||
/* For tiled AFBC, align to tiles of superblocks (this can be large) */
|
||||
if (afbc) {
|
||||
align_w *= pan_afbc_tile_size(layout->modifier);
|
||||
align_h *= pan_afbc_tile_size(layout->modifier);
|
||||
align_w_el *= pan_afbc_tile_size(layout->modifier);
|
||||
align_h_el *= pan_afbc_tile_size(layout->modifier);
|
||||
}
|
||||
|
||||
for (unsigned l = 0; l < layout->nr_slices; ++l) {
|
||||
struct pan_image_slice_layout *slice = &layout->slices[l];
|
||||
|
||||
unsigned effective_width =
|
||||
ALIGN_POT(util_format_get_nblocksx(layout->format, width), align_w);
|
||||
unsigned effective_height =
|
||||
ALIGN_POT(util_format_get_nblocksy(layout->format, height), align_h);
|
||||
unsigned row_stride;
|
||||
unsigned effective_width_el = ALIGN_POT(
|
||||
util_format_get_nblocksx(layout->format, width_px), align_w_el);
|
||||
unsigned effective_height_el = ALIGN_POT(
|
||||
util_format_get_nblocksy(layout->format, height_px), align_h_el);
|
||||
unsigned row_stride_B;
|
||||
|
||||
/* Align levels to cache-line as a performance improvement for
|
||||
* linear/tiled and as a requirement for AFBC */
|
||||
|
||||
offset = ALIGN_POT(offset, pan_image_slice_align(layout->modifier));
|
||||
offset_B = ALIGN_POT(offset_B, pan_image_slice_align(layout->modifier));
|
||||
|
||||
slice->offset = offset;
|
||||
slice->offset_B = offset_B;
|
||||
|
||||
if (afrc) {
|
||||
row_stride = pan_afrc_row_stride(layout->format, layout->modifier,
|
||||
effective_width);
|
||||
row_stride_B = pan_afrc_row_stride(layout->format, layout->modifier,
|
||||
effective_width_el);
|
||||
} else {
|
||||
row_stride = fmt_blocksize * effective_width * block_size.height;
|
||||
row_stride_B =
|
||||
fmt_blocksize_B * effective_width_el * block_size_el.height;
|
||||
}
|
||||
|
||||
/* On v7+ row_stride and offset alignment requirement are equal */
|
||||
if (arch >= 7) {
|
||||
row_stride = ALIGN_POT(row_stride, align_req);
|
||||
row_stride_B = ALIGN_POT(row_stride_B, align_req_B);
|
||||
}
|
||||
|
||||
if (wsi_layout && !afbc && !afrc) {
|
||||
/* Make sure the explicit stride is valid */
|
||||
if (wsi_row_stride < row_stride) {
|
||||
if (wsi_row_stride_B < row_stride_B) {
|
||||
mesa_loge("panfrost: rejecting image due to invalid row stride.\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
row_stride = wsi_row_stride;
|
||||
row_stride_B = wsi_row_stride_B;
|
||||
} else if (linear) {
|
||||
/* Keep lines alignment on 64 byte for performance */
|
||||
row_stride = ALIGN_POT(row_stride, 64);
|
||||
row_stride_B = ALIGN_POT(row_stride_B, 64);
|
||||
}
|
||||
|
||||
uint64_t slice_one_size =
|
||||
(uint64_t)row_stride * (effective_height / block_size.height);
|
||||
uint64_t slice_one_size_B =
|
||||
(uint64_t)row_stride_B * (effective_height_el / block_size_el.height);
|
||||
|
||||
/* Compute AFBC sizes if necessary */
|
||||
if (afbc) {
|
||||
slice->row_stride =
|
||||
pan_afbc_row_stride(layout->modifier, effective_width);
|
||||
slice->afbc.stride = effective_width / block_size.width;
|
||||
slice->afbc.nr_blocks =
|
||||
slice->afbc.stride * (effective_height / block_size.height);
|
||||
slice->afbc.header_size =
|
||||
ALIGN_POT(slice->afbc.nr_blocks * AFBC_HEADER_BYTES_PER_TILE,
|
||||
slice->row_stride_B =
|
||||
pan_afbc_row_stride(layout->modifier, effective_width_el);
|
||||
slice->afbc.stride_sb = effective_width_el / block_size_el.width;
|
||||
slice->afbc.nr_sblocks = slice->afbc.stride_sb *
|
||||
(effective_height_el / block_size_el.height);
|
||||
slice->afbc.header_size_B =
|
||||
ALIGN_POT(slice->afbc.nr_sblocks * AFBC_HEADER_BYTES_PER_TILE,
|
||||
pan_afbc_body_align(arch, layout->modifier));
|
||||
|
||||
if (wsi_layout && wsi_row_stride < slice->row_stride) {
|
||||
if (wsi_layout && wsi_row_stride_B < slice->row_stride_B) {
|
||||
mesa_loge("panfrost: rejecting image due to invalid row stride.\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
/* AFBC body size */
|
||||
slice->afbc.body_size = slice_one_size;
|
||||
slice->afbc.body_size_B = slice_one_size_B;
|
||||
|
||||
/* 3D AFBC resources have all headers placed at the
|
||||
* beginning instead of having them split per depth
|
||||
* level
|
||||
*/
|
||||
if (is_3d) {
|
||||
slice->afbc.surface_stride = slice->afbc.header_size;
|
||||
slice->afbc.header_size *= depth;
|
||||
slice->afbc.body_size *= depth;
|
||||
offset += slice->afbc.header_size;
|
||||
slice->afbc.surface_stride_B = slice->afbc.header_size_B;
|
||||
slice->afbc.header_size_B *= depth_px;
|
||||
slice->afbc.body_size_B *= depth_px;
|
||||
offset_B += slice->afbc.header_size_B;
|
||||
} else {
|
||||
slice_one_size += slice->afbc.header_size;
|
||||
slice->afbc.surface_stride = slice_one_size;
|
||||
slice_one_size_B += slice->afbc.header_size_B;
|
||||
slice->afbc.surface_stride_B = slice_one_size_B;
|
||||
}
|
||||
} else {
|
||||
slice->row_stride = row_stride;
|
||||
slice->row_stride_B = row_stride_B;
|
||||
}
|
||||
|
||||
uint64_t slice_full_size = slice_one_size * depth * layout->nr_samples;
|
||||
uint64_t slice_full_size_B =
|
||||
slice_one_size_B * depth_px * layout->nr_samples;
|
||||
|
||||
slice->surface_stride = slice_one_size;
|
||||
slice->surface_stride_B = slice_one_size_B;
|
||||
|
||||
/* Compute AFBC sizes if necessary */
|
||||
|
||||
offset += slice_full_size;
|
||||
slice->size = slice_full_size;
|
||||
offset_B += slice_full_size_B;
|
||||
slice->size_B = slice_full_size_B;
|
||||
|
||||
/* Add a checksum region if necessary */
|
||||
if (layout->crc) {
|
||||
init_slice_crc_info(arch, slice, width, height, offset);
|
||||
offset += slice->crc.size;
|
||||
slice->size += slice->crc.size;
|
||||
init_slice_crc_info(arch, slice, width_px, height_px, offset_B);
|
||||
offset_B += slice->crc.size_B;
|
||||
slice->size_B += slice->crc.size_B;
|
||||
}
|
||||
|
||||
width = u_minify(width, 1);
|
||||
height = u_minify(height, 1);
|
||||
depth = u_minify(depth, 1);
|
||||
width_px = u_minify(width_px, 1);
|
||||
height_px = u_minify(height_px, 1);
|
||||
depth_px = u_minify(depth_px, 1);
|
||||
}
|
||||
|
||||
/* Arrays and cubemaps have the entire miptree duplicated */
|
||||
layout->array_stride = ALIGN_POT(offset, 64);
|
||||
layout->array_stride_B = ALIGN_POT(offset_B, 64);
|
||||
if (wsi_layout)
|
||||
layout->data_size = offset;
|
||||
layout->data_size_B = offset_B;
|
||||
else
|
||||
layout->data_size = ALIGN_POT(
|
||||
(uint64_t)layout->array_stride * (uint64_t)layout->array_size, 4096);
|
||||
layout->data_size_B = ALIGN_POT(
|
||||
(uint64_t)layout->array_stride_B * (uint64_t)layout->array_size, 4096);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ extern "C" {
|
|||
#define MAX_IMAGE_PLANES 3
|
||||
|
||||
struct pan_image_slice_layout {
|
||||
unsigned offset;
|
||||
unsigned offset_B;
|
||||
|
||||
/* For AFBC images, the number of bytes between two rows of AFBC
|
||||
* headers.
|
||||
|
|
@ -32,22 +32,22 @@ struct pan_image_slice_layout {
|
|||
* images that are compressed or interleaved, this will be greater than
|
||||
* the logical stride.
|
||||
*/
|
||||
unsigned row_stride;
|
||||
unsigned row_stride_B;
|
||||
|
||||
unsigned surface_stride;
|
||||
unsigned surface_stride_B;
|
||||
|
||||
struct {
|
||||
/* Stride in number of superblocks */
|
||||
unsigned stride;
|
||||
unsigned stride_sb;
|
||||
|
||||
/* Number of superblocks */
|
||||
unsigned nr_blocks;
|
||||
unsigned nr_sblocks;
|
||||
|
||||
/* Size of the AFBC header preceding each slice */
|
||||
unsigned header_size;
|
||||
unsigned header_size_B;
|
||||
|
||||
/* Size of the AFBC body */
|
||||
unsigned body_size;
|
||||
unsigned body_size_B;
|
||||
|
||||
/* Stride between AFBC headers of two consecutive surfaces.
|
||||
* For 3D textures, this must be set to header size since
|
||||
|
|
@ -55,24 +55,30 @@ struct pan_image_slice_layout {
|
|||
* should be set to size0, since AFBC headers are placed at
|
||||
* the beginning of each layer
|
||||
*/
|
||||
unsigned surface_stride;
|
||||
unsigned surface_stride_B;
|
||||
} afbc;
|
||||
|
||||
/* If checksumming is enabled following the slice, what
|
||||
* is its offset/stride? */
|
||||
struct {
|
||||
unsigned offset;
|
||||
unsigned stride;
|
||||
unsigned size;
|
||||
unsigned offset_B;
|
||||
unsigned stride_B;
|
||||
unsigned size_B;
|
||||
} crc;
|
||||
|
||||
unsigned size;
|
||||
unsigned size_B;
|
||||
};
|
||||
|
||||
struct pan_image_extent {
|
||||
unsigned width;
|
||||
unsigned height;
|
||||
unsigned depth;
|
||||
};
|
||||
|
||||
struct pan_image_layout {
|
||||
uint64_t modifier;
|
||||
enum pipe_format format;
|
||||
unsigned width, height, depth;
|
||||
struct pan_image_extent extent_px;
|
||||
unsigned nr_samples;
|
||||
enum mali_texture_dimension dim;
|
||||
unsigned nr_slices;
|
||||
|
|
@ -85,8 +91,8 @@ struct pan_image_layout {
|
|||
|
||||
struct pan_image_slice_layout slices[MAX_MIP_LEVELS];
|
||||
|
||||
uint64_t data_size;
|
||||
uint64_t array_stride;
|
||||
uint64_t data_size_B;
|
||||
uint64_t array_stride_B;
|
||||
};
|
||||
|
||||
struct pan_image_wsi_layout {
|
||||
|
|
@ -115,11 +121,11 @@ pan_image_slice_align(uint64_t modifier)
|
|||
return 64;
|
||||
}
|
||||
|
||||
struct pan_image_block_size pan_image_block_size(uint64_t modifier,
|
||||
enum pipe_format format);
|
||||
struct pan_image_block_size pan_image_block_size_el(uint64_t modifier,
|
||||
enum pipe_format format);
|
||||
|
||||
struct pan_image_block_size pan_image_renderblock_size(uint64_t modifier,
|
||||
enum pipe_format format);
|
||||
struct pan_image_block_size
|
||||
pan_image_renderblock_size_el(uint64_t modifier, enum pipe_format format);
|
||||
|
||||
unsigned pan_image_surface_stride(const struct pan_image_layout *layout,
|
||||
unsigned level);
|
||||
|
|
@ -132,11 +138,11 @@ static inline uint64_t
|
|||
pan_image_mip_level_size(const struct pan_image_layout *layout, unsigned level)
|
||||
{
|
||||
assert(level < layout->nr_slices);
|
||||
uint64_t size = layout->slices[level].size;
|
||||
uint64_t size = layout->slices[level].size_B;
|
||||
|
||||
/* If this is an array, we need to cover the whole array. */
|
||||
if (layout->array_size > 1)
|
||||
size += (uint64_t)layout->array_stride * (layout->array_size - 1);
|
||||
size += layout->array_stride_B * (layout->array_size - 1);
|
||||
|
||||
return size;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -183,18 +183,18 @@ GENX(pan_texture_estimate_payload_size)(const struct pan_image_view *iview)
|
|||
|
||||
static void
|
||||
pan_get_surface_strides(const struct pan_image_layout *layout, unsigned l,
|
||||
int32_t *row_stride, int32_t *surf_stride)
|
||||
int32_t *row_stride_B, int32_t *surf_stride_B)
|
||||
{
|
||||
const struct pan_image_slice_layout *slice = &layout->slices[l];
|
||||
|
||||
if (drm_is_afbc(layout->modifier)) {
|
||||
/* Pre v7 don't have a row stride field. This field is
|
||||
* repurposed as a Y offset which we don't use */
|
||||
*row_stride = PAN_ARCH < 7 ? 0 : slice->row_stride;
|
||||
*surf_stride = slice->afbc.surface_stride;
|
||||
*row_stride_B = PAN_ARCH < 7 ? 0 : slice->row_stride_B;
|
||||
*surf_stride_B = slice->afbc.surface_stride_B;
|
||||
} else {
|
||||
*row_stride = slice->row_stride;
|
||||
*surf_stride = slice->surface_stride;
|
||||
*row_stride_B = slice->row_stride_B;
|
||||
*surf_stride_B = slice->surface_stride_B;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -208,7 +208,7 @@ pan_get_surface_pointer(const struct pan_image_layout *layout,
|
|||
if (layout->dim == MALI_TEXTURE_DIMENSION_3D) {
|
||||
assert(!s);
|
||||
offset =
|
||||
layout->slices[l].offset + i * pan_image_surface_stride(layout, l);
|
||||
layout->slices[l].offset_B + i * pan_image_surface_stride(layout, l);
|
||||
} else {
|
||||
offset = pan_image_surface_offset(layout, l, i, s);
|
||||
}
|
||||
|
|
@ -288,32 +288,26 @@ pan_emit_multiplanar_surface(const struct pan_image_section_info *sections,
|
|||
}
|
||||
#endif
|
||||
|
||||
struct pan_tex_extent {
|
||||
unsigned width;
|
||||
unsigned height;
|
||||
unsigned depth;
|
||||
};
|
||||
|
||||
/* Special case for iview->buf.size as the passed layout->width is incorrect */
|
||||
static struct pan_tex_extent
|
||||
static struct pan_image_extent
|
||||
pan_texture_buf_get_extent(const struct pan_image_view *iview,
|
||||
const struct pan_image_layout *layout)
|
||||
{
|
||||
assert(iview->buf.size);
|
||||
|
||||
struct pan_tex_extent extent;
|
||||
struct pan_image_extent extent_px;
|
||||
|
||||
assert(iview->dim == MALI_TEXTURE_DIMENSION_1D);
|
||||
assert(!iview->first_level && !iview->last_level);
|
||||
assert(!iview->first_layer && !iview->last_layer);
|
||||
assert(layout->nr_samples == 1);
|
||||
assert(layout->height == 1 && layout->depth == 1);
|
||||
assert(iview->buf.offset + iview->buf.size <= layout->width);
|
||||
extent.width = iview->buf.size;
|
||||
extent.height = 1;
|
||||
extent.depth = 1;
|
||||
assert(layout->extent_px.height == 1 && layout->extent_px.depth == 1);
|
||||
assert(iview->buf.offset + iview->buf.size <= layout->extent_px.width);
|
||||
extent_px.width = iview->buf.size;
|
||||
extent_px.height = 1;
|
||||
extent_px.depth = 1;
|
||||
|
||||
return extent;
|
||||
return extent_px;
|
||||
}
|
||||
|
||||
#if PAN_ARCH >= 9
|
||||
|
|
@ -464,14 +458,14 @@ pan_emit_plane(const struct pan_image_view *iview,
|
|||
pan_cast_and_pack(*payload, PLANE, cfg) {
|
||||
cfg.pointer = pointer;
|
||||
cfg.row_stride = row_stride;
|
||||
cfg.size = layout->slices[level].size;
|
||||
cfg.size = layout->slices[level].size_B;
|
||||
#if PAN_ARCH >= 10
|
||||
struct pan_tex_extent extent;
|
||||
struct pan_image_extent extent;
|
||||
if (iview->buf.size)
|
||||
extent = pan_texture_buf_get_extent(iview, layout);
|
||||
else {
|
||||
extent.width = u_minify(layout->width, level);
|
||||
extent.height = u_minify(layout->height, level);
|
||||
extent.width = u_minify(layout->extent_px.width, level);
|
||||
extent.height = u_minify(layout->extent_px.height, level);
|
||||
}
|
||||
|
||||
if (is_chroma_2p) {
|
||||
|
|
@ -526,7 +520,7 @@ pan_emit_plane(const struct pan_image_view *iview,
|
|||
cfg.afbc.tiled_header = (layout->modifier & AFBC_FORMAT_MOD_TILED);
|
||||
cfg.afbc.prefetch = true;
|
||||
cfg.afbc.compression_mode = pan_afbc_compression_mode(iview->format);
|
||||
cfg.afbc.header_stride = layout->slices[level].afbc.header_size;
|
||||
cfg.afbc.header_stride = layout->slices[level].afbc.header_size_B;
|
||||
} else if (afrc) {
|
||||
#if PAN_ARCH >= 10
|
||||
struct pan_afrc_format_info finfo =
|
||||
|
|
@ -759,32 +753,34 @@ pan_texture_get_array_size(const struct pan_image_view *iview)
|
|||
return array_size;
|
||||
}
|
||||
|
||||
static struct pan_tex_extent
|
||||
static struct pan_image_extent
|
||||
pan_texture_get_extent(const struct pan_image_view *iview,
|
||||
const struct pan_image_layout *layout)
|
||||
{
|
||||
if (iview->buf.size)
|
||||
return pan_texture_buf_get_extent(iview, layout);
|
||||
|
||||
struct pan_tex_extent extent;
|
||||
extent.width = u_minify(layout->width, iview->first_level);
|
||||
extent.height = u_minify(layout->height, iview->first_level);
|
||||
extent.depth = u_minify(layout->depth, iview->first_level);
|
||||
struct pan_image_extent extent_px = {
|
||||
.width = u_minify(layout->extent_px.width, iview->first_level),
|
||||
.height = u_minify(layout->extent_px.height, iview->first_level),
|
||||
.depth = u_minify(layout->extent_px.depth, iview->first_level),
|
||||
};
|
||||
|
||||
if (util_format_is_compressed(layout->format) &&
|
||||
!util_format_is_compressed(iview->format)) {
|
||||
extent.width =
|
||||
DIV_ROUND_UP(extent.width, util_format_get_blockwidth(layout->format));
|
||||
extent.height = DIV_ROUND_UP(extent.height,
|
||||
util_format_get_blockheight(layout->format));
|
||||
extent.depth =
|
||||
DIV_ROUND_UP(extent.depth, util_format_get_blockdepth(layout->format));
|
||||
extent_px.width = DIV_ROUND_UP(
|
||||
extent_px.width, util_format_get_blockwidth(layout->format));
|
||||
extent_px.height = DIV_ROUND_UP(
|
||||
extent_px.height, util_format_get_blockheight(layout->format));
|
||||
extent_px.depth = DIV_ROUND_UP(
|
||||
extent_px.depth, util_format_get_blockdepth(layout->format));
|
||||
assert(util_format_get_blockwidth(iview->format) == 1);
|
||||
assert(util_format_get_blockheight(iview->format) == 1);
|
||||
assert(util_format_get_blockheight(iview->format) == 1);
|
||||
assert(iview->last_level == iview->first_level);
|
||||
}
|
||||
|
||||
return extent;
|
||||
return extent_px;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -816,16 +812,16 @@ GENX(pan_texture_emit)(const struct pan_image_view *iview,
|
|||
|
||||
unsigned array_size = pan_texture_get_array_size(iview);
|
||||
|
||||
struct pan_tex_extent extent =
|
||||
struct pan_image_extent extent_px =
|
||||
pan_texture_get_extent(iview, layout);
|
||||
|
||||
pan_pack(out, TEXTURE, cfg) {
|
||||
cfg.dimension = iview->dim;
|
||||
cfg.format = mali_format;
|
||||
cfg.width = extent.width;
|
||||
cfg.height = extent.height;
|
||||
cfg.width = extent_px.width;
|
||||
cfg.height = extent_px.height;
|
||||
if (iview->dim == MALI_TEXTURE_DIMENSION_3D)
|
||||
cfg.depth = extent.depth;
|
||||
cfg.depth = extent_px.depth;
|
||||
else
|
||||
cfg.sample_count = layout->nr_samples;
|
||||
cfg.swizzle = pan_translate_swizzle_4(iview->swizzle);
|
||||
|
|
@ -876,7 +872,7 @@ GENX(pan_storage_texture_emit)(const struct pan_image_view *iview,
|
|||
|
||||
unsigned array_size = pan_texture_get_array_size(iview);
|
||||
|
||||
struct pan_tex_extent extent =
|
||||
struct pan_image_extent extent_px =
|
||||
pan_texture_get_extent(iview, layout);
|
||||
|
||||
static const unsigned char rgba_swizzle[4] = {
|
||||
|
|
@ -889,10 +885,10 @@ GENX(pan_storage_texture_emit)(const struct pan_image_view *iview,
|
|||
pan_pack(out, TEXTURE, cfg) {
|
||||
cfg.dimension = iview->dim;
|
||||
cfg.format = mali_format;
|
||||
cfg.width = extent.width;
|
||||
cfg.height = extent.height;
|
||||
cfg.width = extent_px.width;
|
||||
cfg.height = extent_px.height;
|
||||
if (iview->dim == MALI_TEXTURE_DIMENSION_3D)
|
||||
cfg.depth = extent.depth;
|
||||
cfg.depth = extent_px.depth;
|
||||
else
|
||||
cfg.sample_count = layout->nr_samples;
|
||||
cfg.texel_interleave = (layout->modifier != DRM_FORMAT_MOD_LINEAR) ||
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ TEST(BlockSize, Linear)
|
|||
|
||||
for (unsigned i = 0; i < ARRAY_SIZE(format); ++i) {
|
||||
struct pan_image_block_size blk =
|
||||
pan_image_block_size(DRM_FORMAT_MOD_LINEAR, format[i]);
|
||||
pan_image_block_size_el(DRM_FORMAT_MOD_LINEAR, format[i]);
|
||||
|
||||
EXPECT_EQ(blk.width, 1);
|
||||
EXPECT_EQ(blk.height, 1);
|
||||
|
|
@ -49,7 +49,7 @@ TEST(BlockSize, UInterleavedRegular)
|
|||
};
|
||||
|
||||
for (unsigned i = 0; i < ARRAY_SIZE(format); ++i) {
|
||||
struct pan_image_block_size blk = pan_image_block_size(
|
||||
struct pan_image_block_size blk = pan_image_block_size_el(
|
||||
DRM_FORMAT_MOD_ARM_16X16_BLOCK_U_INTERLEAVED, format[i]);
|
||||
|
||||
EXPECT_EQ(blk.width, 16);
|
||||
|
|
@ -62,7 +62,7 @@ TEST(BlockSize, UInterleavedBlockCompressed)
|
|||
enum pipe_format format[] = {PIPE_FORMAT_ETC2_RGB8, PIPE_FORMAT_ASTC_5x5};
|
||||
|
||||
for (unsigned i = 0; i < ARRAY_SIZE(format); ++i) {
|
||||
struct pan_image_block_size blk = pan_image_block_size(
|
||||
struct pan_image_block_size blk = pan_image_block_size_el(
|
||||
DRM_FORMAT_MOD_ARM_16X16_BLOCK_U_INTERLEAVED, format[i]);
|
||||
|
||||
EXPECT_EQ(blk.width, 4);
|
||||
|
|
@ -82,7 +82,7 @@ TEST(BlockSize, AFBCFormatInvariant16x16)
|
|||
|
||||
for (unsigned i = 0; i < ARRAY_SIZE(format); ++i) {
|
||||
struct pan_image_block_size blk =
|
||||
pan_image_block_size(modifier, format[i]);
|
||||
pan_image_block_size_el(modifier, format[i]);
|
||||
|
||||
EXPECT_EQ(blk.width, 16);
|
||||
EXPECT_EQ(blk.height, 16);
|
||||
|
|
@ -101,7 +101,7 @@ TEST(BlockSize, AFBCFormatInvariant32x8)
|
|||
|
||||
for (unsigned i = 0; i < ARRAY_SIZE(format); ++i) {
|
||||
struct pan_image_block_size blk =
|
||||
pan_image_block_size(modifier, format[i]);
|
||||
pan_image_block_size_el(modifier, format[i]);
|
||||
|
||||
EXPECT_EQ(blk.width, 32);
|
||||
EXPECT_EQ(blk.height, 8);
|
||||
|
|
@ -233,9 +233,11 @@ row_stride_from_wsi_pitch(unsigned row_pitch_B, unsigned width_px,
|
|||
struct pan_image_layout l = {
|
||||
.modifier = mod,
|
||||
.format = fmt,
|
||||
.width = width_px,
|
||||
.height = 1,
|
||||
.depth = 1,
|
||||
.extent_px = {
|
||||
.width = width_px,
|
||||
.height = 1,
|
||||
.depth = 1,
|
||||
},
|
||||
.nr_samples = 1,
|
||||
.dim = MALI_TEXTURE_DIMENSION_2D,
|
||||
.nr_slices = 1,
|
||||
|
|
@ -244,7 +246,7 @@ row_stride_from_wsi_pitch(unsigned row_pitch_B, unsigned width_px,
|
|||
|
||||
pan_image_layout_init(0, &l, &wsi_l);
|
||||
|
||||
return l.slices[0].row_stride;
|
||||
return l.slices[0].row_stride_B;
|
||||
}
|
||||
|
||||
TEST(WSI, FromWSILinear)
|
||||
|
|
@ -298,12 +300,15 @@ TEST(Layout, ImplicitLayoutInterleavedETC2)
|
|||
struct pan_image_layout l = {
|
||||
.modifier = DRM_FORMAT_MOD_ARM_16X16_BLOCK_U_INTERLEAVED,
|
||||
.format = PIPE_FORMAT_ETC2_RGB8,
|
||||
.width = 128,
|
||||
.height = 128,
|
||||
.depth = 1,
|
||||
.extent_px = {
|
||||
.width = 128,
|
||||
.height = 128,
|
||||
.depth = 1,
|
||||
},
|
||||
.nr_samples = 1,
|
||||
.dim = MALI_TEXTURE_DIMENSION_2D,
|
||||
.nr_slices = 8};
|
||||
.nr_slices = 8,
|
||||
};
|
||||
|
||||
unsigned offsets[9] = {0, 8192, 10240, 10752, 10880,
|
||||
11008, 11136, 11264, 11392};
|
||||
|
|
@ -312,12 +317,12 @@ TEST(Layout, ImplicitLayoutInterleavedETC2)
|
|||
|
||||
for (unsigned i = 0; i < 8; ++i) {
|
||||
unsigned size = (offsets[i + 1] - offsets[i]);
|
||||
EXPECT_EQ(l.slices[i].offset, offsets[i]);
|
||||
EXPECT_EQ(l.slices[i].offset_B, offsets[i]);
|
||||
|
||||
if (size == 64)
|
||||
EXPECT_TRUE(l.slices[i].size < 64);
|
||||
EXPECT_TRUE(l.slices[i].size_B < 64);
|
||||
else
|
||||
EXPECT_EQ(l.slices[i].size, size);
|
||||
EXPECT_EQ(l.slices[i].size_B, size);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -326,12 +331,15 @@ TEST(Layout, ImplicitLayoutInterleavedASTC5x5)
|
|||
struct pan_image_layout l = {
|
||||
.modifier = DRM_FORMAT_MOD_ARM_16X16_BLOCK_U_INTERLEAVED,
|
||||
.format = PIPE_FORMAT_ASTC_5x5,
|
||||
.width = 50,
|
||||
.height = 50,
|
||||
.depth = 1,
|
||||
.extent_px = {
|
||||
.width = 50,
|
||||
.height = 50,
|
||||
.depth = 1,
|
||||
},
|
||||
.nr_samples = 1,
|
||||
.dim = MALI_TEXTURE_DIMENSION_2D,
|
||||
.nr_slices = 1};
|
||||
.nr_slices = 1,
|
||||
};
|
||||
|
||||
ASSERT_TRUE(pan_image_layout_init(0, &l, NULL));
|
||||
|
||||
|
|
@ -341,22 +349,26 @@ TEST(Layout, ImplicitLayoutInterleavedASTC5x5)
|
|||
* 16 bytes (128-bits), so we require 2304 bytes, with a row stride of 12 *
|
||||
* 16 * 4 = 192 bytes.
|
||||
*/
|
||||
EXPECT_EQ(l.slices[0].offset, 0);
|
||||
EXPECT_EQ(l.slices[0].row_stride, 768);
|
||||
EXPECT_EQ(l.slices[0].surface_stride, 2304);
|
||||
EXPECT_EQ(l.slices[0].size, 2304);
|
||||
EXPECT_EQ(l.slices[0].offset_B, 0);
|
||||
EXPECT_EQ(l.slices[0].row_stride_B, 768);
|
||||
EXPECT_EQ(l.slices[0].surface_stride_B, 2304);
|
||||
EXPECT_EQ(l.slices[0].size_B, 2304);
|
||||
}
|
||||
|
||||
TEST(Layout, ImplicitLayoutLinearASTC5x5)
|
||||
{
|
||||
struct pan_image_layout l = {.modifier = DRM_FORMAT_MOD_LINEAR,
|
||||
.format = PIPE_FORMAT_ASTC_5x5,
|
||||
.width = 50,
|
||||
.height = 50,
|
||||
.depth = 1,
|
||||
.nr_samples = 1,
|
||||
.dim = MALI_TEXTURE_DIMENSION_2D,
|
||||
.nr_slices = 1};
|
||||
struct pan_image_layout l = {
|
||||
.modifier = DRM_FORMAT_MOD_LINEAR,
|
||||
.format = PIPE_FORMAT_ASTC_5x5,
|
||||
.extent_px = {
|
||||
.width = 50,
|
||||
.height = 50,
|
||||
.depth = 1,
|
||||
},
|
||||
.nr_samples = 1,
|
||||
.dim = MALI_TEXTURE_DIMENSION_2D,
|
||||
.nr_slices = 1,
|
||||
};
|
||||
|
||||
ASSERT_TRUE(pan_image_layout_init(0, &l, NULL));
|
||||
|
||||
|
|
@ -365,10 +377,10 @@ TEST(Layout, ImplicitLayoutLinearASTC5x5)
|
|||
* rounded up to the cache line (192 bytes). There are 10 rows, so we have
|
||||
* 1920 bytes total.
|
||||
*/
|
||||
EXPECT_EQ(l.slices[0].offset, 0);
|
||||
EXPECT_EQ(l.slices[0].row_stride, 192);
|
||||
EXPECT_EQ(l.slices[0].surface_stride, 1920);
|
||||
EXPECT_EQ(l.slices[0].size, 1920);
|
||||
EXPECT_EQ(l.slices[0].offset_B, 0);
|
||||
EXPECT_EQ(l.slices[0].row_stride_B, 192);
|
||||
EXPECT_EQ(l.slices[0].surface_stride_B, 1920);
|
||||
EXPECT_EQ(l.slices[0].size_B, 1920);
|
||||
}
|
||||
|
||||
/* dEQP-GLES3.functional.texture.format.unsized.rgba_unsigned_byte_3d_pot */
|
||||
|
|
@ -377,14 +389,18 @@ TEST(AFBCLayout, Linear3D)
|
|||
uint64_t modifier = DRM_FORMAT_MOD_ARM_AFBC(
|
||||
AFBC_FORMAT_MOD_BLOCK_SIZE_16x16 | AFBC_FORMAT_MOD_SPARSE);
|
||||
|
||||
struct pan_image_layout l = {.modifier = modifier,
|
||||
.format = PIPE_FORMAT_R8G8B8A8_UNORM,
|
||||
.width = 8,
|
||||
.height = 32,
|
||||
.depth = 16,
|
||||
.nr_samples = 1,
|
||||
.dim = MALI_TEXTURE_DIMENSION_3D,
|
||||
.nr_slices = 1};
|
||||
struct pan_image_layout l = {
|
||||
.modifier = modifier,
|
||||
.format = PIPE_FORMAT_R8G8B8A8_UNORM,
|
||||
.extent_px = {
|
||||
.width = 8,
|
||||
.height = 32,
|
||||
.depth = 16,
|
||||
},
|
||||
.nr_samples = 1,
|
||||
.dim = MALI_TEXTURE_DIMENSION_3D,
|
||||
.nr_slices = 1,
|
||||
};
|
||||
|
||||
ASSERT_TRUE(pan_image_layout_init(0, &l, NULL));
|
||||
|
||||
|
|
@ -401,13 +417,13 @@ TEST(AFBCLayout, Linear3D)
|
|||
* Each 16x16 superblock consumes 16 * 16 * 4 = 1024 bytes. There are 2 * 1 *
|
||||
* 16 superblocks in the image, so body size is 32768.
|
||||
*/
|
||||
EXPECT_EQ(l.slices[0].offset, 0);
|
||||
EXPECT_EQ(l.slices[0].row_stride, 16);
|
||||
EXPECT_EQ(l.slices[0].afbc.header_size, 1024);
|
||||
EXPECT_EQ(l.slices[0].afbc.body_size, 32768);
|
||||
EXPECT_EQ(l.slices[0].afbc.surface_stride, 64);
|
||||
EXPECT_EQ(l.slices[0].surface_stride, 2048); /* XXX: Not meaningful? */
|
||||
EXPECT_EQ(l.slices[0].size, 32768); /* XXX: Not used by anything and wrong */
|
||||
EXPECT_EQ(l.slices[0].offset_B, 0);
|
||||
EXPECT_EQ(l.slices[0].row_stride_B, 16);
|
||||
EXPECT_EQ(l.slices[0].afbc.header_size_B, 1024);
|
||||
EXPECT_EQ(l.slices[0].afbc.body_size_B, 32768);
|
||||
EXPECT_EQ(l.slices[0].afbc.surface_stride_B, 64);
|
||||
EXPECT_EQ(l.slices[0].surface_stride_B, 2048); /* XXX: Not meaningful? */
|
||||
EXPECT_EQ(l.slices[0].size_B, 32768); /* XXX: Not used by anything and wrong */
|
||||
}
|
||||
|
||||
TEST(AFBCLayout, Tiled16x16)
|
||||
|
|
@ -416,14 +432,18 @@ TEST(AFBCLayout, Tiled16x16)
|
|||
DRM_FORMAT_MOD_ARM_AFBC(AFBC_FORMAT_MOD_BLOCK_SIZE_16x16 |
|
||||
AFBC_FORMAT_MOD_TILED | AFBC_FORMAT_MOD_SPARSE);
|
||||
|
||||
struct pan_image_layout l = {.modifier = modifier,
|
||||
.format = PIPE_FORMAT_R8G8B8A8_UNORM,
|
||||
.width = 917,
|
||||
.height = 417,
|
||||
.depth = 1,
|
||||
.nr_samples = 1,
|
||||
.dim = MALI_TEXTURE_DIMENSION_2D,
|
||||
.nr_slices = 1};
|
||||
struct pan_image_layout l = {
|
||||
.modifier = modifier,
|
||||
.format = PIPE_FORMAT_R8G8B8A8_UNORM,
|
||||
.extent_px = {
|
||||
.width = 917,
|
||||
.height = 417,
|
||||
.depth = 1,
|
||||
},
|
||||
.nr_samples = 1,
|
||||
.dim = MALI_TEXTURE_DIMENSION_2D,
|
||||
.nr_slices = 1,
|
||||
};
|
||||
|
||||
ASSERT_TRUE(pan_image_layout_init(0, &l, NULL));
|
||||
|
||||
|
|
@ -439,12 +459,12 @@ TEST(AFBCLayout, Tiled16x16)
|
|||
*
|
||||
* In total, the AFBC surface is 32768 + 2097152 = 2129920 bytes.
|
||||
*/
|
||||
EXPECT_EQ(l.slices[0].offset, 0);
|
||||
EXPECT_EQ(l.slices[0].row_stride, 8192);
|
||||
EXPECT_EQ(l.slices[0].afbc.header_size, 32768);
|
||||
EXPECT_EQ(l.slices[0].afbc.body_size, 2097152);
|
||||
EXPECT_EQ(l.slices[0].surface_stride, 2129920);
|
||||
EXPECT_EQ(l.slices[0].size, 2129920);
|
||||
EXPECT_EQ(l.slices[0].offset_B, 0);
|
||||
EXPECT_EQ(l.slices[0].row_stride_B, 8192);
|
||||
EXPECT_EQ(l.slices[0].afbc.header_size_B, 32768);
|
||||
EXPECT_EQ(l.slices[0].afbc.body_size_B, 2097152);
|
||||
EXPECT_EQ(l.slices[0].surface_stride_B, 2129920);
|
||||
EXPECT_EQ(l.slices[0].size_B, 2129920);
|
||||
}
|
||||
|
||||
TEST(AFBCLayout, Linear16x16Minimal)
|
||||
|
|
@ -452,24 +472,28 @@ TEST(AFBCLayout, Linear16x16Minimal)
|
|||
uint64_t modifier = DRM_FORMAT_MOD_ARM_AFBC(
|
||||
AFBC_FORMAT_MOD_BLOCK_SIZE_16x16 | AFBC_FORMAT_MOD_SPARSE);
|
||||
|
||||
struct pan_image_layout l = {.modifier = modifier,
|
||||
.format = PIPE_FORMAT_R8_UNORM,
|
||||
.width = 1,
|
||||
.height = 1,
|
||||
.depth = 1,
|
||||
.nr_samples = 1,
|
||||
.dim = MALI_TEXTURE_DIMENSION_2D,
|
||||
.nr_slices = 1};
|
||||
struct pan_image_layout l = {
|
||||
.modifier = modifier,
|
||||
.format = PIPE_FORMAT_R8_UNORM,
|
||||
.extent_px = {
|
||||
.width = 1,
|
||||
.height = 1,
|
||||
.depth = 1,
|
||||
},
|
||||
.nr_samples = 1,
|
||||
.dim = MALI_TEXTURE_DIMENSION_2D,
|
||||
.nr_slices = 1,
|
||||
};
|
||||
|
||||
ASSERT_TRUE(pan_image_layout_init(0, &l, NULL));
|
||||
|
||||
/* Image is 1x1 to test for correct alignment everywhere. */
|
||||
EXPECT_EQ(l.slices[0].offset, 0);
|
||||
EXPECT_EQ(l.slices[0].row_stride, 16);
|
||||
EXPECT_EQ(l.slices[0].afbc.header_size, 64);
|
||||
EXPECT_EQ(l.slices[0].afbc.body_size, 32 * 8);
|
||||
EXPECT_EQ(l.slices[0].surface_stride, 64 + (32 * 8));
|
||||
EXPECT_EQ(l.slices[0].size, 64 + (32 * 8));
|
||||
EXPECT_EQ(l.slices[0].offset_B, 0);
|
||||
EXPECT_EQ(l.slices[0].row_stride_B, 16);
|
||||
EXPECT_EQ(l.slices[0].afbc.header_size_B, 64);
|
||||
EXPECT_EQ(l.slices[0].afbc.body_size_B, 32 * 8);
|
||||
EXPECT_EQ(l.slices[0].surface_stride_B, 64 + (32 * 8));
|
||||
EXPECT_EQ(l.slices[0].size_B, 64 + (32 * 8));
|
||||
}
|
||||
|
||||
TEST(AFBCLayout, Linear16x16Minimalv6)
|
||||
|
|
@ -477,24 +501,28 @@ TEST(AFBCLayout, Linear16x16Minimalv6)
|
|||
uint64_t modifier = DRM_FORMAT_MOD_ARM_AFBC(
|
||||
AFBC_FORMAT_MOD_BLOCK_SIZE_16x16 | AFBC_FORMAT_MOD_SPARSE);
|
||||
|
||||
struct pan_image_layout l = {.modifier = modifier,
|
||||
.format = PIPE_FORMAT_R8_UNORM,
|
||||
.width = 1,
|
||||
.height = 1,
|
||||
.depth = 1,
|
||||
.nr_samples = 1,
|
||||
.dim = MALI_TEXTURE_DIMENSION_2D,
|
||||
.nr_slices = 1};
|
||||
struct pan_image_layout l = {
|
||||
.modifier = modifier,
|
||||
.format = PIPE_FORMAT_R8_UNORM,
|
||||
.extent_px = {
|
||||
.width = 1,
|
||||
.height = 1,
|
||||
.depth = 1,
|
||||
},
|
||||
.nr_samples = 1,
|
||||
.dim = MALI_TEXTURE_DIMENSION_2D,
|
||||
.nr_slices = 1,
|
||||
};
|
||||
|
||||
ASSERT_TRUE(pan_image_layout_init(6, &l, NULL));
|
||||
|
||||
/* Image is 1x1 to test for correct alignment everywhere. */
|
||||
EXPECT_EQ(l.slices[0].offset, 0);
|
||||
EXPECT_EQ(l.slices[0].row_stride, 16);
|
||||
EXPECT_EQ(l.slices[0].afbc.header_size, 128);
|
||||
EXPECT_EQ(l.slices[0].afbc.body_size, 32 * 8);
|
||||
EXPECT_EQ(l.slices[0].surface_stride, 128 + (32 * 8));
|
||||
EXPECT_EQ(l.slices[0].size, 128 + (32 * 8));
|
||||
EXPECT_EQ(l.slices[0].offset_B, 0);
|
||||
EXPECT_EQ(l.slices[0].row_stride_B, 16);
|
||||
EXPECT_EQ(l.slices[0].afbc.header_size_B, 128);
|
||||
EXPECT_EQ(l.slices[0].afbc.body_size_B, 32 * 8);
|
||||
EXPECT_EQ(l.slices[0].surface_stride_B, 128 + (32 * 8));
|
||||
EXPECT_EQ(l.slices[0].size_B, 128 + (32 * 8));
|
||||
}
|
||||
|
||||
TEST(AFBCLayout, Tiled16x16Minimal)
|
||||
|
|
@ -503,22 +531,26 @@ TEST(AFBCLayout, Tiled16x16Minimal)
|
|||
DRM_FORMAT_MOD_ARM_AFBC(AFBC_FORMAT_MOD_BLOCK_SIZE_16x16 |
|
||||
AFBC_FORMAT_MOD_TILED | AFBC_FORMAT_MOD_SPARSE);
|
||||
|
||||
struct pan_image_layout l = {.modifier = modifier,
|
||||
.format = PIPE_FORMAT_R8_UNORM,
|
||||
.width = 1,
|
||||
.height = 1,
|
||||
.depth = 1,
|
||||
.nr_samples = 1,
|
||||
.dim = MALI_TEXTURE_DIMENSION_2D,
|
||||
.nr_slices = 1};
|
||||
struct pan_image_layout l = {
|
||||
.modifier = modifier,
|
||||
.format = PIPE_FORMAT_R8_UNORM,
|
||||
.extent_px = {
|
||||
.width = 1,
|
||||
.height = 1,
|
||||
.depth = 1,
|
||||
},
|
||||
.nr_samples = 1,
|
||||
.dim = MALI_TEXTURE_DIMENSION_2D,
|
||||
.nr_slices = 1,
|
||||
};
|
||||
|
||||
ASSERT_TRUE(pan_image_layout_init(0, &l, NULL));
|
||||
|
||||
/* Image is 1x1 to test for correct alignment everywhere. */
|
||||
EXPECT_EQ(l.slices[0].offset, 0);
|
||||
EXPECT_EQ(l.slices[0].row_stride, 16 * 8 * 8);
|
||||
EXPECT_EQ(l.slices[0].afbc.header_size, 4096);
|
||||
EXPECT_EQ(l.slices[0].afbc.body_size, 32 * 8 * 8 * 8);
|
||||
EXPECT_EQ(l.slices[0].surface_stride, 4096 + (32 * 8 * 8 * 8));
|
||||
EXPECT_EQ(l.slices[0].size, 4096 + (32 * 8 * 8 * 8));
|
||||
EXPECT_EQ(l.slices[0].offset_B, 0);
|
||||
EXPECT_EQ(l.slices[0].row_stride_B, 16 * 8 * 8);
|
||||
EXPECT_EQ(l.slices[0].afbc.header_size_B, 4096);
|
||||
EXPECT_EQ(l.slices[0].afbc.body_size_B, 32 * 8 * 8 * 8);
|
||||
EXPECT_EQ(l.slices[0].surface_stride_B, 4096 + (32 * 8 * 8 * 8));
|
||||
EXPECT_EQ(l.slices[0].size_B, 4096 + (32 * 8 * 8 * 8));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -248,11 +248,13 @@ panvk_image_init_layouts(struct panvk_image *image,
|
|||
image->planes[plane].layout = (struct pan_image_layout){
|
||||
.format = vk_format_to_pipe_format(format),
|
||||
.dim = panvk_image_type_to_mali_tex_dim(image->vk.image_type),
|
||||
.width = vk_format_get_plane_width(image->vk.format, plane,
|
||||
image->vk.extent.width),
|
||||
.height = vk_format_get_plane_height(image->vk.format, plane,
|
||||
image->vk.extent.height),
|
||||
.depth = image->vk.extent.depth,
|
||||
.extent_px = {
|
||||
.width = vk_format_get_plane_width(image->vk.format, plane,
|
||||
image->vk.extent.width),
|
||||
.height = vk_format_get_plane_height(image->vk.format, plane,
|
||||
image->vk.extent.height),
|
||||
.depth = image->vk.extent.depth,
|
||||
},
|
||||
.array_size = image->vk.array_layers,
|
||||
.nr_samples = image->vk.samples,
|
||||
.nr_slices = image->vk.mip_levels,
|
||||
|
|
@ -325,7 +327,7 @@ panvk_image_get_total_size(const struct panvk_image *image)
|
|||
{
|
||||
uint64_t size = 0;
|
||||
for (uint8_t plane = 0; plane < image->plane_count; plane++)
|
||||
size += image->planes[plane].layout.data_size;
|
||||
size += image->planes[plane].layout.data_size_B;
|
||||
return size;
|
||||
}
|
||||
|
||||
|
|
@ -425,16 +427,16 @@ get_image_subresource_layout(const struct panvk_image *image,
|
|||
uint64_t base_offset = 0;
|
||||
if (!is_disjoint(image)) {
|
||||
for (uint8_t plane_idx = 0; plane_idx < plane; plane_idx++)
|
||||
base_offset += image->planes[plane_idx].layout.data_size;
|
||||
base_offset += image->planes[plane_idx].layout.data_size_B;
|
||||
}
|
||||
|
||||
layout->offset = base_offset +
|
||||
slice_layout->offset + (subres->arrayLayer *
|
||||
image->planes[plane].layout.array_stride);
|
||||
layout->size = slice_layout->size;
|
||||
layout->rowPitch = slice_layout->row_stride;
|
||||
layout->arrayPitch = image->planes[plane].layout.array_stride;
|
||||
layout->depthPitch = slice_layout->surface_stride;
|
||||
layout->offset =
|
||||
base_offset + slice_layout->offset_B +
|
||||
(subres->arrayLayer * image->planes[plane].layout.array_stride_B);
|
||||
layout->size = slice_layout->size_B;
|
||||
layout->rowPitch = slice_layout->row_stride_B;
|
||||
layout->arrayPitch = image->planes[plane].layout.array_stride_B;
|
||||
layout->depthPitch = slice_layout->surface_stride_B;
|
||||
}
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL
|
||||
|
|
@ -476,7 +478,7 @@ panvk_GetImageMemoryRequirements2(VkDevice device,
|
|||
plane_info ? plane_info->planeAspect : image->vk.aspects;
|
||||
uint8_t plane = panvk_plane_index(image->vk.format, aspects);
|
||||
const uint64_t size =
|
||||
disjoint ? image->planes[plane].layout.data_size :
|
||||
disjoint ? image->planes[plane].layout.data_size_B :
|
||||
panvk_image_get_total_size(image);
|
||||
|
||||
pMemoryRequirements->memoryRequirements.memoryTypeBits = 1;
|
||||
|
|
@ -555,10 +557,10 @@ panvk_image_plane_bind(struct pan_image *plane, struct pan_kmod_bo *bo,
|
|||
for (unsigned level = 0; level < plane->layout.nr_slices;
|
||||
level++) {
|
||||
void *header = bo_base + offset +
|
||||
(layer * plane->layout.array_stride) +
|
||||
plane->layout.slices[level].offset;
|
||||
(layer * plane->layout.array_stride_B) +
|
||||
plane->layout.slices[level].offset_B;
|
||||
memset(header, 0,
|
||||
plane->layout.slices[level].afbc.header_size);
|
||||
plane->layout.slices[level].afbc.header_size_B);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -606,7 +608,7 @@ panvk_BindImageMemory2(VkDevice device, uint32_t bindInfoCount,
|
|||
for (unsigned plane = 0; plane < image->plane_count; plane++) {
|
||||
panvk_image_plane_bind(&image->planes[plane], image->bo,
|
||||
mem->addr.dev, offset);
|
||||
offset += image->planes[plane].layout.data_size;
|
||||
offset += image->planes[plane].layout.data_size_B;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -66,9 +66,11 @@ panvk_per_arch(CreateBufferView)(VkDevice _device,
|
|||
.modifier = DRM_FORMAT_MOD_LINEAR,
|
||||
.format = pfmt,
|
||||
.dim = MALI_TEXTURE_DIMENSION_1D,
|
||||
.width = view->vk.elements,
|
||||
.height = 1,
|
||||
.depth = 1,
|
||||
.extent_px = {
|
||||
.width = view->vk.elements,
|
||||
.height = 1,
|
||||
.depth = 1,
|
||||
},
|
||||
.array_size = 1,
|
||||
.nr_samples = 1,
|
||||
.nr_slices = 1,
|
||||
|
|
|
|||
|
|
@ -281,7 +281,8 @@ prepare_attr_buf_descs(struct panvk_image_view *view)
|
|||
view->pview.dim == MALI_TEXTURE_DIMENSION_3D
|
||||
? extent.depth
|
||||
: (view->pview.last_layer - view->pview.first_layer + 1);
|
||||
cfg.row_stride = image->planes[plane_idx].layout.slices[level].row_stride;
|
||||
cfg.row_stride =
|
||||
image->planes[plane_idx].layout.slices[level].row_stride_B;
|
||||
if (cfg.r_dimension > 1) {
|
||||
cfg.slice_stride =
|
||||
pan_image_surface_stride(&image->planes[plane_idx].layout, level);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue