Skip to content

lima,panfrost: Do not ralloc contexts against the screen

Alyssa Rosenzweig requested to merge alyssa/mesa:panfrost/ralloc-context into main

ralloc is not thread-safe. While a given context can only be accessed from a single thread at once, multiple contexts can be created against the same screen at once. The ralloc allocations against the shared screens will race. Depending on the result of the race, the same block of memory can be returned as the two new contexts in two different threads, causing a use-after-free when the context is freed later.

We free the context explicitly when it's destroyed anyway. If screens are getting destroyed without the contexts getting destroyed first, that's a state tracker bug, not a Panfrost one.

This matches what Iris does.

Fixes crash in test_integer_ops.int_math on Panfrost.

Fixes: 0fcf73bc ("panfrost: Move to use ralloc for some allocations") Signed-off-by: Alyssa Rosenzweig alyssa@collabora.com

Merge request reports