From 484246ea0a95e6e8e26acf30ad560ff2bc7b2ef4 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Fri, 1 Oct 2021 01:33:09 -0700 Subject: [PATCH] iris: Eliminate prototype introduced in the previous patch By moving iris_flush_resource() below. This is done separately to make the diff for the actual change in the previous patch easier to follow. Reviewed-by: Paulo Zanoni Reviewed-by: Nanley Chery Part-of: --- src/gallium/drivers/iris/iris_resource.c | 83 +++++++++++------------- 1 file changed, 39 insertions(+), 44 deletions(-) diff --git a/src/gallium/drivers/iris/iris_resource.c b/src/gallium/drivers/iris/iris_resource.c index 237583f0c21..12a579e4431 100644 --- a/src/gallium/drivers/iris/iris_resource.c +++ b/src/gallium/drivers/iris/iris_resource.c @@ -1477,50 +1477,6 @@ iris_resource_from_memobj_wrapper(struct pipe_screen *pscreen, return prsc; } -static void -iris_reallocate_resource_inplace(struct iris_context *ice, - struct iris_resource *old_res, - unsigned new_bind_flag); - -static void -iris_flush_resource(struct pipe_context *ctx, struct pipe_resource *resource) -{ - struct iris_context *ice = (struct iris_context *)ctx; - struct iris_resource *res = (void *) resource; - const struct isl_drm_modifier_info *mod = res->mod_info; - bool newly_external = false; - - /* flush_resource() may be used to prepare an image for sharing externally - * with other clients (e.g. via eglCreateImage). To account for this, we - * make sure to eliminate suballocation and any compression that a consumer - * wouldn't know how to handle. - */ - if (!iris_bo_is_real(res->bo)) { - assert(!(res->base.b.bind & PIPE_BIND_SHARED)); - iris_reallocate_resource_inplace(ice, res, PIPE_BIND_SHARED); - assert(res->base.b.bind & PIPE_BIND_SHARED); - newly_external = true; - } - - iris_resource_prepare_access(ice, res, - 0, INTEL_REMAINING_LEVELS, - 0, INTEL_REMAINING_LAYERS, - mod ? res->aux.usage : ISL_AUX_USAGE_NONE, - mod ? mod->supports_clear_color : false); - - bool disable_aux = !res->mod_info && res->aux.usage != ISL_AUX_USAGE_NONE; - - if (newly_external || disable_aux) { - iris_foreach_batch(ice, batch) { - if (iris_batch_references(batch, res->bo)) - iris_batch_flush(batch); - } - } - - if (disable_aux) - iris_resource_disable_aux(res); -} - /** * Reallocate a (non-external) resource into new storage, copying the data * and modifying the original resource to point at the new storage. @@ -1614,6 +1570,45 @@ iris_reallocate_resource_inplace(struct iris_context *ice, pipe_resource_reference((struct pipe_resource **)&new_res, NULL); } +static void +iris_flush_resource(struct pipe_context *ctx, struct pipe_resource *resource) +{ + struct iris_context *ice = (struct iris_context *)ctx; + struct iris_resource *res = (void *) resource; + const struct isl_drm_modifier_info *mod = res->mod_info; + bool newly_external = false; + + /* flush_resource() may be used to prepare an image for sharing externally + * with other clients (e.g. via eglCreateImage). To account for this, we + * make sure to eliminate suballocation and any compression that a consumer + * wouldn't know how to handle. + */ + if (!iris_bo_is_real(res->bo)) { + assert(!(res->base.b.bind & PIPE_BIND_SHARED)); + iris_reallocate_resource_inplace(ice, res, PIPE_BIND_SHARED); + assert(res->base.b.bind & PIPE_BIND_SHARED); + newly_external = true; + } + + iris_resource_prepare_access(ice, res, + 0, INTEL_REMAINING_LEVELS, + 0, INTEL_REMAINING_LAYERS, + mod ? res->aux.usage : ISL_AUX_USAGE_NONE, + mod ? mod->supports_clear_color : false); + + bool disable_aux = !res->mod_info && res->aux.usage != ISL_AUX_USAGE_NONE; + + if (newly_external || disable_aux) { + iris_foreach_batch(ice, batch) { + if (iris_batch_references(batch, res->bo)) + iris_batch_flush(batch); + } + } + + if (disable_aux) + iris_resource_disable_aux(res); +} + static void iris_resource_disable_aux_on_first_query(struct pipe_resource *resource, unsigned usage)