disp.h 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. #ifndef __NV50_KMS_H__
  2. #define __NV50_KMS_H__
  3. #include <nvif/mem.h>
  4. #include "nouveau_display.h"
  5. struct nv50_disp {
  6. struct nvif_disp *disp;
  7. struct nv50_core *core;
  8. #define NV50_DISP_SYNC(c, o) ((c) * 0x040 + (o))
  9. #define NV50_DISP_CORE_NTFY NV50_DISP_SYNC(0 , 0x00)
  10. #define NV50_DISP_WNDW_SEM0(c) NV50_DISP_SYNC(1 + (c), 0x00)
  11. #define NV50_DISP_WNDW_SEM1(c) NV50_DISP_SYNC(1 + (c), 0x10)
  12. #define NV50_DISP_WNDW_NTFY(c) NV50_DISP_SYNC(1 + (c), 0x20)
  13. #define NV50_DISP_BASE_SEM0(c) NV50_DISP_WNDW_SEM0(0 + (c))
  14. #define NV50_DISP_BASE_SEM1(c) NV50_DISP_WNDW_SEM1(0 + (c))
  15. #define NV50_DISP_BASE_NTFY(c) NV50_DISP_WNDW_NTFY(0 + (c))
  16. #define NV50_DISP_OVLY_SEM0(c) NV50_DISP_WNDW_SEM0(4 + (c))
  17. #define NV50_DISP_OVLY_SEM1(c) NV50_DISP_WNDW_SEM1(4 + (c))
  18. #define NV50_DISP_OVLY_NTFY(c) NV50_DISP_WNDW_NTFY(4 + (c))
  19. struct nouveau_bo *sync;
  20. struct mutex mutex;
  21. };
  22. static inline struct nv50_disp *
  23. nv50_disp(struct drm_device *dev)
  24. {
  25. return nouveau_display(dev)->priv;
  26. }
  27. struct nv50_disp_interlock {
  28. enum nv50_disp_interlock_type {
  29. NV50_DISP_INTERLOCK_CORE = 0,
  30. NV50_DISP_INTERLOCK_CURS,
  31. NV50_DISP_INTERLOCK_BASE,
  32. NV50_DISP_INTERLOCK_OVLY,
  33. NV50_DISP_INTERLOCK_WNDW,
  34. NV50_DISP_INTERLOCK_WIMM,
  35. NV50_DISP_INTERLOCK__SIZE
  36. } type;
  37. u32 data;
  38. };
  39. void corec37d_ntfy_init(struct nouveau_bo *, u32);
  40. struct nv50_chan {
  41. struct nvif_object user;
  42. struct nvif_device *device;
  43. };
  44. struct nv50_dmac {
  45. struct nv50_chan base;
  46. struct nvif_mem push;
  47. u32 *ptr;
  48. struct nvif_object sync;
  49. struct nvif_object vram;
  50. /* Protects against concurrent pushbuf access to this channel, lock is
  51. * grabbed by evo_wait (if the pushbuf reservation is successful) and
  52. * dropped again by evo_kick. */
  53. struct mutex lock;
  54. };
  55. int nv50_dmac_create(struct nvif_device *device, struct nvif_object *disp,
  56. const s32 *oclass, u8 head, void *data, u32 size,
  57. u64 syncbuf, struct nv50_dmac *dmac);
  58. void nv50_dmac_destroy(struct nv50_dmac *);
  59. u32 *evo_wait(struct nv50_dmac *, int nr);
  60. void evo_kick(u32 *, struct nv50_dmac *);
  61. #define evo_mthd(p, m, s) do { \
  62. const u32 _m = (m), _s = (s); \
  63. if (drm_debug & DRM_UT_KMS) \
  64. pr_err("%04x %d %s\n", _m, _s, __func__); \
  65. *((p)++) = ((_s << 18) | _m); \
  66. } while(0)
  67. #define evo_data(p, d) do { \
  68. const u32 _d = (d); \
  69. if (drm_debug & DRM_UT_KMS) \
  70. pr_err("\t%08x\n", _d); \
  71. *((p)++) = _d; \
  72. } while(0)
  73. #endif