Lines Matching +full:cairo +full:- +full:tests
32 #include <xmlrpc-c/base.h>
33 #include <xmlrpc-c/client.h>
37 #include <cairo.h>
50 * @short_description: Library for using the Chamelium into igt tests
54 * This library contains helpers for using Chameliums in IGT tests. This allows
55 * for tests to simulate more difficult tasks to automate such as display
59 * [on the ChromeOS project page](https://www.chromium.org/chromium-os/testing/chamelium).
61 * In order to run tests using the Chamelium, a valid configuration file must be
62 * present. It must contain Chamelium-specific keys as shown with the following
65 * |[<!-- language="plain" -->
70 * # This is required so any tests using the Chamelium know which connector
74 * # any hotplugging tests for the incorrect connector mapping will fail.
76 * [Chamelium:DP-1] # The name of the DRM connector
79 * [Chamelium:HDMI-A-1]
149 calloc(sizeof(void*), chamelium->port_count); in chamelium_get_ports()
151 *count = chamelium->port_count; in chamelium_get_ports()
152 for (i = 0; i < chamelium->port_count; i++) in chamelium_get_ports()
153 ret[i] = &chamelium->ports[i]; in chamelium_get_ports()
169 return port->type; in chamelium_port_get_type()
190 connector = drmModeGetConnector(chamelium->drm_fd, in chamelium_port_get_connector()
191 port->connector_id); in chamelium_port_get_connector()
194 chamelium->drm_fd, port->connector_id); in chamelium_port_get_connector()
210 return port->name; in chamelium_port_get_name()
222 free(dump->bgr); in chamelium_destroy_frame_dump()
228 free(audio_file->path); in chamelium_destroy_audio_file()
241 * frame-capturing related tasks. This requires cutting off the display then
248 int drm_fd = args->chamelium->drm_fd; in chamelium_fsm_mon()
254 igt_hotplug_detected(args->mon, 60); in chamelium_fsm_mon()
264 connector = chamelium_port_get_connector(args->chamelium, args->port, in chamelium_fsm_mon()
284 if (chamelium->env.fault_occurred) { in __chamelium_rpc_va()
285 xmlrpc_env_clean(&chamelium->env); in __chamelium_rpc_va()
286 xmlrpc_env_init(&chamelium->env); in __chamelium_rpc_va()
303 xmlrpc_client_call2f_va(&chamelium->env, chamelium->client, in __chamelium_rpc_va()
304 chamelium->url, method_name, format_str, &res, in __chamelium_rpc_va()
347 igt_assert_f(!chamelium->env.fault_occurred, in chamelium_rpc()
349 chamelium->env.fault_string); in chamelium_rpc()
364 if (chamelium->env.fault_occurred) in __chamelium_is_reachable()
366 chamelium->env.fault_string); in __chamelium_is_reachable()
368 return !chamelium->env.fault_occurred; in __chamelium_is_reachable()
390 igt_debug("Plugging %s (Chamelium port ID %d)\n", port->name, port->id); in chamelium_plug()
391 xmlrpc_DECREF(chamelium_rpc(chamelium, NULL, "Plug", "(i)", port->id)); in chamelium_plug()
404 igt_debug("Unplugging port %s\n", port->name); in chamelium_unplug()
406 port->id)); in chamelium_unplug()
425 res = chamelium_rpc(chamelium, NULL, "IsPlugged", "(i)", port->id); in chamelium_is_plugged()
427 xmlrpc_read_bool(&chamelium->env, res, &is_plugged); in chamelium_is_plugged()
452 igt_debug("Waiting for video input to stabalize on %s\n", port->name); in chamelium_port_wait_video_input_stable()
455 port->id, timeout_secs); in chamelium_port_wait_video_input_stable()
457 xmlrpc_read_bool(&chamelium->env, res, &is_on); in chamelium_port_wait_video_input_stable()
484 xmlrpc_value *pulse_widths = xmlrpc_array_new(&chamelium->env); in chamelium_fire_hpd_pulses()
485 xmlrpc_value *width = xmlrpc_int_new(&chamelium->env, width_msec); in chamelium_fire_hpd_pulses()
489 count, width_msec, port->name); in chamelium_fire_hpd_pulses()
492 xmlrpc_array_append_item(&chamelium->env, pulse_widths, width); in chamelium_fire_hpd_pulses()
495 "(iA)", port->id, pulse_widths)); in chamelium_fire_hpd_pulses()
514 xmlrpc_value *pulse_widths = xmlrpc_array_new(&chamelium->env), *width; in chamelium_fire_mixed_hpd_pulses()
517 igt_debug("Firing mixed HPD pulses on %s\n", port->name); in chamelium_fire_mixed_hpd_pulses()
521 width = xmlrpc_int_new(&chamelium->env, arg); in chamelium_fire_mixed_hpd_pulses()
522 xmlrpc_array_append_item(&chamelium->env, pulse_widths, width); in chamelium_fire_mixed_hpd_pulses()
528 "(iA)", port->id, pulse_widths)); in chamelium_fire_mixed_hpd_pulses()
537 * @delay_ms: Delay in milli-second before the toggle takes place
548 igt_debug("Scheduling HPD toggle on %s in %d ms\n", port->name, in chamelium_schedule_hpd_toggle()
552 "(iii)", port->id, delay_ms, rising_edge)); in chamelium_schedule_hpd_toggle()
563 xmlrpc_read_int(&chamelium->env, res, &edid_id); in chamelium_upload_edid()
583 * Callers shouldn't assume that the raw EDID they provide is uploaded as-is to
597 chamelium_edid->chamelium = chamelium; in chamelium_new_edid()
598 chamelium_edid->base = malloc(edid_size); in chamelium_new_edid()
599 memcpy(chamelium_edid->base, edid, edid_size); in chamelium_new_edid()
600 igt_list_add(&chamelium_edid->link, &chamelium->edids); in chamelium_new_edid()
614 edid->prod_code[0] = 'C'; in chamelium_port_tag_edid()
615 edid->prod_code[1] = 'H'; in chamelium_port_tag_edid()
618 serial = (uint32_t *) &edid->serial; in chamelium_port_tag_edid()
619 *serial = port->id; in chamelium_port_tag_edid()
638 size_t port_index = port - edid->chamelium->ports; in chamelium_edid_get_raw()
641 if (!edid->raw[port_index]) { in chamelium_edid_get_raw()
642 edid_size = edid_get_size(edid->base); in chamelium_edid_get_raw()
643 edid->raw[port_index] = malloc(edid_size); in chamelium_edid_get_raw()
644 memcpy(edid->raw[port_index], edid->base, edid_size); in chamelium_edid_get_raw()
645 chamelium_port_tag_edid(port, edid->raw[port_index]); in chamelium_edid_get_raw()
648 return edid->raw[port_index]; in chamelium_edid_get_raw()
674 port_index = port - chamelium->ports; in chamelium_port_set_edid()
675 edid_id = edid->ids[port_index]; in chamelium_port_set_edid()
679 edid->ids[port_index] = edid_id; in chamelium_port_set_edid()
686 port->id, edid_id)); in chamelium_port_set_edid()
705 enabled ? "En" : "Dis", port->name); in chamelium_port_set_ddc_state()
708 port->id, enabled)); in chamelium_port_set_ddc_state()
727 res = chamelium_rpc(chamelium, NULL, "IsDdcEnabled", "(i)", port->id); in chamelium_port_get_ddc_state()
728 xmlrpc_read_bool(&chamelium->env, res, &enabled); in chamelium_port_get_ddc_state()
753 port->id); in chamelium_port_get_resolution()
755 xmlrpc_array_read_item(&chamelium->env, res, 0, &res_x); in chamelium_port_get_resolution()
756 xmlrpc_array_read_item(&chamelium->env, res, 1, &res_y); in chamelium_port_get_resolution()
757 xmlrpc_read_int(&chamelium->env, res_x, x); in chamelium_port_get_resolution()
758 xmlrpc_read_int(&chamelium->env, res_y, y); in chamelium_port_get_resolution()
780 /* XML-RPC has a special code for unsupported methods in chamelium_supports_method()
783 return (!chamelium->env.fault_occurred || in chamelium_supports_method()
784 strstr(chamelium->env.fault_string, "not supported") == NULL); in chamelium_supports_method()
798 xmlrpc_struct_find_value(&chamelium->env, struct_val, key, &val); in read_int_from_xml_struct()
800 xmlrpc_read_int(&chamelium->env, val, dst); in read_int_from_xml_struct()
803 *dst = -1; in read_int_from_xml_struct()
812 xmlrpc_struct_find_value(&chamelium->env, res, "clock", &val); in video_params_from_xml()
814 xmlrpc_read_double(&chamelium->env, val, ¶ms->clock); in video_params_from_xml()
817 params->clock = NAN; in video_params_from_xml()
819 read_int_from_xml_struct(chamelium, res, "htotal", ¶ms->htotal); in video_params_from_xml()
820 read_int_from_xml_struct(chamelium, res, "hactive", ¶ms->hactive); in video_params_from_xml()
822 ¶ms->hsync_offset); in video_params_from_xml()
824 ¶ms->hsync_width); in video_params_from_xml()
826 ¶ms->hsync_polarity); in video_params_from_xml()
827 read_int_from_xml_struct(chamelium, res, "vtotal", ¶ms->vtotal); in video_params_from_xml()
828 read_int_from_xml_struct(chamelium, res, "vactive", ¶ms->vactive); in video_params_from_xml()
830 ¶ms->vsync_offset); in video_params_from_xml()
832 ¶ms->vsync_width); in video_params_from_xml()
834 ¶ms->vsync_polarity); in video_params_from_xml()
843 res = chamelium_rpc(chamelium, NULL, "GetVideoParams", "(i)", port->id); in chamelium_port_get_video_params()
856 xmlrpc_array_read_item(&chamelium->env, res, 0, &res_w); in chamelium_get_captured_resolution()
857 xmlrpc_array_read_item(&chamelium->env, res, 1, &res_h); in chamelium_get_captured_resolution()
858 xmlrpc_read_int(&chamelium->env, res_w, w); in chamelium_get_captured_resolution()
859 xmlrpc_read_int(&chamelium->env, res_h, h); in chamelium_get_captured_resolution()
871 chamelium_get_captured_resolution(chamelium, &ret->width, &ret->height); in frame_from_xml()
872 ret->port = chamelium->capturing_port; in frame_from_xml()
873 xmlrpc_read_base64(&chamelium->env, frame_xml, &ret->size, in frame_from_xml()
874 (void*)&ret->bgr); in frame_from_xml()
891 * optionally cropped to a given region. In situations where pre-calculating
919 port->id, x, y, w, h); in chamelium_port_dump_pixels()
920 chamelium->capturing_port = port; in chamelium_port_dump_pixels()
934 out->n_words = xmlrpc_array_size(&chamelium->env, xml_crc); in crc_from_xml()
935 for (i = 0; i < out->n_words; i++) { in crc_from_xml()
936 xmlrpc_array_read_item(&chamelium->env, xml_crc, i, &res); in crc_from_xml()
937 xmlrpc_read_int(&chamelium->env, res, (int*)&out->crc[i]); in crc_from_xml()
981 port->id, x, y, w, h); in chamelium_get_crc_for_area()
982 chamelium->capturing_port = port; in chamelium_get_crc_for_area()
1002 * A blocking, one-shot version of this function is available: see
1019 port->id, x, y, w, h)); in chamelium_start_capture()
1020 chamelium->capturing_port = port; in chamelium_start_capture()
1068 port->id, frame_count, x, y, w, h)); in chamelium_capture()
1069 chamelium->capturing_port = port; in chamelium_capture()
1090 *frame_count = xmlrpc_array_size(&chamelium->env, res); in chamelium_read_captured_crcs()
1094 xmlrpc_array_read_item(&chamelium->env, res, i, &elem); in chamelium_read_captured_crcs()
1146 xmlrpc_read_int(&chamelium->env, res, &ret); in chamelium_get_captured_frame_count()
1183 port->id, chamelium_infoframe_type_str(type)); in chamelium_get_last_infoframe()
1184 xmlrpc_struct_find_value(&chamelium->env, res, "version", &res_version); in chamelium_get_last_infoframe()
1185 xmlrpc_struct_find_value(&chamelium->env, res, "payload", &res_payload); in chamelium_get_last_infoframe()
1187 xmlrpc_read_int(&chamelium->env, res_version, &infoframe->version); in chamelium_get_last_infoframe()
1188 xmlrpc_read_base64(&chamelium->env, res_payload, in chamelium_get_last_infoframe()
1189 &infoframe->payload_size, &payload); in chamelium_get_last_infoframe()
1190 /* xmlrpc-c's docs say payload is actually not constant */ in chamelium_get_last_infoframe()
1191 infoframe->payload = (uint8_t *) payload; in chamelium_get_last_infoframe()
1196 if (infoframe->payload_size == 0) { in chamelium_get_last_infoframe()
1205 free(infoframe->payload); in chamelium_infoframe_destroy()
1221 "(i)", port->id)); in chamelium_trigger_link_failure()
1235 res = chamelium_rpc(chamelium, port, "HasAudioSupport", "(i)", port->id); in chamelium_has_audio_support()
1236 xmlrpc_read_bool(&chamelium->env, res, &has_support); in chamelium_has_audio_support()
1254 * which input channel the capture channel is mapped to. As a special case, -1
1265 port->id); in chamelium_get_audio_channel_mapping()
1266 res_len = xmlrpc_array_size(&chamelium->env, res); in chamelium_get_audio_channel_mapping()
1269 xmlrpc_array_read_item(&chamelium->env, res, i, &res_channel); in chamelium_get_audio_channel_mapping()
1270 xmlrpc_read_int(&chamelium->env, res_channel, &mapping[i]); in chamelium_get_audio_channel_mapping()
1282 xmlrpc_struct_find_value(&chamelium->env, res, "file_type", &res_type); in audio_format_from_xml()
1283 xmlrpc_struct_find_value(&chamelium->env, res, "rate", &res_rate); in audio_format_from_xml()
1284 xmlrpc_struct_find_value(&chamelium->env, res, "sample_format", &res_sample_format); in audio_format_from_xml()
1285 xmlrpc_struct_find_value(&chamelium->env, res, "channel", &res_channel); in audio_format_from_xml()
1287 xmlrpc_read_string(&chamelium->env, res_type, (const char **) &type); in audio_format_from_xml()
1291 xmlrpc_read_string(&chamelium->env, res_sample_format, (const char **) &sample_format); in audio_format_from_xml()
1296 xmlrpc_read_int(&chamelium->env, res_rate, rate); in audio_format_from_xml()
1298 xmlrpc_read_int(&chamelium->env, res_channel, channels); in audio_format_from_xml()
1312 * @rate: if non-NULL, will be set to the sample rate in Hz
1313 * @channels: if non-NULL, will be set to the number of channels
1327 port->id); in chamelium_get_audio_format()
1353 port->id, save_to_file); in chamelium_start_capturing_audio()
1376 port->id); in chamelium_stop_capturing_audio()
1377 xmlrpc_array_read_item(&chamelium->env, res, 0, &res_path); in chamelium_stop_capturing_audio()
1378 xmlrpc_array_read_item(&chamelium->env, res, 1, &res_props); in chamelium_stop_capturing_audio()
1380 xmlrpc_read_string(&chamelium->env, res_path, (const char **) &path); in chamelium_stop_capturing_audio()
1384 file->path = path; in chamelium_stop_capturing_audio()
1387 &file->rate, &file->channels); in chamelium_stop_capturing_audio()
1418 int w = dump->width, h = dump->height; in convert_frame_dump_argb32()
1419 uint32_t *bits_bgr = (uint32_t *) dump->bgr; in convert_frame_dump_argb32()
1467 reference_suffix = igt_crc_to_string_extended(reference_crc, '-', 2); in compared_frames_dump()
1468 capture_suffix = igt_crc_to_string_extended(capture_crc, '-', 2); in compared_frames_dump()
1485 * the given framebuffer. Useful for scenarios where pre-calculating CRCs might
1494 int w = dump->width, h = dump->height; in chamelium_assert_frame_eq()
1497 /* Get the cairo surface for the framebuffer */ in chamelium_assert_frame_eq()
1498 fb_surface = igt_get_cairo_surface(chamelium->drm_fd, fb); in chamelium_assert_frame_eq()
1512 eq = memcmp(dump->bgr, pixman_image_get_data(reference_bgr), in chamelium_assert_frame_eq()
1513 dump->size) == 0; in chamelium_assert_frame_eq()
1547 /* Convert the reference framebuffer to cairo. */ in chamelium_assert_crc_eq_or_dump()
1548 reference = igt_get_cairo_surface(chamelium->drm_fd, fb); in chamelium_assert_crc_eq_or_dump()
1554 /* Convert the captured frame to cairo. */ in chamelium_assert_crc_eq_or_dump()
1593 reference = igt_get_cairo_surface(chamelium->drm_fd, fb); in chamelium_assert_frame_match_or_dump()
1645 * The detection is done on a brightness-threshold-basis, that is adapted
1646 * to the reference frame used by i-g-t. It may not be as relevant for other
1659 if (dump->width == width && dump->height == height) in chamelium_crop_analog_frame()
1662 /* Start with the most bottom-right position. */ in chamelium_crop_analog_frame()
1663 top = dump->height - height; in chamelium_crop_analog_frame()
1664 left = dump->width - width; in chamelium_crop_analog_frame()
1668 igt_debug("Cropping analog frame from %dx%d to %dx%d\n", dump->width, in chamelium_crop_analog_frame()
1669 dump->height, width, height); in chamelium_crop_analog_frame()
1671 /* Detect the top-left corner of the frame. */ in chamelium_crop_analog_frame()
1672 for (x = 0; x < dump->width; x++) { in chamelium_crop_analog_frame()
1673 for (y = 0; y < dump->height; y++) { in chamelium_crop_analog_frame()
1674 p = &dump->bgr[(x + y * dump->width) * 3]; in chamelium_crop_analog_frame()
1681 * Make sure close-by pixels are also significantly in chamelium_crop_analog_frame()
1687 p = &dump->bgr[(xx + yy * dump->width) * 3]; in chamelium_crop_analog_frame()
1711 /* Crop the frame given the detected top-left corner. */ in chamelium_crop_analog_frame()
1715 p = &dump->bgr[(left + (top + y) * dump->width) * 3]; in chamelium_crop_analog_frame()
1720 free(dump->bgr); in chamelium_crop_analog_frame()
1721 dump->width = width; in chamelium_crop_analog_frame()
1722 dump->height = height; in chamelium_crop_analog_frame()
1723 dump->bgr = bgr; in chamelium_crop_analog_frame()
1751 port->id, w, h); in chamelium_get_frame_limit()
1753 xmlrpc_read_int(&chamelium->env, res, &ret); in chamelium_get_frame_limit()
1802 j = n - i - 1; in chamelium_do_calculate_fb_crc()
1803 out->crc[i] = chamelium_xrgb_hash16(buffer, w, h, j, n); in chamelium_do_calculate_fb_crc()
1806 out->n_words = n; in chamelium_do_calculate_fb_crc()
1824 /* Get the cairo surface for the framebuffer */ in chamelium_calculate_fb_crc()
1840 chamelium_do_calculate_fb_crc(fb_crc->fb_surface, fb_crc->ret); in chamelium_calculate_fb_crc_async_work()
1865 fb_crc->ret = calloc(1, sizeof(igt_crc_t)); in chamelium_calculate_fb_crc_async_start()
1867 /* Get the cairo surface for the framebuffer */ in chamelium_calculate_fb_crc_async_start()
1868 fb_crc->fb_surface = igt_get_cairo_surface(fd, fb); in chamelium_calculate_fb_crc_async_start()
1870 pthread_create(&fb_crc->thread_id, NULL, in chamelium_calculate_fb_crc_async_start()
1878 * @fb_crc: An intermediate structure with thread-related information
1889 pthread_join(fb_crc->thread_id, NULL); in chamelium_calculate_fb_crc_async_finish()
1891 ret = fb_crc->ret; in chamelium_calculate_fb_crc_async_finish()
1905 "(i)", port->id); in chamelium_get_port_type()
1907 xmlrpc_read_string(&chamelium->env, res, &port_type_str); in chamelium_get_port_type()
1908 igt_debug("Port %d is of type '%s'\n", port->id, port_type_str); in chamelium_get_port_type()
1932 xmlrpc_read_bool(&chamelium->env, res, &has_video_support); in chamelium_has_video_support()
1951 res_len = xmlrpc_array_size(&chamelium->env, res); in chamelium_get_video_ports()
1953 xmlrpc_array_read_item(&chamelium->env, res, i, &res_port); in chamelium_get_video_ports()
1954 xmlrpc_read_int(&chamelium->env, res_port, &port_id); in chamelium_get_video_ports()
1990 chamelium->port_count++; in chamelium_read_port_mappings()
1992 igt_assert(chamelium->port_count <= CHAMELIUM_MAX_PORTS); in chamelium_read_port_mappings()
2001 map_name = group + (sizeof("Chamelium:") - 1); in chamelium_read_port_mappings()
2003 port = &chamelium->ports[port_i++]; in chamelium_read_port_mappings()
2004 port->name = strdup(map_name); in chamelium_read_port_mappings()
2005 port->id = g_key_file_get_integer(igt_key_file, group, in chamelium_read_port_mappings()
2008 if (!port->id) { in chamelium_read_port_mappings()
2010 map_name, error->message); in chamelium_read_port_mappings()
2015 port->type = chamelium_get_port_type(chamelium, port); in chamelium_read_port_mappings()
2016 if (port->type == DRM_MODE_CONNECTOR_Unknown) { in chamelium_read_port_mappings()
2024 j < res->count_connectors && !port->connector_id; in chamelium_read_port_mappings()
2029 drm_fd, res->connectors[j]); in chamelium_read_port_mappings()
2032 snprintf(name, 50, "%s-%u", in chamelium_read_port_mappings()
2033 kmstest_connector_type_str(connector->connector_type), in chamelium_read_port_mappings()
2034 connector->connector_type_id); in chamelium_read_port_mappings()
2037 port->connector_id = connector->connector_id; in chamelium_read_port_mappings()
2041 if (!port->connector_id) { in chamelium_read_port_mappings()
2049 map_name, kmstest_connector_type_str(port->type), in chamelium_read_port_mappings()
2050 port->id); in chamelium_read_port_mappings()
2062 int port_id = -1; in port_id_from_edid()
2069 if (connector->connection != DRM_MODE_CONNECTED) { in port_id_from_edid()
2070 igt_debug("Skipping auto-discovery for connector %s-%d: " in port_id_from_edid()
2072 kmstest_connector_type_str(connector->connector_type), in port_id_from_edid()
2073 connector->connector_type_id); in port_id_from_edid()
2074 return -1; in port_id_from_edid()
2077 ok = kmstest_get_property(drm_fd, connector->connector_id, in port_id_from_edid()
2081 igt_debug("Skipping auto-discovery for connector %s-%d: " in port_id_from_edid()
2083 kmstest_connector_type_str(connector->connector_type), in port_id_from_edid()
2084 connector->connector_type_id); in port_id_from_edid()
2085 return -1; in port_id_from_edid()
2091 edid = (const struct edid *) edid_blob->data; in port_id_from_edid()
2095 igt_debug("Skipping connector %s-%d for auto-discovery: " in port_id_from_edid()
2097 kmstest_connector_type_str(connector->connector_type), in port_id_from_edid()
2098 connector->connector_type_id, mfg); in port_id_from_edid()
2102 if (edid->prod_code[0] != 'C' || edid->prod_code[1] != 'H') { in port_id_from_edid()
2103 igt_warn("Invalid EDID for IGT connector %s-%d: " in port_id_from_edid()
2105 kmstest_connector_type_str(connector->connector_type), in port_id_from_edid()
2106 connector->connector_type_id); in port_id_from_edid()
2110 port_id = *(uint32_t *) &edid->serial; in port_id_from_edid()
2111 igt_debug("Auto-discovery mapped connector %s-%d to Chamelium " in port_id_from_edid()
2113 kmstest_connector_type_str(connector->connector_type), in port_id_from_edid()
2114 connector->connector_type_id, port_id); in port_id_from_edid()
2153 igt_debug("Starting Chamelium port auto-discovery on %zu ports\n", in chamelium_autodiscover()
2159 /* Set EDID and plug ports we want to auto-discover */ in chamelium_autodiscover()
2160 port_count = chamelium->port_count; in chamelium_autodiscover()
2166 for (j = 0; j < chamelium->port_count; j++) { in chamelium_autodiscover()
2167 if (chamelium->ports[j].id == port_id) { in chamelium_autodiscover()
2168 port = &chamelium->ports[j]; in chamelium_autodiscover()
2174 port = &chamelium->ports[port_count]; in chamelium_autodiscover()
2177 port->id = port_id; in chamelium_autodiscover()
2189 for (i = 0; i < res->count_connectors; i++) { in chamelium_autodiscover()
2190 conn_id = res->connectors[i]; in chamelium_autodiscover()
2194 connector = drmModeGetConnector(drm_fd, res->connectors[i]); in chamelium_autodiscover()
2203 for (j = 0; j < chamelium->port_count; j++) { in chamelium_autodiscover()
2204 port = &chamelium->ports[j]; in chamelium_autodiscover()
2205 if (port->connector_id == conn_id) { in chamelium_autodiscover()
2207 igt_assert_f(port->id == port_id, in chamelium_autodiscover()
2212 port->name, port->id, port_id); in chamelium_autodiscover()
2228 igt_assert_f(found, "Auto-discovered a port (%d) we haven't " in chamelium_autodiscover()
2244 port = &chamelium->ports[chamelium->port_count]; in chamelium_autodiscover()
2245 chamelium->port_count++; in chamelium_autodiscover()
2247 port->id = port_id; in chamelium_autodiscover()
2248 port->type = chamelium_get_port_type(chamelium, port); in chamelium_autodiscover()
2249 port->connector_id = conn_id; in chamelium_autodiscover()
2252 snprintf(conn_name, sizeof(conn_name), "%s-%u", in chamelium_autodiscover()
2253 kmstest_connector_type_str(connector->connector_type), in chamelium_autodiscover()
2254 connector->connector_type_id); in chamelium_autodiscover()
2256 port->name = strdup(conn_name); in chamelium_autodiscover()
2260 igt_debug("Auto-discovery took %fms\n", in chamelium_autodiscover()
2275 chamelium->url = g_key_file_get_string(igt_key_file, "Chamelium", "URL", in chamelium_read_config()
2277 if (!chamelium->url) { in chamelium_read_config()
2279 error->message); in chamelium_read_config()
2338 chamelium->drm_fd = drm_fd; in chamelium_init()
2339 igt_list_init(&chamelium->edids); in chamelium_init()
2342 xmlrpc_env_init(&chamelium->env); in chamelium_init()
2343 xmlrpc_client_setup_global_const(&chamelium->env); in chamelium_init()
2344 xmlrpc_client_create(&chamelium->env, XMLRPC_CLIENT_NO_FLAGS, PACKAGE, in chamelium_init()
2345 PACKAGE_VERSION, NULL, 0, &chamelium->client); in chamelium_init()
2346 if (chamelium->env.fault_occurred) { in chamelium_init()
2348 chamelium->env.fault_string); in chamelium_init()
2361 xmlrpc_env_clean(&chamelium->env); in chamelium_init()
2375 * want the chamelium interfering with other tests in the same file.
2387 for (i = 0; i < chamelium->port_count; i++) in chamelium_deinit()
2388 chamelium_plug(chamelium, &chamelium->ports[i]); in chamelium_deinit()
2391 igt_list_for_each_safe(pos, tmp, &chamelium->edids, link) { in chamelium_deinit()
2393 if (pos->ids[i]) in chamelium_deinit()
2394 chamelium_destroy_edid(chamelium, pos->ids[i]); in chamelium_deinit()
2395 free(pos->raw[i]); in chamelium_deinit()
2397 free(pos->base); in chamelium_deinit()
2401 xmlrpc_client_destroy(chamelium->client); in chamelium_deinit()
2402 xmlrpc_env_clean(&chamelium->env); in chamelium_deinit()
2404 for (i = 0; i < chamelium->port_count; i++) in chamelium_deinit()
2405 free(chamelium->ports[i].name); in chamelium_deinit()