[Mesa-dev] [PATCH 5/9] panfrost: Bail out early when doing a wallpaper blit

Alyssa Rosenzweig alyssa.rosenzweig at collabora.com
Fri Aug 2 15:02:31 UTC 2019


R-b, thank you especially for the comment deconstructing this magic.

On Fri, Aug 02, 2019 at 12:12:53PM +0200, Boris Brezillon wrote:
> The wallpaper blit is a bit special in that the operation is targetting
> the current FB, but the u_blitter logic creates a new surface for it
> which makes util_framebuffer_state_equal() return false. In that case
> we don't want a new FB descriptor to be emitted/attached, so let's just
> copy the new state into ctx->pipe_framebuffer and exit the function.
> 
> Signed-off-by: Boris Brezillon <boris.brezillon at collabora.com>
> ---
>  src/gallium/drivers/panfrost/pan_context.c | 16 ++++++++++++++--
>  1 file changed, 14 insertions(+), 2 deletions(-)
> 
> diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c
> index d442ae1f2433..1091caeb1148 100644
> --- a/src/gallium/drivers/panfrost/pan_context.c
> +++ b/src/gallium/drivers/panfrost/pan_context.c
> @@ -2369,10 +2369,22 @@ panfrost_set_framebuffer_state(struct pipe_context *pctx,
>          if (util_framebuffer_state_equal(&ctx->pipe_framebuffer, fb))
>                  return;
>  
> -        if (!ctx->wallpaper_batch && (!is_scanout || has_draws)) {
> -                panfrost_flush(pctx, NULL, PIPE_FLUSH_END_OF_FRAME);
> +        /* The wallpaper logic sets a new FB state before doing the blit and
> +         * restore the old one when it's done. Those FB states are reported to
> +         * be different because the surface they are pointing to are different,
> +         * but those surfaces actually point to the same cbufs/zbufs. In that
> +         * case we definitely don't want new FB descs to be emitted/attached
> +         * since the job is expected to be flushed just after the blit is done,
> +         * so let's just copy the new state and return here.
> +         */
> +        if (ctx->wallpaper_batch) {
> +                util_copy_framebuffer_state(&ctx->pipe_framebuffer, fb);
> +                return;
>          }
>  
> +        if (!is_scanout || has_draws)
> +                panfrost_flush(pctx, NULL, PIPE_FLUSH_END_OF_FRAME);
> +
>          util_copy_framebuffer_state(&ctx->pipe_framebuffer, fb);
>  
>          /* Given that we're rendering, we'd love to have compression */
> -- 
> 2.21.0
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20190802/da2a21b9/attachment.sig>


More information about the mesa-dev mailing list