nouveau_connector.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. /*
  2. * Copyright (C) 2008 Maarten Maathuis.
  3. * All Rights Reserved.
  4. *
  5. * Permission is hereby granted, free of charge, to any person obtaining
  6. * a copy of this software and associated documentation files (the
  7. * "Software"), to deal in the Software without restriction, including
  8. * without limitation the rights to use, copy, modify, merge, publish,
  9. * distribute, sublicense, and/or sell copies of the Software, and to
  10. * permit persons to whom the Software is furnished to do so, subject to
  11. * the following conditions:
  12. *
  13. * The above copyright notice and this permission notice (including the
  14. * next paragraph) shall be included in all copies or substantial
  15. * portions of the Software.
  16. *
  17. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  18. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  19. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  20. * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
  21. * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  22. * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  23. * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  24. *
  25. */
  26. #ifndef __NOUVEAU_CONNECTOR_H__
  27. #define __NOUVEAU_CONNECTOR_H__
  28. #include <nvif/notify.h>
  29. #include <drm/drm_edid.h>
  30. #include <drm/drm_encoder.h>
  31. #include <drm/drm_dp_helper.h>
  32. #include "nouveau_crtc.h"
  33. struct nvkm_i2c_port;
  34. struct nouveau_connector {
  35. struct drm_connector base;
  36. enum dcb_connector_type type;
  37. u8 index;
  38. u8 *dcb;
  39. struct nvif_notify hpd;
  40. struct drm_dp_aux aux;
  41. int dithering_mode;
  42. int scaling_mode;
  43. struct nouveau_encoder *detected_encoder;
  44. struct edid *edid;
  45. struct drm_display_mode *native_mode;
  46. };
  47. static inline struct nouveau_connector *nouveau_connector(
  48. struct drm_connector *con)
  49. {
  50. return container_of(con, struct nouveau_connector, base);
  51. }
  52. static inline struct nouveau_connector *
  53. nouveau_crtc_connector_get(struct nouveau_crtc *nv_crtc)
  54. {
  55. struct drm_device *dev = nv_crtc->base.dev;
  56. struct drm_connector *connector;
  57. struct drm_crtc *crtc = to_drm_crtc(nv_crtc);
  58. list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
  59. if (connector->encoder && connector->encoder->crtc == crtc)
  60. return nouveau_connector(connector);
  61. }
  62. return NULL;
  63. }
  64. struct drm_connector *
  65. nouveau_connector_create(struct drm_device *, int index);
  66. extern int nouveau_tv_disable;
  67. extern int nouveau_ignorelid;
  68. extern int nouveau_duallink;
  69. extern int nouveau_hdmimhz;
  70. #include <drm/drm_crtc.h>
  71. #define nouveau_conn_atom(p) \
  72. container_of((p), struct nouveau_conn_atom, state)
  73. struct nouveau_conn_atom {
  74. struct drm_connector_state state;
  75. struct {
  76. /* The enum values specifically defined here match nv50/gf119
  77. * hw values, and the code relies on this.
  78. */
  79. enum {
  80. DITHERING_MODE_OFF = 0x00,
  81. DITHERING_MODE_ON = 0x01,
  82. DITHERING_MODE_DYNAMIC2X2 = 0x10 | DITHERING_MODE_ON,
  83. DITHERING_MODE_STATIC2X2 = 0x18 | DITHERING_MODE_ON,
  84. DITHERING_MODE_TEMPORAL = 0x20 | DITHERING_MODE_ON,
  85. DITHERING_MODE_AUTO
  86. } mode;
  87. enum {
  88. DITHERING_DEPTH_6BPC = 0x00,
  89. DITHERING_DEPTH_8BPC = 0x02,
  90. DITHERING_DEPTH_AUTO
  91. } depth;
  92. } dither;
  93. struct {
  94. int mode; /* DRM_MODE_SCALE_* */
  95. struct {
  96. enum {
  97. UNDERSCAN_OFF,
  98. UNDERSCAN_ON,
  99. UNDERSCAN_AUTO,
  100. } mode;
  101. u32 hborder;
  102. u32 vborder;
  103. } underscan;
  104. bool full;
  105. } scaler;
  106. struct {
  107. int color_vibrance;
  108. int vibrant_hue;
  109. } procamp;
  110. union {
  111. struct {
  112. bool dither:1;
  113. bool scaler:1;
  114. bool procamp:1;
  115. };
  116. u8 mask;
  117. } set;
  118. };
  119. void nouveau_conn_attach_properties(struct drm_connector *);
  120. void nouveau_conn_reset(struct drm_connector *);
  121. struct drm_connector_state *
  122. nouveau_conn_atomic_duplicate_state(struct drm_connector *);
  123. void nouveau_conn_atomic_destroy_state(struct drm_connector *,
  124. struct drm_connector_state *);
  125. int nouveau_conn_atomic_set_property(struct drm_connector *,
  126. struct drm_connector_state *,
  127. struct drm_property *, u64);
  128. int nouveau_conn_atomic_get_property(struct drm_connector *,
  129. const struct drm_connector_state *,
  130. struct drm_property *, u64 *);
  131. struct drm_display_mode *nouveau_conn_native_mode(struct drm_connector *);
  132. #endif /* __NOUVEAU_CONNECTOR_H__ */