disp.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. #ifndef __NV50_KMS_H__
  2. #define __NV50_KMS_H__
  3. #include <linux/workqueue.h>
  4. #include <nvif/mem.h>
  5. #include <nvif/push.h>
  6. #include "nouveau_display.h"
  7. struct nv50_msto;
  8. struct nouveau_encoder;
  9. struct nv50_disp {
  10. struct nvif_disp *disp;
  11. struct nv50_core *core;
  12. struct nvif_object caps;
  13. #define NV50_DISP_SYNC(c, o) ((c) * 0x040 + (o))
  14. #define NV50_DISP_CORE_NTFY NV50_DISP_SYNC(0 , 0x00)
  15. #define NV50_DISP_WNDW_SEM0(c) NV50_DISP_SYNC(1 + (c), 0x00)
  16. #define NV50_DISP_WNDW_SEM1(c) NV50_DISP_SYNC(1 + (c), 0x10)
  17. #define NV50_DISP_WNDW_NTFY(c) NV50_DISP_SYNC(1 + (c), 0x20)
  18. #define NV50_DISP_BASE_SEM0(c) NV50_DISP_WNDW_SEM0(0 + (c))
  19. #define NV50_DISP_BASE_SEM1(c) NV50_DISP_WNDW_SEM1(0 + (c))
  20. #define NV50_DISP_BASE_NTFY(c) NV50_DISP_WNDW_NTFY(0 + (c))
  21. #define NV50_DISP_OVLY_SEM0(c) NV50_DISP_WNDW_SEM0(4 + (c))
  22. #define NV50_DISP_OVLY_SEM1(c) NV50_DISP_WNDW_SEM1(4 + (c))
  23. #define NV50_DISP_OVLY_NTFY(c) NV50_DISP_WNDW_NTFY(4 + (c))
  24. struct nouveau_bo *sync;
  25. struct mutex mutex;
  26. };
  27. static inline struct nv50_disp *
  28. nv50_disp(struct drm_device *dev)
  29. {
  30. return nouveau_display(dev)->priv;
  31. }
  32. struct nv50_disp_interlock {
  33. enum nv50_disp_interlock_type {
  34. NV50_DISP_INTERLOCK_CORE = 0,
  35. NV50_DISP_INTERLOCK_CURS,
  36. NV50_DISP_INTERLOCK_BASE,
  37. NV50_DISP_INTERLOCK_OVLY,
  38. NV50_DISP_INTERLOCK_WNDW,
  39. NV50_DISP_INTERLOCK_WIMM,
  40. NV50_DISP_INTERLOCK__SIZE
  41. } type;
  42. u32 data;
  43. u32 wimm;
  44. };
  45. void corec37d_ntfy_init(struct nouveau_bo *, u32);
  46. void head907d_olut_load(struct drm_color_lut *, int size, void __iomem *);
  47. struct nv50_chan {
  48. struct nvif_object user;
  49. struct nvif_device *device;
  50. };
  51. struct nv50_dmac {
  52. struct nv50_chan base;
  53. struct nvif_push _push;
  54. struct nvif_push *push;
  55. u32 *ptr;
  56. struct nvif_object sync;
  57. struct nvif_object vram;
  58. /* Protects against concurrent pushbuf access to this channel, lock is
  59. * grabbed by evo_wait (if the pushbuf reservation is successful) and
  60. * dropped again by evo_kick. */
  61. struct mutex lock;
  62. u32 cur;
  63. u32 put;
  64. u32 max;
  65. };
  66. struct nv50_outp_atom {
  67. struct list_head head;
  68. struct drm_encoder *encoder;
  69. bool flush_disable;
  70. union nv50_outp_atom_mask {
  71. struct {
  72. bool ctrl:1;
  73. };
  74. u8 mask;
  75. } set, clr;
  76. };
  77. int nv50_dmac_create(struct nvif_device *device, struct nvif_object *disp,
  78. const s32 *oclass, u8 head, void *data, u32 size,
  79. s64 syncbuf, struct nv50_dmac *dmac);
  80. void nv50_dmac_destroy(struct nv50_dmac *);
  81. /*
  82. * For normal encoders this just returns the encoder. For active MST encoders,
  83. * this returns the real outp that's driving displays on the topology.
  84. * Inactive MST encoders return NULL, since they would have no real outp to
  85. * return anyway.
  86. */
  87. struct nouveau_encoder *nv50_real_outp(struct drm_encoder *encoder);
  88. bool nv50_has_mst(struct nouveau_drm *drm);
  89. u32 *evo_wait(struct nv50_dmac *, int nr);
  90. void evo_kick(u32 *, struct nv50_dmac *);
  91. extern const u64 disp50xx_modifiers[];
  92. extern const u64 disp90xx_modifiers[];
  93. extern const u64 wndwc57e_modifiers[];
  94. #endif