intel: Add and use intel_gem_destroy_context()
Again sharing the same function across all Intel drivers. 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/18974>
This commit is contained in:

committed by
Marge Bot

parent
f928ead625
commit
6ae6921216
@@ -1594,10 +1594,8 @@ crocus_clone_hw_context(struct crocus_bufmgr *bufmgr, uint32_t ctx_id)
|
|||||||
void
|
void
|
||||||
crocus_destroy_hw_context(struct crocus_bufmgr *bufmgr, uint32_t ctx_id)
|
crocus_destroy_hw_context(struct crocus_bufmgr *bufmgr, uint32_t ctx_id)
|
||||||
{
|
{
|
||||||
struct drm_i915_gem_context_destroy d = { .ctx_id = ctx_id };
|
|
||||||
|
|
||||||
if (ctx_id != 0 &&
|
if (ctx_id != 0 &&
|
||||||
intel_ioctl(bufmgr->fd, DRM_IOCTL_I915_GEM_CONTEXT_DESTROY, &d) != 0) {
|
!intel_gem_destroy_context(bufmgr->fd, ctx_id)) {
|
||||||
fprintf(stderr, "DRM_IOCTL_I915_GEM_CONTEXT_DESTROY failed: %s\n",
|
fprintf(stderr, "DRM_IOCTL_I915_GEM_CONTEXT_DESTROY failed: %s\n",
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
}
|
}
|
||||||
|
@@ -2294,10 +2294,8 @@ iris_clone_hw_context(struct iris_bufmgr *bufmgr, uint32_t ctx_id)
|
|||||||
void
|
void
|
||||||
iris_destroy_kernel_context(struct iris_bufmgr *bufmgr, uint32_t ctx_id)
|
iris_destroy_kernel_context(struct iris_bufmgr *bufmgr, uint32_t ctx_id)
|
||||||
{
|
{
|
||||||
struct drm_i915_gem_context_destroy d = { .ctx_id = ctx_id };
|
|
||||||
|
|
||||||
if (ctx_id != 0 &&
|
if (ctx_id != 0 &&
|
||||||
intel_ioctl(bufmgr->fd, DRM_IOCTL_I915_GEM_CONTEXT_DESTROY, &d) != 0) {
|
!intel_gem_destroy_context(bufmgr->fd, ctx_id)) {
|
||||||
fprintf(stderr, "DRM_IOCTL_I915_GEM_CONTEXT_DESTROY failed: %s\n",
|
fprintf(stderr, "DRM_IOCTL_I915_GEM_CONTEXT_DESTROY failed: %s\n",
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
}
|
}
|
||||||
|
@@ -68,6 +68,15 @@ intel_gem_create_context(int fd, uint32_t *context_id)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
intel_gem_destroy_context(int fd, uint32_t context_id)
|
||||||
|
{
|
||||||
|
struct drm_i915_gem_context_destroy destroy = {
|
||||||
|
.ctx_id = context_id,
|
||||||
|
};
|
||||||
|
return intel_ioctl(fd, DRM_IOCTL_I915_GEM_CONTEXT_DESTROY, &destroy) == 0;
|
||||||
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
intel_gem_create_context_engines(int fd,
|
intel_gem_create_context_engines(int fd,
|
||||||
const struct intel_query_engine_info *info,
|
const struct intel_query_engine_info *info,
|
||||||
|
@@ -160,6 +160,7 @@ intel_i915_query_alloc(int fd, uint64_t query_id, int32_t *query_length)
|
|||||||
bool intel_gem_supports_syncobj_wait(int fd);
|
bool intel_gem_supports_syncobj_wait(int fd);
|
||||||
|
|
||||||
bool intel_gem_create_context(int fd, uint32_t *context_id);
|
bool intel_gem_create_context(int fd, uint32_t *context_id);
|
||||||
|
bool intel_gem_destroy_context(int fd, uint32_t context_id);
|
||||||
bool
|
bool
|
||||||
intel_gem_create_context_engines(int fd,
|
intel_gem_create_context_engines(int fd,
|
||||||
const struct intel_query_engine_info *info,
|
const struct intel_query_engine_info *info,
|
||||||
|
@@ -3206,7 +3206,7 @@ anv_device_setup_context(struct anv_device *device,
|
|||||||
return result;
|
return result;
|
||||||
|
|
||||||
fail_context:
|
fail_context:
|
||||||
anv_gem_destroy_context(device, device->context_id);
|
intel_gem_destroy_context(device->fd, device->context_id);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3663,7 +3663,7 @@ VkResult anv_CreateDevice(
|
|||||||
anv_queue_finish(&device->queues[i]);
|
anv_queue_finish(&device->queues[i]);
|
||||||
vk_free(&device->vk.alloc, device->queues);
|
vk_free(&device->vk.alloc, device->queues);
|
||||||
fail_context_id:
|
fail_context_id:
|
||||||
anv_gem_destroy_context(device, device->context_id);
|
intel_gem_destroy_context(device->fd, device->context_id);
|
||||||
fail_fd:
|
fail_fd:
|
||||||
close(device->fd);
|
close(device->fd);
|
||||||
fail_device:
|
fail_device:
|
||||||
@@ -3748,7 +3748,7 @@ void anv_DestroyDevice(
|
|||||||
anv_queue_finish(&device->queues[i]);
|
anv_queue_finish(&device->queues[i]);
|
||||||
vk_free(&device->vk.alloc, device->queues);
|
vk_free(&device->vk.alloc, device->queues);
|
||||||
|
|
||||||
anv_gem_destroy_context(device, device->context_id);
|
intel_gem_destroy_context(device->fd, device->context_id);
|
||||||
|
|
||||||
if (INTEL_DEBUG(DEBUG_BATCH))
|
if (INTEL_DEBUG(DEBUG_BATCH))
|
||||||
intel_batch_decode_ctx_finish(&device->decoder_ctx);
|
intel_batch_decode_ctx_finish(&device->decoder_ctx);
|
||||||
|
@@ -302,16 +302,6 @@ anv_gem_has_context_priority(int fd, VkQueueGlobalPriorityKHR priority)
|
|||||||
priority);
|
priority);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
|
||||||
anv_gem_destroy_context(struct anv_device *device, int context)
|
|
||||||
{
|
|
||||||
struct drm_i915_gem_context_destroy destroy = {
|
|
||||||
.ctx_id = context,
|
|
||||||
};
|
|
||||||
|
|
||||||
return intel_ioctl(device->fd, DRM_IOCTL_I915_GEM_CONTEXT_DESTROY, &destroy);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
vk_priority_to_i915(VkQueueGlobalPriorityKHR priority)
|
vk_priority_to_i915(VkQueueGlobalPriorityKHR priority)
|
||||||
{
|
{
|
||||||
|
@@ -124,12 +124,6 @@ anv_gem_get_param(int fd, uint32_t param)
|
|||||||
unreachable("Unused");
|
unreachable("Unused");
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
|
||||||
anv_gem_destroy_context(struct anv_device *device, int context)
|
|
||||||
{
|
|
||||||
unreachable("Unused");
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
int
|
||||||
anv_gem_set_context_param(int fd, int context, uint32_t param, uint64_t value)
|
anv_gem_set_context_param(int fd, int context, uint32_t param, uint64_t value)
|
||||||
{
|
{
|
||||||
|
@@ -1347,7 +1347,6 @@ int anv_gem_execbuffer(struct anv_device *device,
|
|||||||
int anv_gem_set_tiling(struct anv_device *device, uint32_t gem_handle,
|
int anv_gem_set_tiling(struct anv_device *device, uint32_t gem_handle,
|
||||||
uint32_t stride, uint32_t tiling);
|
uint32_t stride, uint32_t tiling);
|
||||||
bool anv_gem_has_context_priority(int fd, VkQueueGlobalPriorityKHR priority);
|
bool anv_gem_has_context_priority(int fd, VkQueueGlobalPriorityKHR priority);
|
||||||
int anv_gem_destroy_context(struct anv_device *device, int context);
|
|
||||||
int anv_gem_set_context_param(int fd, int context, uint32_t param,
|
int anv_gem_set_context_param(int fd, int context, uint32_t param,
|
||||||
uint64_t value);
|
uint64_t value);
|
||||||
int anv_gem_get_param(int fd, uint32_t param);
|
int anv_gem_get_param(int fd, uint32_t param);
|
||||||
|
@@ -2855,7 +2855,7 @@ anv_device_setup_context(struct anv_device *device,
|
|||||||
return result;
|
return result;
|
||||||
|
|
||||||
fail_context:
|
fail_context:
|
||||||
anv_gem_destroy_context(device, device->context_id);
|
intel_gem_destroy_context(device->fd, device->context_id);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3263,7 +3263,7 @@ VkResult anv_CreateDevice(
|
|||||||
anv_queue_finish(&device->queues[i]);
|
anv_queue_finish(&device->queues[i]);
|
||||||
vk_free(&device->vk.alloc, device->queues);
|
vk_free(&device->vk.alloc, device->queues);
|
||||||
fail_context_id:
|
fail_context_id:
|
||||||
anv_gem_destroy_context(device, device->context_id);
|
intel_gem_destroy_context(device->fd, device->context_id);
|
||||||
fail_fd:
|
fail_fd:
|
||||||
close(device->fd);
|
close(device->fd);
|
||||||
fail_device:
|
fail_device:
|
||||||
@@ -3335,7 +3335,7 @@ void anv_DestroyDevice(
|
|||||||
anv_queue_finish(&device->queues[i]);
|
anv_queue_finish(&device->queues[i]);
|
||||||
vk_free(&device->vk.alloc, device->queues);
|
vk_free(&device->vk.alloc, device->queues);
|
||||||
|
|
||||||
anv_gem_destroy_context(device, device->context_id);
|
intel_gem_destroy_context(device->fd, device->context_id);
|
||||||
|
|
||||||
if (INTEL_DEBUG(DEBUG_BATCH))
|
if (INTEL_DEBUG(DEBUG_BATCH))
|
||||||
intel_batch_decode_ctx_finish(&device->decoder_ctx);
|
intel_batch_decode_ctx_finish(&device->decoder_ctx);
|
||||||
|
@@ -273,16 +273,6 @@ anv_gem_has_context_priority(int fd, int priority)
|
|||||||
priority);
|
priority);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
|
||||||
anv_gem_destroy_context(struct anv_device *device, int context)
|
|
||||||
{
|
|
||||||
struct drm_i915_gem_context_destroy destroy = {
|
|
||||||
.ctx_id = context,
|
|
||||||
};
|
|
||||||
|
|
||||||
return intel_ioctl(device->fd, DRM_IOCTL_I915_GEM_CONTEXT_DESTROY, &destroy);
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
int
|
||||||
anv_gem_set_context_param(int fd, int context, uint32_t param, uint64_t value)
|
anv_gem_set_context_param(int fd, int context, uint32_t param, uint64_t value)
|
||||||
{
|
{
|
||||||
|
@@ -116,12 +116,6 @@ anv_gem_get_param(int fd, uint32_t param)
|
|||||||
unreachable("Unused");
|
unreachable("Unused");
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
|
||||||
anv_gem_destroy_context(struct anv_device *device, int context)
|
|
||||||
{
|
|
||||||
unreachable("Unused");
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
int
|
||||||
anv_gem_set_context_param(int fd, int context, uint32_t param, uint64_t value)
|
anv_gem_set_context_param(int fd, int context, uint32_t param, uint64_t value)
|
||||||
{
|
{
|
||||||
|
@@ -1382,7 +1382,6 @@ int anv_gem_execbuffer(struct anv_device *device,
|
|||||||
int anv_gem_set_tiling(struct anv_device *device, uint32_t gem_handle,
|
int anv_gem_set_tiling(struct anv_device *device, uint32_t gem_handle,
|
||||||
uint32_t stride, uint32_t tiling);
|
uint32_t stride, uint32_t tiling);
|
||||||
bool anv_gem_has_context_priority(int fd, int priority);
|
bool anv_gem_has_context_priority(int fd, int priority);
|
||||||
int anv_gem_destroy_context(struct anv_device *device, int context);
|
|
||||||
int anv_gem_set_context_param(int fd, int context, uint32_t param,
|
int anv_gem_set_context_param(int fd, int context, uint32_t param,
|
||||||
uint64_t value);
|
uint64_t value);
|
||||||
int anv_gem_get_param(int fd, uint32_t param);
|
int anv_gem_get_param(int fd, uint32_t param);
|
||||||
|
Reference in New Issue
Block a user