summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/nouveau/include/nvkm/core/engine.h
blob: 48bf128456a16ba90e036e246902bbba3e6db36c (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
#ifndef __NVKM_ENGINE_H__
#define __NVKM_ENGINE_H__
#define nvkm_engine(p) container_of((p), struct nvkm_engine, subdev)
#include <core/subdev.h>
struct nvkm_fifo_chan;
struct nvkm_fb_tile;

struct nvkm_engine {
	const struct nvkm_engine_func *func;
	struct nvkm_subdev subdev;
	spinlock_t lock;

	int usecount;
};

struct nvkm_engine_func {
	void *(*dtor)(struct nvkm_engine *);
	int (*oneinit)(struct nvkm_engine *);
	int (*init)(struct nvkm_engine *);
	int (*fini)(struct nvkm_engine *, bool suspend);
	void (*intr)(struct nvkm_engine *);
	void (*tile)(struct nvkm_engine *, int region, struct nvkm_fb_tile *);

	struct {
		int (*sclass)(struct nvkm_oclass *, int index,
			      const struct nvkm_device_oclass **);
	} base;

	struct {
		int (*cclass)(struct nvkm_fifo_chan *,
			      const struct nvkm_oclass *,
			      struct nvkm_object **);
		int (*sclass)(struct nvkm_oclass *, int index);
	} fifo;

	const struct nvkm_object_func *cclass;
	struct nvkm_sclass sclass[];
};

int nvkm_engine_ctor(const struct nvkm_engine_func *, struct nvkm_device *,
		     int index, u32 pmc_enable, bool enable,
		     struct nvkm_engine *);
int nvkm_engine_new_(const struct nvkm_engine_func *, struct nvkm_device *,
		     int index, u32 pmc_enable, bool enable,
		     struct nvkm_engine **);
struct nvkm_engine *nvkm_engine_ref(struct nvkm_engine *);
void nvkm_engine_unref(struct nvkm_engine **);
void nvkm_engine_tile(struct nvkm_engine *, int region);
#endif