89 lines · c
1/* SPDX-License-Identifier: MIT */2/*3 * Copyright © 2021 Intel Corporation4 */5 6#ifndef _XE_EXEC_QUEUE_H_7#define _XE_EXEC_QUEUE_H_8 9#include "xe_exec_queue_types.h"10#include "xe_vm_types.h"11 12struct drm_device;13struct drm_file;14struct xe_device;15struct xe_file;16 17struct xe_exec_queue *xe_exec_queue_create(struct xe_device *xe, struct xe_vm *vm,18 u32 logical_mask, u16 width,19 struct xe_hw_engine *hw_engine, u32 flags,20 u64 extensions);21struct xe_exec_queue *xe_exec_queue_create_class(struct xe_device *xe, struct xe_gt *gt,22 struct xe_vm *vm,23 enum xe_engine_class class,24 u32 flags, u64 extensions);25struct xe_exec_queue *xe_exec_queue_create_bind(struct xe_device *xe,26 struct xe_tile *tile,27 u32 flags, u64 extensions);28 29void xe_exec_queue_fini(struct xe_exec_queue *q);30void xe_exec_queue_destroy(struct kref *ref);31void xe_exec_queue_assign_name(struct xe_exec_queue *q, u32 instance);32 33static inline struct xe_exec_queue *34xe_exec_queue_get_unless_zero(struct xe_exec_queue *q)35{36 if (kref_get_unless_zero(&q->refcount))37 return q;38 39 return NULL;40}41 42struct xe_exec_queue *xe_exec_queue_lookup(struct xe_file *xef, u32 id);43 44static inline struct xe_exec_queue *xe_exec_queue_get(struct xe_exec_queue *q)45{46 kref_get(&q->refcount);47 return q;48}49 50static inline void xe_exec_queue_put(struct xe_exec_queue *q)51{52 kref_put(&q->refcount, xe_exec_queue_destroy);53}54 55static inline bool xe_exec_queue_is_parallel(struct xe_exec_queue *q)56{57 return q->width > 1;58}59 60bool xe_exec_queue_is_lr(struct xe_exec_queue *q);61 62bool xe_exec_queue_ring_full(struct xe_exec_queue *q);63 64bool xe_exec_queue_is_idle(struct xe_exec_queue *q);65 66void xe_exec_queue_kill(struct xe_exec_queue *q);67 68int xe_exec_queue_create_ioctl(struct drm_device *dev, void *data,69 struct drm_file *file);70int xe_exec_queue_destroy_ioctl(struct drm_device *dev, void *data,71 struct drm_file *file);72int xe_exec_queue_get_property_ioctl(struct drm_device *dev, void *data,73 struct drm_file *file);74enum xe_exec_queue_priority xe_exec_queue_device_get_max_priority(struct xe_device *xe);75 76void xe_exec_queue_last_fence_put(struct xe_exec_queue *e, struct xe_vm *vm);77void xe_exec_queue_last_fence_put_unlocked(struct xe_exec_queue *e);78struct dma_fence *xe_exec_queue_last_fence_get(struct xe_exec_queue *e,79 struct xe_vm *vm);80struct dma_fence *xe_exec_queue_last_fence_get_for_resume(struct xe_exec_queue *e,81 struct xe_vm *vm);82void xe_exec_queue_last_fence_set(struct xe_exec_queue *e, struct xe_vm *vm,83 struct dma_fence *fence);84int xe_exec_queue_last_fence_test_dep(struct xe_exec_queue *q,85 struct xe_vm *vm);86void xe_exec_queue_update_run_ticks(struct xe_exec_queue *q);87 88#endif89