From c86d6c8af8b3a60710add7b60cccea9d60e82b9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Roberto=20de=20Souza?= Date: Tue, 14 Feb 2023 11:19:01 -0800 Subject: [PATCH] iris: Move to iris_i915_batch.c code to destroy i915 context MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: José Roberto de Souza Reviewed-by: Lionel Landwerlin Part-of: --- src/gallium/drivers/iris/i915/iris_batch.c | 18 ++++++++++++++++++ src/gallium/drivers/iris/i915/iris_batch.h | 1 + src/gallium/drivers/iris/iris_batch.c | 2 +- src/gallium/drivers/iris/iris_bufmgr.c | 10 ---------- src/gallium/drivers/iris/iris_bufmgr.h | 2 -- 5 files changed, 20 insertions(+), 13 deletions(-) diff --git a/src/gallium/drivers/iris/i915/iris_batch.c b/src/gallium/drivers/iris/i915/iris_batch.c index fd7aadf78e7..224e065a2dd 100644 --- a/src/gallium/drivers/iris/i915/iris_batch.c +++ b/src/gallium/drivers/iris/i915/iris_batch.c @@ -225,6 +225,16 @@ clone_hw_context(struct iris_batch *batch) return new_ctx; } +static void +iris_destroy_kernel_context(struct iris_bufmgr *bufmgr, uint32_t ctx_id) +{ + if (ctx_id != 0 && + !intel_gem_destroy_context(iris_bufmgr_get_fd(bufmgr), ctx_id)) { + fprintf(stderr, "DRM_IOCTL_I915_GEM_CONTEXT_DESTROY failed: %s\n", + strerror(errno)); + } +} + bool iris_i915_replace_batch(struct iris_batch *batch) { @@ -258,6 +268,14 @@ iris_i915_replace_batch(struct iris_batch *batch) return true; } +void iris_i915_destroy_batch(struct iris_batch *batch) +{ + struct iris_screen *screen = batch->screen; + struct iris_bufmgr *bufmgr = screen->bufmgr; + + iris_destroy_kernel_context(bufmgr, batch->ctx_id); +} + void iris_i915_init_batches(struct iris_context *ice) { if (!iris_init_engines_context(ice)) diff --git a/src/gallium/drivers/iris/i915/iris_batch.h b/src/gallium/drivers/iris/i915/iris_batch.h index 281becaf3ad..ff272f26869 100644 --- a/src/gallium/drivers/iris/i915/iris_batch.h +++ b/src/gallium/drivers/iris/i915/iris_batch.h @@ -29,3 +29,4 @@ struct iris_context; void iris_i915_init_batches(struct iris_context *ice); bool iris_i915_replace_batch(struct iris_batch *batch); +void iris_i915_destroy_batch(struct iris_batch *batch); diff --git a/src/gallium/drivers/iris/iris_batch.c b/src/gallium/drivers/iris/iris_batch.c index 97c548c357a..9664768bb0d 100644 --- a/src/gallium/drivers/iris/iris_batch.c +++ b/src/gallium/drivers/iris/iris_batch.c @@ -510,7 +510,7 @@ iris_batch_free(const struct iris_context *ice, struct iris_batch *batch) * context */ if (!ice->has_engines_context || &ice->batches[0] == batch) - iris_destroy_kernel_context(bufmgr, batch->ctx_id); + iris_i915_destroy_batch(batch); iris_destroy_batch_measure(batch->measure); batch->measure = NULL; diff --git a/src/gallium/drivers/iris/iris_bufmgr.c b/src/gallium/drivers/iris/iris_bufmgr.c index 5af5b01dc4b..42400fa5248 100644 --- a/src/gallium/drivers/iris/iris_bufmgr.c +++ b/src/gallium/drivers/iris/iris_bufmgr.c @@ -2039,16 +2039,6 @@ init_cache_buckets(struct iris_bufmgr *bufmgr, enum iris_heap heap) } } -void -iris_destroy_kernel_context(struct iris_bufmgr *bufmgr, uint32_t ctx_id) -{ - if (ctx_id != 0 && - !intel_gem_destroy_context(bufmgr->fd, ctx_id)) { - fprintf(stderr, "DRM_IOCTL_I915_GEM_CONTEXT_DESTROY failed: %s\n", - strerror(errno)); - } -} - static struct intel_buffer * intel_aux_map_buffer_alloc(void *driver_ctx, uint32_t size) { diff --git a/src/gallium/drivers/iris/iris_bufmgr.h b/src/gallium/drivers/iris/iris_bufmgr.h index 983b34a56a0..808b1cd5e7b 100644 --- a/src/gallium/drivers/iris/iris_bufmgr.h +++ b/src/gallium/drivers/iris/iris_bufmgr.h @@ -481,8 +481,6 @@ struct iris_bo *iris_bo_gem_create_from_name(struct iris_bufmgr *bufmgr, void* iris_bufmgr_get_aux_map_context(struct iris_bufmgr *bufmgr); -void iris_destroy_kernel_context(struct iris_bufmgr *bufmgr, uint32_t ctx_id); - int iris_gem_get_tiling(struct iris_bo *bo, uint32_t *tiling); int iris_gem_set_tiling(struct iris_bo *bo, const struct isl_surf *surf);