blob: fe30a8f47f8c7eaa2ac9e232ebec4eb87c6dcfc6 [file] [log] [blame]
Ben Skeggs20abd162012-04-30 11:33:43 -05001#ifndef __NOUVEAU_SOFTWARE_H__
2#define __NOUVEAU_SOFTWARE_H__
3
4struct nouveau_software_priv {
5 struct nouveau_exec_engine base;
6 struct list_head vblank;
7};
8
9struct nouveau_software_chan {
10 struct list_head flip;
11 struct {
12 struct list_head list;
13 struct nouveau_bo *bo;
14 u32 offset;
15 u32 value;
16 u32 head;
17 } vblank;
18};
19
20static inline void
21nouveau_software_vblank(struct drm_device *dev, int crtc)
22{
23 struct nouveau_software_priv *psw = nv_engine(dev, NVOBJ_ENGINE_SW);
24 struct nouveau_software_chan *pch, *tmp;
25
26 list_for_each_entry_safe(pch, tmp, &psw->vblank, vblank.list) {
27 if (pch->vblank.head != crtc)
28 continue;
29
30 nouveau_bo_wr32(pch->vblank.bo, pch->vblank.offset,
31 pch->vblank.value);
32 list_del(&pch->vblank.list);
33 drm_vblank_put(dev, crtc);
34 }
35}
36
37static inline void
38nouveau_software_context_new(struct nouveau_software_chan *pch)
39{
40 INIT_LIST_HEAD(&pch->flip);
41}
42
43static inline void
44nouveau_software_create(struct nouveau_software_priv *psw)
45{
46 INIT_LIST_HEAD(&psw->vblank);
47}
48
49static inline u16
50nouveau_software_class(struct drm_device *dev)
51{
52 struct drm_nouveau_private *dev_priv = dev->dev_private;
53 if (dev_priv->card_type <= NV_04)
54 return 0x006e;
55 if (dev_priv->card_type <= NV_40)
56 return 0x016e;
57 if (dev_priv->card_type <= NV_50)
58 return 0x506e;
59 if (dev_priv->card_type <= NV_E0)
60 return 0x906e;
61 return 0x0000;
62}
63
64int nv04_software_create(struct drm_device *);
65int nv50_software_create(struct drm_device *);
66int nvc0_software_create(struct drm_device *);
67
68#endif