Linux-libre 3.18.132-gnu
[librecmc/linux-libre.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 #include <core/enum.h>
8
9 struct nvkm_ltc_priv {
10         struct nouveau_ltc base;
11         u32 ltc_nr;
12         u32 lts_nr;
13
14         u32 num_tags;
15         u32 tag_base;
16         struct nouveau_mm tags;
17         struct nouveau_mm_node *tag_ram;
18
19         u32 zbc_color[NOUVEAU_LTC_MAX_ZBC_CNT][4];
20         u32 zbc_depth[NOUVEAU_LTC_MAX_ZBC_CNT];
21 };
22
23 #define nvkm_ltc_create(p,e,o,d)                                               \
24         nvkm_ltc_create_((p), (e), (o), sizeof(**d), (void **)d)
25 #define nvkm_ltc_destroy(p) ({                                                 \
26         struct nvkm_ltc_priv *_priv = (p);                                     \
27         _nvkm_ltc_dtor(nv_object(_priv));                                      \
28 })
29 #define nvkm_ltc_init(p) ({                                                    \
30         struct nvkm_ltc_priv *_priv = (p);                                     \
31         _nvkm_ltc_init(nv_object(_priv));                                      \
32 })
33 #define nvkm_ltc_fini(p,s) ({                                                  \
34         struct nvkm_ltc_priv *_priv = (p);                                     \
35         _nvkm_ltc_fini(nv_object(_priv), (s));                                 \
36 })
37
38 int  nvkm_ltc_create_(struct nouveau_object *, struct nouveau_object *,
39                       struct nouveau_oclass *, int, void **);
40
41 #define _nvkm_ltc_dtor _nouveau_subdev_dtor
42 int _nvkm_ltc_init(struct nouveau_object *);
43 #define _nvkm_ltc_fini _nouveau_subdev_fini
44
45 int  gf100_ltc_ctor(struct nouveau_object *, struct nouveau_object *,
46                     struct nouveau_oclass *, void *, u32,
47                     struct nouveau_object **);
48 void gf100_ltc_dtor(struct nouveau_object *);
49 int  gf100_ltc_init_tag_ram(struct nouveau_fb *, struct nvkm_ltc_priv *);
50 int  gf100_ltc_tags_alloc(struct nouveau_ltc *, u32, struct nouveau_mm_node **);
51 void gf100_ltc_tags_free(struct nouveau_ltc *, struct nouveau_mm_node **);
52
53 struct nvkm_ltc_impl {
54         struct nouveau_oclass base;
55         void (*intr)(struct nouveau_subdev *);
56
57         void (*cbc_clear)(struct nvkm_ltc_priv *, u32 start, u32 limit);
58         void (*cbc_wait)(struct nvkm_ltc_priv *);
59
60         int zbc;
61         void (*zbc_clear_color)(struct nvkm_ltc_priv *, int, const u32[4]);
62         void (*zbc_clear_depth)(struct nvkm_ltc_priv *, int, const u32);
63 };
64
65 void gf100_ltc_intr(struct nouveau_subdev *);
66 void gf100_ltc_cbc_clear(struct nvkm_ltc_priv *, u32, u32);
67 void gf100_ltc_cbc_wait(struct nvkm_ltc_priv *);
68 void gf100_ltc_zbc_clear_color(struct nvkm_ltc_priv *, int, const u32[4]);
69 void gf100_ltc_zbc_clear_depth(struct nvkm_ltc_priv *, int, const u32);
70
71 #endif