vc4: Remove offset from vc4_surface

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35278>
This commit is contained in:
Jose Maria Casanova Crespo
2025-05-30 16:46:59 +02:00
committed by Marge Bot
parent 79498a0849
commit 51bc2e607f
3 changed files with 12 additions and 9 deletions

View File

@@ -296,7 +296,7 @@ vc4_submit_setup_rcl_surface(struct vc4_job *job,
struct vc4_resource *rsc = vc4_resource(psurf->texture);
submit_surf->hindex = vc4_gem_hindex(job, rsc->bo);
submit_surf->offset = surf->offset;
submit_surf->offset = vc4_surface_get_offset(psurf);
if (psurf->texture->nr_samples <= 1) {
if (is_depth) {
@@ -337,7 +337,7 @@ vc4_submit_setup_rcl_render_config_surface(struct vc4_job *job,
struct vc4_resource *rsc = vc4_resource(psurf->texture);
submit_surf->hindex = vc4_gem_hindex(job, rsc->bo);
submit_surf->offset = surf->offset;
submit_surf->offset = vc4_surface_get_offset(psurf);
if (psurf->texture->nr_samples <= 1) {
submit_surf->bits =
@@ -357,14 +357,12 @@ vc4_submit_setup_rcl_msaa_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);
submit_surf->hindex = vc4_gem_hindex(job, rsc->bo);
submit_surf->offset = surf->offset;
submit_surf->offset = vc4_surface_get_offset(psurf);
submit_surf->bits = 0;
rsc->writes++;
}

View File

@@ -781,8 +781,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->offset = (rsc->slices[level].offset +
psurf->first_layer * rsc->cube_map_stride);
surface->tiling = rsc->slices[level].tiling;
return &surface->base;

View File

@@ -44,7 +44,6 @@ struct vc4_resource_slice {
struct vc4_surface {
struct pipe_surface base;
uint32_t offset;
uint8_t tiling;
};
@@ -111,4 +110,12 @@ struct pipe_resource *vc4_get_shadow_index_buffer(struct pipe_context *pctx,
uint32_t *shadow_offset);
void vc4_dump_surface(struct pipe_surface *psurf);
static inline uint32_t vc4_surface_get_offset(struct pipe_surface *psurf)
{
assert(psurf && psurf->texture);
struct vc4_resource *rsc = vc4_resource(psurf->texture);
return rsc->slices[psurf->level].offset +
psurf->first_layer * rsc->cube_map_stride;
}
#endif /* VC4_RESOURCE_H */