1 /* SPDX-License-Identifier: MIT */
2 #ifndef __NVKM_LTC_H__
3 #define __NVKM_LTC_H__
4 #include <core/subdev.h>
5 #include <core/mm.h>
6 
7 #define NVKM_LTC_MAX_ZBC_COLOR_CNT 32
8 #define NVKM_LTC_MAX_ZBC_DEPTH_CNT 16
9 
10 struct nvkm_ltc {
11 	const struct nvkm_ltc_func *func;
12 	struct nvkm_subdev subdev;
13 
14 	u32 ltc_nr;
15 	u32 lts_nr;
16 
17 	struct mutex mutex; /* serialises CBC operations */
18 	u32 num_tags;
19 	u32 tag_base;
20 	struct nvkm_memory *tag_ram;
21 
22 	int zbc_color_min;
23 	int zbc_color_max;
24 	u32 zbc_color[NVKM_LTC_MAX_ZBC_COLOR_CNT][4];
25 	int zbc_depth_min;
26 	int zbc_depth_max;
27 	u32 zbc_depth[NVKM_LTC_MAX_ZBC_DEPTH_CNT];
28 	u32 zbc_stencil[NVKM_LTC_MAX_ZBC_DEPTH_CNT];
29 };
30 
31 void nvkm_ltc_tags_clear(struct nvkm_device *, u32 first, u32 count);
32 
33 int nvkm_ltc_zbc_color_get(struct nvkm_ltc *, int index, const u32[4]);
34 int nvkm_ltc_zbc_depth_get(struct nvkm_ltc *, int index, const u32);
35 int nvkm_ltc_zbc_stencil_get(struct nvkm_ltc *, int index, const u32);
36 
37 void nvkm_ltc_invalidate(struct nvkm_ltc *);
38 void nvkm_ltc_flush(struct nvkm_ltc *);
39 
40 int gf100_ltc_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_ltc **);
41 int gk104_ltc_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_ltc **);
42 int gm107_ltc_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_ltc **);
43 int gm200_ltc_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_ltc **);
44 int gp100_ltc_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_ltc **);
45 int gp102_ltc_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_ltc **);
46 int gp10b_ltc_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_ltc **);
47 int ga102_ltc_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_ltc **);
48 #endif
49