Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid
[firefly-linux-kernel-4.4.55.git] / drivers / gpu / drm / nouveau / core / subdev / ltc / priv.h
1 #ifndef __NVKM_LTC_PRIV_H__
2 #define __NVKM_LTC_PRIV_H__
3
4 #include <subdev/ltc.h>
5 #include <subdev/fb.h>
6
7 struct nvkm_ltc_priv {
8         struct nouveau_ltc base;
9         u32 ltc_nr;
10         u32 lts_nr;
11
12         u32 num_tags;
13         u32 tag_base;
14         struct nouveau_mm tags;
15         struct nouveau_mm_node *tag_ram;
16
17         u32 zbc_color[NOUVEAU_LTC_MAX_ZBC_CNT][4];
18         u32 zbc_depth[NOUVEAU_LTC_MAX_ZBC_CNT];
19 };
20
21 #define nvkm_ltc_create(p,e,o,d)                                               \
22         nvkm_ltc_create_((p), (e), (o), sizeof(**d), (void **)d)
23 #define nvkm_ltc_destroy(p) ({                                                 \
24         struct nvkm_ltc_priv *_priv = (p);                                     \
25         _nvkm_ltc_dtor(nv_object(_priv));                                      \
26 })
27 #define nvkm_ltc_init(p) ({                                                    \
28         struct nvkm_ltc_priv *_priv = (p);                                     \
29         _nvkm_ltc_init(nv_object(_priv));                                      \
30 })
31 #define nvkm_ltc_fini(p,s) ({                                                  \
32         struct nvkm_ltc_priv *_priv = (p);                                     \
33         _nvkm_ltc_fini(nv_object(_priv), (s));                                 \
34 })
35
36 int  nvkm_ltc_create_(struct nouveau_object *, struct nouveau_object *,
37                       struct nouveau_oclass *, int, void **);
38
39 #define _nvkm_ltc_dtor _nouveau_subdev_dtor
40 int _nvkm_ltc_init(struct nouveau_object *);
41 #define _nvkm_ltc_fini _nouveau_subdev_fini
42
43 int  gf100_ltc_ctor(struct nouveau_object *, struct nouveau_object *,
44                     struct nouveau_oclass *, void *, u32,
45                     struct nouveau_object **);
46 void gf100_ltc_dtor(struct nouveau_object *);
47 int  gf100_ltc_init_tag_ram(struct nouveau_fb *, struct nvkm_ltc_priv *);
48 int  gf100_ltc_tags_alloc(struct nouveau_ltc *, u32, struct nouveau_mm_node **);
49 void gf100_ltc_tags_free(struct nouveau_ltc *, struct nouveau_mm_node **);
50
51 struct nvkm_ltc_impl {
52         struct nouveau_oclass base;
53         void (*intr)(struct nouveau_subdev *);
54
55         void (*cbc_clear)(struct nvkm_ltc_priv *, u32 start, u32 limit);
56         void (*cbc_wait)(struct nvkm_ltc_priv *);
57
58         int zbc;
59         void (*zbc_clear_color)(struct nvkm_ltc_priv *, int, const u32[4]);
60         void (*zbc_clear_depth)(struct nvkm_ltc_priv *, int, const u32);
61 };
62
63 void gf100_ltc_intr(struct nouveau_subdev *);
64 void gf100_ltc_cbc_clear(struct nvkm_ltc_priv *, u32, u32);
65 void gf100_ltc_cbc_wait(struct nvkm_ltc_priv *);
66 void gf100_ltc_zbc_clear_color(struct nvkm_ltc_priv *, int, const u32[4]);
67 void gf100_ltc_zbc_clear_depth(struct nvkm_ltc_priv *, int, const u32);
68
69 #endif