Skip to content

panfrost: Fix tiler heap 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. 4fec6c94 ("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.

A different option has been discussed: move the tiler heap at the context level. But that implies duplicating the heap. Not a big deal for a 16M buffer I guess, but we'll have the same problem soon with the varying mem pool needed for indirect draws, and this one a 512M buffer.

/cc @icecream95

Merge request reports