panfrost: Fix a polygon list corruption in the multi-context case
authorBoris Brezillon <boris.brezillon@collabora.com>
Tue, 2 Feb 2021 08:32:41 +0000 (09:32 +0100)
committerBoris Brezillon <boris.brezillon@collabora.com>
Fri, 5 Feb 2021 10:10:43 +0000 (11:10 +0100)
commit66125c429fe7ced20e1125b9a439ae98d5fab993
tree40e70f86c8e18b3fa1604f86edd865162fe30495
parent0c3fe064215864e7966c8640ad36f173d78cb855
panfrost: Fix a polygon list corruption in the multi-context case

The polygon list is written by tiler jobs and read by fragment ones,
and nothing should re-use the heap until the fragment job is done.
4fec6c944817 ("panfrost: Add the tiler heap to fragment jobs") fixed
this for the !multi-context case by adding the heap BO to fragment job.
But the tiler heap is shared accross contexts, and vertex/tiler+fragment
job submission is done through 2 separate ioctls, meaning that
vertex/tiler and fragment jobs from 2 different context might be
interleaved.

Add a lock at the device level to ensure tiler/vertex+fragment jobs are
submitted sequentially, with no other jobs using the same tiler heap
in-between.

Cc: mesa-stable
Fixes: d8deb1eb6a22 ("panfrost: Share tiler_heap across batches/contexts")
Reported-by: Icecream95 <ixn@disroot.org>
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Tested-by: Icecream95 <ixn@disroot.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8822>
src/gallium/drivers/panfrost/pan_job.c
src/panfrost/lib/pan_device.h
src/panfrost/lib/pan_props.c