wndw.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. #ifndef __NV50_KMS_WNDW_H__
  2. #define __NV50_KMS_WNDW_H__
  3. #define nv50_wndw(p) container_of((p), struct nv50_wndw, plane)
  4. #include "disp.h"
  5. #include "atom.h"
  6. #include "lut.h"
  7. struct nv50_wndw_ctxdma {
  8. struct list_head head;
  9. struct nvif_object object;
  10. };
  11. struct nv50_wndw {
  12. const struct nv50_wndw_func *func;
  13. const struct nv50_wimm_func *immd;
  14. int id;
  15. struct nv50_disp_interlock interlock;
  16. struct {
  17. struct nvif_object *parent;
  18. struct list_head list;
  19. } ctxdma;
  20. struct drm_plane plane;
  21. struct nv50_lut ilut;
  22. struct nv50_dmac wndw;
  23. struct nv50_dmac wimm;
  24. u16 ntfy;
  25. u16 sema;
  26. u32 data;
  27. };
  28. int nv50_wndw_new_(const struct nv50_wndw_func *, struct drm_device *,
  29. enum drm_plane_type, const char *name, int index,
  30. const u32 *format, u32 heads,
  31. enum nv50_disp_interlock_type, u32 interlock_data,
  32. struct nv50_wndw **);
  33. void nv50_wndw_flush_set(struct nv50_wndw *, u32 *interlock,
  34. struct nv50_wndw_atom *);
  35. void nv50_wndw_flush_clr(struct nv50_wndw *, u32 *interlock, bool flush,
  36. struct nv50_wndw_atom *);
  37. void nv50_wndw_ntfy_enable(struct nv50_wndw *, struct nv50_wndw_atom *);
  38. int nv50_wndw_wait_armed(struct nv50_wndw *, struct nv50_wndw_atom *);
  39. struct nv50_wndw_func {
  40. int (*acquire)(struct nv50_wndw *, struct nv50_wndw_atom *asyw,
  41. struct nv50_head_atom *asyh);
  42. void (*release)(struct nv50_wndw *, struct nv50_wndw_atom *asyw,
  43. struct nv50_head_atom *asyh);
  44. void (*prepare)(struct nv50_wndw *, struct nv50_head_atom *asyh,
  45. struct nv50_wndw_atom *asyw);
  46. int (*sema_set)(struct nv50_wndw *, struct nv50_wndw_atom *);
  47. int (*sema_clr)(struct nv50_wndw *);
  48. void (*ntfy_reset)(struct nouveau_bo *, u32 offset);
  49. int (*ntfy_set)(struct nv50_wndw *, struct nv50_wndw_atom *);
  50. int (*ntfy_clr)(struct nv50_wndw *);
  51. int (*ntfy_wait_begun)(struct nouveau_bo *, u32 offset,
  52. struct nvif_device *);
  53. void (*ilut)(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyh, int size);
  54. void (*csc)(struct nv50_wndw *, struct nv50_wndw_atom *,
  55. const struct drm_color_ctm *);
  56. int (*csc_set)(struct nv50_wndw *, struct nv50_wndw_atom *);
  57. int (*csc_clr)(struct nv50_wndw *);
  58. bool ilut_identity;
  59. int ilut_size;
  60. bool olut_core;
  61. int (*xlut_set)(struct nv50_wndw *, struct nv50_wndw_atom *);
  62. int (*xlut_clr)(struct nv50_wndw *);
  63. int (*image_set)(struct nv50_wndw *, struct nv50_wndw_atom *);
  64. int (*image_clr)(struct nv50_wndw *);
  65. int (*scale_set)(struct nv50_wndw *, struct nv50_wndw_atom *);
  66. int (*blend_set)(struct nv50_wndw *, struct nv50_wndw_atom *);
  67. int (*update)(struct nv50_wndw *, u32 *interlock);
  68. };
  69. extern const struct drm_plane_funcs nv50_wndw;
  70. void base507c_ntfy_reset(struct nouveau_bo *, u32);
  71. int base507c_ntfy_set(struct nv50_wndw *, struct nv50_wndw_atom *);
  72. int base507c_ntfy_clr(struct nv50_wndw *);
  73. int base507c_ntfy_wait_begun(struct nouveau_bo *, u32, struct nvif_device *);
  74. int base507c_image_clr(struct nv50_wndw *);
  75. int base507c_update(struct nv50_wndw *, u32 *);
  76. void base907c_csc(struct nv50_wndw *, struct nv50_wndw_atom *,
  77. const struct drm_color_ctm *);
  78. struct nv50_wimm_func {
  79. int (*point)(struct nv50_wndw *, struct nv50_wndw_atom *);
  80. int (*update)(struct nv50_wndw *, u32 *interlock);
  81. };
  82. extern const struct nv50_wimm_func curs507a;
  83. bool curs507a_space(struct nv50_wndw *);
  84. static inline __must_check int
  85. nvif_chan_wait(struct nv50_dmac *dmac, u32 size)
  86. {
  87. struct nv50_wndw *wndw = container_of(dmac, typeof(*wndw), wimm);
  88. return curs507a_space(wndw) ? 0 : -ETIMEDOUT;
  89. }
  90. int wndwc37e_new(struct nouveau_drm *, enum drm_plane_type, int, s32,
  91. struct nv50_wndw **);
  92. int wndwc37e_new_(const struct nv50_wndw_func *, struct nouveau_drm *,
  93. enum drm_plane_type type, int index, s32 oclass, u32 heads,
  94. struct nv50_wndw **);
  95. int wndwc37e_acquire(struct nv50_wndw *, struct nv50_wndw_atom *,
  96. struct nv50_head_atom *);
  97. void wndwc37e_release(struct nv50_wndw *, struct nv50_wndw_atom *,
  98. struct nv50_head_atom *);
  99. int wndwc37e_sema_set(struct nv50_wndw *, struct nv50_wndw_atom *);
  100. int wndwc37e_sema_clr(struct nv50_wndw *);
  101. int wndwc37e_ntfy_set(struct nv50_wndw *, struct nv50_wndw_atom *);
  102. int wndwc37e_ntfy_clr(struct nv50_wndw *);
  103. int wndwc37e_image_clr(struct nv50_wndw *);
  104. int wndwc37e_blend_set(struct nv50_wndw *, struct nv50_wndw_atom *);
  105. int wndwc37e_update(struct nv50_wndw *, u32 *);
  106. int wndwc57e_new(struct nouveau_drm *, enum drm_plane_type, int, s32,
  107. struct nv50_wndw **);
  108. void wndwc57e_ilut(struct nv50_wndw *, struct nv50_wndw_atom *, int);
  109. int wndwc57e_ilut_set(struct nv50_wndw *, struct nv50_wndw_atom *);
  110. int wndwc57e_ilut_clr(struct nv50_wndw *);
  111. int wndwc57e_csc_set(struct nv50_wndw *, struct nv50_wndw_atom *);
  112. int wndwc57e_csc_clr(struct nv50_wndw *);
  113. int wndwc67e_new(struct nouveau_drm *, enum drm_plane_type, int, s32,
  114. struct nv50_wndw **);
  115. int nv50_wndw_new(struct nouveau_drm *, enum drm_plane_type, int index,
  116. struct nv50_wndw **);
  117. #endif