xref: /netbsd-src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/engine/gr/nv40.h (revision 41ec02673d281bbb3d38e6c78504ce6e30c228c1)
1 /*	$NetBSD: nv40.h,v 1.3 2021/12/18 23:45:36 riastradh Exp $	*/
2 
3 /* SPDX-License-Identifier: MIT */
4 #ifndef __NV40_GR_H__
5 #define __NV40_GR_H__
6 #define nv40_gr(p) container_of((p), struct nv40_gr, base)
7 #include "priv.h"
8 
9 struct nv40_gr {
10 	struct nvkm_gr base;
11 	u32 size;
12 	struct list_head chan;
13 };
14 
15 int nv40_gr_new_(const struct nvkm_gr_func *, struct nvkm_device *, int index,
16 		 struct nvkm_gr **);
17 int nv40_gr_init(struct nvkm_gr *);
18 void nv40_gr_intr(struct nvkm_gr *);
19 u64 nv40_gr_units(struct nvkm_gr *);
20 
21 #define nv40_gr_chan(p) container_of((p), struct nv40_gr_chan, object)
22 #include <core/object.h>
23 
24 struct nv40_gr_chan {
25 	struct nvkm_object object;
26 	struct nv40_gr *gr;
27 	struct nvkm_fifo_chan *fifo;
28 	u32 inst;
29 	struct list_head head;
30 };
31 
32 int nv40_gr_chan_new(struct nvkm_gr *, struct nvkm_fifo_chan *,
33 		     const struct nvkm_oclass *, struct nvkm_object **);
34 
35 extern const struct nvkm_object_func nv40_gr_object;
36 
37 /* returns 1 if device is one of the nv4x using the 0x4497 object class,
38  * helpful to determine a number of other hardware features
39  */
40 static inline int
nv44_gr_class(struct nvkm_device * device)41 nv44_gr_class(struct nvkm_device *device)
42 {
43 	if ((device->chipset & 0xf0) == 0x60)
44 		return 1;
45 
46 	return !(0x0aaf & (1 << (device->chipset & 0x0f)));
47 }
48 
49 int  nv40_grctx_init(struct nvkm_device *, u32 *size);
50 void nv40_grctx_fill(struct nvkm_device *, struct nvkm_gpuobj *);
51 #endif
52