panfrost: Allow testing if a specific batch is targeting a scanout FB
Rename panfrost_is_scanout() into panfrost_batch_is_scanout(), pass it a batch instead of a context and move the code to pan_job.c. With this in place, we can now test if a batch is targeting a scanout FB even if this batch is not bound to the context. Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com> Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
This commit is contained in:
@@ -151,24 +151,6 @@ panfrost_emit_mfbd(struct panfrost_context *ctx, unsigned vertex_count)
|
||||
return framebuffer;
|
||||
}
|
||||
|
||||
/* Are we currently rendering to the screen (rather than an FBO)? */
|
||||
|
||||
bool
|
||||
panfrost_is_scanout(struct panfrost_context *ctx)
|
||||
{
|
||||
/* If there is no color buffer, it's an FBO */
|
||||
if (ctx->pipe_framebuffer.nr_cbufs != 1)
|
||||
return false;
|
||||
|
||||
/* If we're too early that no framebuffer was sent, it's scanout */
|
||||
if (!ctx->pipe_framebuffer.cbufs[0])
|
||||
return true;
|
||||
|
||||
return ctx->pipe_framebuffer.cbufs[0]->texture->bind & PIPE_BIND_DISPLAY_TARGET ||
|
||||
ctx->pipe_framebuffer.cbufs[0]->texture->bind & PIPE_BIND_SCANOUT ||
|
||||
ctx->pipe_framebuffer.cbufs[0]->texture->bind & PIPE_BIND_SHARED;
|
||||
}
|
||||
|
||||
static void
|
||||
panfrost_clear(
|
||||
struct pipe_context *pipe,
|
||||
@@ -2396,7 +2378,7 @@ panfrost_set_framebuffer_state(struct pipe_context *pctx,
|
||||
*/
|
||||
|
||||
struct panfrost_batch *batch = panfrost_get_batch_for_fbo(ctx);
|
||||
bool is_scanout = panfrost_is_scanout(ctx);
|
||||
bool is_scanout = panfrost_batch_is_scanout(batch);
|
||||
bool has_draws = batch->last_job.gpu;
|
||||
|
||||
/* Bail out early when the current and new states are the same. */
|
||||
|
@@ -315,9 +315,6 @@ panfrost_flush(
|
||||
struct pipe_fence_handle **fence,
|
||||
unsigned flags);
|
||||
|
||||
bool
|
||||
panfrost_is_scanout(struct panfrost_context *ctx);
|
||||
|
||||
mali_ptr panfrost_sfbd_fragment(struct panfrost_context *ctx, bool has_draws);
|
||||
mali_ptr panfrost_mfbd_fragment(struct panfrost_context *ctx, bool has_draws);
|
||||
|
||||
|
@@ -375,6 +375,24 @@ panfrost_batch_intersection_scissor(struct panfrost_batch *batch,
|
||||
batch->maxy = MIN2(batch->maxy, maxy);
|
||||
}
|
||||
|
||||
/* Are we currently rendering to the screen (rather than an FBO)? */
|
||||
|
||||
bool
|
||||
panfrost_batch_is_scanout(struct panfrost_batch *batch)
|
||||
{
|
||||
/* If there is no color buffer, it's an FBO */
|
||||
if (batch->key.nr_cbufs != 1)
|
||||
return false;
|
||||
|
||||
/* If we're too early that no framebuffer was sent, it's scanout */
|
||||
if (!batch->key.cbufs[0])
|
||||
return true;
|
||||
|
||||
return batch->key.cbufs[0]->texture->bind & PIPE_BIND_DISPLAY_TARGET ||
|
||||
batch->key.cbufs[0]->texture->bind & PIPE_BIND_SCANOUT ||
|
||||
batch->key.cbufs[0]->texture->bind & PIPE_BIND_SHARED;
|
||||
}
|
||||
|
||||
void
|
||||
panfrost_batch_init(struct panfrost_context *ctx)
|
||||
{
|
||||
|
@@ -189,4 +189,7 @@ panfrost_scoreboard_queue_fused_job_prepend(
|
||||
void
|
||||
panfrost_scoreboard_link_batch(struct panfrost_batch *batch);
|
||||
|
||||
bool
|
||||
panfrost_batch_is_scanout(struct panfrost_batch *batch);
|
||||
|
||||
#endif
|
||||
|
@@ -454,9 +454,8 @@ panfrost_mfbd_fragment(struct panfrost_context *ctx, bool has_draws)
|
||||
* The exception is ReadPixels, but this is not supported on GLES so we
|
||||
* can safely ignore it. */
|
||||
|
||||
if (panfrost_is_scanout(ctx)) {
|
||||
if (panfrost_batch_is_scanout(batch))
|
||||
batch->requirements &= ~PAN_REQ_DEPTH_WRITE;
|
||||
}
|
||||
|
||||
/* Actualize the requirements */
|
||||
|
||||
|
Reference in New Issue
Block a user