1#ifndef __NVKM_LTC_PRIV_H__
2#define __NVKM_LTC_PRIV_H__
3#include <subdev/ltc.h>
4
5#include <core/mm.h>
6struct nvkm_fb;
7
8struct nvkm_ltc_priv {
9	struct nvkm_ltc base;
10	u32 ltc_nr;
11	u32 lts_nr;
12
13	u32 num_tags;
14	u32 tag_base;
15	struct nvkm_mm tags;
16	struct nvkm_mm_node *tag_ram;
17
18	u32 zbc_color[NVKM_LTC_MAX_ZBC_CNT][4];
19	u32 zbc_depth[NVKM_LTC_MAX_ZBC_CNT];
20};
21
22#define nvkm_ltc_create(p,e,o,d)                                               \
23	nvkm_ltc_create_((p), (e), (o), sizeof(**d), (void **)d)
24#define nvkm_ltc_destroy(p) ({                                                 \
25	struct nvkm_ltc_priv *_priv = (p);                                     \
26	_nvkm_ltc_dtor(nv_object(_priv));                                      \
27})
28#define nvkm_ltc_init(p) ({                                                    \
29	struct nvkm_ltc_priv *_priv = (p);                                     \
30	_nvkm_ltc_init(nv_object(_priv));                                      \
31})
32#define nvkm_ltc_fini(p,s) ({                                                  \
33	struct nvkm_ltc_priv *_priv = (p);                                     \
34	_nvkm_ltc_fini(nv_object(_priv), (s));                                 \
35})
36
37int  nvkm_ltc_create_(struct nvkm_object *, struct nvkm_object *,
38		      struct nvkm_oclass *, int, void **);
39
40#define _nvkm_ltc_dtor _nvkm_subdev_dtor
41int _nvkm_ltc_init(struct nvkm_object *);
42#define _nvkm_ltc_fini _nvkm_subdev_fini
43
44int  gf100_ltc_ctor(struct nvkm_object *, struct nvkm_object *,
45		    struct nvkm_oclass *, void *, u32,
46		    struct nvkm_object **);
47void gf100_ltc_dtor(struct nvkm_object *);
48int  gf100_ltc_init_tag_ram(struct nvkm_fb *, struct nvkm_ltc_priv *);
49int  gf100_ltc_tags_alloc(struct nvkm_ltc *, u32, struct nvkm_mm_node **);
50void gf100_ltc_tags_free(struct nvkm_ltc *, struct nvkm_mm_node **);
51
52struct nvkm_ltc_impl {
53	struct nvkm_oclass base;
54	void (*intr)(struct nvkm_subdev *);
55
56	void (*cbc_clear)(struct nvkm_ltc_priv *, u32 start, u32 limit);
57	void (*cbc_wait)(struct nvkm_ltc_priv *);
58
59	int zbc;
60	void (*zbc_clear_color)(struct nvkm_ltc_priv *, int, const u32[4]);
61	void (*zbc_clear_depth)(struct nvkm_ltc_priv *, int, const u32);
62};
63
64void gf100_ltc_intr(struct nvkm_subdev *);
65void gf100_ltc_cbc_clear(struct nvkm_ltc_priv *, u32, u32);
66void gf100_ltc_cbc_wait(struct nvkm_ltc_priv *);
67void gf100_ltc_zbc_clear_color(struct nvkm_ltc_priv *, int, const u32[4]);
68void gf100_ltc_zbc_clear_depth(struct nvkm_ltc_priv *, int, const u32);
69#endif
70