Oscar Mateo | 37f26d1 | 2013-11-12 11:50:38 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright © 2013 Intel Corporation |
| 3 | * |
| 4 | * Permission is hereby granted, free of charge, to any person obtaining a |
| 5 | * copy of this software and associated documentation files (the "Software"), |
| 6 | * to deal in the Software without restriction, including without limitation |
| 7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 8 | * and/or sell copies of the Software, and to permit persons to whom the |
| 9 | * Software is furnished to do so, subject to the following conditions: |
| 10 | * |
| 11 | * The above copyright notice and this permission notice (including the next |
| 12 | * paragraph) shall be included in all copies or substantial portions of the |
| 13 | * Software. |
| 14 | * |
| 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 18 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
| 20 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS |
| 21 | * IN THE SOFTWARE. |
| 22 | * |
Daniel Vetter | 57d7db8 | 2014-03-26 09:06:11 +0100 | [diff] [blame] | 23 | * Authors: |
| 24 | * Daniel Vetter <daniel.vetter@ffwll.ch> |
| 25 | * Damien Lespiau <damien.lespiau@intel.com> |
Oscar Mateo | 37f26d1 | 2013-11-12 11:50:38 +0000 | [diff] [blame] | 26 | */ |
| 27 | |
| 28 | #ifndef __IGT_KMS_H__ |
| 29 | #define __IGT_KMS_H__ |
| 30 | |
Damien Lespiau | 3670d6d | 2014-01-27 16:25:43 +0000 | [diff] [blame] | 31 | #include <stdbool.h> |
Daniel Vetter | 6cfcd71 | 2014-03-22 20:07:35 +0100 | [diff] [blame] | 32 | #include <stdint.h> |
Thomas Wood | d96490a | 2014-06-16 16:21:35 +0100 | [diff] [blame] | 33 | #include <stddef.h> |
Daniel Vetter | 3f56038 | 2017-08-14 11:32:07 +0200 | [diff] [blame] | 34 | #include <assert.h> |
Oscar Mateo | 37f26d1 | 2013-11-12 11:50:38 +0000 | [diff] [blame] | 35 | |
Daniel Vetter | 254f19b | 2014-03-22 21:29:01 +0100 | [diff] [blame] | 36 | #include <xf86drmMode.h> |
| 37 | |
Daniel Vetter | 9a15b5a | 2014-08-12 11:13:03 +0200 | [diff] [blame] | 38 | #include "igt_fb.h" |
Tvrtko Ursulin | e36091d | 2015-03-03 14:11:01 +0000 | [diff] [blame] | 39 | #include "ioctl_wrappers.h" |
Daniel Vetter | 9a15b5a | 2014-08-12 11:13:03 +0200 | [diff] [blame] | 40 | |
Daniel Vetter | 33f0884 | 2014-08-12 11:23:09 +0200 | [diff] [blame] | 41 | /* Low-level helpers with kmstest_ prefix */ |
| 42 | |
Maarten Lankhorst | 2d672a1 | 2016-07-27 15:33:12 +0200 | [diff] [blame] | 43 | /** |
| 44 | * pipe: |
| 45 | * @PIPE_NONE: Invalid pipe, used for disconnecting a output from a pipe. |
| 46 | * @PIPE_ANY: Deprecated alias for @PIPE_NONE. |
| 47 | * @PIPE_A: First crtc. |
| 48 | * @PIPE_B: Second crtc. |
| 49 | * @PIPE_C: Third crtc. |
Leo (Sunpeng) Li | df68217 | 2017-06-09 17:13:04 -0400 | [diff] [blame] | 50 | * ... and so on. |
| 51 | * @IGT_MAX_PIPES: Max number of pipes allowed. |
Maarten Lankhorst | 2d672a1 | 2016-07-27 15:33:12 +0200 | [diff] [blame] | 52 | */ |
Daniel Vetter | 64401f5 | 2014-03-26 10:19:42 +0100 | [diff] [blame] | 53 | enum pipe { |
Maarten Lankhorst | 0794ebe | 2016-06-30 07:43:36 +0200 | [diff] [blame] | 54 | PIPE_NONE = -1, |
| 55 | PIPE_ANY = PIPE_NONE, |
Daniel Vetter | 64401f5 | 2014-03-26 10:19:42 +0100 | [diff] [blame] | 56 | PIPE_A = 0, |
| 57 | PIPE_B, |
| 58 | PIPE_C, |
Leo (Sunpeng) Li | 597cae9 | 2017-06-09 17:08:53 -0400 | [diff] [blame] | 59 | PIPE_D, |
| 60 | PIPE_E, |
| 61 | PIPE_F, |
Leo (Sunpeng) Li | df68217 | 2017-06-09 17:13:04 -0400 | [diff] [blame] | 62 | IGT_MAX_PIPES |
Daniel Vetter | 64401f5 | 2014-03-26 10:19:42 +0100 | [diff] [blame] | 63 | }; |
Daniel Vetter | dd8fba4 | 2014-08-12 11:00:37 +0200 | [diff] [blame] | 64 | const char *kmstest_pipe_name(enum pipe pipe); |
Mika Kahola | 12e34d8 | 2016-11-23 11:19:37 +0200 | [diff] [blame] | 65 | int kmstest_pipe_to_index(char pipe); |
Robert Foss | 3665623 | 2017-01-18 12:28:45 -0500 | [diff] [blame] | 66 | const char *kmstest_plane_type_name(int plane_type); |
Daniel Vetter | 64401f5 | 2014-03-26 10:19:42 +0100 | [diff] [blame] | 67 | |
| 68 | enum port { |
| 69 | PORT_A = 0, |
| 70 | PORT_B, |
| 71 | PORT_C, |
| 72 | PORT_D, |
| 73 | PORT_E, |
| 74 | I915_MAX_PORTS |
| 75 | }; |
Daniel Vetter | 27a19de | 2014-08-12 11:04:49 +0200 | [diff] [blame] | 76 | |
| 77 | /** |
| 78 | * kmstest_port_name: |
| 79 | * @port: display plane |
| 80 | * |
Thomas Wood | 519f377 | 2014-09-26 14:24:52 +0100 | [diff] [blame] | 81 | * Returns: String representing @port, e.g. "A". |
Daniel Vetter | 27a19de | 2014-08-12 11:04:49 +0200 | [diff] [blame] | 82 | */ |
| 83 | #define kmstest_port_name(port) ((port) + 'A') |
Daniel Vetter | 64401f5 | 2014-03-26 10:19:42 +0100 | [diff] [blame] | 84 | |
Daniel Vetter | 9a15b5a | 2014-08-12 11:13:03 +0200 | [diff] [blame] | 85 | const char *kmstest_encoder_type_str(int type); |
Daniel Vetter | 9a15b5a | 2014-08-12 11:13:03 +0200 | [diff] [blame] | 86 | const char *kmstest_connector_status_str(int status); |
Daniel Vetter | 9a15b5a | 2014-08-12 11:13:03 +0200 | [diff] [blame] | 87 | const char *kmstest_connector_type_str(int type); |
Damien Lespiau | 3670d6d | 2014-01-27 16:25:43 +0000 | [diff] [blame] | 88 | |
Daniel Vetter | 3b39bff | 2014-08-12 11:31:44 +0200 | [diff] [blame] | 89 | void kmstest_dump_mode(drmModeModeInfo *mode); |
| 90 | |
| 91 | int kmstest_get_pipe_from_crtc_id(int fd, int crtc_id); |
| 92 | void kmstest_set_vt_graphics_mode(void); |
Thomas Wood | fcb324c | 2014-08-14 13:59:02 +0100 | [diff] [blame] | 93 | void kmstest_restore_vt_mode(void); |
Daniel Vetter | 3b39bff | 2014-08-12 11:31:44 +0200 | [diff] [blame] | 94 | |
Mayuresh Gharpure | 0e2e880 | 2016-03-11 13:55:29 +0530 | [diff] [blame] | 95 | enum igt_atomic_crtc_properties { |
| 96 | IGT_CRTC_BACKGROUND = 0, |
Lionel Landwerlin | 1716625 | 2016-03-18 17:33:01 +0000 | [diff] [blame] | 97 | IGT_CRTC_CTM, |
| 98 | IGT_CRTC_DEGAMMA_LUT, |
| 99 | IGT_CRTC_GAMMA_LUT, |
Maarten Lankhorst | c7d4dab | 2016-06-30 12:33:47 +0200 | [diff] [blame] | 100 | IGT_CRTC_MODE_ID, |
| 101 | IGT_CRTC_ACTIVE, |
Gustavo Padovan | 513846b | 2016-06-20 10:24:08 -0400 | [diff] [blame] | 102 | IGT_CRTC_OUT_FENCE_PTR, |
Mayuresh Gharpure | 0e2e880 | 2016-03-11 13:55:29 +0530 | [diff] [blame] | 103 | IGT_NUM_CRTC_PROPS |
| 104 | }; |
| 105 | |
Gustavo Padovan | e707ace | 2016-10-26 12:14:43 +0000 | [diff] [blame] | 106 | /** |
| 107 | * igt_crtc_prop_names |
| 108 | * |
| 109 | * igt_crtc_prop_names contains a list of crtc property names, |
| 110 | * as indexed by the igt_atomic_crtc_properties enum. |
| 111 | */ |
| 112 | extern const char *igt_crtc_prop_names[]; |
| 113 | |
Mayuresh Gharpure | 0e2e880 | 2016-03-11 13:55:29 +0530 | [diff] [blame] | 114 | enum igt_atomic_connector_properties { |
| 115 | IGT_CONNECTOR_SCALING_MODE = 0, |
Maarten Lankhorst | c7d4dab | 2016-06-30 12:33:47 +0200 | [diff] [blame] | 116 | IGT_CONNECTOR_CRTC_ID, |
Maarten Lankhorst | bbc0b3c | 2017-08-02 11:57:32 +0200 | [diff] [blame] | 117 | IGT_CONNECTOR_DPMS, |
Mayuresh Gharpure | 0e2e880 | 2016-03-11 13:55:29 +0530 | [diff] [blame] | 118 | IGT_NUM_CONNECTOR_PROPS |
| 119 | }; |
| 120 | |
Gustavo Padovan | e707ace | 2016-10-26 12:14:43 +0000 | [diff] [blame] | 121 | /** |
| 122 | * igt_connector_prop_names |
| 123 | * |
| 124 | * igt_connector_prop_names contains a list of crtc property names, |
| 125 | * as indexed by the igt_atomic_connector_properties enum. |
| 126 | */ |
| 127 | extern const char *igt_connector_prop_names[]; |
| 128 | |
Oscar Mateo | 37f26d1 | 2013-11-12 11:50:38 +0000 | [diff] [blame] | 129 | struct kmstest_connector_config { |
| 130 | drmModeCrtc *crtc; |
| 131 | drmModeConnector *connector; |
| 132 | drmModeEncoder *encoder; |
| 133 | drmModeModeInfo default_mode; |
Mayuresh Gharpure | 0e2e880 | 2016-03-11 13:55:29 +0530 | [diff] [blame] | 134 | uint64_t connector_scaling_mode; |
Maarten Lankhorst | 0404de4 | 2016-06-29 15:56:28 +0200 | [diff] [blame] | 135 | bool connector_scaling_mode_changed; |
Maarten Lankhorst | c7d4dab | 2016-06-30 12:33:47 +0200 | [diff] [blame] | 136 | bool pipe_changed; |
Mayuresh Gharpure | 0e2e880 | 2016-03-11 13:55:29 +0530 | [diff] [blame] | 137 | uint32_t atomic_props_connector[IGT_NUM_CONNECTOR_PROPS]; |
Oscar Mateo | 37f26d1 | 2013-11-12 11:50:38 +0000 | [diff] [blame] | 138 | int pipe; |
Maarten Lankhorst | be13126 | 2016-06-13 15:27:22 +0200 | [diff] [blame] | 139 | unsigned valid_crtc_idx_mask; |
Oscar Mateo | 37f26d1 | 2013-11-12 11:50:38 +0000 | [diff] [blame] | 140 | }; |
| 141 | |
Mika Kahola | 12e34d8 | 2016-11-23 11:19:37 +0200 | [diff] [blame] | 142 | struct kmstest_plane { |
| 143 | int id; |
Robert Foss | fdced48 | 2017-01-18 11:25:39 -0500 | [diff] [blame] | 144 | int index; |
Robert Foss | 9de6359 | 2017-01-18 12:12:54 -0500 | [diff] [blame] | 145 | int type; |
Mika Kahola | 12e34d8 | 2016-11-23 11:19:37 +0200 | [diff] [blame] | 146 | int pos_x; |
| 147 | int pos_y; |
| 148 | int width; |
| 149 | int height; |
| 150 | }; |
| 151 | |
| 152 | struct kmstest_crtc { |
| 153 | int id; |
| 154 | int pipe; |
| 155 | bool active; |
| 156 | int width; |
| 157 | int height; |
Robert Foss | 260df25 | 2017-01-18 11:26:12 -0500 | [diff] [blame] | 158 | int n_planes; |
| 159 | struct kmstest_plane *planes; |
Mika Kahola | 12e34d8 | 2016-11-23 11:19:37 +0200 | [diff] [blame] | 160 | }; |
| 161 | |
Thomas Wood | 37ffb22 | 2014-05-16 17:22:46 +0100 | [diff] [blame] | 162 | /** |
| 163 | * kmstest_force_connector_state: |
| 164 | * @FORCE_CONNECTOR_UNSPECIFIED: Unspecified |
| 165 | * @FORCE_CONNECTOR_ON: On |
| 166 | * @FORCE_CONNECTOR_DIGITAL: Digital |
| 167 | * @FORCE_CONNECTOR_OFF: Off |
| 168 | */ |
| 169 | enum kmstest_force_connector_state { |
| 170 | FORCE_CONNECTOR_UNSPECIFIED, |
| 171 | FORCE_CONNECTOR_ON, |
| 172 | FORCE_CONNECTOR_DIGITAL, |
| 173 | FORCE_CONNECTOR_OFF |
| 174 | }; |
| 175 | |
Lyude | 3bd89da | 2017-01-05 13:01:18 -0500 | [diff] [blame] | 176 | /** |
| 177 | * kmstest_broadcast_rgb_mode: |
| 178 | * @BROADCAST_RGB_AUTO: Choose the color range to use automatically |
| 179 | * @BROADCAST_RGB_FULL: Force the connector to use full color range |
| 180 | * @BROADCAST_RGB_16_235: Force the connector to use a limited 16:235 color |
| 181 | * range |
| 182 | */ |
| 183 | enum kmstest_broadcast_rgb_mode { |
| 184 | BROADCAST_RGB_AUTO = 0, |
| 185 | BROADCAST_RGB_FULL, |
| 186 | BROADCAST_RGB_16_235 |
| 187 | }; |
| 188 | |
| 189 | |
Daniel Vetter | 3b39bff | 2014-08-12 11:31:44 +0200 | [diff] [blame] | 190 | bool kmstest_force_connector(int fd, drmModeConnector *connector, |
| 191 | enum kmstest_force_connector_state state); |
Thomas Wood | a124b1a | 2014-07-30 11:10:49 +0100 | [diff] [blame] | 192 | void kmstest_edid_add_3d(const unsigned char *edid, size_t length, unsigned char *new_edid_ptr[], size_t *new_length); |
Abdiel Janulgue | 3cfa6a9 | 2017-03-27 12:47:08 +0300 | [diff] [blame] | 193 | void kmstest_edid_add_4k(const unsigned char *edid, size_t length, unsigned char *new_edid_ptr[], size_t *new_length); |
| 194 | void kmstest_edid_add_audio(const unsigned char *edid, size_t length, unsigned char *new_edid_ptr[], size_t *new_length); |
Daniel Vetter | 3b39bff | 2014-08-12 11:31:44 +0200 | [diff] [blame] | 195 | void kmstest_force_edid(int drm_fd, drmModeConnector *connector, |
| 196 | const unsigned char *edid, size_t length); |
Thomas Wood | 13cd79c | 2014-05-27 14:47:25 +0100 | [diff] [blame] | 197 | |
Daniel Vetter | 81dfcab | 2014-08-12 11:56:41 +0200 | [diff] [blame] | 198 | bool kmstest_get_connector_default_mode(int drm_fd, drmModeConnector *connector, |
| 199 | drmModeModeInfo *mode); |
Daniel Vetter | 1cad834 | 2014-08-12 11:57:32 +0200 | [diff] [blame] | 200 | bool kmstest_get_connector_config(int drm_fd, uint32_t connector_id, |
| 201 | unsigned long crtc_idx_mask, |
| 202 | struct kmstest_connector_config *config); |
Jesse Barnes | e28acef | 2016-01-14 14:03:53 -0800 | [diff] [blame] | 203 | bool kmstest_probe_connector_config(int drm_fd, uint32_t connector_id, |
| 204 | unsigned long crtc_idx_mask, |
| 205 | struct kmstest_connector_config *config); |
Oscar Mateo | 37f26d1 | 2013-11-12 11:50:38 +0000 | [diff] [blame] | 206 | void kmstest_free_connector_config(struct kmstest_connector_config *config); |
| 207 | |
Daniel Vetter | 29ee36f | 2014-04-24 23:33:09 +0200 | [diff] [blame] | 208 | void kmstest_set_connector_dpms(int fd, drmModeConnector *connector, int mode); |
Lyude | 3bd89da | 2017-01-05 13:01:18 -0500 | [diff] [blame] | 209 | bool kmstest_set_connector_broadcast_rgb(int fd, drmModeConnector *connector, |
| 210 | enum kmstest_broadcast_rgb_mode mode); |
Paulo Zanoni | 4924b78 | 2014-08-06 12:14:56 -0300 | [diff] [blame] | 211 | bool kmstest_get_property(int drm_fd, uint32_t object_id, uint32_t object_type, |
| 212 | const char *name, uint32_t *prop_id, uint64_t *value, |
| 213 | drmModePropertyPtr *prop); |
Paulo Zanoni | d523656 | 2014-08-06 14:31:53 -0300 | [diff] [blame] | 214 | void kmstest_unset_all_crtcs(int drm_fd, drmModeResPtr resources); |
Paulo Zanoni | c6279ec | 2016-02-26 08:54:57 -0300 | [diff] [blame] | 215 | int kmstest_get_crtc_idx(drmModeRes *res, uint32_t crtc_id); |
Paulo Zanoni | d8bf28f | 2016-02-26 11:27:20 -0300 | [diff] [blame] | 216 | uint32_t kmstest_find_crtc_for_connector(int fd, drmModeRes *res, |
| 217 | drmModeConnector *connector, |
| 218 | uint32_t crtc_blacklist_idx_mask); |
Oscar Mateo | 37f26d1 | 2013-11-12 11:50:38 +0000 | [diff] [blame] | 219 | |
Tomeu Vizoso | dc84e7d | 2016-03-02 13:39:44 +0100 | [diff] [blame] | 220 | uint32_t kmstest_dumb_create(int fd, int width, int height, int bpp, |
| 221 | unsigned *stride, unsigned *size); |
| 222 | |
Tomeu Vizoso | fb66a5d | 2016-03-07 16:37:36 +0100 | [diff] [blame] | 223 | void *kmstest_dumb_map_buffer(int fd, uint32_t handle, uint64_t size, |
| 224 | unsigned prot); |
Mika Kahola | 12e34d8 | 2016-11-23 11:19:37 +0200 | [diff] [blame] | 225 | unsigned int kmstest_get_vblank(int fd, int pipe, unsigned int flags); |
Chris Wilson | 83884e9 | 2017-03-21 17:16:03 +0000 | [diff] [blame] | 226 | void kmstest_get_crtc(int fd, enum pipe pipe, struct kmstest_crtc *crtc); |
| 227 | void igt_assert_plane_visible(int fd, enum pipe pipe, bool visibility); |
Tomeu Vizoso | fb66a5d | 2016-03-07 16:37:36 +0100 | [diff] [blame] | 228 | |
Damien Lespiau | 3670d6d | 2014-01-27 16:25:43 +0000 | [diff] [blame] | 229 | /* |
| 230 | * A small modeset API |
| 231 | */ |
| 232 | |
Daniel Vetter | 33f0884 | 2014-08-12 11:23:09 +0200 | [diff] [blame] | 233 | /* High-level kms api with igt_ prefix */ |
Maarten Lankhorst | 2d672a1 | 2016-07-27 15:33:12 +0200 | [diff] [blame] | 234 | |
| 235 | /** |
| 236 | * igt_commit_style: |
| 237 | * @COMMIT_LEGACY: Changes will be committed using the legacy API. |
| 238 | * @COMMIT_UNIVERSAL: Changes will be committed with the universal plane API, no modesets are allowed. |
| 239 | * @COMMIT_ATOMIC: Changes will be committed using the atomic API. |
| 240 | */ |
Daniel Vetter | 9a15b5a | 2014-08-12 11:13:03 +0200 | [diff] [blame] | 241 | enum igt_commit_style { |
| 242 | COMMIT_LEGACY = 0, |
| 243 | COMMIT_UNIVERSAL, |
Mayuresh Gharpure | 0e2e880 | 2016-03-11 13:55:29 +0530 | [diff] [blame] | 244 | COMMIT_ATOMIC, |
Daniel Vetter | 9a15b5a | 2014-08-12 11:13:03 +0200 | [diff] [blame] | 245 | }; |
| 246 | |
Mayuresh Gharpure | 0e2e880 | 2016-03-11 13:55:29 +0530 | [diff] [blame] | 247 | enum igt_atomic_plane_properties { |
| 248 | IGT_PLANE_SRC_X = 0, |
| 249 | IGT_PLANE_SRC_Y, |
| 250 | IGT_PLANE_SRC_W, |
| 251 | IGT_PLANE_SRC_H, |
| 252 | |
| 253 | IGT_PLANE_CRTC_X, |
| 254 | IGT_PLANE_CRTC_Y, |
| 255 | IGT_PLANE_CRTC_W, |
| 256 | IGT_PLANE_CRTC_H, |
| 257 | |
| 258 | IGT_PLANE_FB_ID, |
| 259 | IGT_PLANE_CRTC_ID, |
Robert Foss | 221848d | 2016-06-20 10:24:08 -0400 | [diff] [blame] | 260 | IGT_PLANE_IN_FENCE_FD, |
Mayuresh Gharpure | 0e2e880 | 2016-03-11 13:55:29 +0530 | [diff] [blame] | 261 | IGT_PLANE_TYPE, |
| 262 | IGT_PLANE_ROTATION, |
| 263 | IGT_NUM_PLANE_PROPS |
| 264 | }; |
| 265 | |
Gustavo Padovan | e707ace | 2016-10-26 12:14:43 +0000 | [diff] [blame] | 266 | /** |
| 267 | * igt_plane_prop_names |
| 268 | * |
| 269 | * igt_plane_prop_names contains a list of crtc property names, |
| 270 | * as indexed by the igt_atomic_plane_properties enum. |
| 271 | */ |
| 272 | extern const char *igt_plane_prop_names[]; |
Mayuresh Gharpure | 0e2e880 | 2016-03-11 13:55:29 +0530 | [diff] [blame] | 273 | |
Damien Lespiau | 3670d6d | 2014-01-27 16:25:43 +0000 | [diff] [blame] | 274 | typedef struct igt_display igt_display_t; |
| 275 | typedef struct igt_pipe igt_pipe_t; |
Damien Lespiau | 5ec399b | 2014-02-05 16:36:51 +0000 | [diff] [blame] | 276 | typedef uint32_t igt_fixed_t; /* 16.16 fixed point */ |
Damien Lespiau | 3670d6d | 2014-01-27 16:25:43 +0000 | [diff] [blame] | 277 | |
Daniel Vetter | 9a15b5a | 2014-08-12 11:13:03 +0200 | [diff] [blame] | 278 | typedef enum { |
| 279 | /* this maps to the kernel API */ |
| 280 | IGT_ROTATION_0 = 1 << 0, |
| 281 | IGT_ROTATION_90 = 1 << 1, |
| 282 | IGT_ROTATION_180 = 1 << 2, |
| 283 | IGT_ROTATION_270 = 1 << 3, |
| 284 | } igt_rotation_t; |
| 285 | |
Damien Lespiau | 3670d6d | 2014-01-27 16:25:43 +0000 | [diff] [blame] | 286 | typedef struct { |
Thomas Wood | 52a3a2e | 2014-06-09 17:23:21 +0100 | [diff] [blame] | 287 | /*< private >*/ |
Damien Lespiau | 3670d6d | 2014-01-27 16:25:43 +0000 | [diff] [blame] | 288 | igt_pipe_t *pipe; |
| 289 | int index; |
Damien Lespiau | b2eb485 | 2014-07-08 15:23:05 +0100 | [diff] [blame] | 290 | /* capabilities */ |
Robert Foss | 3665623 | 2017-01-18 12:28:45 -0500 | [diff] [blame] | 291 | int type; |
Damien Lespiau | b2eb485 | 2014-07-08 15:23:05 +0100 | [diff] [blame] | 292 | /* state tracking */ |
Damien Lespiau | f0e0b2a | 2014-02-06 17:54:33 +0000 | [diff] [blame] | 293 | unsigned int fb_changed : 1; |
Damien Lespiau | 5ec399b | 2014-02-05 16:36:51 +0000 | [diff] [blame] | 294 | unsigned int position_changed : 1; |
Damien Lespiau | 068efd8 | 2014-07-08 16:02:05 +0100 | [diff] [blame] | 295 | unsigned int rotation_changed : 1; |
chandra konduru | a26f9f9 | 2015-03-30 13:52:04 -0700 | [diff] [blame] | 296 | unsigned int size_changed : 1; |
Damien Lespiau | f0e0b2a | 2014-02-06 17:54:33 +0000 | [diff] [blame] | 297 | /* |
| 298 | * drm_plane can be NULL for primary and cursor planes (when not |
| 299 | * using the atomic modeset API) |
| 300 | */ |
| 301 | drmModePlane *drm_plane; |
Daniel Vetter | 9aea7ae | 2014-03-26 09:18:11 +0100 | [diff] [blame] | 302 | struct igt_fb *fb; |
Damien Lespiau | b2eb485 | 2014-07-08 15:23:05 +0100 | [diff] [blame] | 303 | |
| 304 | uint32_t rotation_property; |
| 305 | |
Damien Lespiau | 5ec399b | 2014-02-05 16:36:51 +0000 | [diff] [blame] | 306 | /* position within pipe_src_w x pipe_src_h */ |
| 307 | int crtc_x, crtc_y; |
Ville Syrjälä | 7b76754 | 2014-09-12 20:18:04 +0300 | [diff] [blame] | 308 | /* size within pipe_src_w x pipe_src_h */ |
| 309 | int crtc_w, crtc_h; |
Lionel Landwerlin | cd8da3f | 2016-04-05 14:13:53 +0100 | [diff] [blame] | 310 | |
| 311 | /* position within the framebuffer */ |
| 312 | uint32_t src_x; |
| 313 | uint32_t src_y; |
| 314 | /* size within the framebuffer*/ |
| 315 | uint32_t src_w; |
| 316 | uint32_t src_h; |
| 317 | |
Damien Lespiau | 068efd8 | 2014-07-08 16:02:05 +0100 | [diff] [blame] | 318 | igt_rotation_t rotation; |
Robert Foss | 221848d | 2016-06-20 10:24:08 -0400 | [diff] [blame] | 319 | |
| 320 | /* in fence fd */ |
| 321 | int fence_fd; |
Mayuresh Gharpure | 0e2e880 | 2016-03-11 13:55:29 +0530 | [diff] [blame] | 322 | uint32_t atomic_props_plane[IGT_NUM_PLANE_PROPS]; |
Damien Lespiau | 3670d6d | 2014-01-27 16:25:43 +0000 | [diff] [blame] | 323 | } igt_plane_t; |
| 324 | |
| 325 | struct igt_pipe { |
| 326 | igt_display_t *display; |
| 327 | enum pipe pipe; |
Robert Foss | 3665623 | 2017-01-18 12:28:45 -0500 | [diff] [blame] | 328 | |
Damien Lespiau | 3670d6d | 2014-01-27 16:25:43 +0000 | [diff] [blame] | 329 | int n_planes; |
Robert Foss | 3665623 | 2017-01-18 12:28:45 -0500 | [diff] [blame] | 330 | int plane_cursor; |
| 331 | int plane_primary; |
| 332 | igt_plane_t *planes; |
Maarten Lankhorst | 9f45ea1 | 2016-06-30 10:24:28 +0200 | [diff] [blame] | 333 | |
| 334 | uint32_t atomic_props_crtc[IGT_NUM_CRTC_PROPS]; |
| 335 | |
chandra konduru | ace4208 | 2015-03-30 13:44:32 -0700 | [diff] [blame] | 336 | uint64_t background; /* Background color MSB BGR 16bpc LSB */ |
| 337 | uint32_t background_changed : 1; |
| 338 | uint32_t background_property; |
Lionel Landwerlin | 1716625 | 2016-03-18 17:33:01 +0000 | [diff] [blame] | 339 | |
| 340 | uint64_t degamma_blob; |
| 341 | uint32_t degamma_property; |
| 342 | uint64_t ctm_blob; |
| 343 | uint32_t ctm_property; |
| 344 | uint64_t gamma_blob; |
| 345 | uint32_t gamma_property; |
| 346 | uint32_t color_mgmt_changed : 1; |
| 347 | |
Lionel Landwerlin | 59b5487 | 2016-03-18 17:33:00 +0000 | [diff] [blame] | 348 | uint32_t crtc_id; |
Maarten Lankhorst | c7d4dab | 2016-06-30 12:33:47 +0200 | [diff] [blame] | 349 | |
| 350 | uint64_t mode_blob; |
| 351 | bool mode_changed; |
Gustavo Padovan | 513846b | 2016-06-20 10:24:08 -0400 | [diff] [blame] | 352 | |
| 353 | int32_t out_fence_fd; |
| 354 | bool out_fence_requested; |
Damien Lespiau | 3670d6d | 2014-01-27 16:25:43 +0000 | [diff] [blame] | 355 | }; |
| 356 | |
| 357 | typedef struct { |
Thomas Wood | 52a3a2e | 2014-06-09 17:23:21 +0100 | [diff] [blame] | 358 | /*< private >*/ |
Damien Lespiau | 3670d6d | 2014-01-27 16:25:43 +0000 | [diff] [blame] | 359 | igt_display_t *display; |
| 360 | uint32_t id; /* KMS id */ |
| 361 | struct kmstest_connector_config config; |
| 362 | char *name; |
Maarten Lankhorst | ba237f9 | 2017-01-10 10:50:50 +0100 | [diff] [blame] | 363 | bool force_reprobe; |
Maarten Lankhorst | 76c7a71 | 2017-09-27 12:25:37 +0200 | [diff] [blame] | 364 | enum pipe pending_pipe; |
Ander Conselvan de Oliveira | 9aeff2b | 2015-03-30 10:03:00 +0300 | [diff] [blame] | 365 | bool use_override_mode; |
| 366 | drmModeModeInfo override_mode; |
Damien Lespiau | 3670d6d | 2014-01-27 16:25:43 +0000 | [diff] [blame] | 367 | } igt_output_t; |
| 368 | |
| 369 | struct igt_display { |
| 370 | int drm_fd; |
Damien Lespiau | 3670d6d | 2014-01-27 16:25:43 +0000 | [diff] [blame] | 371 | int log_shift; |
| 372 | int n_pipes; |
| 373 | int n_outputs; |
Damien Lespiau | 3670d6d | 2014-01-27 16:25:43 +0000 | [diff] [blame] | 374 | igt_output_t *outputs; |
Lyude | 3ccce99 | 2016-12-12 13:25:39 -0500 | [diff] [blame] | 375 | igt_pipe_t *pipes; |
Lyude | 80baeb0 | 2016-12-07 19:02:04 -0500 | [diff] [blame] | 376 | bool has_cursor_plane; |
Mayuresh Gharpure | 0e2e880 | 2016-03-11 13:55:29 +0530 | [diff] [blame] | 377 | bool is_atomic; |
Damien Lespiau | 3670d6d | 2014-01-27 16:25:43 +0000 | [diff] [blame] | 378 | }; |
| 379 | |
| 380 | void igt_display_init(igt_display_t *display, int drm_fd); |
| 381 | void igt_display_fini(igt_display_t *display); |
Matt Roper | 1c25547 | 2014-06-30 16:44:24 -0700 | [diff] [blame] | 382 | int igt_display_commit2(igt_display_t *display, enum igt_commit_style s); |
Damien Lespiau | 3670d6d | 2014-01-27 16:25:43 +0000 | [diff] [blame] | 383 | int igt_display_commit(igt_display_t *display); |
Maarten Lankhorst | 826150f | 2016-07-05 14:52:20 +0200 | [diff] [blame] | 384 | int igt_display_try_commit_atomic(igt_display_t *display, uint32_t flags, void *user_data); |
| 385 | void igt_display_commit_atomic(igt_display_t *display, uint32_t flags, void *user_data); |
Matt Roper | 82bc03f | 2014-06-30 16:44:25 -0700 | [diff] [blame] | 386 | int igt_display_try_commit2(igt_display_t *display, enum igt_commit_style s); |
Damien Lespiau | 72e9a6c | 2014-02-04 14:59:39 +0000 | [diff] [blame] | 387 | int igt_display_get_n_pipes(igt_display_t *display); |
Maarten Lankhorst | 0b8933d | 2017-06-12 11:03:22 +0200 | [diff] [blame] | 388 | void igt_display_require_output(igt_display_t *display); |
| 389 | void igt_display_require_output_on_pipe(igt_display_t *display, enum pipe pipe); |
Damien Lespiau | 3670d6d | 2014-01-27 16:25:43 +0000 | [diff] [blame] | 390 | |
| 391 | const char *igt_output_name(igt_output_t *output); |
| 392 | drmModeModeInfo *igt_output_get_mode(igt_output_t *output); |
Ander Conselvan de Oliveira | 9aeff2b | 2015-03-30 10:03:00 +0300 | [diff] [blame] | 393 | void igt_output_override_mode(igt_output_t *output, drmModeModeInfo *mode); |
Damien Lespiau | 3670d6d | 2014-01-27 16:25:43 +0000 | [diff] [blame] | 394 | void igt_output_set_pipe(igt_output_t *output, enum pipe pipe); |
Maarten Lankhorst | 826150f | 2016-07-05 14:52:20 +0200 | [diff] [blame] | 395 | void igt_output_set_scaling_mode(igt_output_t *output, uint64_t scaling_mode); |
Robert Foss | 3665623 | 2017-01-18 12:28:45 -0500 | [diff] [blame] | 396 | igt_plane_t *igt_output_get_plane(igt_output_t *output, int plane_idx); |
| 397 | igt_plane_t *igt_output_get_plane_type(igt_output_t *output, int plane_type); |
Lyude | 528cdaf | 2016-12-29 19:25:31 -0500 | [diff] [blame] | 398 | igt_output_t *igt_output_from_connector(igt_display_t *display, |
Robert Foss | 3665623 | 2017-01-18 12:28:45 -0500 | [diff] [blame] | 399 | drmModeConnector *connector); |
| 400 | igt_plane_t *igt_pipe_get_plane_type(igt_pipe_t *pipe, int plane_type); |
Lionel Landwerlin | 1716625 | 2016-03-18 17:33:01 +0000 | [diff] [blame] | 401 | bool igt_pipe_get_property(igt_pipe_t *pipe, const char *name, |
| 402 | uint32_t *prop_id, uint64_t *value, |
| 403 | drmModePropertyPtr *prop); |
Damien Lespiau | 3670d6d | 2014-01-27 16:25:43 +0000 | [diff] [blame] | 404 | |
Damien Lespiau | b2eb485 | 2014-07-08 15:23:05 +0100 | [diff] [blame] | 405 | static inline bool igt_plane_supports_rotation(igt_plane_t *plane) |
| 406 | { |
| 407 | return plane->rotation_property != 0; |
| 408 | } |
Gustavo Padovan | 513846b | 2016-06-20 10:24:08 -0400 | [diff] [blame] | 409 | void igt_pipe_request_out_fence(igt_pipe_t *pipe); |
Lionel Landwerlin | 1716625 | 2016-03-18 17:33:01 +0000 | [diff] [blame] | 410 | void igt_pipe_set_degamma_lut(igt_pipe_t *pipe, void *ptr, size_t length); |
| 411 | void igt_pipe_set_ctm_matrix(igt_pipe_t *pipe, void *ptr, size_t length); |
| 412 | void igt_pipe_set_gamma_lut(igt_pipe_t *pipe, void *ptr, size_t length); |
| 413 | |
Daniel Vetter | 9aea7ae | 2014-03-26 09:18:11 +0100 | [diff] [blame] | 414 | void igt_plane_set_fb(igt_plane_t *plane, struct igt_fb *fb); |
Robert Foss | 221848d | 2016-06-20 10:24:08 -0400 | [diff] [blame] | 415 | void igt_plane_set_fence_fd(igt_plane_t *plane, int fence_fd); |
Damien Lespiau | 5ec399b | 2014-02-05 16:36:51 +0000 | [diff] [blame] | 416 | void igt_plane_set_position(igt_plane_t *plane, int x, int y); |
Ville Syrjälä | 7b76754 | 2014-09-12 20:18:04 +0300 | [diff] [blame] | 417 | void igt_plane_set_size(igt_plane_t *plane, int w, int h); |
Damien Lespiau | 068efd8 | 2014-07-08 16:02:05 +0100 | [diff] [blame] | 418 | void igt_plane_set_rotation(igt_plane_t *plane, igt_rotation_t rotation); |
chandra konduru | ace4208 | 2015-03-30 13:44:32 -0700 | [diff] [blame] | 419 | void igt_crtc_set_background(igt_pipe_t *pipe, uint64_t background); |
chandra konduru | a26f9f9 | 2015-03-30 13:52:04 -0700 | [diff] [blame] | 420 | void igt_fb_set_position(struct igt_fb *fb, igt_plane_t *plane, |
| 421 | uint32_t x, uint32_t y); |
| 422 | void igt_fb_set_size(struct igt_fb *fb, igt_plane_t *plane, |
| 423 | uint32_t w, uint32_t h); |
Damien Lespiau | 3670d6d | 2014-01-27 16:25:43 +0000 | [diff] [blame] | 424 | |
Daniel Vetter | 64401f5 | 2014-03-26 10:19:42 +0100 | [diff] [blame] | 425 | void igt_wait_for_vblank(int drm_fd, enum pipe pipe); |
Chris Wilson | 2c64f11 | 2017-03-13 15:58:26 +0000 | [diff] [blame] | 426 | void igt_wait_for_vblank_count(int drm_fd, enum pipe pipe, int count); |
Daniel Vetter | 64401f5 | 2014-03-26 10:19:42 +0100 | [diff] [blame] | 427 | |
Maarten Lankhorst | 5a63668 | 2016-06-30 09:18:49 +0200 | [diff] [blame] | 428 | static inline bool igt_output_is_connected(igt_output_t *output) |
| 429 | { |
| 430 | /* Something went wrong during probe? */ |
| 431 | if (!output->config.connector) |
| 432 | return false; |
| 433 | |
| 434 | if (output->config.connector->connection == DRM_MODE_CONNECTED) |
| 435 | return true; |
| 436 | |
| 437 | return false; |
| 438 | } |
| 439 | |
Maarten Lankhorst | 2d672a1 | 2016-07-27 15:33:12 +0200 | [diff] [blame] | 440 | /** |
| 441 | * igt_pipe_connector_valid: |
| 442 | * @pipe: pipe to check. |
| 443 | * @output: #igt_output_t to check. |
| 444 | * |
| 445 | * Checks whether the given pipe and output can be used together. |
| 446 | */ |
| 447 | #define igt_pipe_connector_valid(pipe, output) \ |
| 448 | (igt_output_is_connected((output)) && \ |
| 449 | (output->config.valid_crtc_idx_mask & (1 << (pipe)))) |
Maarten Lankhorst | be13126 | 2016-06-13 15:27:22 +0200 | [diff] [blame] | 450 | |
| 451 | #define for_each_if(condition) if (!(condition)) {} else |
| 452 | |
Maarten Lankhorst | 2d672a1 | 2016-07-27 15:33:12 +0200 | [diff] [blame] | 453 | /** |
| 454 | * for_each_connected_output: |
| 455 | * @display: a pointer to an #igt_display_t structure |
| 456 | * @output: The output to iterate. |
| 457 | * |
| 458 | * This for loop iterates over all outputs. |
| 459 | */ |
Damien Lespiau | 992bd5d | 2014-02-04 12:06:57 +0000 | [diff] [blame] | 460 | #define for_each_connected_output(display, output) \ |
Daniel Vetter | 3f56038 | 2017-08-14 11:32:07 +0200 | [diff] [blame] | 461 | for (int i__ = 0; assert(igt_can_fail()), i__ < (display)->n_outputs; i__++) \ |
Maarten Lankhorst | 5a63668 | 2016-06-30 09:18:49 +0200 | [diff] [blame] | 462 | for_each_if (((output = &(display)->outputs[i__]), \ |
| 463 | igt_output_is_connected(output))) |
Damien Lespiau | 992bd5d | 2014-02-04 12:06:57 +0000 | [diff] [blame] | 464 | |
Maarten Lankhorst | 2d672a1 | 2016-07-27 15:33:12 +0200 | [diff] [blame] | 465 | /** |
| 466 | * for_each_pipe: |
Daniel Vetter | 229d7d2 | 2017-08-14 11:32:05 +0200 | [diff] [blame] | 467 | * @pipe: The pipe to iterate. |
| 468 | * |
| 469 | * This for loop iterates over all pipes supported by IGT libraries. |
| 470 | * |
| 471 | * This should be used to enumerate per-pipe subtests since it has no runtime |
| 472 | * depencies. |
| 473 | */ |
| 474 | #define for_each_pipe_static(pipe) \ |
| 475 | for (pipe = 0; pipe < IGT_MAX_PIPES; pipe++) |
| 476 | |
| 477 | /** |
| 478 | * for_each_pipe: |
Maarten Lankhorst | 2d672a1 | 2016-07-27 15:33:12 +0200 | [diff] [blame] | 479 | * @display: a pointer to an #igt_display_t structure |
| 480 | * @pipe: The pipe to iterate. |
| 481 | * |
| 482 | * This for loop iterates over all pipes. |
Daniel Vetter | 229d7d2 | 2017-08-14 11:32:05 +0200 | [diff] [blame] | 483 | * |
| 484 | * Note that this cannot be used to enumerate per-pipe subtest names since it |
| 485 | * depends upon runtime probing of the actual kms driver that is being tested. |
| 486 | * Used #for_each_pipe_static instead. |
Maarten Lankhorst | 2d672a1 | 2016-07-27 15:33:12 +0200 | [diff] [blame] | 487 | */ |
Damien Lespiau | 753352c | 2014-07-08 18:43:22 +0100 | [diff] [blame] | 488 | #define for_each_pipe(display, pipe) \ |
Daniel Vetter | 3f56038 | 2017-08-14 11:32:07 +0200 | [diff] [blame] | 489 | for (pipe = 0; assert(igt_can_fail()), pipe < igt_display_get_n_pipes(display); pipe++) |
Damien Lespiau | 753352c | 2014-07-08 18:43:22 +0100 | [diff] [blame] | 490 | |
Maarten Lankhorst | 2d672a1 | 2016-07-27 15:33:12 +0200 | [diff] [blame] | 491 | /** |
| 492 | * for_each_pipe_with_valid_output: |
| 493 | * @display: a pointer to an #igt_display_t structure |
| 494 | * @pipe: The pipe for which this @pipe / @output combination is valid. |
| 495 | * @output: The output for which this @pipe / @output combination is valid. |
| 496 | * |
| 497 | * This for loop is called over all connected outputs. This function |
| 498 | * will try every combination of @pipe and @output. |
| 499 | */ |
Maarten Lankhorst | be13126 | 2016-06-13 15:27:22 +0200 | [diff] [blame] | 500 | #define for_each_pipe_with_valid_output(display, pipe, output) \ |
| 501 | for (int con__ = pipe = 0; \ |
Daniel Vetter | 3f56038 | 2017-08-14 11:32:07 +0200 | [diff] [blame] | 502 | assert(igt_can_fail()), pipe < igt_display_get_n_pipes((display)) && con__ < (display)->n_outputs; \ |
Maarten Lankhorst | be13126 | 2016-06-13 15:27:22 +0200 | [diff] [blame] | 503 | con__ = (con__ + 1 < (display)->n_outputs) ? con__ + 1 : (pipe = pipe + 1, 0)) \ |
| 504 | for_each_if (((output = &(display)->outputs[con__]), \ |
| 505 | igt_pipe_connector_valid(pipe, output))) |
| 506 | |
Maarten Lankhorst | 2d672a1 | 2016-07-27 15:33:12 +0200 | [diff] [blame] | 507 | /** |
| 508 | * for_each_valid_output_on_pipe: |
| 509 | * @display: a pointer to an #igt_display_t structure |
| 510 | * @pipe: Pipe to enumerate valid outputs over |
| 511 | * @output: The enumerated output. |
| 512 | * |
| 513 | * This for loop is called over all connected @output that can be used |
| 514 | * on this @pipe . If there are no valid outputs for this pipe, nothing |
| 515 | * happens. |
| 516 | */ |
Maarten Lankhorst | be13126 | 2016-06-13 15:27:22 +0200 | [diff] [blame] | 517 | #define for_each_valid_output_on_pipe(display, pipe, output) \ |
Maarten Lankhorst | 0404de4 | 2016-06-29 15:56:28 +0200 | [diff] [blame] | 518 | for_each_connected_output(display, output) \ |
Maarten Lankhorst | be13126 | 2016-06-13 15:27:22 +0200 | [diff] [blame] | 519 | for_each_if (igt_pipe_connector_valid(pipe, output)) |
| 520 | |
Ville Syrjälä | 2b74b2b | 2015-03-27 20:51:46 +0200 | [diff] [blame] | 521 | #define for_each_plane_on_pipe(display, pipe, plane) \ |
Daniel Vetter | 3f56038 | 2017-08-14 11:32:07 +0200 | [diff] [blame] | 522 | for (int j__ = 0; assert(igt_can_fail()), (plane) = &(display)->pipes[(pipe)].planes[j__], \ |
Mayuresh Gharpure | 0e2e880 | 2016-03-11 13:55:29 +0530 | [diff] [blame] | 523 | j__ < (display)->pipes[(pipe)].n_planes; j__++) |
Ville Syrjälä | 2b74b2b | 2015-03-27 20:51:46 +0200 | [diff] [blame] | 524 | |
Damien Lespiau | 5ec399b | 2014-02-05 16:36:51 +0000 | [diff] [blame] | 525 | #define IGT_FIXED(i,f) ((i) << 16 | (f)) |
| 526 | |
Mayuresh Gharpure | 0e2e880 | 2016-03-11 13:55:29 +0530 | [diff] [blame] | 527 | /** |
| 528 | * igt_atomic_populate_plane_req: |
| 529 | * @req: A pointer to drmModeAtomicReq |
| 530 | * @plane: A pointer igt_plane_t |
| 531 | * @prop: one of igt_atomic_plane_properties |
| 532 | * @value: the value to add |
| 533 | */ |
| 534 | #define igt_atomic_populate_plane_req(req, plane, prop, value) \ |
| 535 | igt_assert_lt(0, drmModeAtomicAddProperty(req, plane->drm_plane->plane_id,\ |
| 536 | plane->atomic_props_plane[prop], value)) |
| 537 | |
| 538 | /** |
| 539 | * igt_atomic_populate_crtc_req: |
| 540 | * @req: A pointer to drmModeAtomicReq |
Maarten Lankhorst | 9f45ea1 | 2016-06-30 10:24:28 +0200 | [diff] [blame] | 541 | * @pipe: A pointer igt_pipe_t |
Mayuresh Gharpure | 0e2e880 | 2016-03-11 13:55:29 +0530 | [diff] [blame] | 542 | * @prop: one of igt_atomic_crtc_properties |
| 543 | * @value: the value to add |
| 544 | */ |
Maarten Lankhorst | 9f45ea1 | 2016-06-30 10:24:28 +0200 | [diff] [blame] | 545 | #define igt_atomic_populate_crtc_req(req, pipe, prop, value) \ |
| 546 | igt_assert_lt(0, drmModeAtomicAddProperty(req, pipe->crtc_id,\ |
| 547 | pipe->atomic_props_crtc[prop], value)) |
Mayuresh Gharpure | 0e2e880 | 2016-03-11 13:55:29 +0530 | [diff] [blame] | 548 | /** |
| 549 | * igt_atomic_populate_connector_req: |
| 550 | * @req: A pointer to drmModeAtomicReq |
| 551 | * @output: A pointer igt_output_t |
| 552 | * @prop: one of igt_atomic_connector_properties |
| 553 | * @value: the value to add |
| 554 | */ |
| 555 | #define igt_atomic_populate_connector_req(req, output, prop, value) \ |
| 556 | igt_assert_lt(0, drmModeAtomicAddProperty(req, output->config.connector->connector_id,\ |
| 557 | output->config.atomic_props_connector[prop], value)) |
| 558 | |
Maarten Lankhorst | 7df7e3b | 2017-09-21 12:53:27 +0200 | [diff] [blame] | 559 | /* |
| 560 | * igt_pipe_refresh: |
| 561 | * @display: a pointer to an #igt_display_t structure |
| 562 | * @pipe: Pipe to refresh |
| 563 | * @force: Should be set to true if mode_blob is no longer considered |
| 564 | * to be valid, for example after doing an atomic commit during fork or closing display fd. |
| 565 | * |
| 566 | * Requests the pipe to be part of the state on next update. |
| 567 | * This is useful when state may have been out of sync after |
| 568 | * a fork, or we just want to be sure the pipe is included |
| 569 | * in the next commit. |
| 570 | */ |
| 571 | static inline void |
| 572 | igt_pipe_refresh(igt_display_t *display, enum pipe pipe, bool force) |
| 573 | { |
| 574 | if (force) |
| 575 | display->pipes[pipe].mode_blob = 0; |
| 576 | |
| 577 | display->pipes[pipe].mode_changed = true; |
| 578 | } |
| 579 | |
Thomas Wood | b6ed9fb | 2014-05-28 14:06:01 +0100 | [diff] [blame] | 580 | void igt_enable_connectors(void); |
| 581 | void igt_reset_connectors(void); |
| 582 | |
Marius Vlad | 7ead45c | 2016-07-04 16:52:46 +0300 | [diff] [blame] | 583 | uint32_t kmstest_get_vbl_flag(uint32_t pipe_id); |
| 584 | |
Thomas Wood | 8d82e5b | 2014-10-08 16:16:39 +0100 | [diff] [blame] | 585 | #define EDID_LENGTH 128 |
Thomas Wood | 273a06d | 2014-10-08 14:11:30 +0100 | [diff] [blame] | 586 | const unsigned char* igt_kms_get_base_edid(void); |
Ville Syrjälä | 870548b | 2015-12-04 15:49:30 +0200 | [diff] [blame] | 587 | const unsigned char* igt_kms_get_alt_edid(void); |
Thomas Wood | 273a06d | 2014-10-08 14:11:30 +0100 | [diff] [blame] | 588 | |
Lyude | 6adb7b3 | 2016-11-17 10:06:09 -0500 | [diff] [blame] | 589 | #ifdef HAVE_UDEV |
| 590 | struct udev_monitor *igt_watch_hotplug(void); |
| 591 | bool igt_hotplug_detected(struct udev_monitor *mon, |
| 592 | int timeout_secs); |
| 593 | void igt_flush_hotplugs(struct udev_monitor *mon); |
| 594 | void igt_cleanup_hotplug(struct udev_monitor *mon); |
| 595 | #endif |
Thomas Wood | 273a06d | 2014-10-08 14:11:30 +0100 | [diff] [blame] | 596 | |
Oscar Mateo | 37f26d1 | 2013-11-12 11:50:38 +0000 | [diff] [blame] | 597 | #endif /* __IGT_KMS_H__ */ |