mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 13:58:04 +02:00
panfrost: Use get_texture_address for framebuffer computations
Allows for sharing some code as well as theoretically allowing cubemap rendering. Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
This commit is contained in:
parent
3609b50a64
commit
65bc56b568
4 changed files with 28 additions and 25 deletions
|
|
@ -826,25 +826,6 @@ panfrost_upload_sampler_descriptors(struct panfrost_context *ctx)
|
|||
}
|
||||
}
|
||||
|
||||
/* Computes the address to a texture at a particular slice */
|
||||
|
||||
static mali_ptr
|
||||
panfrost_get_texture_address(
|
||||
struct panfrost_resource *rsrc,
|
||||
unsigned level, unsigned face)
|
||||
{
|
||||
unsigned level_offset = rsrc->bo->slices[level].offset;
|
||||
unsigned face_offset = face * rsrc->bo->cubemap_stride;
|
||||
|
||||
/* Lower-bit is set when sampling from colour AFBC */
|
||||
bool is_afbc = rsrc->bo->layout == PAN_AFBC;
|
||||
bool is_zs = rsrc->base.bind & PIPE_BIND_DEPTH_STENCIL;
|
||||
unsigned afbc_bit = (is_afbc && !is_zs) ? 1 : 0;
|
||||
|
||||
return rsrc->bo->gpu + level_offset + face_offset + afbc_bit;
|
||||
|
||||
}
|
||||
|
||||
static mali_ptr
|
||||
panfrost_upload_tex(
|
||||
struct panfrost_context *ctx,
|
||||
|
|
|
|||
|
|
@ -94,10 +94,10 @@ panfrost_mfbd_set_cbuf(
|
|||
struct panfrost_resource *rsrc = pan_resource(surf->texture);
|
||||
|
||||
unsigned level = surf->u.tex.level;
|
||||
assert(surf->u.tex.first_layer == 0);
|
||||
|
||||
unsigned first_layer = surf->u.tex.first_layer;
|
||||
int stride = rsrc->bo->slices[level].stride;
|
||||
unsigned offset = rsrc->bo->slices[level].offset;
|
||||
|
||||
mali_ptr base = panfrost_get_texture_address(rsrc, level, first_layer);
|
||||
|
||||
rt->format = panfrost_mfbd_format(surf);
|
||||
|
||||
|
|
@ -105,16 +105,15 @@ panfrost_mfbd_set_cbuf(
|
|||
|
||||
if (rsrc->bo->layout == PAN_LINEAR) {
|
||||
rt->format.block = MALI_MFBD_BLOCK_LINEAR;
|
||||
rt->framebuffer = rsrc->bo->gpu + offset;
|
||||
rt->framebuffer = base;
|
||||
rt->framebuffer_stride = stride / 16;
|
||||
} else if (rsrc->bo->layout == PAN_TILED) {
|
||||
rt->format.block = MALI_MFBD_BLOCK_TILED;
|
||||
rt->framebuffer = rsrc->bo->gpu + offset;
|
||||
rt->framebuffer = base;
|
||||
rt->framebuffer_stride = stride;
|
||||
} else if (rsrc->bo->layout == PAN_AFBC) {
|
||||
rt->format.block = MALI_MFBD_BLOCK_AFBC;
|
||||
|
||||
mali_ptr base = rsrc->bo->gpu + offset;
|
||||
unsigned header_size = rsrc->bo->slices[level].header_size;
|
||||
|
||||
rt->framebuffer = base + header_size;
|
||||
|
|
|
|||
|
|
@ -718,6 +718,24 @@ panfrost_generate_mipmap(
|
|||
return blit_res;
|
||||
}
|
||||
|
||||
/* Computes the address to a texture at a particular slice */
|
||||
|
||||
mali_ptr
|
||||
panfrost_get_texture_address(
|
||||
struct panfrost_resource *rsrc,
|
||||
unsigned level, unsigned face)
|
||||
{
|
||||
unsigned level_offset = rsrc->bo->slices[level].offset;
|
||||
unsigned face_offset = face * rsrc->bo->cubemap_stride;
|
||||
|
||||
/* Lower-bit is set when sampling from colour AFBC */
|
||||
bool is_afbc = rsrc->bo->layout == PAN_AFBC;
|
||||
bool is_zs = rsrc->base.bind & PIPE_BIND_DEPTH_STENCIL;
|
||||
unsigned afbc_bit = (is_afbc && !is_zs) ? 1 : 0;
|
||||
|
||||
return rsrc->bo->gpu + level_offset + face_offset + afbc_bit;
|
||||
}
|
||||
|
||||
static void
|
||||
panfrost_resource_set_stencil(struct pipe_resource *prsrc,
|
||||
struct pipe_resource *stencil)
|
||||
|
|
|
|||
|
|
@ -120,6 +120,11 @@ pan_transfer(struct pipe_transfer *p)
|
|||
return (struct panfrost_gtransfer *)p;
|
||||
}
|
||||
|
||||
mali_ptr
|
||||
panfrost_get_texture_address(
|
||||
struct panfrost_resource *rsrc,
|
||||
unsigned level, unsigned face);
|
||||
|
||||
void panfrost_resource_screen_init(struct panfrost_screen *screen);
|
||||
void panfrost_resource_screen_deinit(struct panfrost_screen *screen);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue