drm/nv50: extend vblank semaphore to generic dmaobj + offset pair
[firefly-linux-kernel-4.4.55.git] / drivers / gpu / drm / nouveau / nouveau_software.h
1 #ifndef __NOUVEAU_SOFTWARE_H__
2 #define __NOUVEAU_SOFTWARE_H__
3
4 struct nouveau_software_priv {
5         struct nouveau_exec_engine base;
6         struct list_head vblank;
7         spinlock_t peephole_lock;
8 };
9
10 struct nouveau_software_chan {
11         struct list_head flip;
12         struct {
13                 struct list_head list;
14                 u32 channel;
15                 u32 ctxdma;
16                 u32 offset;
17                 u32 value;
18                 u32 head;
19         } vblank;
20 };
21
22 static inline void
23 nouveau_software_context_new(struct nouveau_software_chan *pch)
24 {
25         INIT_LIST_HEAD(&pch->flip);
26 }
27
28 static inline void
29 nouveau_software_create(struct nouveau_software_priv *psw)
30 {
31         INIT_LIST_HEAD(&psw->vblank);
32         spin_lock_init(&psw->peephole_lock);
33 }
34
35 static inline u16
36 nouveau_software_class(struct drm_device *dev)
37 {
38         struct drm_nouveau_private *dev_priv = dev->dev_private;
39         if (dev_priv->card_type <= NV_04)
40                 return 0x006e;
41         if (dev_priv->card_type <= NV_40)
42                 return 0x016e;
43         if (dev_priv->card_type <= NV_50)
44                 return 0x506e;
45         if (dev_priv->card_type <= NV_E0)
46                 return 0x906e;
47         return 0x0000;
48 }
49
50 int nv04_software_create(struct drm_device *);
51 int nv50_software_create(struct drm_device *);
52 int nvc0_software_create(struct drm_device *);
53 u64 nvc0_software_crtc(struct nouveau_channel *, int crtc);
54
55 #endif