Lines Matching refs:chamelium
86 struct chamelium *chamelium; member
115 struct chamelium { struct
130 static struct chamelium *cleanup_instance; argument
144 struct chamelium_port **chamelium_get_ports(struct chamelium *chamelium, in chamelium_get_ports() argument
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()
183 drmModeConnector *chamelium_port_get_connector(struct chamelium *chamelium, in chamelium_port_get_connector() argument
190 connector = drmModeGetConnector(chamelium->drm_fd, in chamelium_port_get_connector()
194 chamelium->drm_fd, port->connector_id); in chamelium_port_get_connector()
233 struct chamelium *chamelium; member
248 int drm_fd = args->chamelium->drm_fd; in chamelium_fsm_mon()
264 connector = chamelium_port_get_connector(args->chamelium, args->port, in chamelium_fsm_mon()
273 static xmlrpc_value *__chamelium_rpc_va(struct chamelium *chamelium, in __chamelium_rpc_va() argument
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()
296 monitor_args.chamelium = chamelium; 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()
316 static xmlrpc_value *__chamelium_rpc(struct chamelium *chamelium, in __chamelium_rpc() argument
326 res = __chamelium_rpc_va(chamelium, fsm_port, method_name, in __chamelium_rpc()
333 static xmlrpc_value *chamelium_rpc(struct chamelium *chamelium, in chamelium_rpc() argument
343 res = __chamelium_rpc_va(chamelium, fsm_port, method_name, in chamelium_rpc()
347 igt_assert_f(!chamelium->env.fault_occurred, in chamelium_rpc()
349 chamelium->env.fault_string); in chamelium_rpc()
354 static bool __chamelium_is_reachable(struct chamelium *chamelium) in __chamelium_is_reachable() argument
359 res = __chamelium_rpc(chamelium, NULL, "GetSupportedInputs", "()"); in __chamelium_is_reachable()
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()
371 void chamelium_wait_reachable(struct chamelium *chamelium, int timeout) in chamelium_wait_reachable() argument
373 bool chamelium_online = igt_wait(__chamelium_is_reachable(chamelium), in chamelium_wait_reachable()
388 void chamelium_plug(struct chamelium *chamelium, struct chamelium_port *port) in chamelium_plug() argument
391 xmlrpc_DECREF(chamelium_rpc(chamelium, NULL, "Plug", "(i)", port->id)); in chamelium_plug()
402 void chamelium_unplug(struct chamelium *chamelium, struct chamelium_port *port) in chamelium_unplug() argument
405 xmlrpc_DECREF(chamelium_rpc(chamelium, NULL, "Unplug", "(i)", in chamelium_unplug()
419 bool chamelium_is_plugged(struct chamelium *chamelium, in chamelium_is_plugged() argument
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()
445 bool chamelium_port_wait_video_input_stable(struct chamelium *chamelium, in chamelium_port_wait_video_input_stable() argument
454 res = chamelium_rpc(chamelium, port, "WaitVideoInputStable", "(ii)", in chamelium_port_wait_video_input_stable()
457 xmlrpc_read_bool(&chamelium->env, res, &is_on); in chamelium_port_wait_video_input_stable()
480 void chamelium_fire_hpd_pulses(struct chamelium *chamelium, in chamelium_fire_hpd_pulses() argument
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()
492 xmlrpc_array_append_item(&chamelium->env, pulse_widths, width); in chamelium_fire_hpd_pulses()
494 xmlrpc_DECREF(chamelium_rpc(chamelium, NULL, "FireMixedHpdPulses", in chamelium_fire_hpd_pulses()
510 void chamelium_fire_mixed_hpd_pulses(struct chamelium *chamelium, in chamelium_fire_mixed_hpd_pulses() argument
514 xmlrpc_value *pulse_widths = xmlrpc_array_new(&chamelium->env), *width; 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()
527 xmlrpc_DECREF(chamelium_rpc(chamelium, NULL, "FireMixedHpdPulses", in chamelium_fire_mixed_hpd_pulses()
544 void chamelium_schedule_hpd_toggle(struct chamelium *chamelium, in chamelium_schedule_hpd_toggle() argument
551 xmlrpc_DECREF(chamelium_rpc(chamelium, NULL, "ScheduleHpdToggle", in chamelium_schedule_hpd_toggle()
555 static int chamelium_upload_edid(struct chamelium *chamelium, in chamelium_upload_edid() argument
561 res = chamelium_rpc(chamelium, NULL, "CreateEdid", "(6)", in chamelium_upload_edid()
563 xmlrpc_read_int(&chamelium->env, res, &edid_id); in chamelium_upload_edid()
569 static void chamelium_destroy_edid(struct chamelium *chamelium, int edid_id) in chamelium_destroy_edid() argument
571 xmlrpc_DECREF(chamelium_rpc(chamelium, NULL, "DestroyEdid", "(i)", in chamelium_destroy_edid()
590 struct chamelium_edid *chamelium_new_edid(struct chamelium *chamelium, in chamelium_new_edid() argument
597 chamelium_edid->chamelium = chamelium; in chamelium_new_edid()
600 igt_list_add(&chamelium_edid->link, &chamelium->edids); in chamelium_new_edid()
638 size_t port_index = port - edid->chamelium->ports; in chamelium_edid_get_raw()
665 void chamelium_port_set_edid(struct chamelium *chamelium, in chamelium_port_set_edid() argument
674 port_index = port - chamelium->ports; in chamelium_port_set_edid()
678 edid_id = chamelium_upload_edid(chamelium, raw_edid); in chamelium_port_set_edid()
685 xmlrpc_DECREF(chamelium_rpc(chamelium, NULL, "ApplyEdid", "(ii)", in chamelium_port_set_edid()
700 void chamelium_port_set_ddc_state(struct chamelium *chamelium, in chamelium_port_set_ddc_state() argument
707 xmlrpc_DECREF(chamelium_rpc(chamelium, NULL, "SetDdcState", "(ib)", in chamelium_port_set_ddc_state()
721 bool chamelium_port_get_ddc_state(struct chamelium *chamelium, in chamelium_port_get_ddc_state() argument
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()
746 void chamelium_port_get_resolution(struct chamelium *chamelium, in chamelium_port_get_resolution() argument
752 res = chamelium_rpc(chamelium, port, "DetectResolution", "(i)", 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()
771 static bool chamelium_supports_method(struct chamelium *chamelium, in chamelium_supports_method() argument
776 res = __chamelium_rpc(chamelium, NULL, name, "()"); 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()
787 bool chamelium_supports_get_video_params(struct chamelium *chamelium) in chamelium_supports_get_video_params() argument
789 return chamelium_supports_method(chamelium, "GetVideoParams"); in chamelium_supports_get_video_params()
792 static void read_int_from_xml_struct(struct chamelium *chamelium, in read_int_from_xml_struct() argument
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()
806 static void video_params_from_xml(struct chamelium *chamelium, in video_params_from_xml() argument
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()
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()
821 read_int_from_xml_struct(chamelium, res, "hsync_offset", in video_params_from_xml()
823 read_int_from_xml_struct(chamelium, res, "hsync_width", in video_params_from_xml()
825 read_int_from_xml_struct(chamelium, res, "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()
829 read_int_from_xml_struct(chamelium, res, "vsync_offset", in video_params_from_xml()
831 read_int_from_xml_struct(chamelium, res, "vsync_width", in video_params_from_xml()
833 read_int_from_xml_struct(chamelium, res, "vsync_polarity", in video_params_from_xml()
837 void chamelium_port_get_video_params(struct chamelium *chamelium, in chamelium_port_get_video_params() argument
843 res = chamelium_rpc(chamelium, NULL, "GetVideoParams", "(i)", port->id); in chamelium_port_get_video_params()
844 video_params_from_xml(chamelium, res, params); in chamelium_port_get_video_params()
849 static void chamelium_get_captured_resolution(struct chamelium *chamelium, in chamelium_get_captured_resolution() argument
854 res = chamelium_rpc(chamelium, NULL, "GetCapturedResolution", "()"); in chamelium_get_captured_resolution()
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()
866 static struct chamelium_frame_dump *frame_from_xml(struct chamelium *chamelium, in frame_from_xml() argument
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()
909 struct chamelium_frame_dump *chamelium_port_dump_pixels(struct chamelium *chamelium, in chamelium_port_dump_pixels() argument
917 res = chamelium_rpc(chamelium, port, "DumpPixels", in chamelium_port_dump_pixels()
920 chamelium->capturing_port = port; in chamelium_port_dump_pixels()
922 frame = frame_from_xml(chamelium, res); in chamelium_port_dump_pixels()
928 static void crc_from_xml(struct chamelium *chamelium, in crc_from_xml() argument
934 out->n_words = xmlrpc_array_size(&chamelium->env, xml_crc); 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()
972 igt_crc_t *chamelium_get_crc_for_area(struct chamelium *chamelium, in chamelium_get_crc_for_area() argument
979 res = chamelium_rpc(chamelium, port, "ComputePixelChecksum", in chamelium_get_crc_for_area()
982 chamelium->capturing_port = port; in chamelium_get_crc_for_area()
984 crc_from_xml(chamelium, res, ret); in chamelium_get_crc_for_area()
1014 void chamelium_start_capture(struct chamelium *chamelium, in chamelium_start_capture() argument
1017 xmlrpc_DECREF(chamelium_rpc(chamelium, port, "StartCapturingVideo", in chamelium_start_capture()
1020 chamelium->capturing_port = port; in chamelium_start_capture()
1033 void chamelium_stop_capture(struct chamelium *chamelium, int frame_count) in chamelium_stop_capture() argument
1035 xmlrpc_DECREF(chamelium_rpc(chamelium, NULL, "StopCapturingVideo", in chamelium_stop_capture()
1063 void chamelium_capture(struct chamelium *chamelium, struct chamelium_port *port, in chamelium_capture() argument
1066 xmlrpc_DECREF(chamelium_rpc(chamelium, port, "CaptureVideo", in chamelium_capture()
1069 chamelium->capturing_port = port; in chamelium_capture()
1081 igt_crc_t *chamelium_read_captured_crcs(struct chamelium *chamelium, in chamelium_read_captured_crcs() argument
1088 res = chamelium_rpc(chamelium, NULL, "GetCapturedChecksums", "(in)", 0); in chamelium_read_captured_crcs()
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()
1096 crc_from_xml(chamelium, elem, &ret[i]); in chamelium_read_captured_crcs()
1118 struct chamelium_frame_dump *chamelium_read_captured_frame(struct chamelium *chamelium, in chamelium_read_captured_frame() argument
1124 res = chamelium_rpc(chamelium, NULL, "ReadCapturedFrame", "(i)", index); in chamelium_read_captured_frame()
1125 frame = frame_from_xml(chamelium, res); in chamelium_read_captured_frame()
1140 int chamelium_get_captured_frame_count(struct chamelium *chamelium) in chamelium_get_captured_frame_count() argument
1145 res = chamelium_rpc(chamelium, NULL, "GetCapturedFrameCount", "()"); in chamelium_get_captured_frame_count()
1146 xmlrpc_read_int(&chamelium->env, res, &ret); in chamelium_get_captured_frame_count()
1152 bool chamelium_supports_get_last_infoframe(struct chamelium *chamelium) in chamelium_supports_get_last_infoframe() argument
1154 return chamelium_supports_method(chamelium, "GetLastInfoFrame"); in chamelium_supports_get_last_infoframe()
1174 chamelium_get_last_infoframe(struct chamelium *chamelium, in chamelium_get_last_infoframe() argument
1182 res = chamelium_rpc(chamelium, NULL, "GetLastInfoFrame", "(is)", 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()
1209 bool chamelium_supports_trigger_link_failure(struct chamelium *chamelium) in chamelium_supports_trigger_link_failure() argument
1211 return chamelium_supports_method(chamelium, "TriggerLinkFailure"); in chamelium_supports_trigger_link_failure()
1217 void chamelium_trigger_link_failure(struct chamelium *chamelium, in chamelium_trigger_link_failure() argument
1220 xmlrpc_DECREF(chamelium_rpc(chamelium, port, "TriggerLinkFailure", in chamelium_trigger_link_failure()
1224 bool chamelium_has_audio_support(struct chamelium *chamelium, in chamelium_has_audio_support() argument
1230 if (!chamelium_supports_method(chamelium, "GetAudioFormat")) { in chamelium_has_audio_support()
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()
1257 void chamelium_get_audio_channel_mapping(struct chamelium *chamelium, in chamelium_get_audio_channel_mapping() argument
1264 res = chamelium_rpc(chamelium, port, "GetAudioChannelMapping", "(i)", 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()
1276 static void audio_format_from_xml(struct chamelium *chamelium, in audio_format_from_xml() argument
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()
1320 void chamelium_get_audio_format(struct chamelium *chamelium, in chamelium_get_audio_format() argument
1326 res = chamelium_rpc(chamelium, port, "GetAudioFormat", "(i)", in chamelium_get_audio_format()
1328 audio_format_from_xml(chamelium, res, rate, channels); in chamelium_get_audio_format()
1346 void chamelium_start_capturing_audio(struct chamelium *chamelium, in chamelium_start_capturing_audio() argument
1352 res = chamelium_rpc(chamelium, port, "StartCapturingAudio", "(ib)", in chamelium_start_capturing_audio()
1368 struct chamelium_audio_file *chamelium_stop_capturing_audio(struct chamelium *chamelium, in chamelium_stop_capturing_audio() argument
1375 res = chamelium_rpc(chamelium, NULL, "StopCapturingAudio", "(i)", 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()
1386 audio_format_from_xml(chamelium, res_props, in chamelium_stop_capturing_audio()
1488 void chamelium_assert_frame_eq(const struct chamelium *chamelium, in chamelium_assert_frame_eq() argument
1498 fb_surface = igt_get_cairo_surface(chamelium->drm_fd, fb); in chamelium_assert_frame_eq()
1532 void chamelium_assert_crc_eq_or_dump(struct chamelium *chamelium, in chamelium_assert_crc_eq_or_dump() argument
1548 reference = igt_get_cairo_surface(chamelium->drm_fd, fb); in chamelium_assert_crc_eq_or_dump()
1551 frame = chamelium_read_captured_frame(chamelium, index); in chamelium_assert_crc_eq_or_dump()
1580 void chamelium_assert_frame_match_or_dump(struct chamelium *chamelium, in chamelium_assert_frame_match_or_dump() argument
1593 reference = igt_get_cairo_surface(chamelium->drm_fd, fb); in chamelium_assert_frame_match_or_dump()
1617 capture_crc = chamelium_get_crc_for_area(chamelium, port, 0, 0, in chamelium_assert_frame_match_or_dump()
1740 int chamelium_get_frame_limit(struct chamelium *chamelium, in chamelium_get_frame_limit() argument
1748 chamelium_port_get_resolution(chamelium, port, &w, &h); in chamelium_get_frame_limit()
1750 res = chamelium_rpc(chamelium, port, "GetMaxFrameLimit", "(iii)", in chamelium_get_frame_limit()
1753 xmlrpc_read_int(&chamelium->env, res, &ret); in chamelium_get_frame_limit()
1897 static unsigned int chamelium_get_port_type(struct chamelium *chamelium, in chamelium_get_port_type() argument
1904 res = chamelium_rpc(chamelium, NULL, "GetConnectorType", in chamelium_get_port_type()
1907 xmlrpc_read_string(&chamelium->env, res, &port_type_str); in chamelium_get_port_type()
1925 static bool chamelium_has_video_support(struct chamelium *chamelium, in chamelium_has_video_support() argument
1931 res = chamelium_rpc(chamelium, NULL, "HasVideoSupport", "(i)", port_id); in chamelium_has_video_support()
1932 xmlrpc_read_bool(&chamelium->env, res, &has_video_support); in chamelium_has_video_support()
1943 static size_t chamelium_get_video_ports(struct chamelium *chamelium, in chamelium_get_video_ports() argument
1950 res = chamelium_rpc(chamelium, NULL, "GetSupportedInputs", "()"); in chamelium_get_video_ports()
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()
1957 if (!chamelium_has_video_support(chamelium, port_id)) in chamelium_get_video_ports()
1969 static bool chamelium_read_port_mappings(struct chamelium *chamelium, in chamelium_read_port_mappings() argument
1990 chamelium->port_count++; in chamelium_read_port_mappings()
1992 igt_assert(chamelium->port_count <= CHAMELIUM_MAX_PORTS); in chamelium_read_port_mappings()
2003 port = &chamelium->ports[port_i++]; in chamelium_read_port_mappings()
2015 port->type = chamelium_get_port_type(chamelium, port); in chamelium_read_port_mappings()
2133 static bool chamelium_autodiscover(struct chamelium *chamelium, int drm_fd) in chamelium_autodiscover() argument
2150 candidate_ports_len = chamelium_get_video_ports(chamelium, in chamelium_autodiscover()
2157 edid = chamelium_new_edid(chamelium, igt_kms_get_base_edid()); 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()
2180 chamelium_port_set_edid(chamelium, port, edid); in chamelium_autodiscover()
2181 chamelium_plug(chamelium, port); in chamelium_autodiscover()
2203 for (j = 0; j < chamelium->port_count; j++) { in chamelium_autodiscover()
2204 port = &chamelium->ports[j]; in chamelium_autodiscover()
2244 port = &chamelium->ports[chamelium->port_count]; in chamelium_autodiscover()
2245 chamelium->port_count++; in chamelium_autodiscover()
2248 port->type = chamelium_get_port_type(chamelium, port); in chamelium_autodiscover()
2266 static bool chamelium_read_config(struct chamelium *chamelium, int drm_fd) in chamelium_read_config() argument
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()
2283 if (!chamelium_read_port_mappings(chamelium, drm_fd)) { in chamelium_read_config()
2286 return chamelium_autodiscover(chamelium, drm_fd); in chamelium_read_config()
2296 void chamelium_reset(struct chamelium *chamelium) in chamelium_reset() argument
2299 xmlrpc_DECREF(chamelium_rpc(chamelium, NULL, "Reset", "()")); in chamelium_reset()
2324 struct chamelium *chamelium_init(int drm_fd) in chamelium_init()
2326 struct chamelium *chamelium = malloc(sizeof(struct chamelium)); in chamelium_init() local
2328 if (!chamelium) in chamelium_init()
2337 memset(chamelium, 0, sizeof(*chamelium)); in chamelium_init()
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()
2352 if (!chamelium_read_config(chamelium, drm_fd)) in chamelium_init()
2355 cleanup_instance = chamelium; in chamelium_init()
2358 return chamelium; in chamelium_init()
2361 xmlrpc_env_clean(&chamelium->env); in chamelium_init()
2362 free(chamelium); in chamelium_init()
2377 void chamelium_deinit(struct chamelium *chamelium) in chamelium_deinit() argument
2386 chamelium_reset(chamelium); in chamelium_deinit()
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()
2394 chamelium_destroy_edid(chamelium, pos->ids[i]); 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()
2407 free(chamelium); in chamelium_deinit()