diff options
Diffstat (limited to 'src/gallium/drivers/panfrost/pan_resource.c')
-rw-r--r-- | src/gallium/drivers/panfrost/pan_resource.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/src/gallium/drivers/panfrost/pan_resource.c b/src/gallium/drivers/panfrost/pan_resource.c index 73f987c45bc..6638f362855 100644 --- a/src/gallium/drivers/panfrost/pan_resource.c +++ b/src/gallium/drivers/panfrost/pan_resource.c @@ -416,16 +416,25 @@ panfrost_transfer_map(struct pipe_context *pctx, *out_transfer = &transfer->base; - if (resource->bind & PIPE_BIND_DISPLAY_TARGET || - resource->bind & PIPE_BIND_SCANOUT || - resource->bind & PIPE_BIND_SHARED) { - /* Mipmapped readpixels?! */ - assert(level == 0); + /* Check if we're bound for rendering and this is a read pixels. If so, + * we need to flush */ + + struct panfrost_context *ctx = pan_context(pctx); + struct pipe_framebuffer_state *fb = &ctx->pipe_framebuffer; + + bool is_bound = false; - /* Force a flush -- kill the pipeline */ + for (unsigned c = 0; c < fb->nr_cbufs; ++c) { + is_bound |= fb->cbufs[c]->texture == resource; + } + + if (is_bound && (usage & PIPE_TRANSFER_READ)) { + assert(level == 0); panfrost_flush(pctx, NULL, PIPE_FLUSH_END_OF_FRAME); } + /* TODO: Respect usage flags */ + if (usage & PIPE_TRANSFER_DISCARD_WHOLE_RESOURCE) { /* TODO: reallocate */ //printf("debug: Missed reallocate\n"); |