From 40f3dac7160379f33e149a9a39fcaba754c3d93e Mon Sep 17 00:00:00 2001 From: Jose Maria Casanova Crespo Date: Fri, 30 May 2025 22:38:37 +0200 Subject: [PATCH] vc4: Remove tiling from vc4_surface Reviewed-by: Iago Toral Quiroga Part-of: --- src/gallium/drivers/vc4/vc4_job.c | 14 +++++--------- src/gallium/drivers/vc4/vc4_resource.c | 2 -- src/gallium/drivers/vc4/vc4_resource.h | 8 +++++++- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/gallium/drivers/vc4/vc4_job.c b/src/gallium/drivers/vc4/vc4_job.c index 1521319d3fc..961795f0871 100644 --- a/src/gallium/drivers/vc4/vc4_job.c +++ b/src/gallium/drivers/vc4/vc4_job.c @@ -289,9 +289,7 @@ vc4_submit_setup_rcl_surface(struct vc4_job *job, struct pipe_surface *psurf, bool is_depth, bool is_write) { - struct vc4_surface *surf = vc4_surface(psurf); - - if (!surf) + if (!psurf) return; struct vc4_resource *rsc = vc4_resource(psurf->texture); @@ -314,7 +312,7 @@ vc4_submit_setup_rcl_surface(struct vc4_job *job, VC4_LOADSTORE_TILE_BUFFER_FORMAT); } submit_surf->bits |= - VC4_SET_FIELD(surf->tiling, + VC4_SET_FIELD(vc4_surface_get_tiling(psurf), VC4_LOADSTORE_TILE_BUFFER_TILING); } else { assert(!is_write); @@ -330,9 +328,7 @@ vc4_submit_setup_rcl_render_config_surface(struct vc4_job *job, struct drm_vc4_submit_rcl_surface *submit_surf, struct pipe_surface *psurf) { - struct vc4_surface *surf = vc4_surface(psurf); - - if (!surf) + if (!psurf) return; struct vc4_resource *rsc = vc4_resource(psurf->texture); @@ -341,11 +337,11 @@ vc4_submit_setup_rcl_render_config_surface(struct vc4_job *job, if (psurf->texture->nr_samples <= 1) { submit_surf->bits = - VC4_SET_FIELD(vc4_rt_format_is_565(surf->base.format) ? + VC4_SET_FIELD(vc4_rt_format_is_565(psurf->format) ? VC4_RENDER_CONFIG_FORMAT_BGR565 : VC4_RENDER_CONFIG_FORMAT_RGBA8888, VC4_RENDER_CONFIG_FORMAT) | - VC4_SET_FIELD(surf->tiling, + VC4_SET_FIELD(vc4_surface_get_tiling(psurf), VC4_RENDER_CONFIG_MEMORY_FORMAT); } diff --git a/src/gallium/drivers/vc4/vc4_resource.c b/src/gallium/drivers/vc4/vc4_resource.c index d525cbaa960..cab44bc95b6 100644 --- a/src/gallium/drivers/vc4/vc4_resource.c +++ b/src/gallium/drivers/vc4/vc4_resource.c @@ -763,7 +763,6 @@ vc4_create_surface(struct pipe_context *pctx, const struct pipe_surface *surf_tmpl) { struct vc4_surface *surface = CALLOC_STRUCT(vc4_surface); - struct vc4_resource *rsc = vc4_resource(ptex); if (!surface) return NULL; @@ -781,7 +780,6 @@ vc4_create_surface(struct pipe_context *pctx, psurf->level = level; psurf->first_layer = surf_tmpl->first_layer; psurf->last_layer = surf_tmpl->last_layer; - surface->tiling = rsc->slices[level].tiling; return &surface->base; } diff --git a/src/gallium/drivers/vc4/vc4_resource.h b/src/gallium/drivers/vc4/vc4_resource.h index 5cd687881e5..ddce81288b6 100644 --- a/src/gallium/drivers/vc4/vc4_resource.h +++ b/src/gallium/drivers/vc4/vc4_resource.h @@ -44,7 +44,6 @@ struct vc4_resource_slice { struct vc4_surface { struct pipe_surface base; - uint8_t tiling; }; struct vc4_resource { @@ -118,4 +117,11 @@ static inline uint32_t vc4_surface_get_offset(struct pipe_surface *psurf) psurf->first_layer * rsc->cube_map_stride; } +static inline uint8_t vc4_surface_get_tiling(struct pipe_surface *psurf) +{ + assert(psurf && psurf->texture); + struct vc4_resource *rsc = vc4_resource(psurf->texture); + return rsc->slices[psurf->level].tiling; +} + #endif /* VC4_RESOURCE_H */