Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2016 Intel Corporation |
| 3 | * |
| 4 | * Permission to use, copy, modify, distribute, and sell this software and its |
| 5 | * documentation for any purpose is hereby granted without fee, provided that |
| 6 | * the above copyright notice appear in all copies and that both that copyright |
| 7 | * notice and this permission notice appear in supporting documentation, and |
| 8 | * that the name of the copyright holders not be used in advertising or |
| 9 | * publicity pertaining to distribution of the software without specific, |
| 10 | * written prior permission. The copyright holders make no representations |
| 11 | * about the suitability of this software for any purpose. It is provided "as |
| 12 | * is" without express or implied warranty. |
| 13 | * |
| 14 | * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, |
| 15 | * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO |
| 16 | * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR |
| 17 | * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, |
| 18 | * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 19 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE |
| 20 | * OF THIS SOFTWARE. |
| 21 | */ |
| 22 | |
| 23 | #ifndef __DRM_CONNECTOR_H__ |
| 24 | #define __DRM_CONNECTOR_H__ |
| 25 | |
| 26 | #include <linux/list.h> |
Daniel Vetter | ea497bb | 2017-12-13 13:49:36 +0100 | [diff] [blame] | 27 | #include <linux/llist.h> |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 28 | #include <linux/ctype.h> |
Maarten Lankhorst | 0e9f25d | 2017-05-01 15:37:53 +0200 | [diff] [blame] | 29 | #include <linux/hdmi.h> |
Daniel Vetter | 949619f | 2016-08-29 10:27:51 +0200 | [diff] [blame] | 30 | #include <drm/drm_mode_object.h> |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 31 | |
Daniel Vetter | 199e4e9 | 2016-08-31 18:09:05 +0200 | [diff] [blame] | 32 | #include <uapi/drm/drm_mode.h> |
| 33 | |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 34 | struct drm_connector_helper_funcs; |
Maarten Lankhorst | 6c5ed5a | 2017-04-06 20:55:20 +0200 | [diff] [blame] | 35 | struct drm_modeset_acquire_ctx; |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 36 | struct drm_device; |
| 37 | struct drm_crtc; |
| 38 | struct drm_encoder; |
| 39 | struct drm_property; |
| 40 | struct drm_property_blob; |
Rob Clark | fceffb32 | 2016-11-05 11:08:09 -0400 | [diff] [blame] | 41 | struct drm_printer; |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 42 | struct edid; |
| 43 | |
| 44 | enum drm_connector_force { |
| 45 | DRM_FORCE_UNSPECIFIED, |
| 46 | DRM_FORCE_OFF, |
| 47 | DRM_FORCE_ON, /* force on analog part normally */ |
| 48 | DRM_FORCE_ON_DIGITAL, /* for DVI-I use digital connector */ |
| 49 | }; |
| 50 | |
Daniel Vetter | ae2a6da | 2016-08-12 22:48:53 +0200 | [diff] [blame] | 51 | /** |
| 52 | * enum drm_connector_status - status for a &drm_connector |
| 53 | * |
| 54 | * This enum is used to track the connector status. There are no separate |
| 55 | * #defines for the uapi! |
| 56 | */ |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 57 | enum drm_connector_status { |
Daniel Vetter | ae2a6da | 2016-08-12 22:48:53 +0200 | [diff] [blame] | 58 | /** |
| 59 | * @connector_status_connected: The connector is definitely connected to |
| 60 | * a sink device, and can be enabled. |
| 61 | */ |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 62 | connector_status_connected = 1, |
Daniel Vetter | ae2a6da | 2016-08-12 22:48:53 +0200 | [diff] [blame] | 63 | /** |
| 64 | * @connector_status_disconnected: The connector isn't connected to a |
| 65 | * sink device which can be autodetect. For digital outputs like DP or |
| 66 | * HDMI (which can be realiable probed) this means there's really |
| 67 | * nothing there. It is driver-dependent whether a connector with this |
| 68 | * status can be lit up or not. |
| 69 | */ |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 70 | connector_status_disconnected = 2, |
Daniel Vetter | ae2a6da | 2016-08-12 22:48:53 +0200 | [diff] [blame] | 71 | /** |
| 72 | * @connector_status_unknown: The connector's status could not be |
| 73 | * reliably detected. This happens when probing would either cause |
| 74 | * flicker (like load-detection when the connector is in use), or when a |
| 75 | * hardware resource isn't available (like when load-detection needs a |
| 76 | * free CRTC). It should be possible to light up the connector with one |
| 77 | * of the listed fallback modes. For default configuration userspace |
| 78 | * should only try to light up connectors with unknown status when |
| 79 | * there's not connector with @connector_status_connected. |
| 80 | */ |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 81 | connector_status_unknown = 3, |
| 82 | }; |
| 83 | |
| 84 | enum subpixel_order { |
| 85 | SubPixelUnknown = 0, |
| 86 | SubPixelHorizontalRGB, |
| 87 | SubPixelHorizontalBGR, |
| 88 | SubPixelVerticalRGB, |
| 89 | SubPixelVerticalBGR, |
| 90 | SubPixelNone, |
Shashank Sharma | afa1c76 | 2017-03-13 16:54:01 +0530 | [diff] [blame] | 91 | |
| 92 | }; |
| 93 | |
Shashank Sharma | 62c58af | 2017-03-13 16:54:02 +0530 | [diff] [blame] | 94 | /** |
| 95 | * struct drm_scrambling: sink's scrambling support. |
| 96 | */ |
| 97 | struct drm_scrambling { |
| 98 | /** |
| 99 | * @supported: scrambling supported for rates > 340 Mhz. |
| 100 | */ |
| 101 | bool supported; |
| 102 | /** |
| 103 | * @low_rates: scrambling supported for rates <= 340 Mhz. |
| 104 | */ |
| 105 | bool low_rates; |
| 106 | }; |
| 107 | |
Shashank Sharma | afa1c76 | 2017-03-13 16:54:01 +0530 | [diff] [blame] | 108 | /* |
| 109 | * struct drm_scdc - Information about scdc capabilities of a HDMI 2.0 sink |
| 110 | * |
| 111 | * Provides SCDC register support and capabilities related information on a |
| 112 | * HDMI 2.0 sink. In case of a HDMI 1.4 sink, all parameter must be 0. |
| 113 | */ |
| 114 | struct drm_scdc { |
| 115 | /** |
| 116 | * @supported: status control & data channel present. |
| 117 | */ |
| 118 | bool supported; |
| 119 | /** |
| 120 | * @read_request: sink is capable of generating scdc read request. |
| 121 | */ |
| 122 | bool read_request; |
Shashank Sharma | 62c58af | 2017-03-13 16:54:02 +0530 | [diff] [blame] | 123 | /** |
| 124 | * @scrambling: sink's scrambling capabilities |
| 125 | */ |
| 126 | struct drm_scrambling scrambling; |
Shashank Sharma | afa1c76 | 2017-03-13 16:54:01 +0530 | [diff] [blame] | 127 | }; |
| 128 | |
Shashank Sharma | 62c58af | 2017-03-13 16:54:02 +0530 | [diff] [blame] | 129 | |
Shashank Sharma | afa1c76 | 2017-03-13 16:54:01 +0530 | [diff] [blame] | 130 | /** |
| 131 | * struct drm_hdmi_info - runtime information about the connected HDMI sink |
| 132 | * |
| 133 | * Describes if a given display supports advanced HDMI 2.0 features. |
| 134 | * This information is available in CEA-861-F extension blocks (like HF-VSDB). |
| 135 | */ |
| 136 | struct drm_hdmi_info { |
Shashank Sharma | 86cc921 | 2017-03-28 10:06:19 +0300 | [diff] [blame] | 137 | /** @scdc: sink's scdc support and capabilities */ |
Shashank Sharma | afa1c76 | 2017-03-13 16:54:01 +0530 | [diff] [blame] | 138 | struct drm_scdc scdc; |
Shashank Sharma | d852315 | 2017-07-13 21:03:11 +0530 | [diff] [blame] | 139 | |
| 140 | /** |
| 141 | * @y420_vdb_modes: bitmap of modes which can support ycbcr420 |
| 142 | * output only (not normal RGB/YCBCR444/422 outputs). There are total |
| 143 | * 107 VICs defined by CEA-861-F spec, so the size is 128 bits to map |
| 144 | * upto 128 VICs; |
| 145 | */ |
| 146 | unsigned long y420_vdb_modes[BITS_TO_LONGS(128)]; |
Shashank Sharma | 832d4f2 | 2017-07-14 16:03:46 +0530 | [diff] [blame] | 147 | |
| 148 | /** |
| 149 | * @y420_cmdb_modes: bitmap of modes which can support ycbcr420 |
| 150 | * output also, along with normal HDMI outputs. There are total 107 |
| 151 | * VICs defined by CEA-861-F spec, so the size is 128 bits to map upto |
| 152 | * 128 VICs; |
| 153 | */ |
| 154 | unsigned long y420_cmdb_modes[BITS_TO_LONGS(128)]; |
| 155 | |
| 156 | /** @y420_cmdb_map: bitmap of SVD index, to extraxt vcb modes */ |
| 157 | u64 y420_cmdb_map; |
Shashank Sharma | e6a9a2c | 2017-07-13 21:03:13 +0530 | [diff] [blame] | 158 | |
| 159 | /** @y420_dc_modes: bitmap of deep color support index */ |
| 160 | u8 y420_dc_modes; |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 161 | }; |
| 162 | |
Daniel Vetter | b3c6c8b | 2016-08-12 22:48:55 +0200 | [diff] [blame] | 163 | /** |
Manasi Navare | 40ee6fb | 2016-12-16 12:29:06 +0200 | [diff] [blame] | 164 | * enum drm_link_status - connector's link_status property value |
| 165 | * |
| 166 | * This enum is used as the connector's link status property value. |
| 167 | * It is set to the values defined in uapi. |
Manasi Navare | 41232c1 | 2017-03-01 06:45:10 -0800 | [diff] [blame] | 168 | * |
| 169 | * @DRM_LINK_STATUS_GOOD: DP Link is Good as a result of successful |
| 170 | * link training |
| 171 | * @DRM_LINK_STATUS_BAD: DP Link is BAD as a result of link training |
| 172 | * failure |
Manasi Navare | 40ee6fb | 2016-12-16 12:29:06 +0200 | [diff] [blame] | 173 | */ |
| 174 | enum drm_link_status { |
| 175 | DRM_LINK_STATUS_GOOD = DRM_MODE_LINK_STATUS_GOOD, |
| 176 | DRM_LINK_STATUS_BAD = DRM_MODE_LINK_STATUS_BAD, |
| 177 | }; |
| 178 | |
| 179 | /** |
Hans de Goede | 8d70f39 | 2017-11-25 20:35:49 +0100 | [diff] [blame] | 180 | * enum drm_panel_orientation - panel_orientation info for &drm_display_info |
| 181 | * |
| 182 | * This enum is used to track the (LCD) panel orientation. There are no |
| 183 | * separate #defines for the uapi! |
| 184 | * |
| 185 | * @DRM_MODE_PANEL_ORIENTATION_UNKNOWN: The drm driver has not provided any |
| 186 | * panel orientation information (normal |
| 187 | * for non panels) in this case the "panel |
| 188 | * orientation" connector prop will not be |
| 189 | * attached. |
| 190 | * @DRM_MODE_PANEL_ORIENTATION_NORMAL: The top side of the panel matches the |
| 191 | * top side of the device's casing. |
| 192 | * @DRM_MODE_PANEL_ORIENTATION_BOTTOM_UP: The top side of the panel matches the |
| 193 | * bottom side of the device's casing, iow |
| 194 | * the panel is mounted upside-down. |
| 195 | * @DRM_MODE_PANEL_ORIENTATION_LEFT_UP: The left side of the panel matches the |
| 196 | * top side of the device's casing. |
| 197 | * @DRM_MODE_PANEL_ORIENTATION_RIGHT_UP: The right side of the panel matches the |
| 198 | * top side of the device's casing. |
| 199 | */ |
| 200 | enum drm_panel_orientation { |
| 201 | DRM_MODE_PANEL_ORIENTATION_UNKNOWN = -1, |
| 202 | DRM_MODE_PANEL_ORIENTATION_NORMAL = 0, |
| 203 | DRM_MODE_PANEL_ORIENTATION_BOTTOM_UP, |
| 204 | DRM_MODE_PANEL_ORIENTATION_LEFT_UP, |
| 205 | DRM_MODE_PANEL_ORIENTATION_RIGHT_UP, |
| 206 | }; |
| 207 | |
| 208 | /** |
Daniel Vetter | b3c6c8b | 2016-08-12 22:48:55 +0200 | [diff] [blame] | 209 | * struct drm_display_info - runtime data about the connected sink |
| 210 | * |
| 211 | * Describes a given display (e.g. CRT or flat panel) and its limitations. For |
| 212 | * fixed display sinks like built-in panels there's not much difference between |
Daniel Vetter | ea0dd85 | 2016-12-29 21:48:26 +0100 | [diff] [blame] | 213 | * this and &struct drm_connector. But for sinks with a real cable this |
Daniel Vetter | b3c6c8b | 2016-08-12 22:48:55 +0200 | [diff] [blame] | 214 | * structure is meant to describe all the things at the other end of the cable. |
| 215 | * |
| 216 | * For sinks which provide an EDID this can be filled out by calling |
| 217 | * drm_add_edid_modes(). |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 218 | */ |
| 219 | struct drm_display_info { |
Daniel Vetter | b3c6c8b | 2016-08-12 22:48:55 +0200 | [diff] [blame] | 220 | /** |
| 221 | * @name: Name of the display. |
| 222 | */ |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 223 | char name[DRM_DISPLAY_INFO_LEN]; |
| 224 | |
Daniel Vetter | b3c6c8b | 2016-08-12 22:48:55 +0200 | [diff] [blame] | 225 | /** |
| 226 | * @width_mm: Physical width in mm. |
| 227 | */ |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 228 | unsigned int width_mm; |
Daniel Vetter | b3c6c8b | 2016-08-12 22:48:55 +0200 | [diff] [blame] | 229 | /** |
| 230 | * @height_mm: Physical height in mm. |
| 231 | */ |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 232 | unsigned int height_mm; |
| 233 | |
Daniel Vetter | b3c6c8b | 2016-08-12 22:48:55 +0200 | [diff] [blame] | 234 | /** |
| 235 | * @pixel_clock: Maximum pixel clock supported by the sink, in units of |
Peter Meerwald-Stadler | 188f7882 | 2016-12-16 14:24:23 +0100 | [diff] [blame] | 236 | * 100Hz. This mismatches the clock in &drm_display_mode (which is in |
Daniel Vetter | b3c6c8b | 2016-08-12 22:48:55 +0200 | [diff] [blame] | 237 | * kHZ), because that's what the EDID uses as base unit. |
| 238 | */ |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 239 | unsigned int pixel_clock; |
Daniel Vetter | b3c6c8b | 2016-08-12 22:48:55 +0200 | [diff] [blame] | 240 | /** |
| 241 | * @bpc: Maximum bits per color channel. Used by HDMI and DP outputs. |
| 242 | */ |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 243 | unsigned int bpc; |
| 244 | |
Daniel Vetter | b3c6c8b | 2016-08-12 22:48:55 +0200 | [diff] [blame] | 245 | /** |
| 246 | * @subpixel_order: Subpixel order of LCD panels. |
| 247 | */ |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 248 | enum subpixel_order subpixel_order; |
| 249 | |
| 250 | #define DRM_COLOR_FORMAT_RGB444 (1<<0) |
| 251 | #define DRM_COLOR_FORMAT_YCRCB444 (1<<1) |
| 252 | #define DRM_COLOR_FORMAT_YCRCB422 (1<<2) |
Shashank Sharma | 832d4f2 | 2017-07-14 16:03:46 +0530 | [diff] [blame] | 253 | #define DRM_COLOR_FORMAT_YCRCB420 (1<<3) |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 254 | |
Daniel Vetter | b3c6c8b | 2016-08-12 22:48:55 +0200 | [diff] [blame] | 255 | /** |
Hans de Goede | 8d70f39 | 2017-11-25 20:35:49 +0100 | [diff] [blame] | 256 | * @panel_orientation: Read only connector property for built-in panels, |
| 257 | * indicating the orientation of the panel vs the device's casing. |
| 258 | * drm_connector_init() sets this to DRM_MODE_PANEL_ORIENTATION_UNKNOWN. |
| 259 | * When not UNKNOWN this gets used by the drm_fb_helpers to rotate the |
| 260 | * fb to compensate and gets exported as prop to userspace. |
| 261 | */ |
| 262 | int panel_orientation; |
| 263 | |
| 264 | /** |
Daniel Vetter | b3c6c8b | 2016-08-12 22:48:55 +0200 | [diff] [blame] | 265 | * @color_formats: HDMI Color formats, selects between RGB and YCrCb |
| 266 | * modes. Used DRM_COLOR_FORMAT\_ defines, which are _not_ the same ones |
| 267 | * as used to describe the pixel format in framebuffers, and also don't |
| 268 | * match the formats in @bus_formats which are shared with v4l. |
| 269 | */ |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 270 | u32 color_formats; |
| 271 | |
Daniel Vetter | b3c6c8b | 2016-08-12 22:48:55 +0200 | [diff] [blame] | 272 | /** |
| 273 | * @bus_formats: Pixel data format on the wire, somewhat redundant with |
| 274 | * @color_formats. Array of size @num_bus_formats encoded using |
| 275 | * MEDIA_BUS_FMT\_ defines shared with v4l and media drivers. |
| 276 | */ |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 277 | const u32 *bus_formats; |
Daniel Vetter | b3c6c8b | 2016-08-12 22:48:55 +0200 | [diff] [blame] | 278 | /** |
| 279 | * @num_bus_formats: Size of @bus_formats array. |
| 280 | */ |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 281 | unsigned int num_bus_formats; |
| 282 | |
| 283 | #define DRM_BUS_FLAG_DE_LOW (1<<0) |
| 284 | #define DRM_BUS_FLAG_DE_HIGH (1<<1) |
| 285 | /* drive data on pos. edge */ |
| 286 | #define DRM_BUS_FLAG_PIXDATA_POSEDGE (1<<2) |
| 287 | /* drive data on neg. edge */ |
| 288 | #define DRM_BUS_FLAG_PIXDATA_NEGEDGE (1<<3) |
Laurent Pinchart | 5ec1a96 | 2016-11-18 16:55:48 +0200 | [diff] [blame] | 289 | /* data is transmitted MSB to LSB on the bus */ |
| 290 | #define DRM_BUS_FLAG_DATA_MSB_TO_LSB (1<<4) |
| 291 | /* data is transmitted LSB to MSB on the bus */ |
| 292 | #define DRM_BUS_FLAG_DATA_LSB_TO_MSB (1<<5) |
Peter Ujfalusi | 955f60d | 2018-06-18 16:22:34 +0300 | [diff] [blame] | 293 | /* drive sync on pos. edge */ |
| 294 | #define DRM_BUS_FLAG_SYNC_POSEDGE (1<<6) |
| 295 | /* drive sync on neg. edge */ |
| 296 | #define DRM_BUS_FLAG_SYNC_NEGEDGE (1<<7) |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 297 | |
Daniel Vetter | b3c6c8b | 2016-08-12 22:48:55 +0200 | [diff] [blame] | 298 | /** |
| 299 | * @bus_flags: Additional information (like pixel signal polarity) for |
| 300 | * the pixel data on the bus, using DRM_BUS_FLAGS\_ defines. |
| 301 | */ |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 302 | u32 bus_flags; |
| 303 | |
Daniel Vetter | b3c6c8b | 2016-08-12 22:48:55 +0200 | [diff] [blame] | 304 | /** |
Ville Syrjälä | 2a272ca | 2016-09-28 16:51:37 +0300 | [diff] [blame] | 305 | * @max_tmds_clock: Maximum TMDS clock rate supported by the |
| 306 | * sink in kHz. 0 means undefined. |
| 307 | */ |
| 308 | int max_tmds_clock; |
| 309 | |
| 310 | /** |
| 311 | * @dvi_dual: Dual-link DVI sink? |
| 312 | */ |
| 313 | bool dvi_dual; |
| 314 | |
| 315 | /** |
Ville Syrjälä | f1781e9 | 2017-11-13 19:04:19 +0200 | [diff] [blame] | 316 | * @has_hdmi_infoframe: Does the sink support the HDMI infoframe? |
| 317 | */ |
| 318 | bool has_hdmi_infoframe; |
| 319 | |
| 320 | /** |
Daniel Vetter | b3c6c8b | 2016-08-12 22:48:55 +0200 | [diff] [blame] | 321 | * @edid_hdmi_dc_modes: Mask of supported hdmi deep color modes. Even |
| 322 | * more stuff redundant with @bus_formats. |
| 323 | */ |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 324 | u8 edid_hdmi_dc_modes; |
| 325 | |
Daniel Vetter | b3c6c8b | 2016-08-12 22:48:55 +0200 | [diff] [blame] | 326 | /** |
| 327 | * @cea_rev: CEA revision of the HDMI sink. |
| 328 | */ |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 329 | u8 cea_rev; |
Shashank Sharma | afa1c76 | 2017-03-13 16:54:01 +0530 | [diff] [blame] | 330 | |
| 331 | /** |
| 332 | * @hdmi: advance features of a HDMI sink. |
| 333 | */ |
| 334 | struct drm_hdmi_info hdmi; |
Dave Airlie | 66660d4 | 2017-10-16 05:08:09 +0100 | [diff] [blame] | 335 | |
| 336 | /** |
| 337 | * @non_desktop: Non desktop display (HMD). |
| 338 | */ |
| 339 | bool non_desktop; |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 340 | }; |
| 341 | |
Daniel Vetter | b3c6c8b | 2016-08-12 22:48:55 +0200 | [diff] [blame] | 342 | int drm_display_info_set_bus_formats(struct drm_display_info *info, |
| 343 | const u32 *formats, |
| 344 | unsigned int num_formats); |
| 345 | |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 346 | /** |
Boris Brezillon | 299a16b | 2016-12-02 14:48:09 +0100 | [diff] [blame] | 347 | * struct drm_tv_connector_state - TV connector related states |
| 348 | * @subconnector: selected subconnector |
Jani Nikula | 07d8529 | 2018-02-19 12:40:09 +0200 | [diff] [blame] | 349 | * @margins: margins |
| 350 | * @margins.left: left margin |
| 351 | * @margins.right: right margin |
| 352 | * @margins.top: top margin |
| 353 | * @margins.bottom: bottom margin |
Boris Brezillon | 299a16b | 2016-12-02 14:48:09 +0100 | [diff] [blame] | 354 | * @mode: TV mode |
| 355 | * @brightness: brightness in percent |
| 356 | * @contrast: contrast in percent |
| 357 | * @flicker_reduction: flicker reduction in percent |
| 358 | * @overscan: overscan in percent |
| 359 | * @saturation: saturation in percent |
| 360 | * @hue: hue in percent |
| 361 | */ |
| 362 | struct drm_tv_connector_state { |
| 363 | enum drm_mode_subconnector subconnector; |
| 364 | struct { |
| 365 | unsigned int left; |
| 366 | unsigned int right; |
| 367 | unsigned int top; |
| 368 | unsigned int bottom; |
| 369 | } margins; |
| 370 | unsigned int mode; |
| 371 | unsigned int brightness; |
| 372 | unsigned int contrast; |
| 373 | unsigned int flicker_reduction; |
| 374 | unsigned int overscan; |
| 375 | unsigned int saturation; |
| 376 | unsigned int hue; |
| 377 | }; |
| 378 | |
| 379 | /** |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 380 | * struct drm_connector_state - mutable connector state |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 381 | */ |
| 382 | struct drm_connector_state { |
Daniel Vetter | aab999a | 2018-07-09 10:40:04 +0200 | [diff] [blame] | 383 | /** @connector: backpointer to the connector */ |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 384 | struct drm_connector *connector; |
| 385 | |
Daniel Vetter | afb21ea6 | 2016-08-31 18:09:04 +0200 | [diff] [blame] | 386 | /** |
| 387 | * @crtc: CRTC to connect connector to, NULL if disabled. |
| 388 | * |
| 389 | * Do not change this directly, use drm_atomic_set_crtc_for_connector() |
| 390 | * instead. |
| 391 | */ |
| 392 | struct drm_crtc *crtc; |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 393 | |
Daniel Vetter | aab999a | 2018-07-09 10:40:04 +0200 | [diff] [blame] | 394 | /** |
| 395 | * @best_encoder: |
| 396 | * |
| 397 | * Used by the atomic helpers to select the encoder, through the |
| 398 | * &drm_connector_helper_funcs.atomic_best_encoder or |
| 399 | * &drm_connector_helper_funcs.best_encoder callbacks. |
| 400 | */ |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 401 | struct drm_encoder *best_encoder; |
| 402 | |
Manasi Navare | 40ee6fb | 2016-12-16 12:29:06 +0200 | [diff] [blame] | 403 | /** |
| 404 | * @link_status: Connector link_status to keep track of whether link is |
| 405 | * GOOD or BAD to notify userspace if retraining is necessary. |
| 406 | */ |
| 407 | enum drm_link_status link_status; |
| 408 | |
Daniel Vetter | aab999a | 2018-07-09 10:40:04 +0200 | [diff] [blame] | 409 | /** @state: backpointer to global drm_atomic_state */ |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 410 | struct drm_atomic_state *state; |
Boris Brezillon | 299a16b | 2016-12-02 14:48:09 +0100 | [diff] [blame] | 411 | |
Maarten Lankhorst | 21a01ab | 2017-09-04 12:48:37 +0200 | [diff] [blame] | 412 | /** |
| 413 | * @commit: Tracks the pending commit to prevent use-after-free conditions. |
| 414 | * |
| 415 | * Is only set when @crtc is NULL. |
| 416 | */ |
| 417 | struct drm_crtc_commit *commit; |
| 418 | |
Daniel Vetter | aab999a | 2018-07-09 10:40:04 +0200 | [diff] [blame] | 419 | /** @tv: TV connector state */ |
Boris Brezillon | 299a16b | 2016-12-02 14:48:09 +0100 | [diff] [blame] | 420 | struct drm_tv_connector_state tv; |
Maarten Lankhorst | 0e9f25d | 2017-05-01 15:37:53 +0200 | [diff] [blame] | 421 | |
| 422 | /** |
| 423 | * @picture_aspect_ratio: Connector property to control the |
| 424 | * HDMI infoframe aspect ratio setting. |
| 425 | * |
Maarten Lankhorst | 8f6e1e2 | 2017-05-01 15:37:54 +0200 | [diff] [blame] | 426 | * The %DRM_MODE_PICTURE_ASPECT_\* values much match the |
Maarten Lankhorst | 0e9f25d | 2017-05-01 15:37:53 +0200 | [diff] [blame] | 427 | * values for &enum hdmi_picture_aspect |
| 428 | */ |
| 429 | enum hdmi_picture_aspect picture_aspect_ratio; |
Maarten Lankhorst | 8f6e1e2 | 2017-05-01 15:37:54 +0200 | [diff] [blame] | 430 | |
| 431 | /** |
Stanislav Lisovskiy | 50525c3 | 2018-05-15 16:59:27 +0300 | [diff] [blame] | 432 | * @content_type: Connector property to control the |
| 433 | * HDMI infoframe content type setting. |
| 434 | * The %DRM_MODE_CONTENT_TYPE_\* values much |
| 435 | * match the values. |
| 436 | */ |
| 437 | unsigned int content_type; |
| 438 | |
| 439 | /** |
Maarten Lankhorst | 8f6e1e2 | 2017-05-01 15:37:54 +0200 | [diff] [blame] | 440 | * @scaling_mode: Connector property to control the |
| 441 | * upscaling, mostly used for built-in panels. |
| 442 | */ |
| 443 | unsigned int scaling_mode; |
Sean Paul | 2455786 | 2018-01-08 14:55:37 -0500 | [diff] [blame] | 444 | |
| 445 | /** |
| 446 | * @content_protection: Connector property to request content |
| 447 | * protection. This is most commonly used for HDCP. |
| 448 | */ |
| 449 | unsigned int content_protection; |
Brian Starkey | 935774c | 2017-03-29 17:42:32 +0100 | [diff] [blame] | 450 | |
| 451 | /** |
| 452 | * @writeback_job: Writeback job for writeback connectors |
| 453 | * |
Brian Starkey | b13cc8d | 2017-03-29 17:42:33 +0100 | [diff] [blame] | 454 | * Holds the framebuffer and out-fence for a writeback connector. As |
| 455 | * the writeback completion may be asynchronous to the normal commit |
| 456 | * cycle, the writeback job lifetime is managed separately from the |
| 457 | * normal atomic state by this object. |
Brian Starkey | 935774c | 2017-03-29 17:42:32 +0100 | [diff] [blame] | 458 | * |
| 459 | * See also: drm_writeback_queue_job() and |
| 460 | * drm_writeback_signal_completion() |
| 461 | */ |
| 462 | struct drm_writeback_job *writeback_job; |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 463 | }; |
| 464 | |
| 465 | /** |
| 466 | * struct drm_connector_funcs - control connectors on a given device |
| 467 | * |
| 468 | * Each CRTC may have one or more connectors attached to it. The functions |
| 469 | * below allow the core DRM code to control connectors, enumerate available modes, |
| 470 | * etc. |
| 471 | */ |
| 472 | struct drm_connector_funcs { |
| 473 | /** |
| 474 | * @dpms: |
| 475 | * |
| 476 | * Legacy entry point to set the per-connector DPMS state. Legacy DPMS |
| 477 | * is exposed as a standard property on the connector, but diverted to |
| 478 | * this callback in the drm core. Note that atomic drivers don't |
| 479 | * implement the 4 level DPMS support on the connector any more, but |
| 480 | * instead only have an on/off "ACTIVE" property on the CRTC object. |
| 481 | * |
Daniel Vetter | 144a799 | 2017-07-25 14:02:04 +0200 | [diff] [blame] | 482 | * This hook is not used by atomic drivers, remapping of the legacy DPMS |
| 483 | * property is entirely handled in the DRM core. |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 484 | * |
| 485 | * RETURNS: |
| 486 | * |
| 487 | * 0 on success or a negative error code on failure. |
| 488 | */ |
| 489 | int (*dpms)(struct drm_connector *connector, int mode); |
| 490 | |
| 491 | /** |
| 492 | * @reset: |
| 493 | * |
| 494 | * Reset connector hardware and software state to off. This function isn't |
| 495 | * called by the core directly, only through drm_mode_config_reset(). |
| 496 | * It's not a helper hook only for historical reasons. |
| 497 | * |
| 498 | * Atomic drivers can use drm_atomic_helper_connector_reset() to reset |
| 499 | * atomic state using this hook. |
| 500 | */ |
| 501 | void (*reset)(struct drm_connector *connector); |
| 502 | |
| 503 | /** |
| 504 | * @detect: |
| 505 | * |
| 506 | * Check to see if anything is attached to the connector. The parameter |
| 507 | * force is set to false whilst polling, true when checking the |
| 508 | * connector due to a user request. force can be used by the driver to |
| 509 | * avoid expensive, destructive operations during automated probing. |
| 510 | * |
Laurent Pinchart | 949f088 | 2016-11-29 22:56:30 +0200 | [diff] [blame] | 511 | * This callback is optional, if not implemented the connector will be |
| 512 | * considered as always being attached. |
| 513 | * |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 514 | * FIXME: |
| 515 | * |
| 516 | * Note that this hook is only called by the probe helper. It's not in |
| 517 | * the helper library vtable purely for historical reasons. The only DRM |
| 518 | * core entry point to probe connector state is @fill_modes. |
| 519 | * |
Maarten Lankhorst | 6c5ed5a | 2017-04-06 20:55:20 +0200 | [diff] [blame] | 520 | * Note that the helper library will already hold |
| 521 | * &drm_mode_config.connection_mutex. Drivers which need to grab additional |
| 522 | * locks to avoid races with concurrent modeset changes need to use |
| 523 | * &drm_connector_helper_funcs.detect_ctx instead. |
| 524 | * |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 525 | * RETURNS: |
| 526 | * |
| 527 | * drm_connector_status indicating the connector's status. |
| 528 | */ |
| 529 | enum drm_connector_status (*detect)(struct drm_connector *connector, |
| 530 | bool force); |
| 531 | |
| 532 | /** |
| 533 | * @force: |
| 534 | * |
| 535 | * This function is called to update internal encoder state when the |
| 536 | * connector is forced to a certain state by userspace, either through |
| 537 | * the sysfs interfaces or on the kernel cmdline. In that case the |
| 538 | * @detect callback isn't called. |
| 539 | * |
| 540 | * FIXME: |
| 541 | * |
| 542 | * Note that this hook is only called by the probe helper. It's not in |
| 543 | * the helper library vtable purely for historical reasons. The only DRM |
| 544 | * core entry point to probe connector state is @fill_modes. |
| 545 | */ |
| 546 | void (*force)(struct drm_connector *connector); |
| 547 | |
| 548 | /** |
| 549 | * @fill_modes: |
| 550 | * |
| 551 | * Entry point for output detection and basic mode validation. The |
| 552 | * driver should reprobe the output if needed (e.g. when hotplug |
Daniel Vetter | d574528 | 2017-01-25 07:26:45 +0100 | [diff] [blame] | 553 | * handling is unreliable), add all detected modes to &drm_connector.modes |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 554 | * and filter out any the device can't support in any configuration. It |
| 555 | * also needs to filter out any modes wider or higher than the |
| 556 | * parameters max_width and max_height indicate. |
| 557 | * |
| 558 | * The drivers must also prune any modes no longer valid from |
Daniel Vetter | d574528 | 2017-01-25 07:26:45 +0100 | [diff] [blame] | 559 | * &drm_connector.modes. Furthermore it must update |
| 560 | * &drm_connector.status and &drm_connector.edid. If no EDID has been |
| 561 | * received for this output connector->edid must be NULL. |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 562 | * |
| 563 | * Drivers using the probe helpers should use |
Daniel Vetter | 92e1d26 | 2018-07-09 10:40:05 +0200 | [diff] [blame^] | 564 | * drm_helper_probe_single_connector_modes() to implement this |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 565 | * function. |
| 566 | * |
| 567 | * RETURNS: |
| 568 | * |
Daniel Vetter | d574528 | 2017-01-25 07:26:45 +0100 | [diff] [blame] | 569 | * The number of modes detected and filled into &drm_connector.modes. |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 570 | */ |
| 571 | int (*fill_modes)(struct drm_connector *connector, uint32_t max_width, uint32_t max_height); |
| 572 | |
| 573 | /** |
| 574 | * @set_property: |
| 575 | * |
| 576 | * This is the legacy entry point to update a property attached to the |
| 577 | * connector. |
| 578 | * |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 579 | * This callback is optional if the driver does not support any legacy |
Daniel Vetter | 144a799 | 2017-07-25 14:02:04 +0200 | [diff] [blame] | 580 | * driver-private properties. For atomic drivers it is not used because |
| 581 | * property handling is done entirely in the DRM core. |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 582 | * |
| 583 | * RETURNS: |
| 584 | * |
| 585 | * 0 on success or a negative error code on failure. |
| 586 | */ |
| 587 | int (*set_property)(struct drm_connector *connector, struct drm_property *property, |
| 588 | uint64_t val); |
| 589 | |
| 590 | /** |
| 591 | * @late_register: |
| 592 | * |
| 593 | * This optional hook can be used to register additional userspace |
| 594 | * interfaces attached to the connector, light backlight control, i2c, |
| 595 | * DP aux or similar interfaces. It is called late in the driver load |
| 596 | * sequence from drm_connector_register() when registering all the |
| 597 | * core drm connector interfaces. Everything added from this callback |
| 598 | * should be unregistered in the early_unregister callback. |
| 599 | * |
Daniel Vetter | d574528 | 2017-01-25 07:26:45 +0100 | [diff] [blame] | 600 | * This is called while holding &drm_connector.mutex. |
Daniel Vetter | e73ab00 | 2016-12-18 14:35:45 +0100 | [diff] [blame] | 601 | * |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 602 | * Returns: |
| 603 | * |
| 604 | * 0 on success, or a negative error code on failure. |
| 605 | */ |
| 606 | int (*late_register)(struct drm_connector *connector); |
| 607 | |
| 608 | /** |
| 609 | * @early_unregister: |
| 610 | * |
| 611 | * This optional hook should be used to unregister the additional |
| 612 | * userspace interfaces attached to the connector from |
Grazvydas Ignotas | 621a999 | 2016-10-09 20:07:00 +0300 | [diff] [blame] | 613 | * late_register(). It is called from drm_connector_unregister(), |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 614 | * early in the driver unload sequence to disable userspace access |
| 615 | * before data structures are torndown. |
Daniel Vetter | e73ab00 | 2016-12-18 14:35:45 +0100 | [diff] [blame] | 616 | * |
Daniel Vetter | d574528 | 2017-01-25 07:26:45 +0100 | [diff] [blame] | 617 | * This is called while holding &drm_connector.mutex. |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 618 | */ |
| 619 | void (*early_unregister)(struct drm_connector *connector); |
| 620 | |
| 621 | /** |
| 622 | * @destroy: |
| 623 | * |
| 624 | * Clean up connector resources. This is called at driver unload time |
| 625 | * through drm_mode_config_cleanup(). It can also be called at runtime |
| 626 | * when a connector is being hot-unplugged for drivers that support |
| 627 | * connector hotplugging (e.g. DisplayPort MST). |
| 628 | */ |
| 629 | void (*destroy)(struct drm_connector *connector); |
| 630 | |
| 631 | /** |
| 632 | * @atomic_duplicate_state: |
| 633 | * |
| 634 | * Duplicate the current atomic state for this connector and return it. |
Grazvydas Ignotas | 621a999 | 2016-10-09 20:07:00 +0300 | [diff] [blame] | 635 | * The core and helpers guarantee that any atomic state duplicated with |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 636 | * this hook and still owned by the caller (i.e. not transferred to the |
Daniel Vetter | d574528 | 2017-01-25 07:26:45 +0100 | [diff] [blame] | 637 | * driver by calling &drm_mode_config_funcs.atomic_commit) will be |
| 638 | * cleaned up by calling the @atomic_destroy_state hook in this |
| 639 | * structure. |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 640 | * |
Haneen Mohammed | ba1f665 | 2018-05-25 04:25:55 +0300 | [diff] [blame] | 641 | * This callback is mandatory for atomic drivers. |
| 642 | * |
Daniel Vetter | ea0dd85 | 2016-12-29 21:48:26 +0100 | [diff] [blame] | 643 | * Atomic drivers which don't subclass &struct drm_connector_state should use |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 644 | * drm_atomic_helper_connector_duplicate_state(). Drivers that subclass the |
| 645 | * state structure to extend it with driver-private state should use |
| 646 | * __drm_atomic_helper_connector_duplicate_state() to make sure shared state is |
| 647 | * duplicated in a consistent fashion across drivers. |
| 648 | * |
Daniel Vetter | d574528 | 2017-01-25 07:26:45 +0100 | [diff] [blame] | 649 | * It is an error to call this hook before &drm_connector.state has been |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 650 | * initialized correctly. |
| 651 | * |
| 652 | * NOTE: |
| 653 | * |
| 654 | * If the duplicate state references refcounted resources this hook must |
| 655 | * acquire a reference for each of them. The driver must release these |
| 656 | * references again in @atomic_destroy_state. |
| 657 | * |
| 658 | * RETURNS: |
| 659 | * |
| 660 | * Duplicated atomic state or NULL when the allocation failed. |
| 661 | */ |
| 662 | struct drm_connector_state *(*atomic_duplicate_state)(struct drm_connector *connector); |
| 663 | |
| 664 | /** |
| 665 | * @atomic_destroy_state: |
| 666 | * |
| 667 | * Destroy a state duplicated with @atomic_duplicate_state and release |
| 668 | * or unreference all resources it references |
Haneen Mohammed | ba1f665 | 2018-05-25 04:25:55 +0300 | [diff] [blame] | 669 | * |
| 670 | * This callback is mandatory for atomic drivers. |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 671 | */ |
| 672 | void (*atomic_destroy_state)(struct drm_connector *connector, |
| 673 | struct drm_connector_state *state); |
| 674 | |
| 675 | /** |
| 676 | * @atomic_set_property: |
| 677 | * |
| 678 | * Decode a driver-private property value and store the decoded value |
| 679 | * into the passed-in state structure. Since the atomic core decodes all |
| 680 | * standardized properties (even for extensions beyond the core set of |
| 681 | * properties which might not be implemented by all drivers) this |
| 682 | * requires drivers to subclass the state structure. |
| 683 | * |
| 684 | * Such driver-private properties should really only be implemented for |
| 685 | * truly hardware/vendor specific state. Instead it is preferred to |
| 686 | * standardize atomic extension and decode the properties used to expose |
| 687 | * such an extension in the core. |
| 688 | * |
| 689 | * Do not call this function directly, use |
| 690 | * drm_atomic_connector_set_property() instead. |
| 691 | * |
| 692 | * This callback is optional if the driver does not support any |
| 693 | * driver-private atomic properties. |
| 694 | * |
| 695 | * NOTE: |
| 696 | * |
| 697 | * This function is called in the state assembly phase of atomic |
| 698 | * modesets, which can be aborted for any reason (including on |
| 699 | * userspace's request to just check whether a configuration would be |
| 700 | * possible). Drivers MUST NOT touch any persistent state (hardware or |
| 701 | * software) or data structures except the passed in @state parameter. |
| 702 | * |
| 703 | * Also since userspace controls in which order properties are set this |
| 704 | * function must not do any input validation (since the state update is |
| 705 | * incomplete and hence likely inconsistent). Instead any such input |
| 706 | * validation must be done in the various atomic_check callbacks. |
| 707 | * |
| 708 | * RETURNS: |
| 709 | * |
| 710 | * 0 if the property has been found, -EINVAL if the property isn't |
| 711 | * implemented by the driver (which shouldn't ever happen, the core only |
| 712 | * asks for properties attached to this connector). No other validation |
| 713 | * is allowed by the driver. The core already checks that the property |
| 714 | * value is within the range (integer, valid enum value, ...) the driver |
| 715 | * set when registering the property. |
| 716 | */ |
| 717 | int (*atomic_set_property)(struct drm_connector *connector, |
| 718 | struct drm_connector_state *state, |
| 719 | struct drm_property *property, |
| 720 | uint64_t val); |
| 721 | |
| 722 | /** |
| 723 | * @atomic_get_property: |
| 724 | * |
| 725 | * Reads out the decoded driver-private property. This is used to |
| 726 | * implement the GETCONNECTOR IOCTL. |
| 727 | * |
| 728 | * Do not call this function directly, use |
| 729 | * drm_atomic_connector_get_property() instead. |
| 730 | * |
| 731 | * This callback is optional if the driver does not support any |
| 732 | * driver-private atomic properties. |
| 733 | * |
| 734 | * RETURNS: |
| 735 | * |
| 736 | * 0 on success, -EINVAL if the property isn't implemented by the |
| 737 | * driver (which shouldn't ever happen, the core only asks for |
| 738 | * properties attached to this connector). |
| 739 | */ |
| 740 | int (*atomic_get_property)(struct drm_connector *connector, |
| 741 | const struct drm_connector_state *state, |
| 742 | struct drm_property *property, |
| 743 | uint64_t *val); |
Rob Clark | fceffb32 | 2016-11-05 11:08:09 -0400 | [diff] [blame] | 744 | |
| 745 | /** |
| 746 | * @atomic_print_state: |
| 747 | * |
Daniel Vetter | ea0dd85 | 2016-12-29 21:48:26 +0100 | [diff] [blame] | 748 | * If driver subclasses &struct drm_connector_state, it should implement |
Rob Clark | fceffb32 | 2016-11-05 11:08:09 -0400 | [diff] [blame] | 749 | * this optional hook for printing additional driver specific state. |
| 750 | * |
| 751 | * Do not call this directly, use drm_atomic_connector_print_state() |
| 752 | * instead. |
| 753 | */ |
| 754 | void (*atomic_print_state)(struct drm_printer *p, |
| 755 | const struct drm_connector_state *state); |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 756 | }; |
| 757 | |
| 758 | /* mode specified on the command line */ |
| 759 | struct drm_cmdline_mode { |
| 760 | bool specified; |
| 761 | bool refresh_specified; |
| 762 | bool bpp_specified; |
| 763 | int xres, yres; |
| 764 | int bpp; |
| 765 | int refresh; |
| 766 | bool rb; |
| 767 | bool interlace; |
| 768 | bool cvt; |
| 769 | bool margins; |
| 770 | enum drm_connector_force force; |
| 771 | }; |
| 772 | |
| 773 | /** |
| 774 | * struct drm_connector - central DRM connector control structure |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 775 | * |
| 776 | * Each connector may be connected to one or more CRTCs, or may be clonable by |
| 777 | * another connector if they can share a CRTC. Each connector also has a specific |
| 778 | * position in the broader display (referred to as a 'screen' though it could |
| 779 | * span multiple monitors). |
| 780 | */ |
| 781 | struct drm_connector { |
Daniel Vetter | 92e1d26 | 2018-07-09 10:40:05 +0200 | [diff] [blame^] | 782 | /** @dev: parent DRM device */ |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 783 | struct drm_device *dev; |
Daniel Vetter | 92e1d26 | 2018-07-09 10:40:05 +0200 | [diff] [blame^] | 784 | /** @kdev: kernel device for sysfs attributes */ |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 785 | struct device *kdev; |
Daniel Vetter | 92e1d26 | 2018-07-09 10:40:05 +0200 | [diff] [blame^] | 786 | /** @attr: sysfs attributes */ |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 787 | struct device_attribute *attr; |
Daniel Vetter | 92e1d26 | 2018-07-09 10:40:05 +0200 | [diff] [blame^] | 788 | |
| 789 | /** |
| 790 | * @head: |
| 791 | * |
| 792 | * List of all connectors on a @dev, linked from |
| 793 | * &drm_mode_config.connector_list. Protected by |
| 794 | * &drm_mode_config.connector_list_lock, but please only use |
| 795 | * &drm_connector_list_iter to walk this list. |
| 796 | */ |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 797 | struct list_head head; |
| 798 | |
Daniel Vetter | 92e1d26 | 2018-07-09 10:40:05 +0200 | [diff] [blame^] | 799 | /** @base: base KMS object */ |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 800 | struct drm_mode_object base; |
| 801 | |
Daniel Vetter | 92e1d26 | 2018-07-09 10:40:05 +0200 | [diff] [blame^] | 802 | /** @name: human readable name, can be overwritten by the driver */ |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 803 | char *name; |
| 804 | |
| 805 | /** |
Daniel Vetter | e73ab00 | 2016-12-18 14:35:45 +0100 | [diff] [blame] | 806 | * @mutex: Lock for general connector state, but currently only protects |
Daniel Vetter | d574528 | 2017-01-25 07:26:45 +0100 | [diff] [blame] | 807 | * @registered. Most of the connector state is still protected by |
| 808 | * &drm_mode_config.mutex. |
Daniel Vetter | e73ab00 | 2016-12-18 14:35:45 +0100 | [diff] [blame] | 809 | */ |
| 810 | struct mutex mutex; |
| 811 | |
| 812 | /** |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 813 | * @index: Compacted connector index, which matches the position inside |
| 814 | * the mode_config.list for drivers not supporting hot-add/removing. Can |
| 815 | * be used as an array index. It is invariant over the lifetime of the |
| 816 | * connector. |
| 817 | */ |
| 818 | unsigned index; |
| 819 | |
Daniel Vetter | 92e1d26 | 2018-07-09 10:40:05 +0200 | [diff] [blame^] | 820 | /** |
| 821 | * @connector_type: |
| 822 | * one of the DRM_MODE_CONNECTOR_<foo> types from drm_mode.h |
| 823 | */ |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 824 | int connector_type; |
Daniel Vetter | 92e1d26 | 2018-07-09 10:40:05 +0200 | [diff] [blame^] | 825 | /** @connector_type_id: index into connector type enum */ |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 826 | int connector_type_id; |
Daniel Vetter | 92e1d26 | 2018-07-09 10:40:05 +0200 | [diff] [blame^] | 827 | /** |
| 828 | * @interlace_allowed: |
| 829 | * Can this connector handle interlaced modes? Only used by |
| 830 | * drm_helper_probe_single_connector_modes() for mode filtering. |
| 831 | */ |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 832 | bool interlace_allowed; |
Daniel Vetter | 92e1d26 | 2018-07-09 10:40:05 +0200 | [diff] [blame^] | 833 | /** |
| 834 | * @doublescan_allowed: |
| 835 | * Can this connector handle doublescan? Only used by |
| 836 | * drm_helper_probe_single_connector_modes() for mode filtering. |
| 837 | */ |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 838 | bool doublescan_allowed; |
Daniel Vetter | 92e1d26 | 2018-07-09 10:40:05 +0200 | [diff] [blame^] | 839 | /** |
| 840 | * @stereo_allowed: |
| 841 | * Can this connector handle stereo modes? Only used by |
| 842 | * drm_helper_probe_single_connector_modes() for mode filtering. |
| 843 | */ |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 844 | bool stereo_allowed; |
Shashank Sharma | d852315 | 2017-07-13 21:03:11 +0530 | [diff] [blame] | 845 | |
| 846 | /** |
| 847 | * @ycbcr_420_allowed : This bool indicates if this connector is |
| 848 | * capable of handling YCBCR 420 output. While parsing the EDID |
| 849 | * blocks, its very helpful to know, if the source is capable of |
| 850 | * handling YCBCR 420 outputs. |
| 851 | */ |
| 852 | bool ycbcr_420_allowed; |
| 853 | |
Daniel Vetter | e73ab00 | 2016-12-18 14:35:45 +0100 | [diff] [blame] | 854 | /** |
| 855 | * @registered: Is this connector exposed (registered) with userspace? |
| 856 | * Protected by @mutex. |
| 857 | */ |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 858 | bool registered; |
Daniel Vetter | 91eefc0 | 2016-12-14 00:08:10 +0100 | [diff] [blame] | 859 | |
| 860 | /** |
| 861 | * @modes: |
| 862 | * Modes available on this connector (from fill_modes() + user). |
Daniel Vetter | d574528 | 2017-01-25 07:26:45 +0100 | [diff] [blame] | 863 | * Protected by &drm_mode_config.mutex. |
Daniel Vetter | 91eefc0 | 2016-12-14 00:08:10 +0100 | [diff] [blame] | 864 | */ |
Daniel Vetter | d574528 | 2017-01-25 07:26:45 +0100 | [diff] [blame] | 865 | struct list_head modes; |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 866 | |
Daniel Vetter | 91eefc0 | 2016-12-14 00:08:10 +0100 | [diff] [blame] | 867 | /** |
| 868 | * @status: |
| 869 | * One of the drm_connector_status enums (connected, not, or unknown). |
Daniel Vetter | d574528 | 2017-01-25 07:26:45 +0100 | [diff] [blame] | 870 | * Protected by &drm_mode_config.mutex. |
Daniel Vetter | 91eefc0 | 2016-12-14 00:08:10 +0100 | [diff] [blame] | 871 | */ |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 872 | enum drm_connector_status status; |
| 873 | |
Daniel Vetter | 91eefc0 | 2016-12-14 00:08:10 +0100 | [diff] [blame] | 874 | /** |
| 875 | * @probed_modes: |
| 876 | * These are modes added by probing with DDC or the BIOS, before |
Daniel Vetter | d574528 | 2017-01-25 07:26:45 +0100 | [diff] [blame] | 877 | * filtering is applied. Used by the probe helpers. Protected by |
| 878 | * &drm_mode_config.mutex. |
Daniel Vetter | 91eefc0 | 2016-12-14 00:08:10 +0100 | [diff] [blame] | 879 | */ |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 880 | struct list_head probed_modes; |
| 881 | |
Daniel Vetter | ae2a6da | 2016-08-12 22:48:53 +0200 | [diff] [blame] | 882 | /** |
| 883 | * @display_info: Display information is filled from EDID information |
| 884 | * when a display is detected. For non hot-pluggable displays such as |
| 885 | * flat panels in embedded systems, the driver should initialize the |
Daniel Vetter | d574528 | 2017-01-25 07:26:45 +0100 | [diff] [blame] | 886 | * &drm_display_info.width_mm and &drm_display_info.height_mm fields |
| 887 | * with the physical size of the display. |
Daniel Vetter | 91eefc0 | 2016-12-14 00:08:10 +0100 | [diff] [blame] | 888 | * |
Daniel Vetter | d574528 | 2017-01-25 07:26:45 +0100 | [diff] [blame] | 889 | * Protected by &drm_mode_config.mutex. |
Daniel Vetter | ae2a6da | 2016-08-12 22:48:53 +0200 | [diff] [blame] | 890 | */ |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 891 | struct drm_display_info display_info; |
Daniel Vetter | 92e1d26 | 2018-07-09 10:40:05 +0200 | [diff] [blame^] | 892 | |
| 893 | /** @funcs: connector control functions */ |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 894 | const struct drm_connector_funcs *funcs; |
| 895 | |
Daniel Vetter | 92e1d26 | 2018-07-09 10:40:05 +0200 | [diff] [blame^] | 896 | /** |
| 897 | * @edid_blob_ptr: DRM property containing EDID if present. Protected by |
| 898 | * &drm_mode_config.mutex. This should be updated only by calling |
| 899 | * drm_mode_connector_update_edid_property(). |
| 900 | */ |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 901 | struct drm_property_blob *edid_blob_ptr; |
Daniel Vetter | 92e1d26 | 2018-07-09 10:40:05 +0200 | [diff] [blame^] | 902 | |
| 903 | /** @properties: property tracking for this connector */ |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 904 | struct drm_object_properties properties; |
| 905 | |
Daniel Vetter | 92e1d26 | 2018-07-09 10:40:05 +0200 | [diff] [blame^] | 906 | /** |
| 907 | * @scaling_mode_property: Optional atomic property to control the |
| 908 | * upscaling. See drm_connector_attach_content_protection_property(). |
| 909 | */ |
Maarten Lankhorst | 8f6e1e2 | 2017-05-01 15:37:54 +0200 | [diff] [blame] | 910 | struct drm_property *scaling_mode_property; |
| 911 | |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 912 | /** |
Sean Paul | 2455786 | 2018-01-08 14:55:37 -0500 | [diff] [blame] | 913 | * @content_protection_property: DRM ENUM property for content |
Daniel Vetter | 92e1d26 | 2018-07-09 10:40:05 +0200 | [diff] [blame^] | 914 | * protection. See drm_connector_attach_content_protection_property(). |
Sean Paul | 2455786 | 2018-01-08 14:55:37 -0500 | [diff] [blame] | 915 | */ |
| 916 | struct drm_property *content_protection_property; |
| 917 | |
| 918 | /** |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 919 | * @path_blob_ptr: |
| 920 | * |
Daniel Vetter | 92e1d26 | 2018-07-09 10:40:05 +0200 | [diff] [blame^] | 921 | * DRM blob property data for the DP MST path property. This should only |
| 922 | * be updated by calling drm_mode_connector_set_path_property(). |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 923 | */ |
| 924 | struct drm_property_blob *path_blob_ptr; |
| 925 | |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 926 | #define DRM_CONNECTOR_POLL_HPD (1 << 0) |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 927 | #define DRM_CONNECTOR_POLL_CONNECT (1 << 1) |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 928 | #define DRM_CONNECTOR_POLL_DISCONNECT (1 << 2) |
| 929 | |
Daniel Vetter | ae2a6da | 2016-08-12 22:48:53 +0200 | [diff] [blame] | 930 | /** |
| 931 | * @polled: |
| 932 | * |
| 933 | * Connector polling mode, a combination of |
| 934 | * |
| 935 | * DRM_CONNECTOR_POLL_HPD |
| 936 | * The connector generates hotplug events and doesn't need to be |
| 937 | * periodically polled. The CONNECT and DISCONNECT flags must not |
| 938 | * be set together with the HPD flag. |
| 939 | * |
| 940 | * DRM_CONNECTOR_POLL_CONNECT |
| 941 | * Periodically poll the connector for connection. |
| 942 | * |
| 943 | * DRM_CONNECTOR_POLL_DISCONNECT |
Daniel Vetter | 92e1d26 | 2018-07-09 10:40:05 +0200 | [diff] [blame^] | 944 | * Periodically poll the connector for disconnection, without |
| 945 | * causing flickering even when the connector is in use. DACs should |
| 946 | * rarely do this without a lot of testing. |
Daniel Vetter | ae2a6da | 2016-08-12 22:48:53 +0200 | [diff] [blame] | 947 | * |
| 948 | * Set to 0 for connectors that don't support connection status |
| 949 | * discovery. |
| 950 | */ |
| 951 | uint8_t polled; |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 952 | |
Daniel Vetter | 92e1d26 | 2018-07-09 10:40:05 +0200 | [diff] [blame^] | 953 | /** |
| 954 | * @dpms: Current dpms state. For legacy drivers the |
| 955 | * &drm_connector_funcs.dpms callback must update this. For atomic |
| 956 | * drivers, this is handled by the core atomic code, and drivers must |
| 957 | * only take &drm_crtc_state.active into account. |
| 958 | */ |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 959 | int dpms; |
| 960 | |
Daniel Vetter | 92e1d26 | 2018-07-09 10:40:05 +0200 | [diff] [blame^] | 961 | /** @helper_private: mid-layer private data */ |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 962 | const struct drm_connector_helper_funcs *helper_private; |
| 963 | |
Daniel Vetter | 92e1d26 | 2018-07-09 10:40:05 +0200 | [diff] [blame^] | 964 | /** @cmdline_mode: mode line parsed from the kernel cmdline for this connector */ |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 965 | struct drm_cmdline_mode cmdline_mode; |
Daniel Vetter | 92e1d26 | 2018-07-09 10:40:05 +0200 | [diff] [blame^] | 966 | /** @force: a DRM_FORCE_<foo> state for forced mode sets */ |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 967 | enum drm_connector_force force; |
Daniel Vetter | 92e1d26 | 2018-07-09 10:40:05 +0200 | [diff] [blame^] | 968 | /** @override_edid: has the EDID been overwritten through debugfs for testing? */ |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 969 | bool override_edid; |
| 970 | |
| 971 | #define DRM_CONNECTOR_MAX_ENCODER 3 |
Daniel Vetter | 92e1d26 | 2018-07-09 10:40:05 +0200 | [diff] [blame^] | 972 | /** |
| 973 | * @encoder_ids: Valid encoders for this connector. Please only use |
| 974 | * drm_connector_for_each_possible_encoder() to enumerate these. |
| 975 | */ |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 976 | uint32_t encoder_ids[DRM_CONNECTOR_MAX_ENCODER]; |
Daniel Vetter | 92e1d26 | 2018-07-09 10:40:05 +0200 | [diff] [blame^] | 977 | |
Daniel Vetter | 2e2b96e | 2017-11-08 21:30:07 +0100 | [diff] [blame] | 978 | /** |
| 979 | * @encoder: Currently bound encoder driving this connector, if any. |
| 980 | * Only really meaningful for non-atomic drivers. Atomic drivers should |
| 981 | * instead look at &drm_connector_state.best_encoder, and in case they |
| 982 | * need the CRTC driving this output, &drm_connector_state.crtc. |
| 983 | */ |
| 984 | struct drm_encoder *encoder; |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 985 | |
| 986 | #define MAX_ELD_BYTES 128 |
Daniel Vetter | 92e1d26 | 2018-07-09 10:40:05 +0200 | [diff] [blame^] | 987 | /** @eld: EDID-like data, if present */ |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 988 | uint8_t eld[MAX_ELD_BYTES]; |
Daniel Vetter | 92e1d26 | 2018-07-09 10:40:05 +0200 | [diff] [blame^] | 989 | /** @latency_present: AV delay info from ELD, if found */ |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 990 | bool latency_present[2]; |
Daniel Vetter | 92e1d26 | 2018-07-09 10:40:05 +0200 | [diff] [blame^] | 991 | /** |
| 992 | * @video_latency: Video latency info from ELD, if found. |
| 993 | * [0]: progressive, [1]: interlaced |
| 994 | */ |
| 995 | int video_latency[2]; |
| 996 | /** |
| 997 | * @audio_latency: audio latency info from ELD, if found |
| 998 | * [0]: progressive, [1]: interlaced |
| 999 | */ |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 1000 | int audio_latency[2]; |
Daniel Vetter | 92e1d26 | 2018-07-09 10:40:05 +0200 | [diff] [blame^] | 1001 | /** |
| 1002 | * @null_edid_counter: track sinks that give us all zeros for the EDID. |
| 1003 | * Needed to workaround some HW bugs where we get all 0s |
| 1004 | */ |
| 1005 | int null_edid_counter; |
| 1006 | |
| 1007 | /** @bad_edid_counter: track sinks that give us an EDID with invalid checksum */ |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 1008 | unsigned bad_edid_counter; |
| 1009 | |
Daniel Vetter | 92e1d26 | 2018-07-09 10:40:05 +0200 | [diff] [blame^] | 1010 | /** |
| 1011 | * @edid_corrupt: Indicates whether the last read EDID was corrupt. Used |
| 1012 | * in Displayport compliance testing - Displayport Link CTS Core 1.2 |
| 1013 | * rev1.1 4.2.2.6 |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 1014 | */ |
| 1015 | bool edid_corrupt; |
| 1016 | |
Daniel Vetter | 92e1d26 | 2018-07-09 10:40:05 +0200 | [diff] [blame^] | 1017 | /** @debugfs_entry: debugfs directory for this connector */ |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 1018 | struct dentry *debugfs_entry; |
| 1019 | |
Daniel Vetter | c9e42b7 | 2017-03-28 17:53:48 +0200 | [diff] [blame] | 1020 | /** |
| 1021 | * @state: |
| 1022 | * |
| 1023 | * Current atomic state for this connector. |
| 1024 | * |
Daniel Vetter | 92e1d26 | 2018-07-09 10:40:05 +0200 | [diff] [blame^] | 1025 | * This is protected by &drm_mode_config.connection_mutex. Note that |
Daniel Vetter | c9e42b7 | 2017-03-28 17:53:48 +0200 | [diff] [blame] | 1026 | * nonblocking atomic commits access the current connector state without |
| 1027 | * taking locks. Either by going through the &struct drm_atomic_state |
Maarten Lankhorst | 77ac3b0 | 2017-07-19 16:39:20 +0200 | [diff] [blame] | 1028 | * pointers, see for_each_oldnew_connector_in_state(), |
Daniel Vetter | c9e42b7 | 2017-03-28 17:53:48 +0200 | [diff] [blame] | 1029 | * for_each_old_connector_in_state() and |
| 1030 | * for_each_new_connector_in_state(). Or through careful ordering of |
| 1031 | * atomic commit operations as implemented in the atomic helpers, see |
| 1032 | * &struct drm_crtc_commit. |
| 1033 | */ |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 1034 | struct drm_connector_state *state; |
| 1035 | |
Daniel Vetter | 92e1d26 | 2018-07-09 10:40:05 +0200 | [diff] [blame^] | 1036 | /* DisplayID bits. FIXME: Extract into a substruct? */ |
| 1037 | |
| 1038 | /** |
| 1039 | * @tile_blob_ptr: |
| 1040 | * |
| 1041 | * DRM blob property data for the tile property (used mostly by DP MST). |
| 1042 | * This is meant for screens which are driven through separate display |
| 1043 | * pipelines represented by &drm_crtc, which might not be running with |
| 1044 | * genlocked clocks. For tiled panels which are genlocked, like |
| 1045 | * dual-link LVDS or dual-link DSI, the driver should try to not expose |
| 1046 | * the tiling and virtualize both &drm_crtc and &drm_plane if needed. |
| 1047 | * |
| 1048 | * This should only be updated by calling |
| 1049 | * drm_mode_connector_set_tile_property(). |
| 1050 | */ |
| 1051 | struct drm_property_blob *tile_blob_ptr; |
| 1052 | |
| 1053 | /** @has_tile: is this connector connected to a tiled monitor */ |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 1054 | bool has_tile; |
Daniel Vetter | 92e1d26 | 2018-07-09 10:40:05 +0200 | [diff] [blame^] | 1055 | /** @tile_group: tile group for the connected monitor */ |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 1056 | struct drm_tile_group *tile_group; |
Daniel Vetter | 92e1d26 | 2018-07-09 10:40:05 +0200 | [diff] [blame^] | 1057 | /** @tile_is_single_monitor: whether the tile is one monitor housing */ |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 1058 | bool tile_is_single_monitor; |
| 1059 | |
Daniel Vetter | 92e1d26 | 2018-07-09 10:40:05 +0200 | [diff] [blame^] | 1060 | /** @num_h_tile: number of horizontal tiles in the tile group */ |
| 1061 | /** @num_v_tile: number of vertical tiles in the tile group */ |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 1062 | uint8_t num_h_tile, num_v_tile; |
Daniel Vetter | 92e1d26 | 2018-07-09 10:40:05 +0200 | [diff] [blame^] | 1063 | /** @tile_h_loc: horizontal location of this tile */ |
| 1064 | /** @tile_v_loc: vertical location of this tile */ |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 1065 | uint8_t tile_h_loc, tile_v_loc; |
Daniel Vetter | 92e1d26 | 2018-07-09 10:40:05 +0200 | [diff] [blame^] | 1066 | /** @tile_h_size: horizontal size of this tile. */ |
| 1067 | /** @tile_v_size: vertical size of this tile. */ |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 1068 | uint16_t tile_h_size, tile_v_size; |
Daniel Vetter | a703c55 | 2017-12-04 21:48:18 +0100 | [diff] [blame] | 1069 | |
| 1070 | /** |
Daniel Vetter | ea497bb | 2017-12-13 13:49:36 +0100 | [diff] [blame] | 1071 | * @free_node: |
Daniel Vetter | a703c55 | 2017-12-04 21:48:18 +0100 | [diff] [blame] | 1072 | * |
Daniel Vetter | 92e1d26 | 2018-07-09 10:40:05 +0200 | [diff] [blame^] | 1073 | * List used only by &drm_connector_list_iter to be able to clean up a |
Daniel Vetter | ea497bb | 2017-12-13 13:49:36 +0100 | [diff] [blame] | 1074 | * connector from any context, in conjunction with |
| 1075 | * &drm_mode_config.connector_free_work. |
Daniel Vetter | a703c55 | 2017-12-04 21:48:18 +0100 | [diff] [blame] | 1076 | */ |
Daniel Vetter | ea497bb | 2017-12-13 13:49:36 +0100 | [diff] [blame] | 1077 | struct llist_node free_node; |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 1078 | }; |
| 1079 | |
| 1080 | #define obj_to_connector(x) container_of(x, struct drm_connector, base) |
| 1081 | |
| 1082 | int drm_connector_init(struct drm_device *dev, |
| 1083 | struct drm_connector *connector, |
| 1084 | const struct drm_connector_funcs *funcs, |
| 1085 | int connector_type); |
| 1086 | int drm_connector_register(struct drm_connector *connector); |
| 1087 | void drm_connector_unregister(struct drm_connector *connector); |
| 1088 | int drm_mode_connector_attach_encoder(struct drm_connector *connector, |
| 1089 | struct drm_encoder *encoder); |
| 1090 | |
| 1091 | void drm_connector_cleanup(struct drm_connector *connector); |
Ville Syrjälä | 7370573 | 2018-06-26 22:47:10 +0300 | [diff] [blame] | 1092 | |
| 1093 | static inline unsigned int drm_connector_index(const struct drm_connector *connector) |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 1094 | { |
| 1095 | return connector->index; |
| 1096 | } |
| 1097 | |
Ville Syrjälä | 7370573 | 2018-06-26 22:47:10 +0300 | [diff] [blame] | 1098 | static inline u32 drm_connector_mask(const struct drm_connector *connector) |
| 1099 | { |
| 1100 | return 1 << connector->index; |
| 1101 | } |
| 1102 | |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 1103 | /** |
| 1104 | * drm_connector_lookup - lookup connector object |
| 1105 | * @dev: DRM device |
Dave Airlie | e7e62c7 | 2017-11-09 09:35:04 +1000 | [diff] [blame] | 1106 | * @file_priv: drm file to check for lease against. |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 1107 | * @id: connector object id |
| 1108 | * |
| 1109 | * This function looks up the connector object specified by id |
| 1110 | * add takes a reference to it. |
| 1111 | */ |
| 1112 | static inline struct drm_connector *drm_connector_lookup(struct drm_device *dev, |
Keith Packard | 418da17 | 2017-03-14 23:25:07 -0700 | [diff] [blame] | 1113 | struct drm_file *file_priv, |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 1114 | uint32_t id) |
| 1115 | { |
| 1116 | struct drm_mode_object *mo; |
Keith Packard | 418da17 | 2017-03-14 23:25:07 -0700 | [diff] [blame] | 1117 | mo = drm_mode_object_find(dev, file_priv, id, DRM_MODE_OBJECT_CONNECTOR); |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 1118 | return mo ? obj_to_connector(mo) : NULL; |
| 1119 | } |
| 1120 | |
| 1121 | /** |
Thierry Reding | ad09360 | 2017-02-28 15:46:39 +0100 | [diff] [blame] | 1122 | * drm_connector_get - acquire a connector reference |
| 1123 | * @connector: DRM connector |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 1124 | * |
| 1125 | * This function increments the connector's refcount. |
| 1126 | */ |
Thierry Reding | ad09360 | 2017-02-28 15:46:39 +0100 | [diff] [blame] | 1127 | static inline void drm_connector_get(struct drm_connector *connector) |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 1128 | { |
Thierry Reding | ad09360 | 2017-02-28 15:46:39 +0100 | [diff] [blame] | 1129 | drm_mode_object_get(&connector->base); |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 1130 | } |
| 1131 | |
| 1132 | /** |
Thierry Reding | ad09360 | 2017-02-28 15:46:39 +0100 | [diff] [blame] | 1133 | * drm_connector_put - release a connector reference |
| 1134 | * @connector: DRM connector |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 1135 | * |
Thierry Reding | ad09360 | 2017-02-28 15:46:39 +0100 | [diff] [blame] | 1136 | * This function decrements the connector's reference count and frees the |
| 1137 | * object if the reference count drops to zero. |
| 1138 | */ |
| 1139 | static inline void drm_connector_put(struct drm_connector *connector) |
| 1140 | { |
| 1141 | drm_mode_object_put(&connector->base); |
| 1142 | } |
| 1143 | |
| 1144 | /** |
| 1145 | * drm_connector_reference - acquire a connector reference |
| 1146 | * @connector: DRM connector |
| 1147 | * |
| 1148 | * This is a compatibility alias for drm_connector_get() and should not be |
| 1149 | * used by new code. |
| 1150 | */ |
| 1151 | static inline void drm_connector_reference(struct drm_connector *connector) |
| 1152 | { |
| 1153 | drm_connector_get(connector); |
| 1154 | } |
| 1155 | |
| 1156 | /** |
| 1157 | * drm_connector_unreference - release a connector reference |
| 1158 | * @connector: DRM connector |
| 1159 | * |
| 1160 | * This is a compatibility alias for drm_connector_put() and should not be |
| 1161 | * used by new code. |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 1162 | */ |
| 1163 | static inline void drm_connector_unreference(struct drm_connector *connector) |
| 1164 | { |
Thierry Reding | ad09360 | 2017-02-28 15:46:39 +0100 | [diff] [blame] | 1165 | drm_connector_put(connector); |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 1166 | } |
| 1167 | |
| 1168 | const char *drm_get_connector_status_name(enum drm_connector_status status); |
| 1169 | const char *drm_get_subpixel_order_name(enum subpixel_order order); |
| 1170 | const char *drm_get_dpms_name(int val); |
| 1171 | const char *drm_get_dvi_i_subconnector_name(int val); |
| 1172 | const char *drm_get_dvi_i_select_name(int val); |
| 1173 | const char *drm_get_tv_subconnector_name(int val); |
| 1174 | const char *drm_get_tv_select_name(int val); |
Sean Paul | 2455786 | 2018-01-08 14:55:37 -0500 | [diff] [blame] | 1175 | const char *drm_get_content_protection_name(int val); |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 1176 | |
| 1177 | int drm_mode_create_dvi_i_properties(struct drm_device *dev); |
| 1178 | int drm_mode_create_tv_properties(struct drm_device *dev, |
| 1179 | unsigned int num_modes, |
| 1180 | const char * const modes[]); |
| 1181 | int drm_mode_create_scaling_mode_property(struct drm_device *dev); |
Stanislav Lisovskiy | 50525c3 | 2018-05-15 16:59:27 +0300 | [diff] [blame] | 1182 | int drm_connector_attach_content_type_property(struct drm_connector *dev); |
Maarten Lankhorst | 8f6e1e2 | 2017-05-01 15:37:54 +0200 | [diff] [blame] | 1183 | int drm_connector_attach_scaling_mode_property(struct drm_connector *connector, |
| 1184 | u32 scaling_mode_mask); |
Sean Paul | 2455786 | 2018-01-08 14:55:37 -0500 | [diff] [blame] | 1185 | int drm_connector_attach_content_protection_property( |
| 1186 | struct drm_connector *connector); |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 1187 | int drm_mode_create_aspect_ratio_property(struct drm_device *dev); |
Stanislav Lisovskiy | 50525c3 | 2018-05-15 16:59:27 +0300 | [diff] [blame] | 1188 | int drm_mode_create_content_type_property(struct drm_device *dev); |
| 1189 | void drm_hdmi_avi_infoframe_content_type(struct hdmi_avi_infoframe *frame, |
| 1190 | const struct drm_connector_state *conn_state); |
| 1191 | |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 1192 | int drm_mode_create_suggested_offset_properties(struct drm_device *dev); |
| 1193 | |
| 1194 | int drm_mode_connector_set_path_property(struct drm_connector *connector, |
| 1195 | const char *path); |
| 1196 | int drm_mode_connector_set_tile_property(struct drm_connector *connector); |
| 1197 | int drm_mode_connector_update_edid_property(struct drm_connector *connector, |
| 1198 | const struct edid *edid); |
Manasi Navare | 40ee6fb | 2016-12-16 12:29:06 +0200 | [diff] [blame] | 1199 | void drm_mode_connector_set_link_status_property(struct drm_connector *connector, |
| 1200 | uint64_t link_status); |
Hans de Goede | 8d70f39 | 2017-11-25 20:35:49 +0100 | [diff] [blame] | 1201 | int drm_connector_init_panel_orientation_property( |
| 1202 | struct drm_connector *connector, int width, int height); |
Daniel Vetter | afb21ea6 | 2016-08-31 18:09:04 +0200 | [diff] [blame] | 1203 | |
| 1204 | /** |
Daniel Vetter | 9498c19 | 2016-11-14 12:58:24 +0100 | [diff] [blame] | 1205 | * struct drm_tile_group - Tile group metadata |
| 1206 | * @refcount: reference count |
| 1207 | * @dev: DRM device |
| 1208 | * @id: tile group id exposed to userspace |
| 1209 | * @group_data: Sink-private data identifying this group |
| 1210 | * |
| 1211 | * @group_data corresponds to displayid vend/prod/serial for external screens |
| 1212 | * with an EDID. |
| 1213 | */ |
| 1214 | struct drm_tile_group { |
| 1215 | struct kref refcount; |
| 1216 | struct drm_device *dev; |
| 1217 | int id; |
| 1218 | u8 group_data[8]; |
| 1219 | }; |
| 1220 | |
| 1221 | struct drm_tile_group *drm_mode_create_tile_group(struct drm_device *dev, |
| 1222 | char topology[8]); |
| 1223 | struct drm_tile_group *drm_mode_get_tile_group(struct drm_device *dev, |
| 1224 | char topology[8]); |
| 1225 | void drm_mode_put_tile_group(struct drm_device *dev, |
| 1226 | struct drm_tile_group *tg); |
| 1227 | |
| 1228 | /** |
Daniel Vetter | 613051d | 2016-12-14 00:08:06 +0100 | [diff] [blame] | 1229 | * struct drm_connector_list_iter - connector_list iterator |
| 1230 | * |
| 1231 | * This iterator tracks state needed to be able to walk the connector_list |
| 1232 | * within struct drm_mode_config. Only use together with |
Thierry Reding | b982dab | 2017-02-28 15:46:43 +0100 | [diff] [blame] | 1233 | * drm_connector_list_iter_begin(), drm_connector_list_iter_end() and |
Daniel Vetter | 613051d | 2016-12-14 00:08:06 +0100 | [diff] [blame] | 1234 | * drm_connector_list_iter_next() respectively the convenience macro |
| 1235 | * drm_for_each_connector_iter(). |
| 1236 | */ |
| 1237 | struct drm_connector_list_iter { |
| 1238 | /* private: */ |
| 1239 | struct drm_device *dev; |
| 1240 | struct drm_connector *conn; |
| 1241 | }; |
| 1242 | |
Thierry Reding | b982dab | 2017-02-28 15:46:43 +0100 | [diff] [blame] | 1243 | void drm_connector_list_iter_begin(struct drm_device *dev, |
| 1244 | struct drm_connector_list_iter *iter); |
Daniel Vetter | 613051d | 2016-12-14 00:08:06 +0100 | [diff] [blame] | 1245 | struct drm_connector * |
| 1246 | drm_connector_list_iter_next(struct drm_connector_list_iter *iter); |
Thierry Reding | b982dab | 2017-02-28 15:46:43 +0100 | [diff] [blame] | 1247 | void drm_connector_list_iter_end(struct drm_connector_list_iter *iter); |
Daniel Vetter | 613051d | 2016-12-14 00:08:06 +0100 | [diff] [blame] | 1248 | |
Ville Syrjälä | 38cb8d9 | 2018-06-28 16:13:13 +0300 | [diff] [blame] | 1249 | bool drm_connector_has_possible_encoder(struct drm_connector *connector, |
| 1250 | struct drm_encoder *encoder); |
| 1251 | |
Daniel Vetter | 613051d | 2016-12-14 00:08:06 +0100 | [diff] [blame] | 1252 | /** |
| 1253 | * drm_for_each_connector_iter - connector_list iterator macro |
Daniel Vetter | ea0dd85 | 2016-12-29 21:48:26 +0100 | [diff] [blame] | 1254 | * @connector: &struct drm_connector pointer used as cursor |
| 1255 | * @iter: &struct drm_connector_list_iter |
Daniel Vetter | 613051d | 2016-12-14 00:08:06 +0100 | [diff] [blame] | 1256 | * |
| 1257 | * Note that @connector is only valid within the list body, if you want to use |
Thierry Reding | b982dab | 2017-02-28 15:46:43 +0100 | [diff] [blame] | 1258 | * @connector after calling drm_connector_list_iter_end() then you need to grab |
Gabriel Krisman Bertazi | 5e851c9 | 2017-04-20 21:38:19 -0300 | [diff] [blame] | 1259 | * your own reference first using drm_connector_get(). |
Daniel Vetter | 613051d | 2016-12-14 00:08:06 +0100 | [diff] [blame] | 1260 | */ |
| 1261 | #define drm_for_each_connector_iter(connector, iter) \ |
| 1262 | while ((connector = drm_connector_list_iter_next(iter))) |
| 1263 | |
Ville Syrjälä | 83aefbb | 2018-06-28 16:13:09 +0300 | [diff] [blame] | 1264 | /** |
| 1265 | * drm_connector_for_each_possible_encoder - iterate connector's possible encoders |
| 1266 | * @connector: &struct drm_connector pointer |
| 1267 | * @encoder: &struct drm_encoder pointer used as cursor |
| 1268 | * @__i: int iteration cursor, for macro-internal use |
| 1269 | */ |
| 1270 | #define drm_connector_for_each_possible_encoder(connector, encoder, __i) \ |
| 1271 | for ((__i) = 0; (__i) < ARRAY_SIZE((connector)->encoder_ids) && \ |
| 1272 | (connector)->encoder_ids[(__i)] != 0; (__i)++) \ |
| 1273 | for_each_if((encoder) = \ |
| 1274 | drm_encoder_find((connector)->dev, NULL, \ |
| 1275 | (connector)->encoder_ids[(__i)])) \ |
| 1276 | |
Daniel Vetter | 5221719 | 2016-08-12 22:48:50 +0200 | [diff] [blame] | 1277 | #endif |