nouveau_software.h 1.5 KB

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