OSDN Git Service

broadcom/vc4: Fix use-after-free trying to mix a quad and tile clear.
authorEric Anholt <eric@anholt.net>
Mon, 18 Sep 2017 22:17:31 +0000 (15:17 -0700)
committerJuan A. Suarez Romero <jasuarez@igalia.com>
Wed, 20 Sep 2017 20:54:11 +0000 (22:54 +0200)
commitf6469ac143a7ebff31fb5c5490d0cfa646cd1e22
treebf50856aff629fe31be88feebfe055109c92ea7d
parent727a6a8cddaf31ab422dde649752c9cbee54c7c6
broadcom/vc4: Fix use-after-free trying to mix a quad and tile clear.

The blitter will bind just the depth buffer, which flushes the current job
if we had both a color and depth/stencil.  If the clear was doing partial
depth/stencil (quad-based) and color (tile-based), we'd go on to try to
set up the rest of the tile clear in the now flushed job.

Instead, move the partial clear up before we start setting up the job for
the current FBO state, and re-fetch the job if we're continuing on to a
tile-based clear.  Fixes valgrind failures in fbo-depthtex.

Fixes: 9421a6065c4e ("vc4: Fix fallback to quad clears of depth in GLX.")
(cherry picked from commit 9940fb42058e0b0815e0edb202ca69b7853aead5)
src/gallium/drivers/vc4/vc4_draw.c