Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Lyude Paul <lyude@redhat.com>
To: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH i-g-t 3/4] tests/chamelium: Only initialize igt_display once
Date: Fri, 17 Nov 2017 19:05:37 -0500	[thread overview]
Message-ID: <1510963537.22441.3.camel@redhat.com> (raw)
In-Reply-To: <20171116124522.4673-3-maarten.lankhorst@linux.intel.com>

Reviewed-by: Lyude Paul <lyude@redhat.com>

On Thu, 2017-11-16 at 13:45 +0100, Maarten Lankhorst wrote:
> Instead of first calling kmstest_unset_all_crtcs, and calling
> igt_display_init for each test, use igt_display_reset to reset
> igt_display between tests, and use atomic commit to disable all
> unused crtcs in enable_output().
> 
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> ---
>  tests/chamelium.c | 45 ++++++++++++---------------------------------
>  1 file changed, 12 insertions(+), 33 deletions(-)
> 
> diff --git a/tests/chamelium.c b/tests/chamelium.c
> index d4a185e76873..8855a8300049 100644
> --- a/tests/chamelium.c
> +++ b/tests/chamelium.c
> @@ -33,6 +33,7 @@
>  typedef struct {
>  	struct chamelium *chamelium;
>  	struct chamelium_port **ports;
> +	igt_display_t display;
>  	int port_count;
>  
>  	int drm_fd;
> @@ -409,9 +410,9 @@ test_suspend_resume_edid_change(data_t *data, struct
> chamelium_port *port,
>  
>  static igt_output_t *
>  prepare_output(data_t *data,
> -	       igt_display_t *display,
>  	       struct chamelium_port *port)
>  {
> +	igt_display_t *display = &data->display;
>  	igt_output_t *output;
>  	drmModeRes *res;
>  	drmModeConnector *connector =
> @@ -420,7 +421,6 @@ prepare_output(data_t *data,
>  	bool found = false;
>  
>  	igt_assert(res = drmModeGetResources(data->drm_fd));
> -	kmstest_unset_all_crtcs(data->drm_fd, res);
>  
>  	/* The chamelium's default EDID has a lot of resolutions, way more
> then
>  	 * we need to test
> @@ -430,11 +430,9 @@ prepare_output(data_t *data,
>  	chamelium_plug(data->chamelium, port);
>  	wait_for_connector(data, port, DRM_MODE_CONNECTED);
>  
> -	igt_display_init(display, data->drm_fd);
> -	output = igt_output_from_connector(display, connector);
> +	igt_display_reset(display);
>  
> -	igt_assert(kmstest_probe_connector_config(
> -		data->drm_fd, connector->connector_id, ~0, &output-
> >config));
> +	output = igt_output_from_connector(display, connector);
>  
>  	for_each_pipe(display, pipe) {
>  		if (!igt_pipe_connector_valid(pipe, output))
> @@ -477,7 +475,7 @@ enable_output(data_t *data,
>  	igt_pipe_obj_replace_prop_blob(primary->pipe, IGT_CRTC_GAMMA_LUT,
> NULL, 0);
>  	igt_pipe_obj_replace_prop_blob(primary->pipe, IGT_CRTC_CTM, NULL,
> 0);
>  
> -	igt_display_commit(display);
> +	igt_display_commit2(display, COMMIT_ATOMIC);
>  
>  	if (chamelium_port_get_type(port) == DRM_MODE_CONNECTOR_VGA)
>  		usleep(250000);
> @@ -485,25 +483,10 @@ enable_output(data_t *data,
>  	drmModeFreeConnector(connector);
>  }
>  
> -static void
> -disable_output(data_t *data,
> -	       struct chamelium_port *port,
> -	       igt_output_t *output)
> -{
> -	igt_display_t *display = output->display;
> -	igt_plane_t *primary = igt_output_get_plane_type(output,
> DRM_PLANE_TYPE_PRIMARY);
> -	igt_assert(primary);
> -
> -	/* Disable the display */
> -	igt_plane_set_fb(primary, NULL);
> -	igt_display_commit(display);
> -}
> -
>  static void
>  test_display_crc(data_t *data, struct chamelium_port *port, int count,
>  		 bool fast)
>  {
> -	igt_display_t display;
>  	igt_output_t *output;
>  	igt_plane_t *primary;
>  	igt_crc_t *crc;
> @@ -517,7 +500,7 @@ test_display_crc(data_t *data, struct chamelium_port
> *port, int count,
>  
>  	reset_state(data, port);
>  
> -	output = prepare_output(data, &display, port);
> +	output = prepare_output(data, port);
>  	connector = chamelium_port_get_connector(data->chamelium, port,
> false);
>  	primary = igt_output_get_plane_type(output,
> DRM_PLANE_TYPE_PRIMARY);
>  	igt_assert(primary);
> @@ -561,18 +544,15 @@ test_display_crc(data_t *data, struct chamelium_port
> *port, int count,
>  		free(expected_crc);
>  		free(crc);
>  
> -		disable_output(data, port, output);
>  		igt_remove_fb(data->drm_fd, &fb);
>  	}
>  
>  	drmModeFreeConnector(connector);
> -	igt_display_fini(&display);
>  }
>  
>  static void
>  test_display_frame_dump(data_t *data, struct chamelium_port *port)
>  {
> -	igt_display_t display;
>  	igt_output_t *output;
>  	igt_plane_t *primary;
>  	struct igt_fb fb;
> @@ -583,7 +563,7 @@ test_display_frame_dump(data_t *data, struct
> chamelium_port *port)
>  
>  	reset_state(data, port);
>  
> -	output = prepare_output(data, &display, port);
> +	output = prepare_output(data, port);
>  	connector = chamelium_port_get_connector(data->chamelium, port,
> false);
>  	primary = igt_output_get_plane_type(output,
> DRM_PLANE_TYPE_PRIMARY);
>  	igt_assert(primary);
> @@ -608,18 +588,15 @@ test_display_frame_dump(data_t *data, struct
> chamelium_port *port)
>  			chamelium_destroy_frame_dump(frame);
>  		}
>  
> -		disable_output(data, port, output);
>  		igt_remove_fb(data->drm_fd, &fb);
>  	}
>  
>  	drmModeFreeConnector(connector);
> -	igt_display_fini(&display);
>  }
>  
>  static void
>  test_analog_frame_dump(data_t *data, struct chamelium_port *port)
>  {
> -	igt_display_t display;
>  	igt_output_t *output;
>  	igt_plane_t *primary;
>  	struct igt_fb fb;
> @@ -631,7 +608,7 @@ test_analog_frame_dump(data_t *data, struct
> chamelium_port *port)
>  
>  	reset_state(data, port);
>  
> -	output = prepare_output(data, &display, port);
> +	output = prepare_output(data, port);
>  	connector = chamelium_port_get_connector(data->chamelium, port,
> false);
>  	primary = igt_output_get_plane_type(output,
> DRM_PLANE_TYPE_PRIMARY);
>  	igt_assert(primary);
> @@ -666,12 +643,10 @@ test_analog_frame_dump(data_t *data, struct
> chamelium_port *port)
>  
>  		chamelium_destroy_frame_dump(frame);
>  
> -		disable_output(data, port, output);
>  		igt_remove_fb(data->drm_fd, &fb);
>  	}
>  
>  	drmModeFreeConnector(connector);
> -	igt_display_fini(&display);
>  }
>  
>  static void
> @@ -773,6 +748,9 @@ igt_main
>  
>  		/* So fbcon doesn't try to reprobe things itself */
>  		kmstest_set_vt_graphics_mode();
> +
> +		igt_display_init(&data.display, data.drm_fd);
> +		igt_require(data.display.is_atomic);
>  	}
>  
>  	igt_subtest_group {
> @@ -952,6 +930,7 @@ igt_main
>  	}
>  
>  	igt_fixture {
> +		igt_display_fini(&data.display);
>  		close(data.drm_fd);
>  	}
>  }
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2017-11-18  0:05 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-16 12:45 [PATCH i-g-t 1/4] lib/igt_kms: Add igt_display_reset function Maarten Lankhorst
2017-11-16 12:45 ` [PATCH i-g-t 2/4] lib/igt_kms: Make igt_output_from_connector probe all outputs Maarten Lankhorst
2017-11-18  0:14   ` Lyude Paul
2017-11-16 12:45 ` [PATCH i-g-t 3/4] tests/chamelium: Only initialize igt_display once Maarten Lankhorst
2017-11-18  0:05   ` Lyude Paul [this message]
2017-11-16 12:45 ` [PATCH i-g-t 4/4] tests: Rename chamelium to kms_chamelium Maarten Lankhorst
2017-11-18  0:42   ` Lyude Paul
2017-11-21 14:13     ` Maarten Lankhorst
2017-11-16 13:44 ` ✗ Fi.CI.BAT: failure for series starting with [1/4] lib/igt_kms: Add igt_display_reset function Patchwork
2017-11-16 16:07 ` [PATCH i-g-t] lib/igt_kms: Add igt_display_reset function, v2 Maarten Lankhorst
2017-11-16 18:42   ` [PATCH i-g-t] lib/igt_kms: Add igt_display_reset function, v3 Maarten Lankhorst
2017-11-16 16:23 ` ✗ Fi.CI.BAT: failure for series starting with lib/igt_kms: Add igt_display_reset function, v2. (rev2) Patchwork
2017-11-16 19:03 ` ✓ Fi.CI.BAT: success for series starting with lib/igt_kms: Add igt_display_reset function, v3. (rev3) Patchwork
2017-11-16 19:41 ` ✓ Fi.CI.IGT: " Patchwork
2017-11-18  0:00 ` [PATCH i-g-t 1/4] lib/igt_kms: Add igt_display_reset function Lyude Paul

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1510963537.22441.3.camel@redhat.com \
    --to=lyude@redhat.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=maarten.lankhorst@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox