summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/xe/xe_engine.h
blob: a3a44534003f78e02751e70d6f2a825cf5dfb47b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/* SPDX-License-Identifier: MIT */
/*
 * Copyright © 2021 Intel Corporation
 */

#ifndef _XE_ENGINE_H_
#define _XE_ENGINE_H_

#include "xe_engine_types.h"
#include "xe_vm_types.h"

struct drm_device;
struct drm_file;
struct xe_device;
struct xe_file;

struct xe_engine *xe_engine_create(struct xe_device *xe, struct xe_vm *vm,
				   u32 logical_mask, u16 width,
				   struct xe_hw_engine *hw_engine, u32 flags);
struct xe_engine *xe_engine_create_class(struct xe_device *xe, struct xe_gt *gt,
					 struct xe_vm *vm,
					 enum xe_engine_class class, u32 flags);

void xe_engine_fini(struct xe_engine *e);
void xe_engine_destroy(struct kref *ref);

struct xe_engine *xe_engine_lookup(struct xe_file *xef, u32 id);

static inline struct xe_engine *xe_engine_get(struct xe_engine *engine)
{
	kref_get(&engine->refcount);
	return engine;
}

static inline void xe_engine_put(struct xe_engine *engine)
{
	kref_put(&engine->refcount, xe_engine_destroy);
}

static inline bool xe_engine_is_parallel(struct xe_engine *engine)
{
	return engine->width > 1;
}

void xe_engine_kill(struct xe_engine *e);

int xe_engine_create_ioctl(struct drm_device *dev, void *data,
			   struct drm_file *file);
int xe_engine_destroy_ioctl(struct drm_device *dev, void *data,
			    struct drm_file *file);
int xe_engine_set_property_ioctl(struct drm_device *dev, void *data,
				 struct drm_file *file);
int xe_engine_get_property_ioctl(struct drm_device *dev, void *data,
				 struct drm_file *file);

#endif