From 42a865730ef72574e179b56a314f30fdccc6cba8 Mon Sep 17 00:00:00 2001 From: Nanley Chery Date: Mon, 27 Sep 2021 17:09:02 -0700 Subject: [PATCH] iris: Disable the SMEM fallback for CCS on XeHP On XeHP, CCS is only supported in local memory. Reviewed-by: Kenneth Graunke Part-of: --- src/gallium/drivers/iris/iris_resource.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/gallium/drivers/iris/iris_resource.c b/src/gallium/drivers/iris/iris_resource.c index 8b9037866b8..348665d6332 100644 --- a/src/gallium/drivers/iris/iris_resource.c +++ b/src/gallium/drivers/iris/iris_resource.c @@ -412,7 +412,8 @@ iris_resource_disable_aux(struct iris_resource *res) static uint32_t iris_resource_alloc_flags(const struct iris_screen *screen, - const struct pipe_resource *templ) + const struct pipe_resource *templ, + enum isl_aux_usage aux_usage) { if (templ->flags & IRIS_RESOURCE_FLAG_DEVICE_MEM) return 0; @@ -443,6 +444,9 @@ iris_resource_alloc_flags(const struct iris_screen *screen, PIPE_RESOURCE_FLAG_MAP_PERSISTENT)) flags |= BO_ALLOC_SMEM; + if (screen->devinfo.verx10 >= 125 && isl_aux_usage_has_ccs(aux_usage)) + flags |= BO_ALLOC_LMEM; + if ((templ->bind & PIPE_BIND_SHARED) || util_format_get_num_planes(templ->format) > 1) flags |= BO_ALLOC_NO_SUBALLOC; @@ -1052,7 +1056,7 @@ iris_resource_create_for_buffer(struct pipe_screen *pscreen, name = "bindless surface state"; } - unsigned flags = iris_resource_alloc_flags(screen, templ); + unsigned flags = iris_resource_alloc_flags(screen, templ, res->aux.usage); res->bo = iris_bo_alloc(screen->bufmgr, name, templ->width0, 1, memzone, flags); @@ -1095,10 +1099,13 @@ iris_resource_create_with_modifiers(struct pipe_screen *pscreen, iris_resource_configure_main(screen, res, templ, modifier, 0); assert(isl_surf_created_successfully); + if (!iris_resource_configure_aux(screen, res, false)) + goto fail; + const char *name = "miptree"; enum iris_memory_zone memzone = IRIS_MEMZONE_OTHER; - unsigned int flags = iris_resource_alloc_flags(screen, templ); + unsigned flags = iris_resource_alloc_flags(screen, templ, res->aux.usage); /* These are for u_upload_mgr buffers only */ assert(!(templ->flags & (IRIS_RESOURCE_FLAG_SHADER_MEMZONE | @@ -1106,9 +1113,6 @@ iris_resource_create_with_modifiers(struct pipe_screen *pscreen, IRIS_RESOURCE_FLAG_DYNAMIC_MEMZONE | IRIS_RESOURCE_FLAG_BINDLESS_MEMZONE))); - if (!iris_resource_configure_aux(screen, res, false)) - goto fail; - /* Modifiers require the aux data to be in the same buffer as the main * surface, but we combine them even when a modifier is not being used. */