freedreno: Move layout init to backends
Export the existing helper, and call it from the legacy backends which are not using fdl. This moves all the layout initialization to the backends (and eventually to fdl for the backends using that). Signed-off-by: Rob Clark <rob.clark@oss.qualcomm.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36075>
This commit is contained in:
@@ -17,6 +17,8 @@ fd2_layout_resource(struct fd_resource *rsc, enum fd_layout_type type)
|
||||
uint32_t height0 = util_format_get_nblocksy(format, prsc->height0);
|
||||
uint32_t level, size = 0;
|
||||
|
||||
fd_resource_layout_init(prsc);
|
||||
|
||||
/* 32 pixel alignment */
|
||||
fdl_set_pitchalign(&rsc->layout, fdl_cpp_shift(&rsc->layout) + 5);
|
||||
|
||||
|
||||
@@ -56,6 +56,8 @@ fd3_layout_resource(struct fd_resource *rsc, enum fd_layout_type type)
|
||||
{
|
||||
uint32_t alignment;
|
||||
|
||||
fd_resource_layout_init(&rsc->b.b);
|
||||
|
||||
if (type >= FD_LAYOUT_TILED)
|
||||
rsc->layout.tile_mode = fd3_tile_mode(&rsc->b.b);
|
||||
if (type == FD_LAYOUT_UBWC)
|
||||
|
||||
@@ -26,6 +26,8 @@ fd4_layout_resource(struct fd_resource *rsc, enum fd_layout_type type)
|
||||
|
||||
assert(type == FD_LAYOUT_LINEAR);
|
||||
|
||||
fd_resource_layout_init(prsc);
|
||||
|
||||
if (prsc->target == PIPE_TEXTURE_3D) {
|
||||
rsc->layout.layer_first = false;
|
||||
layers_in_level = prsc->array_size;
|
||||
|
||||
@@ -1180,7 +1180,8 @@ fd_resource_resize(struct pipe_resource *prsc, uint32_t sz)
|
||||
realloc_bo(rsc, rsc->layout.size);
|
||||
}
|
||||
|
||||
static void
|
||||
/* Helper for legacy backends not using fdl: */
|
||||
void
|
||||
fd_resource_layout_init(struct pipe_resource *prsc)
|
||||
{
|
||||
struct fd_resource *rsc = fd_resource(prsc);
|
||||
@@ -1368,8 +1369,6 @@ fd_resource_allocate_and_resolve(struct pipe_screen *pscreen,
|
||||
if (tmpl->bind & PIPE_BIND_SHARED)
|
||||
rsc->b.is_shared = true;
|
||||
|
||||
fd_resource_layout_init(prsc);
|
||||
|
||||
enum fd_layout_type layout =
|
||||
get_best_layout(screen, tmpl, modifiers, count);
|
||||
if (layout == FD_LAYOUT_ERROR) {
|
||||
|
||||
@@ -344,6 +344,7 @@ void fd_resource_context_init(struct pipe_context *pctx);
|
||||
|
||||
uint32_t fd_setup_slices(struct fd_resource *rsc);
|
||||
void fd_resource_resize(struct pipe_resource *prsc, uint32_t sz);
|
||||
void fd_resource_layout_init(struct pipe_resource *prsc);
|
||||
void fd_replace_buffer_storage(struct pipe_context *ctx,
|
||||
struct pipe_resource *dst,
|
||||
struct pipe_resource *src,
|
||||
|
||||
Reference in New Issue
Block a user