panfrost: Fix the DISCARD_WHOLE_RES case in transfer_map()
authorBoris Brezillon <boris.brezillon@collabora.com>
Thu, 10 Oct 2019 13:12:30 +0000 (15:12 +0200)
committerBoris Brezillon <boris.brezillon@collabora.com>
Mon, 21 Oct 2019 12:37:02 +0000 (14:37 +0200)
commit7fa5cd3ee365ed35c5799b96d7867b6ebded4fdd
treed121433b28f873c1b78ee3db5072e336d426a731
parent2d5edf2558869178515cd62b2305e01c2b3cfa35
panfrost: Fix the DISCARD_WHOLE_RES case in transfer_map()

The current implementation does not synchronize on BO readiness when
DISCARD_WHOLE_RES flag is set, which can lead to misbehaviours when the
resource being updated is being used by one of the pending or already
flushed batches.

Adding unconditional BO synchronization would do the trick, but we can
sometimes optimize this path by re-allocating a new BO instead of
waiting for the existing one to be ready.

Reported-by: Daniel Stone <daniels@collabora.com>
Reported-by: Heinrich Fink <heinrich.fink@daqri.com>
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
src/gallium/drivers/panfrost/pan_job.c
src/gallium/drivers/panfrost/pan_job.h
src/gallium/drivers/panfrost/pan_resource.c