gallium: add PIPE_RESOURCE_FLAG_UNMAPPABLE for shared unmappable buffers

We need to handle this in u_threaded_context for GL-VK interop.

Drivers should set this when importing buffers if needed.

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14750>
This commit is contained in:
Marek Olšák 2022-01-22 11:22:40 -05:00 committed by Marge Bot
parent 10e4bad803
commit eb4bd06ef4
2 changed files with 4 additions and 3 deletions

View file

@ -2013,7 +2013,7 @@ tc_invalidate_buffer(struct threaded_context *tc,
/* Shared, pinned, and sparse buffers can't be reallocated. */
if (tbuf->is_shared ||
tbuf->is_user_ptr ||
tbuf->b.flags & PIPE_RESOURCE_FLAG_SPARSE)
tbuf->b.flags & (PIPE_RESOURCE_FLAG_SPARSE | PIPE_RESOURCE_FLAG_UNMAPPABLE))
return false;
/* Allocate a new one. */
@ -2085,7 +2085,7 @@ tc_improve_map_buffer_flags(struct threaded_context *tc,
* (fully invalidated). That may just be a radeonsi limitation, but
* the threaded context must obey it with radeonsi.
*/
if (tres->b.flags & PIPE_RESOURCE_FLAG_SPARSE) {
if (tres->b.flags & (PIPE_RESOURCE_FLAG_SPARSE | PIPE_RESOURCE_FLAG_UNMAPPABLE)) {
/* We can use DISCARD_RANGE instead of full discard. This is the only
* fast path for sparse buffers that doesn't need thread synchronization.
*/

View file

@ -530,7 +530,8 @@ enum pipe_flush_flags
#define PIPE_RESOURCE_FLAG_ENCRYPTED (1 << 5)
#define PIPE_RESOURCE_FLAG_DONT_OVER_ALLOCATE (1 << 6)
#define PIPE_RESOURCE_FLAG_DONT_MAP_DIRECTLY (1 << 7) /* for small visible VRAM */
#define PIPE_RESOURCE_FLAG_DRV_PRIV (1 << 8) /* driver/winsys private */
#define PIPE_RESOURCE_FLAG_UNMAPPABLE (1 << 8) /* implies staging transfers due to VK interop */
#define PIPE_RESOURCE_FLAG_DRV_PRIV (1 << 9) /* driver/winsys private */
#define PIPE_RESOURCE_FLAG_FRONTEND_PRIV (1 << 24) /* gallium frontend private */
/**