iris: Move to iris_i915_batch.c code to destroy i915 context

Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21965>
This commit is contained in:
José Roberto de Souza
2023-02-14 11:19:01 -08:00
committed by Marge Bot
parent cb40ff3ecb
commit c86d6c8af8
5 changed files with 20 additions and 13 deletions

View File

@@ -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))

View File

@@ -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);

View File

@@ -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;

View File

@@ -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)
{

View File

@@ -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);