mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 04:48:08 +02:00
etnaviv: add helper to get TS validity
Add a small helper to get the validity of the TS buffer for a resource level. We can drop the ts_size check in several places, as we never set ts_valid to true if there is no TS buffer. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Reviewed-by: Christian Gmeiner <cgmeiner@igalia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19964>
This commit is contained in:
parent
f9af3b368a
commit
0f2df7d361
5 changed files with 13 additions and 7 deletions
|
|
@ -471,7 +471,7 @@ etna_try_blt_blit(struct pipe_context *pctx,
|
|||
*/
|
||||
if (src == dst) {
|
||||
assert(!memcmp(&blit_info->src, &blit_info->dst, sizeof(blit_info->src)));
|
||||
if (!src_lev->ts_size || !src_lev->ts_valid) /* No TS, no worries */
|
||||
if (!etna_resource_level_ts_valid(src_lev)) /* No TS, no worries */
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -517,7 +517,7 @@ etna_try_blt_blit(struct pipe_context *pctx,
|
|||
for (unsigned x=0; x<4; ++x)
|
||||
op.src.swizzle[x] = x;
|
||||
|
||||
if (src_lev->ts_size && src_lev->ts_valid) {
|
||||
if (etna_resource_level_ts_valid(src_lev)) {
|
||||
op.src.use_ts = 1;
|
||||
op.src.ts_addr.bo = src->ts_bo;
|
||||
op.src.ts_addr.offset = src_lev->ts_offset + blit_info->src.box.z * src_lev->ts_layer_stride;
|
||||
|
|
|
|||
|
|
@ -94,6 +94,12 @@ etna_resource_level_older(struct etna_resource_level *a,
|
|||
return (int)(a->seqno - b->seqno) < 0;
|
||||
}
|
||||
|
||||
static inline bool
|
||||
etna_resource_level_ts_valid(struct etna_resource_level *lvl)
|
||||
{
|
||||
return lvl->ts_valid;
|
||||
}
|
||||
|
||||
/* returns TRUE if a is older than b */
|
||||
static inline bool
|
||||
etna_resource_level_needs_flush(struct etna_resource_level *lvl)
|
||||
|
|
|
|||
|
|
@ -734,7 +734,7 @@ etna_try_rs_blit(struct pipe_context *pctx,
|
|||
|
||||
/* Set up color TS to source surface before blit, if needed */
|
||||
bool source_ts_valid = false;
|
||||
if (src_lev->ts_size && src_lev->ts_valid) {
|
||||
if (etna_resource_level_ts_valid(src_lev)) {
|
||||
struct etna_reloc reloc;
|
||||
unsigned ts_offset =
|
||||
src_lev->ts_offset + blit_info->src.box.z * src_lev->ts_layer_stride;
|
||||
|
|
|
|||
|
|
@ -650,7 +650,7 @@ etna_update_ts_config(struct etna_context *ctx)
|
|||
if (ctx->framebuffer_s.nr_cbufs > 0) {
|
||||
struct etna_surface *c_surf = etna_surface(ctx->framebuffer_s.cbufs[0]);
|
||||
|
||||
if(c_surf->level->ts_size && c_surf->level->ts_valid) {
|
||||
if (etna_resource_level_ts_valid(c_surf->level)) {
|
||||
new_ts_config |= VIVS_TS_MEM_CONFIG_COLOR_FAST_CLEAR;
|
||||
} else {
|
||||
new_ts_config &= ~VIVS_TS_MEM_CONFIG_COLOR_FAST_CLEAR;
|
||||
|
|
@ -660,7 +660,7 @@ etna_update_ts_config(struct etna_context *ctx)
|
|||
if (ctx->framebuffer_s.zsbuf) {
|
||||
struct etna_surface *zs_surf = etna_surface(ctx->framebuffer_s.zsbuf);
|
||||
|
||||
if(zs_surf->level->ts_size && zs_surf->level->ts_valid) {
|
||||
if (etna_resource_level_ts_valid(zs_surf->level)) {
|
||||
new_ts_config |= VIVS_TS_MEM_CONFIG_DEPTH_FAST_CLEAR;
|
||||
} else {
|
||||
new_ts_config &= ~VIVS_TS_MEM_CONFIG_DEPTH_FAST_CLEAR;
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ etna_configure_sampler_ts(struct etna_sampler_ts *sts, struct pipe_sampler_view
|
|||
(lev->clear_value >> 32) != sts->TS_SAMPLER_CLEAR_VALUE2)
|
||||
dirty = true;
|
||||
|
||||
assert(rsc->ts_bo && lev->ts_valid);
|
||||
assert(rsc->ts_bo && etna_resource_level_ts_valid(lev));
|
||||
|
||||
sts->mode = lev->ts_mode;
|
||||
sts->comp = lev->ts_compress_fmt >= 0;
|
||||
|
|
@ -151,7 +151,7 @@ etna_can_use_sampler_ts(struct pipe_sampler_view *view, int num)
|
|||
return false;
|
||||
|
||||
/* The resource TS is valid for level 0. */
|
||||
if (!rsc->levels[0].ts_valid)
|
||||
if (!etna_resource_level_ts_valid(&rsc->levels[0]))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue