diff options
author | Alyssa Rosenzweig <[email protected]> | 2019-03-12 22:01:23 +0000 |
---|---|---|
committer | Alyssa Rosenzweig <[email protected]> | 2019-03-14 22:47:11 +0000 |
commit | d47f0907380d87946b1993163b3e9188c18b1d48 (patch) | |
tree | bcb8a0987a8be28012c23b4d690b9d156f13076c /src/gallium/drivers/panfrost/pan_sfbd.c | |
parent | 9dd84db7a5d7ae74f7fca835ae51fa6a88313d09 (diff) |
panfrost: Remove staging SFBD for pan_context
The fragment framebuffer descriptor should not be a context entry;
rather, it should be constructed only at fragment time to keep analysis
tractable.
Signed-off-by: Alyssa Rosenzweig <[email protected]>
Diffstat (limited to 'src/gallium/drivers/panfrost/pan_sfbd.c')
-rw-r--r-- | src/gallium/drivers/panfrost/pan_sfbd.c | 55 |
1 files changed, 22 insertions, 33 deletions
diff --git a/src/gallium/drivers/panfrost/pan_sfbd.c b/src/gallium/drivers/panfrost/pan_sfbd.c index d04da20e258..0e283bbb082 100644 --- a/src/gallium/drivers/panfrost/pan_sfbd.c +++ b/src/gallium/drivers/panfrost/pan_sfbd.c @@ -36,16 +36,11 @@ panfrost_sfbd_format(struct pipe_surface *surf) } static void -panfrost_sfbd_enable_msaa(struct panfrost_context *ctx) -{ - ctx->fragment_sfbd.format |= MALI_FRAMEBUFFER_MSAA_A | MALI_FRAMEBUFFER_MSAA_B; -} - -static void -panfrost_sfbd_clear(struct panfrost_job *job) +panfrost_sfbd_clear( + struct panfrost_job *job, + struct mali_single_framebuffer *sfbd) { struct panfrost_context *ctx = job->ctx; - struct mali_single_framebuffer *sfbd = &ctx->fragment_sfbd; if (job->clear & PIPE_CLEAR_COLOR) { sfbd->clear_color_1 = job->clear_color; @@ -91,60 +86,54 @@ panfrost_sfbd_clear(struct panfrost_job *job) static void panfrost_sfbd_set_cbuf( - struct panfrost_context *ctx, - struct pipe_surface *surf) + struct mali_single_framebuffer *fb, + struct pipe_surface *surf, + bool flip_y) { struct panfrost_resource *rsrc = pan_resource(surf->texture); signed stride = util_format_get_stride(surf->format, surf->texture->width0); - ctx->fragment_sfbd.format = panfrost_sfbd_format(surf); + fb->format = panfrost_sfbd_format(surf); if (rsrc->bo->layout == PAN_LINEAR) { mali_ptr framebuffer = rsrc->bo->gpu[0]; /* The default is upside down from OpenGL's perspective. */ - if (panfrost_is_scanout(ctx)) { + if (flip_y) { framebuffer += stride * (surf->texture->height0 - 1); stride = -stride; } - ctx->fragment_sfbd.framebuffer = framebuffer; - ctx->fragment_sfbd.stride = stride; + fb->framebuffer = framebuffer; + fb->stride = stride; } else { fprintf(stderr, "Invalid render layout\n"); assert(0); } } -static void -panfrost_sfbd_set_targets(struct panfrost_context *ctx) -{ - assert(ctx->pipe_framebuffer.nr_cbufs == 1); - panfrost_sfbd_set_cbuf(ctx, ctx->pipe_framebuffer.cbufs[0]); - - if (ctx->pipe_framebuffer.zsbuf) { - /* TODO */ - } -} - /* Creates an SFBD for the FRAGMENT section of the bound framebuffer */ mali_ptr -panfrost_sfbd_fragment(struct panfrost_context *ctx) +panfrost_sfbd_fragment(struct panfrost_context *ctx, bool flip_y) { struct panfrost_job *job = panfrost_get_job_for_fbo(ctx); - struct mali_single_framebuffer fb = panfrost_emit_sfbd(ctx); - memcpy(&ctx->fragment_sfbd, &fb, sizeof(fb)); - panfrost_sfbd_clear(job); - panfrost_sfbd_set_targets(ctx); + panfrost_sfbd_clear(job, &fb); + + /* SFBD does not support MRT natively; sanity check */ + assert(ctx->pipe_framebuffer.nr_cbufs == 1); + panfrost_sfbd_set_cbuf(&fb, ctx->pipe_framebuffer.cbufs[0], flip_y); + + if (ctx->pipe_framebuffer.zsbuf) { + /* TODO */ + } if (job->msaa) - panfrost_sfbd_enable_msaa(ctx); + fb.format |= MALI_FRAMEBUFFER_MSAA_A | MALI_FRAMEBUFFER_MSAA_B; - return MALI_SFBD | - panfrost_upload_transient(ctx, &ctx->fragment_sfbd, sizeof(fb)); + return panfrost_upload_transient(ctx, &fb, sizeof(fb)) | MALI_SFBD; } |