Ben Skeggs | 20abd16 | 2012-04-30 11:33:43 -0500 | [diff] [blame^] | 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 | }; |
| 8 | |
| 9 | struct 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 | |
| 20 | static inline void |
| 21 | nouveau_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 | |
| 37 | static inline void |
| 38 | nouveau_software_context_new(struct nouveau_software_chan *pch) |
| 39 | { |
| 40 | INIT_LIST_HEAD(&pch->flip); |
| 41 | } |
| 42 | |
| 43 | static inline void |
| 44 | nouveau_software_create(struct nouveau_software_priv *psw) |
| 45 | { |
| 46 | INIT_LIST_HEAD(&psw->vblank); |
| 47 | } |
| 48 | |
| 49 | static inline u16 |
| 50 | nouveau_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 | |
| 64 | int nv04_software_create(struct drm_device *); |
| 65 | int nv50_software_create(struct drm_device *); |
| 66 | int nvc0_software_create(struct drm_device *); |
| 67 | |
| 68 | #endif |