From f652c61283b7c36ef20c3be72730ace70f15649e Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Tue, 8 Jun 2021 20:27:52 -0400 Subject: [PATCH] panfrost: Reduce pan_image_state indirection In actuality, this just shadows the crc_valid for pan_cs... the data_valid checks are contained in the caller and just add noise. Signed-off-by: Alyssa Rosenzweig Part-of: --- src/gallium/drivers/panfrost/pan_job.c | 6 ++---- src/panfrost/lib/pan_blitter.c | 4 ++-- src/panfrost/lib/pan_cs.c | 12 ++++++------ src/panfrost/lib/pan_cs.h | 6 +----- 4 files changed, 11 insertions(+), 17 deletions(-) diff --git a/src/gallium/drivers/panfrost/pan_job.c b/src/gallium/drivers/panfrost/pan_job.c index ce2df7c..70233eb 100644 --- a/src/gallium/drivers/panfrost/pan_job.c +++ b/src/gallium/drivers/panfrost/pan_job.c @@ -657,14 +657,14 @@ panfrost_batch_to_fb_info(const struct panfrost_batch *batch, rts[i].image = &prsrc->image; rts[i].nr_samples = surf->nr_samples ? : MAX2(surf->texture->nr_samples, 1); memcpy(rts[i].swizzle, id_swz, sizeof(rts[i].swizzle)); - fb->rts[i].state = &prsrc->state; + fb->rts[i].crc_valid = &prsrc->state.crc_valid; fb->rts[i].view = &rts[i]; /* Preload if the RT is read or updated */ if (!(batch->clear & mask) && ((batch->read & mask) || ((batch->draws & mask) && - fb->rts[i].state->slices[fb->rts[i].view->first_level].data_valid))) + prsrc->state.slices[fb->rts[i].view->first_level].data_valid))) fb->rts[i].preload = true; } @@ -686,7 +686,6 @@ panfrost_batch_to_fb_info(const struct panfrost_batch *batch, zs->nr_samples = surf->nr_samples ? : MAX2(surf->texture->nr_samples, 1); memcpy(zs->swizzle, id_swz, sizeof(zs->swizzle)); fb->zs.view.zs = zs; - fb->zs.state.zs = &prsrc->state; z_view = zs; z_state = &prsrc->state; if (util_format_is_depth_and_stencil(zs->format)) { @@ -704,7 +703,6 @@ panfrost_batch_to_fb_info(const struct panfrost_batch *batch, s->nr_samples = surf->nr_samples ? : MAX2(surf->texture->nr_samples, 1); memcpy(s->swizzle, id_swz, sizeof(s->swizzle)); fb->zs.view.s = s; - fb->zs.state.s = &prsrc->separate_stencil->state; s_view = s; s_state = &prsrc->separate_stencil->state; } diff --git a/src/panfrost/lib/pan_blitter.c b/src/panfrost/lib/pan_blitter.c index 97e3daf..3f5e3cd 100644 --- a/src/panfrost/lib/pan_blitter.c +++ b/src/panfrost/lib/pan_blitter.c @@ -1248,12 +1248,12 @@ pan_preload_emit_bifrost_pre_frame_dcd(struct pan_pool *desc_pool, /* If CRC data is currently invalid and this batch will make it valid, * write even clean tiles to make sure CRC data is updated. */ if (crc_rt >= 0) { - bool valid = fb->rts[crc_rt].state->crc_valid; + bool *valid = fb->rts[crc_rt].crc_valid; bool full = !fb->extent.minx && !fb->extent.miny && fb->extent.maxx == (fb->width - 1) && fb->extent.maxy == (fb->height - 1); - if (full && !valid) + if (full && !(*valid)) always_write = true; } diff --git a/src/panfrost/lib/pan_cs.c b/src/panfrost/lib/pan_cs.c index 423e68c..fa0fdb6 100644 --- a/src/panfrost/lib/pan_cs.c +++ b/src/panfrost/lib/pan_cs.c @@ -331,7 +331,7 @@ pan_select_crc_rt(const struct panfrost_device *dev, const struct pan_fb_info *f fb->rts[i].view->image->layout.crc_mode == PAN_IMAGE_CRC_NONE) continue; - bool valid = fb->rts[i].state->crc_valid; + bool valid = *(fb->rts[i].crc_valid); bool full = !fb->extent.minx && !fb->extent.miny && fb->extent.maxx == (fb->width - 1) && fb->extent.maxy == (fb->height - 1); @@ -720,19 +720,19 @@ pan_emit_mfbd(const struct panfrost_device *dev, cfg.has_zs_crc_extension = has_zs_crc_ext; if (crc_rt >= 0) { - bool valid = fb->rts[crc_rt].state->crc_valid; + bool *valid = fb->rts[crc_rt].crc_valid; bool full = !fb->extent.minx && !fb->extent.miny && fb->extent.maxx == (fb->width - 1) && fb->extent.maxy == (fb->height - 1); - cfg.crc_read_enable = valid; + cfg.crc_read_enable = *valid; /* If the data is currently invalid, still write CRC * data if we are doing a full write, so that it is * valid for next time. */ - cfg.crc_write_enable = valid || full; + cfg.crc_write_enable = *valid || full; - fb->rts[crc_rt].state->crc_valid = full; + *valid = full; } } @@ -760,7 +760,7 @@ pan_emit_mfbd(const struct panfrost_device *dev, tile_size * fb->rts[i].view->image->layout.nr_samples; if (i != crc_rt) - fb->rts[i].state->crc_valid = false; + *(fb->rts[i].crc_valid) = false; } tags |= MALI_POSITIVE(MAX2(fb->rt_count, 1)) << 2; diff --git a/src/panfrost/lib/pan_cs.h b/src/panfrost/lib/pan_cs.h index e3e67d3..fd06fd7 100644 --- a/src/panfrost/lib/pan_cs.h +++ b/src/panfrost/lib/pan_cs.h @@ -36,7 +36,7 @@ struct pan_compute_dim { struct pan_fb_color_attachment { const struct pan_image_view *view; - struct pan_image_state *state; + bool *crc_valid; bool clear; bool preload; bool discard; @@ -49,10 +49,6 @@ struct pan_fb_zs_attachment { } view; struct { - struct pan_image_state *zs, *s; - } state; - - struct { bool z, s; } clear; -- 2.7.4