From dfc5620a41ee7fa86850ed68ac32c4dde3466a95 Mon Sep 17 00:00:00 2001 From: Rafael Antognolli Date: Tue, 26 Mar 2019 16:28:10 -0700 Subject: [PATCH] iris: Do not allocate clear_color_bo for gen8. Since we are not using it for the clear color, there's no need to allocate it. Fixes: a8b5ea8ef015ed4a "iris: Add function to update clear color in surface state." Reviewed-by: Kenneth Graunke --- src/gallium/drivers/iris/iris_resource.c | 9 +++++---- src/gallium/drivers/iris/iris_state.c | 6 ++++-- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/gallium/drivers/iris/iris_resource.c b/src/gallium/drivers/iris/iris_resource.c index bf8af133552..60ab31bc014 100644 --- a/src/gallium/drivers/iris/iris_resource.c +++ b/src/gallium/drivers/iris/iris_resource.c @@ -335,8 +335,7 @@ iris_resource_alloc_aux(struct iris_screen *screen, struct iris_resource *res) const struct gen_device_info *devinfo = &screen->devinfo; const unsigned clear_color_state_size = devinfo->gen >= 10 ? screen->isl_dev.ss.clear_color_state_size : - screen->isl_dev.ss.clear_value_size; - + (devinfo->gen >= 9 ? screen->isl_dev.ss.clear_value_size : 0); assert(!res->aux.bo); @@ -437,8 +436,10 @@ iris_resource_alloc_aux(struct iris_screen *screen, struct iris_resource *res) iris_bo_unmap(res->aux.bo); } - res->aux.clear_color_bo = res->aux.bo; - iris_bo_reference(res->aux.clear_color_bo); + if (clear_color_state_size > 0) { + res->aux.clear_color_bo = res->aux.bo; + iris_bo_reference(res->aux.clear_color_bo); + } if (res->aux.usage == ISL_AUX_USAGE_HIZ) { for (unsigned level = 0; level < res->surf.levels; ++level) { diff --git a/src/gallium/drivers/iris/iris_state.c b/src/gallium/drivers/iris/iris_state.c index fa9f2f74725..a77ca3fa621 100644 --- a/src/gallium/drivers/iris/iris_state.c +++ b/src/gallium/drivers/iris/iris_state.c @@ -3839,7 +3839,8 @@ use_surface(struct iris_context *ice, if (res->aux.bo) { iris_use_pinned_bo(batch, res->aux.bo, writeable); - iris_use_pinned_bo(batch, res->aux.clear_color_bo, false); + if (res->aux.clear_color_bo) + iris_use_pinned_bo(batch, res->aux.clear_color_bo, false); if (memcmp(&res->aux.clear_color, &surf->clear_color, sizeof(surf->clear_color)) != 0) { @@ -3867,7 +3868,8 @@ use_sampler_view(struct iris_context *ice, if (isv->res->aux.bo) { iris_use_pinned_bo(batch, isv->res->aux.bo, false); - iris_use_pinned_bo(batch, isv->res->aux.clear_color_bo, false); + if (isv->res->aux.clear_color_bo) + iris_use_pinned_bo(batch, isv->res->aux.clear_color_bo, false); if (memcmp(&isv->res->aux.clear_color, &isv->clear_color, sizeof(isv->clear_color)) != 0) { update_clear_value(ice, batch, isv->res, -- 2.30.2