diff --git a/src/gallium/drivers/crocus/crocus_bufmgr.c b/src/gallium/drivers/crocus/crocus_bufmgr.c index aa70271ffee..d3fe5ee42f5 100644 --- a/src/gallium/drivers/crocus/crocus_bufmgr.c +++ b/src/gallium/drivers/crocus/crocus_bufmgr.c @@ -429,6 +429,9 @@ bo_alloc_internal(struct crocus_bufmgr *bufmgr, bo->index = -1; bo->kflags = 0; + if (flags & BO_ALLOC_SCANOUT) + bo->scanout = 1; + if ((flags & BO_ALLOC_COHERENT) && !bo->cache_coherent) { struct drm_i915_gem_caching arg = { .handle = bo->gem_handle, @@ -1010,6 +1013,9 @@ crocus_bo_map_gtt(struct pipe_debug_callback *dbg, static bool can_map_cpu(struct crocus_bo *bo, unsigned flags) { + if (bo->scanout) + return false; + if (bo->cache_coherent) return true; diff --git a/src/gallium/drivers/crocus/crocus_bufmgr.h b/src/gallium/drivers/crocus/crocus_bufmgr.h index e4310448440..de550d99fa7 100644 --- a/src/gallium/drivers/crocus/crocus_bufmgr.h +++ b/src/gallium/drivers/crocus/crocus_bufmgr.h @@ -141,12 +141,18 @@ struct crocus_bo { */ bool userptr; + /** + * Boolean of if this is used for scanout. + */ + bool scanout; + /** Pre-computed hash using _mesa_hash_pointer for cache tracking sets */ uint32_t hash; }; #define BO_ALLOC_ZEROED (1 << 0) #define BO_ALLOC_COHERENT (1 << 1) +#define BO_ALLOC_SCANOUT (1 << 2) /** * Allocate a buffer object. diff --git a/src/gallium/drivers/crocus/crocus_resource.c b/src/gallium/drivers/crocus/crocus_resource.c index 38bfcc3660e..e503392ee56 100644 --- a/src/gallium/drivers/crocus/crocus_resource.c +++ b/src/gallium/drivers/crocus/crocus_resource.c @@ -708,6 +708,10 @@ crocus_resource_create_with_modifiers(struct pipe_screen *pscreen, if (templ->usage == PIPE_USAGE_STAGING) flags |= BO_ALLOC_COHERENT; + /* Scanout buffers need to be WC. */ + if (templ->bind & PIPE_BIND_SCANOUT) + flags |= BO_ALLOC_SCANOUT; + uint64_t aux_size = 0; uint32_t aux_preferred_alloc_flags;