Lyude | c99f8b7 | 2016-10-18 14:12:09 -0400 | [diff] [blame] | 1 | /* |
| 2 | * Copyright © 2016 Red Hat Inc. |
| 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 | * |
| 23 | * Authors: Lyude Paul <lyude@redhat.com> |
| 24 | */ |
| 25 | |
| 26 | #ifndef IGT_CHAMELIUM_H |
| 27 | #define IGT_CHAMELIUM_H |
| 28 | |
| 29 | #include "config.h" |
Arkadiusz Hiler | a702b60 | 2017-04-12 12:33:12 +0200 | [diff] [blame] | 30 | |
Lyude | c99f8b7 | 2016-10-18 14:12:09 -0400 | [diff] [blame] | 31 | #include <stdbool.h> |
Daniel Vetter | 8c1fcc6 | 2017-09-08 11:23:15 +0200 | [diff] [blame] | 32 | #include <xf86drmMode.h> |
| 33 | |
| 34 | #include "igt_debugfs.h" |
| 35 | |
| 36 | struct igt_fb; |
Lyude | c99f8b7 | 2016-10-18 14:12:09 -0400 | [diff] [blame] | 37 | |
| 38 | struct chamelium; |
| 39 | struct chamelium_port; |
| 40 | struct chamelium_frame_dump; |
Paul Kocialkowski | e0802ba | 2017-07-19 16:46:05 +0300 | [diff] [blame] | 41 | struct chamelium_fb_crc_async_data; |
Lyude | c99f8b7 | 2016-10-18 14:12:09 -0400 | [diff] [blame] | 42 | |
| 43 | struct chamelium *chamelium_init(int drm_fd); |
| 44 | void chamelium_deinit(struct chamelium *chamelium); |
| 45 | void chamelium_reset(struct chamelium *chamelium); |
| 46 | |
| 47 | struct chamelium_port **chamelium_get_ports(struct chamelium *chamelium, |
| 48 | int *count); |
| 49 | unsigned int chamelium_port_get_type(const struct chamelium_port *port); |
| 50 | drmModeConnector *chamelium_port_get_connector(struct chamelium *chamelium, |
| 51 | struct chamelium_port *port, |
| 52 | bool reprobe); |
| 53 | const char *chamelium_port_get_name(struct chamelium_port *port); |
| 54 | |
| 55 | void chamelium_plug(struct chamelium *chamelium, struct chamelium_port *port); |
| 56 | void chamelium_unplug(struct chamelium *chamelium, struct chamelium_port *port); |
| 57 | bool chamelium_is_plugged(struct chamelium *chamelium, |
| 58 | struct chamelium_port *port); |
| 59 | bool chamelium_port_wait_video_input_stable(struct chamelium *chamelium, |
| 60 | struct chamelium_port *port, |
| 61 | int timeout_secs); |
| 62 | void chamelium_fire_mixed_hpd_pulses(struct chamelium *chamelium, |
| 63 | struct chamelium_port *port, ...); |
| 64 | void chamelium_fire_hpd_pulses(struct chamelium *chamelium, |
| 65 | struct chamelium_port *port, |
| 66 | int width_msec, int count); |
Paul Kocialkowki | fa8b6ee | 2017-06-27 13:53:06 +0300 | [diff] [blame] | 67 | void chamelium_schedule_hpd_toggle(struct chamelium *chamelium, |
| 68 | struct chamelium_port *port, int delay_ms, |
| 69 | bool rising_edge); |
Lyude | c99f8b7 | 2016-10-18 14:12:09 -0400 | [diff] [blame] | 70 | int chamelium_new_edid(struct chamelium *chamelium, const unsigned char *edid); |
| 71 | void chamelium_port_set_edid(struct chamelium *chamelium, |
| 72 | struct chamelium_port *port, int edid_id); |
| 73 | bool chamelium_port_get_ddc_state(struct chamelium *chamelium, |
| 74 | struct chamelium_port *port); |
| 75 | void chamelium_port_set_ddc_state(struct chamelium *chamelium, |
| 76 | struct chamelium_port *port, |
| 77 | bool enabled); |
| 78 | void chamelium_port_get_resolution(struct chamelium *chamelium, |
| 79 | struct chamelium_port *port, |
| 80 | int *x, int *y); |
| 81 | igt_crc_t *chamelium_get_crc_for_area(struct chamelium *chamelium, |
| 82 | struct chamelium_port *port, |
| 83 | int x, int y, int w, int h); |
| 84 | void chamelium_start_capture(struct chamelium *chamelium, |
| 85 | struct chamelium_port *port, |
| 86 | int x, int y, int w, int h); |
| 87 | void chamelium_stop_capture(struct chamelium *chamelium, int frame_count); |
| 88 | void chamelium_capture(struct chamelium *chamelium, struct chamelium_port *port, |
| 89 | int x, int y, int w, int h, int frame_count); |
| 90 | igt_crc_t *chamelium_read_captured_crcs(struct chamelium *chamelium, |
| 91 | int *frame_count); |
| 92 | struct chamelium_frame_dump *chamelium_read_captured_frame(struct chamelium *chamelium, |
| 93 | unsigned int index); |
| 94 | struct chamelium_frame_dump *chamelium_port_dump_pixels(struct chamelium *chamelium, |
| 95 | struct chamelium_port *port, |
| 96 | int x, int y, |
| 97 | int w, int h); |
Paul Kocialkowski | e0802ba | 2017-07-19 16:46:05 +0300 | [diff] [blame] | 98 | igt_crc_t *chamelium_calculate_fb_crc(int fd, struct igt_fb *fb); |
| 99 | struct chamelium_fb_crc_async_data *chamelium_calculate_fb_crc_async_start(int fd, |
| 100 | struct igt_fb *fb); |
| 101 | igt_crc_t *chamelium_calculate_fb_crc_async_finish(struct chamelium_fb_crc_async_data *fb_crc); |
Lyude | c99f8b7 | 2016-10-18 14:12:09 -0400 | [diff] [blame] | 102 | int chamelium_get_captured_frame_count(struct chamelium *chamelium); |
| 103 | int chamelium_get_frame_limit(struct chamelium *chamelium, |
| 104 | struct chamelium_port *port, |
| 105 | int w, int h); |
Lyude | c99f8b7 | 2016-10-18 14:12:09 -0400 | [diff] [blame] | 106 | void chamelium_assert_frame_eq(const struct chamelium *chamelium, |
| 107 | const struct chamelium_frame_dump *dump, |
| 108 | struct igt_fb *fb); |
Paul Kocialkowski | 5e4e829 | 2017-07-19 16:46:09 +0300 | [diff] [blame] | 109 | void chamelium_assert_crc_eq_or_dump(struct chamelium *chamelium, |
| 110 | igt_crc_t *reference_crc, |
| 111 | igt_crc_t *capture_crc, struct igt_fb *fb, |
| 112 | int index); |
Paul Kocialkowski | e246ff0 | 2017-07-20 18:13:37 +0300 | [diff] [blame] | 113 | void chamelium_assert_analog_frame_match_or_dump(struct chamelium *chamelium, |
| 114 | struct chamelium_port *port, |
| 115 | const struct chamelium_frame_dump *frame, |
| 116 | struct igt_fb *fb); |
| 117 | void chamelium_crop_analog_frame(struct chamelium_frame_dump *dump, int width, |
| 118 | int height); |
Lyude | c99f8b7 | 2016-10-18 14:12:09 -0400 | [diff] [blame] | 119 | void chamelium_destroy_frame_dump(struct chamelium_frame_dump *dump); |
| 120 | |
| 121 | #endif /* IGT_CHAMELIUM_H */ |