Android 7.0.0 Release 0.2
gpu: pvr_sync: Handle out-of-order cleanup sync completion

pvr_sync uses a concept of a 'cleanup sync' to identify if a PVR sync
object is still in use by an outstanding render submitted to the
hardware, so it is not free'd until all operations are complete.

If multiple operations were submitted that depend on the same sync, each
would be assigned an incrementing value to write to the cleanup_sync.
The cleanup_sync would then be considered complete (and therefore safe
to free) when it reached the highest of these values. These values would
be assigned in submission order.

This caused an issue if the operations completed in a different order to
their submission, as the cleanup_sync will be set to the assigned value
at the end of the operation with no checks as to it's current value.
This meant that if the 'last submitted' command complete, the sync would
be considered safe to free even if there were other outstanding
operations, so when the sync was free'd and it's value reset for reuse
it may cause an operation to depend on a sync value that will never be
reached, causing the graphics queue to lockup.

This change makes it so that instead of an increment cleanup_sync value
being assigned to each render, a list of cleanup syncs is used. Each new
render is assigned a new cleanup_sync, and only when all cleanup_syncs
in the list are complete is it considered safe to free the PVR sync
object.

Bug: 28979017
Change-Id: I7b55e7eba7a07aa812eed4075b79e869bcc89c63
Signed-off-by: Jonathan Hamilton <jonathan.hamilton@imgtec.com>
1 file changed