summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/nouveau/nvkm/subdev/fb/priv.h
blob: 283863f7aa9bd58ba9403773b40cc28e77aab8c0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#ifndef __NVKM_FB_PRIV_H__
#define __NVKM_FB_PRIV_H__

#include <subdev/fb.h>

#define nouveau_ram_create(p,e,o,d)                                            \
	nouveau_object_create_((p), (e), (o), 0, sizeof(**d), (void **)d)
#define nouveau_ram_destroy(p)                                                 \
	nouveau_object_destroy(&(p)->base)
#define nouveau_ram_init(p)                                                    \
	nouveau_object_init(&(p)->base)
#define nouveau_ram_fini(p,s)                                                  \
	nouveau_object_fini(&(p)->base, (s))

#define nouveau_ram_create_(p,e,o,s,d)                                         \
	nouveau_object_create_((p), (e), (o), 0, (s), (void **)d)
#define _nouveau_ram_dtor nouveau_object_destroy
#define _nouveau_ram_init nouveau_object_init
#define _nouveau_ram_fini nouveau_object_fini

extern struct nouveau_oclass nv04_ram_oclass;
extern struct nouveau_oclass nv10_ram_oclass;
extern struct nouveau_oclass nv1a_ram_oclass;
extern struct nouveau_oclass nv20_ram_oclass;
extern struct nouveau_oclass nv40_ram_oclass;
extern struct nouveau_oclass nv41_ram_oclass;
extern struct nouveau_oclass nv44_ram_oclass;
extern struct nouveau_oclass nv49_ram_oclass;
extern struct nouveau_oclass nv4e_ram_oclass;
extern struct nouveau_oclass nv50_ram_oclass;
extern struct nouveau_oclass nva3_ram_oclass;
extern struct nouveau_oclass nvaa_ram_oclass;
extern struct nouveau_oclass nvc0_ram_oclass;
extern struct nouveau_oclass nve0_ram_oclass;
extern struct nouveau_oclass gk20a_ram_oclass;
extern struct nouveau_oclass gm107_ram_oclass;

int nouveau_sddr2_calc(struct nouveau_ram *ram);
int nouveau_sddr3_calc(struct nouveau_ram *ram);
int nouveau_gddr3_calc(struct nouveau_ram *ram);
int nouveau_gddr5_calc(struct nouveau_ram *ram, bool nuts);

#define nouveau_fb_create(p,e,c,d)                                             \
	nouveau_fb_create_((p), (e), (c), sizeof(**d), (void **)d)
#define nouveau_fb_destroy(p) ({                                               \
	struct nouveau_fb *pfb = (p);                                          \
	_nouveau_fb_dtor(nv_object(pfb));                                      \
})
#define nouveau_fb_init(p) ({                                                  \
	struct nouveau_fb *pfb = (p);                                          \
	_nouveau_fb_init(nv_object(pfb));                                      \
})
#define nouveau_fb_fini(p,s) ({                                                \
	struct nouveau_fb *pfb = (p);                                          \
	_nouveau_fb_fini(nv_object(pfb), (s));                                 \
})

int nouveau_fb_create_(struct nouveau_object *, struct nouveau_object *,
		       struct nouveau_oclass *, int, void **);
void _nouveau_fb_dtor(struct nouveau_object *);
int  _nouveau_fb_init(struct nouveau_object *);
int  _nouveau_fb_fini(struct nouveau_object *, bool);

struct nouveau_fb_impl {
	struct nouveau_oclass base;
	struct nouveau_oclass *ram;
	bool (*memtype)(struct nouveau_fb *, u32);
};

bool nv04_fb_memtype_valid(struct nouveau_fb *, u32 memtype);
bool nv50_fb_memtype_valid(struct nouveau_fb *, u32 memtype);

struct nouveau_bios;
int  nouveau_fb_bios_memtype(struct nouveau_bios *);

#endif