diff options
author | Alyssa Rosenzweig <[email protected]> | 2019-07-18 11:05:01 -0700 |
---|---|---|
committer | Alyssa Rosenzweig <[email protected]> | 2019-07-18 15:25:40 -0700 |
commit | 629c7366a793393828384f5c1e74d3c45bac4d04 (patch) | |
tree | 90bf4fe7a62b818ff608b2b5046d2f0631eb3550 /src/gallium | |
parent | 227c395c00b69fc105546d479d751d92e923b4fc (diff) |
panfrost: Simplify set_framebuffer_state
Most of the ad hoc logic is already in Gallium.
Signed-off-by: Alyssa Rosenzweig <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r-- | src/gallium/drivers/panfrost/pan_context.c | 44 |
1 files changed, 9 insertions, 35 deletions
diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c index 06943c22b44..68d74224d07 100644 --- a/src/gallium/drivers/panfrost/pan_context.c +++ b/src/gallium/drivers/panfrost/pan_context.c @@ -2377,45 +2377,19 @@ panfrost_set_framebuffer_state(struct pipe_context *pctx, panfrost_flush(pctx, NULL, PIPE_FLUSH_END_OF_FRAME); } - ctx->pipe_framebuffer.nr_cbufs = fb->nr_cbufs; - ctx->pipe_framebuffer.samples = fb->samples; - ctx->pipe_framebuffer.layers = fb->layers; - ctx->pipe_framebuffer.width = fb->width; - ctx->pipe_framebuffer.height = fb->height; + util_copy_framebuffer_state(&ctx->pipe_framebuffer, fb); - struct pipe_surface *zb = fb->zsbuf; - bool needs_reattach = false; + /* Given that we're rendering, we'd love to have compression */ + struct panfrost_screen *screen = pan_screen(ctx->base.screen); - for (int i = 0; i < PIPE_MAX_COLOR_BUFS; i++) { - struct pipe_surface *cb = i < fb->nr_cbufs ? fb->cbufs[i] : NULL; + panfrost_hint_afbc(screen, &ctx->pipe_framebuffer); - /* check if changing cbuf */ - if (ctx->pipe_framebuffer.cbufs[i] == cb) continue; - - /* assign new */ - pipe_surface_reference(&ctx->pipe_framebuffer.cbufs[i], cb); - - needs_reattach |= (cb != NULL); - } - - if (ctx->pipe_framebuffer.zsbuf != zb) { - pipe_surface_reference(&ctx->pipe_framebuffer.zsbuf, zb); - needs_reattach |= (zb != NULL); - } - - if (needs_reattach) { - /* Given that we're rendering, we'd love to have compression */ - struct panfrost_screen *screen = pan_screen(ctx->base.screen); - - panfrost_hint_afbc(screen, &ctx->pipe_framebuffer); - - if (ctx->require_sfbd) - ctx->vt_framebuffer_sfbd = panfrost_emit_sfbd(ctx, ~0); - else - ctx->vt_framebuffer_mfbd = panfrost_emit_mfbd(ctx, ~0); + if (ctx->require_sfbd) + ctx->vt_framebuffer_sfbd = panfrost_emit_sfbd(ctx, ~0); + else + ctx->vt_framebuffer_mfbd = panfrost_emit_mfbd(ctx, ~0); - panfrost_attach_vt_framebuffer(ctx, false); - } + panfrost_attach_vt_framebuffer(ctx, false); } static void * |