Re: [PATCH i-g-t] lib/igt_chamelium: Remove any special handling for the connector FSM

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 2017-08-04 at 17:10 +0300, Paul Kocialkowski wrote:
> No specific treatment should be required for handling the connector
> FSM,
> since the chamelium-side daemon will automatically send an HPD event
> to
> reset the source.
> 
> The event is sufficient to make the receiver on the chamelium consider
> the input as stable after it. On the other hand, toggling DPMS was
> found
> to sometimes confuse the receiver so that it does not consider the
> input
> as stable at any point. Doing nothing special instead works in all
> cases.
> 
> This issue can be witnessed with i915 when drm debugging is enabled
> and
> leads to DP frame-related tests failing on the test farm.

It turns out the receiver was (most likely) confused by the extra reset
that was taking place in enable_output.

Now that it was removed, DP FSM does not fail anymore in this case, so
let's keep this as-is and forget about this change.

> Signed-off-by: Paul Kocialkowski <paul.kocialkowski@xxxxxxxxxxxxxxx>
> ---
>  lib/igt_chamelium.c | 113 ++++++++++++-------------------------------
> ---------
>  1 file changed, 25 insertions(+), 88 deletions(-)
> 
> diff --git a/lib/igt_chamelium.c b/lib/igt_chamelium.c
> index dcd8855f..4cea5fdb 100644
> --- a/lib/igt_chamelium.c
> +++ b/lib/igt_chamelium.c
> @@ -209,57 +209,13 @@ void chamelium_destroy_frame_dump(struct
> chamelium_frame_dump *dump)
>  	free(dump);
>  }
>  
> -struct fsm_monitor_args {
> -	struct chamelium *chamelium;
> -	struct chamelium_port *port;
> -	struct udev_monitor *mon;
> -};
> -
> -/*
> - * Whenever resolutions or other factors change with the display
> output, the
> - * Chamelium's display receivers need to be fully reset in order to
> perform any
> - * frame-capturing related tasks. This requires cutting off the
> display then
> - * turning it back on, and is indicated by the Chamelium sending
> hotplug events
> - */
> -static void *chamelium_fsm_mon(void *data)
> -{
> -	struct fsm_monitor_args *args = data;
> -	drmModeConnector *connector;
> -	int drm_fd = args->chamelium->drm_fd;
> -
> -	/*
> -	 * Wait for the chamelium to try unplugging the connector,
> otherwise
> -	 * the thread calling chamelium_rpc will kill us
> -	 */
> -	igt_hotplug_detected(args->mon, 60);
> -
> -	/*
> -	 * Just in case the RPC call being executed returns before we
> complete
> -	 * the FSM modesetting sequence, so we don't leave the
> display in a bad
> -	 * state.
> -	 */
> -	pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL);
> -
> -	igt_debug("Chamelium needs FSM, handling\n");
> -	connector = chamelium_port_get_connector(args->chamelium,
> args->port,
> -						 false);
> -	kmstest_set_connector_dpms(drm_fd, connector,
> DRM_MODE_DPMS_OFF);
> -	kmstest_set_connector_dpms(drm_fd, connector,
> DRM_MODE_DPMS_ON);
> -
> -	drmModeFreeConnector(connector);
> -	return NULL;
> -}
> -
>  static xmlrpc_value *chamelium_rpc(struct chamelium *chamelium,
> -				   struct chamelium_port *fsm_port,
>  				   const char *method_name,
>  				   const char *format_str,
>  				   ...)
>  {
>  	xmlrpc_value *res;
>  	va_list va_args;
> -	struct fsm_monitor_args monitor_args;
> -	pthread_t fsm_thread_id;
>  
>  	/* Cleanup the last error, if any */
>  	if (chamelium->env.fault_occurred) {
> @@ -267,31 +223,12 @@ static xmlrpc_value *chamelium_rpc(struct
> chamelium *chamelium,
>  		xmlrpc_env_init(&chamelium->env);
>  	}
>  
> -	/* Unfortunately xmlrpc_client's event loop helpers are
> rather useless
> -	 * for implementing any sort of event loop, since they
> provide no way
> -	 * to poll for events other then the RPC response. This means
> in order
> -	 * to handle the chamelium attempting FSM, we have to fork
> into another
> -	 * thread and have that handle hotplugging displays
> -	 */
> -	if (fsm_port) {
> -		monitor_args.chamelium = chamelium;
> -		monitor_args.port = fsm_port;
> -		monitor_args.mon = igt_watch_hotplug();
> -		pthread_create(&fsm_thread_id, NULL,
> chamelium_fsm_mon,
> -			       &monitor_args);
> -	}
> -
>  	va_start(va_args, format_str);
>  	xmlrpc_client_call2f_va(&chamelium->env, chamelium->client,
>  				chamelium->url, method_name,
> format_str, &res,
>  				va_args);
>  	va_end(va_args);
>  
> -	if (fsm_port) {
> -		pthread_cancel(fsm_thread_id);
> -		igt_cleanup_hotplug(monitor_args.mon);
> -	}
> -
>  	igt_assert_f(!chamelium->env.fault_occurred,
>  		     "Chamelium RPC call failed: %s\n",
>  		     chamelium->env.fault_string);
> @@ -310,7 +247,7 @@ static xmlrpc_value *chamelium_rpc(struct
> chamelium *chamelium,
>  void chamelium_plug(struct chamelium *chamelium, struct
> chamelium_port *port)
>  {
>  	igt_debug("Plugging %s\n", port->name);
> -	xmlrpc_DECREF(chamelium_rpc(chamelium, NULL, "Plug", "(i)",
> port->id));
> +	xmlrpc_DECREF(chamelium_rpc(chamelium, "Plug", "(i)", port-
> >id));
>  }
>  
>  /**
> @@ -324,7 +261,7 @@ void chamelium_plug(struct chamelium *chamelium,
> struct chamelium_port *port)
>  void chamelium_unplug(struct chamelium *chamelium, struct
> chamelium_port *port)
>  {
>  	igt_debug("Unplugging port %s\n", port->name);
> -	xmlrpc_DECREF(chamelium_rpc(chamelium, NULL, "Unplug", "(i)",
> +	xmlrpc_DECREF(chamelium_rpc(chamelium, "Unplug", "(i)",
>  				    port->id));
>  }
>  
> @@ -344,7 +281,7 @@ bool chamelium_is_plugged(struct chamelium
> *chamelium,
>  	xmlrpc_value *res;
>  	xmlrpc_bool is_plugged;
>  
> -	res = chamelium_rpc(chamelium, NULL, "IsPlugged", "(i)",
> port->id);
> +	res = chamelium_rpc(chamelium, "IsPlugged", "(i)", port->id);
>  
>  	xmlrpc_read_bool(&chamelium->env, res, &is_plugged);
>  	xmlrpc_DECREF(res);
> @@ -373,7 +310,7 @@ bool chamelium_port_wait_video_input_stable(struct
> chamelium *chamelium,
>  
>  	igt_debug("Waiting for video input to stabalize on %s\n",
> port->name);
>  
> -	res = chamelium_rpc(chamelium, port, "WaitVideoInputStable",
> "(ii)",
> +	res = chamelium_rpc(chamelium, "WaitVideoInputStable",
> "(ii)",
>  			    port->id, timeout_secs);
>  
>  	xmlrpc_read_bool(&chamelium->env, res, &is_on);
> @@ -413,7 +350,7 @@ void chamelium_fire_hpd_pulses(struct chamelium
> *chamelium,
>  	for (i = 0; i < count; i++)
>  		xmlrpc_array_append_item(&chamelium->env,
> pulse_widths, width);
>  
> -	xmlrpc_DECREF(chamelium_rpc(chamelium, NULL,
> "FireMixedHpdPulses",
> +	xmlrpc_DECREF(chamelium_rpc(chamelium, "FireMixedHpdPulses",
>  				    "(iA)", port->id, pulse_widths));
>  
>  	xmlrpc_DECREF(width);
> @@ -446,7 +383,7 @@ void chamelium_fire_mixed_hpd_pulses(struct
> chamelium *chamelium,
>  	}
>  	va_end(args);
>  
> -	xmlrpc_DECREF(chamelium_rpc(chamelium, NULL,
> "FireMixedHpdPulses",
> +	xmlrpc_DECREF(chamelium_rpc(chamelium, "FireMixedHpdPulses",
>  				    "(iA)", port->id, pulse_widths));
>  
>  	xmlrpc_DECREF(pulse_widths);
> @@ -470,7 +407,7 @@ void chamelium_schedule_hpd_toggle(struct
> chamelium *chamelium,
>  	igt_debug("Scheduling HPD toggle on %s in %d ms\n", port-
> >name,
>  		  delay_ms);
>  
> -	xmlrpc_DECREF(chamelium_rpc(chamelium, NULL,
> "ScheduleHpdToggle",
> +	xmlrpc_DECREF(chamelium_rpc(chamelium, "ScheduleHpdToggle",
>  				    "(iii)", port->id, delay_ms,
> rising_edge));
>  }
>  
> @@ -490,7 +427,7 @@ int chamelium_new_edid(struct chamelium
> *chamelium, const unsigned char *edid)
>  	struct chamelium_edid *allocated_edid;
>  	int edid_id;
>  
> -	res = chamelium_rpc(chamelium, NULL, "CreateEdid", "(6)",
> +	res = chamelium_rpc(chamelium, "CreateEdid", "(6)",
>  			    edid, EDID_LENGTH);
>  
>  	xmlrpc_read_int(&chamelium->env, res, &edid_id);
> @@ -512,7 +449,7 @@ int chamelium_new_edid(struct chamelium
> *chamelium, const unsigned char *edid)
>  
>  static void chamelium_destroy_edid(struct chamelium *chamelium, int
> edid_id)
>  {
> -	xmlrpc_DECREF(chamelium_rpc(chamelium, NULL, "DestroyEdid",
> "(i)",
> +	xmlrpc_DECREF(chamelium_rpc(chamelium, "DestroyEdid", "(i)",
>  				    edid_id));
>  }
>  
> @@ -532,7 +469,7 @@ static void chamelium_destroy_edid(struct
> chamelium *chamelium, int edid_id)
>  void chamelium_port_set_edid(struct chamelium *chamelium,
>  			     struct chamelium_port *port, int
> edid_id)
>  {
> -	xmlrpc_DECREF(chamelium_rpc(chamelium, NULL, "ApplyEdid",
> "(ii)",
> +	xmlrpc_DECREF(chamelium_rpc(chamelium, "ApplyEdid", "(ii)",
>  				    port->id, edid_id));
>  }
>  
> @@ -554,7 +491,7 @@ void chamelium_port_set_ddc_state(struct chamelium
> *chamelium,
>  	igt_debug("%sabling DDC bus on %s\n",
>  		  enabled ? "En" : "Dis", port->name);
>  
> -	xmlrpc_DECREF(chamelium_rpc(chamelium, NULL, "SetDdcState",
> "(ib)",
> +	xmlrpc_DECREF(chamelium_rpc(chamelium, "SetDdcState", "(ib)",
>  				    port->id, enabled));
>  }
>  
> @@ -574,7 +511,7 @@ bool chamelium_port_get_ddc_state(struct chamelium
> *chamelium,
>  	xmlrpc_value *res;
>  	xmlrpc_bool enabled;
>  
> -	res = chamelium_rpc(chamelium, NULL, "IsDdcEnabled", "(i)",
> port->id);
> +	res = chamelium_rpc(chamelium, "IsDdcEnabled", "(i)", port-
> >id);
>  	xmlrpc_read_bool(&chamelium->env, res, &enabled);
>  
>  	xmlrpc_DECREF(res);
> @@ -599,7 +536,7 @@ void chamelium_port_get_resolution(struct
> chamelium *chamelium,
>  {
>  	xmlrpc_value *res, *res_x, *res_y;
>  
> -	res = chamelium_rpc(chamelium, port, "DetectResolution",
> "(i)",
> +	res = chamelium_rpc(chamelium, "DetectResolution", "(i)",
>  			    port->id);
>  
>  	xmlrpc_array_read_item(&chamelium->env, res, 0, &res_x);
> @@ -617,7 +554,7 @@ static void
> chamelium_get_captured_resolution(struct chamelium *chamelium,
>  {
>  	xmlrpc_value *res, *res_w, *res_h;
>  
> -	res = chamelium_rpc(chamelium, NULL, "GetCapturedResolution",
> "()");
> +	res = chamelium_rpc(chamelium, "GetCapturedResolution",
> "()");
>  
>  	xmlrpc_array_read_item(&chamelium->env, res, 0, &res_w);
>  	xmlrpc_array_read_item(&chamelium->env, res, 1, &res_h);
> @@ -680,7 +617,7 @@ struct chamelium_frame_dump
> *chamelium_port_dump_pixels(struct chamelium *chamel
>  	xmlrpc_value *res;
>  	struct chamelium_frame_dump *frame;
>  
> -	res = chamelium_rpc(chamelium, port, "DumpPixels",
> +	res = chamelium_rpc(chamelium, "DumpPixels",
>  			    (w && h) ? "(iiiii)" : "(innnn)",
>  			    port->id, x, y, w, h);
>  	chamelium->capturing_port = port;
> @@ -742,7 +679,7 @@ igt_crc_t *chamelium_get_crc_for_area(struct
> chamelium *chamelium,
>  	xmlrpc_value *res;
>  	igt_crc_t *ret = malloc(sizeof(igt_crc_t));
>  
> -	res = chamelium_rpc(chamelium, port, "ComputePixelChecksum",
> +	res = chamelium_rpc(chamelium, "ComputePixelChecksum",
>  			    (w && h) ? "(iiiii)" : "(innnn)",
>  			    port->id, x, y, w, h);
>  	chamelium->capturing_port = port;
> @@ -780,7 +717,7 @@ igt_crc_t *chamelium_get_crc_for_area(struct
> chamelium *chamelium,
>  void chamelium_start_capture(struct chamelium *chamelium,
>  			     struct chamelium_port *port, int x, int
> y, int w, int h)
>  {
> -	xmlrpc_DECREF(chamelium_rpc(chamelium, port,
> "StartCapturingVideo",
> +	xmlrpc_DECREF(chamelium_rpc(chamelium, "StartCapturingVideo",
>  				    (w && h) ? "(iiiii)" : "(innnn)",
>  				    port->id, x, y, w, h));
>  	chamelium->capturing_port = port;
> @@ -798,7 +735,7 @@ void chamelium_start_capture(struct chamelium
> *chamelium,
>   */
>  void chamelium_stop_capture(struct chamelium *chamelium, int
> frame_count)
>  {
> -	xmlrpc_DECREF(chamelium_rpc(chamelium, NULL,
> "StopCapturingVideo",
> +	xmlrpc_DECREF(chamelium_rpc(chamelium, "StopCapturingVideo",
>  				    "(i)", frame_count));
>  }
>  
> @@ -829,7 +766,7 @@ void chamelium_stop_capture(struct chamelium
> *chamelium, int frame_count)
>  void chamelium_capture(struct chamelium *chamelium, struct
> chamelium_port *port,
>  		       int x, int y, int w, int h, int frame_count)
>  {
> -	xmlrpc_DECREF(chamelium_rpc(chamelium, port, "CaptureVideo",
> +	xmlrpc_DECREF(chamelium_rpc(chamelium, "CaptureVideo",
>  				    (w && h) ? "(iiiiii)" :
> "(iinnnn)",
>  				    port->id, frame_count, x, y, w,
> h));
>  	chamelium->capturing_port = port;
> @@ -851,7 +788,7 @@ igt_crc_t *chamelium_read_captured_crcs(struct
> chamelium *chamelium,
>  	xmlrpc_value *res, *elem;
>  	int i;
>  
> -	res = chamelium_rpc(chamelium, NULL, "GetCapturedChecksums",
> "(in)", 0);
> +	res = chamelium_rpc(chamelium, "GetCapturedChecksums",
> "(in)", 0);
>  
>  	*frame_count = xmlrpc_array_size(&chamelium->env, res);
>  	ret = calloc(sizeof(igt_crc_t), *frame_count);
> @@ -887,7 +824,7 @@ struct chamelium_frame_dump
> *chamelium_read_captured_frame(struct chamelium *cha
>  	xmlrpc_value *res;
>  	struct chamelium_frame_dump *frame;
>  
> -	res = chamelium_rpc(chamelium, NULL, "ReadCapturedFrame",
> "(i)", index);
> +	res = chamelium_rpc(chamelium, "ReadCapturedFrame", "(i)",
> index);
>  	frame = frame_from_xml(chamelium, res);
>  	xmlrpc_DECREF(res);
>  
> @@ -908,7 +845,7 @@ int chamelium_get_captured_frame_count(struct
> chamelium *chamelium)
>  	xmlrpc_value *res;
>  	int ret;
>  
> -	res = chamelium_rpc(chamelium, NULL, "GetCapturedFrameCount",
> "()");
> +	res = chamelium_rpc(chamelium, "GetCapturedFrameCount",
> "()");
>  	xmlrpc_read_int(&chamelium->env, res, &ret);
>  
>  	xmlrpc_DECREF(res);
> @@ -1231,7 +1168,7 @@ int chamelium_get_frame_limit(struct chamelium
> *chamelium,
>  	if (!w && !h)
>  		chamelium_port_get_resolution(chamelium, port, &w,
> &h);
>  
> -	res = chamelium_rpc(chamelium, port, "GetMaxFrameLimit",
> "(iii)",
> +	res = chamelium_rpc(chamelium, "GetMaxFrameLimit", "(iii)",
>  			    port->id, w, h);
>  
>  	xmlrpc_read_int(&chamelium->env, res, &ret);
> @@ -1383,7 +1320,7 @@ static unsigned int
> chamelium_get_port_type(struct chamelium *chamelium,
>  	const char *port_type_str;
>  	unsigned int port_type;
>  
> -	res = chamelium_rpc(chamelium, NULL, "GetConnectorType",
> +	res = chamelium_rpc(chamelium, "GetConnectorType",
>  			    "(i)", port->id);
>  
>  	xmlrpc_read_string(&chamelium->env, res, &port_type_str);
> @@ -1524,7 +1461,7 @@ static bool chamelium_read_config(struct
> chamelium *chamelium, int drm_fd)
>  void chamelium_reset(struct chamelium *chamelium)
>  {
>  	igt_debug("Resetting the chamelium\n");
> -	xmlrpc_DECREF(chamelium_rpc(chamelium, NULL, "Reset", "()"));
> +	xmlrpc_DECREF(chamelium_rpc(chamelium, "Reset", "()"));
>  }
>  
>  static void chamelium_exit_handler(int sig)
-- 
Paul Kocialkowski <paul.kocialkowski@xxxxxxxxxxxxxxx>
Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo, Finland
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux