All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Kahola, Mika" <mika.kahola@intel.com>
To: "juhapekka.heikkila@gmail.com" <juhapekka.heikkila@gmail.com>,
	"igt-dev@lists.freedesktop.org" <igt-dev@lists.freedesktop.org>,
	"Lisovskiy, Stanislav" <stanislav.lisovskiy@intel.com>
Subject: Re: [igt-dev] [PATCH i-g-t] tests/kms_plane_multiple: before going testing check how many planes are allowed
Date: Tue, 4 Jun 2019 10:26:30 +0000	[thread overview]
Message-ID: <980210640b5107a465a070356e1e92854b94939e.camel@intel.com> (raw)
In-Reply-To: <6789380751d548bb7d505aa1a2c048bfa06c3b5d.camel@intel.com>

On Wed, 2019-05-29 at 13:39 +0000, Lisovskiy, Stanislav wrote:
> On Fri, 2019-04-05 at 17:55 +0300, Juha-Pekka Heikkila wrote:
> 
> 
> With current failures we need this fixed.
> 
> Reviewed-by: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>
Patch is now merged to IGT. Thanks for the patch and a review!

Cheers,
Mika

> 
> > before start testing try out how many planes kernel will
> > allow simultaneously to be used.
> > 
> > v2 (Jose Souza, Daniel Vetter): Fix resource leaks. Randomize
> > used planes.
> > 
> > Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
> > ---
> >  tests/kms_plane_multiple.c | 88
> > +++++++++++++++++++++++++++++++++++++---------
> >  1 file changed, 71 insertions(+), 17 deletions(-)
> > 
> > diff --git a/tests/kms_plane_multiple.c
> > b/tests/kms_plane_multiple.c
> > index bfaeede..f2707dc 100644
> > --- a/tests/kms_plane_multiple.c
> > +++ b/tests/kms_plane_multiple.c
> > @@ -80,16 +80,6 @@ static void test_fini(data_t *data, igt_output_t
> > *output, int n_planes)
> >  {
> >  	igt_pipe_crc_stop(data->pipe_crc);
> >  
> > -	for (int i = 0; i < n_planes; i++) {
> > -		igt_plane_t *plane = data->plane[i];
> > -		if (!plane)
> > -			continue;
> > -		if (plane->type == DRM_PLANE_TYPE_PRIMARY)
> > -			continue;
> > -		igt_plane_set_fb(plane, NULL);
> > -		data->plane[i] = NULL;
> > -	}
> > -
> >  	/* reset the constraint on the pipe */
> >  	igt_output_set_pipe(output, PIPE_ANY);
> >  
> > @@ -99,7 +89,8 @@ static void test_fini(data_t *data, igt_output_t
> > *output, int n_planes)
> >  	free(data->plane);
> >  	data->plane = NULL;
> >  
> > -	igt_remove_fb(data->drm_fd, data->fb);
> > +	free(data->fb);
> > +	data->fb = NULL;
> >  
> >  	igt_display_reset(&data->display);
> >  }
> > @@ -195,6 +186,7 @@ prepare_planes(data_t *data, enum pipe pipe_id,
> > color_t *color,
> >  	int *y;
> >  	int *size;
> >  	int i;
> > +	int* suffle;
> >  
> >  	igt_output_set_pipe(output, pipe_id);
> >  	primary = igt_output_get_plane_type(output,
> > DRM_PLANE_TYPE_PRIMARY);
> > @@ -206,6 +198,34 @@ prepare_planes(data_t *data, enum pipe
> > pipe_id,
> > color_t *color,
> >  	igt_assert_f(y, "Failed to allocate %ld bytes for variable
> > y\n", (long int) (pipe->n_planes * sizeof(*y)));
> >  	size = malloc(pipe->n_planes * sizeof(*size));
> >  	igt_assert_f(size, "Failed to allocate %ld bytes for variable
> > size\n", (long int) (pipe->n_planes * sizeof(*size)));
> > +	suffle = malloc(pipe->n_planes * sizeof(*suffle));
> > +	igt_assert_f(suffle, "Failed to allocate %ld bytes for variable
> > size\n", (long int) (pipe->n_planes * sizeof(*suffle)));
> > +
> > +	for (i = 0; i < pipe->n_planes; i++)
> > +		suffle[i] = i;
> > +
> > +	/*
> > +	 * suffle table for planes. using rand() should keep it
> > +	 * 'randomized in expected way'
> > +	 */
> > +	for (i = 0; i < 256; i++) {
> > +		int n, m;
> > +		int a, b;
> > +
> > +		n = rand() % (pipe->n_planes-1);
> > +		m = rand() % (pipe->n_planes-1);
> > +
> > +		/*
> > +		 * keep primary plane at its place for test's sake.
> > +		 */
> > +		if(n == primary->index || m == primary->index)
> > +			continue;
> > +
> > +		a = suffle[n];
> > +		b = suffle[m];
> > +		suffle[n] = b;
> > +		suffle[m] = a;
> > +	}
> >  
> >  	mode = igt_output_get_mode(output);
> >  
> > @@ -213,7 +233,11 @@ prepare_planes(data_t *data, enum pipe
> > pipe_id,
> > color_t *color,
> >  	x[primary->index] = 0;
> >  	y[primary->index] = 0;
> >  	for (i = 0; i < max_planes; i++) {
> > -		igt_plane_t *plane = igt_output_get_plane(output, i);
> > +		/*
> > +		 * Here is made assumption primary plane will have
> > +		 * index zero.
> > +		 */
> > +		igt_plane_t *plane = igt_output_get_plane(output,
> > suffle[i]);
> >  		uint32_t plane_format;
> >  		uint64_t plane_tiling;
> >  
> > @@ -251,6 +275,10 @@ prepare_planes(data_t *data, enum pipe
> > pipe_id,
> > color_t *color,
> >  	create_fb_for_mode_position(data, output, mode, color, x, y,
> >  				    size, size, tiling, max_planes);
> >  	igt_plane_set_fb(data->plane[primary->index], &data-
> > > fb[primary->index]);
> > 
> > +	free((void*)x);
> > +	free((void*)y);
> > +	free((void*)size);
> > +	free((void*)suffle);
> >  }
> >  
> >  static void
> > @@ -260,7 +288,9 @@ test_plane_position_with_output(data_t *data,
> > enum pipe pipe,
> >  {
> >  	color_t blue  = { 0.0f, 0.0f, 1.0f };
> >  	igt_crc_t crc;
> > +	igt_plane_t *plane;
> >  	int i;
> > +	int err, c = 0;
> >  	int iterations = opt.iterations < 1 ? 1 : opt.iterations;
> >  	bool loop_forever;
> >  	char info[256];
> > @@ -274,22 +304,46 @@ test_plane_position_with_output(data_t *data,
> > enum pipe pipe,
> >  			iterations, iterations > 1 ? "iterations" :
> > "iteration");
> >  	}
> >  
> > -	igt_info("Testing connector %s using pipe %s with %d planes %s
> > with seed %d\n",
> > -		 igt_output_name(output), kmstest_pipe_name(pipe),
> > n_planes,
> > -		 info, opt.seed);
> > -
> >  	test_init(data, pipe, n_planes);
> >  
> >  	test_grab_crc(data, output, pipe, &blue, tiling);
> >  
> > +	/*
> > +	 * Find out how many planes are allowed simultaneously
> > +	 */
> > +	do {
> > +		c++;
> > +		prepare_planes(data, pipe, &blue, tiling, c, output);
> > +		err = igt_display_try_commit2(&data->display,
> > COMMIT_ATOMIC);
> > +
> > +		for_each_plane_on_pipe(&data->display, pipe, plane)
> > +			igt_plane_set_fb(plane, NULL);
> > +
> > +		for (int x = 0; x < c; x++)
> > +			igt_remove_fb(data->drm_fd, &data->fb[x]);
> > +	} while (!err && c < n_planes);
> > +
> > +	if(err)
> > +		c--;
> > +
> > +	igt_info("Testing connector %s using pipe %s with %d planes %s
> > with seed %d\n",
> > +		 igt_output_name(output), kmstest_pipe_name(pipe), c,
> > +		 info, opt.seed);
> > +
> >  	i = 0;
> >  	while (i < iterations || loop_forever) {
> > -		prepare_planes(data, pipe, &blue, tiling, n_planes,
> > output);
> > +		prepare_planes(data, pipe, &blue, tiling, c, output);
> >  
> >  		igt_display_commit2(&data->display, COMMIT_ATOMIC);
> >  
> >  		igt_pipe_crc_get_current(data->display.drm_fd, data-
> > > pipe_crc, &crc);
> > 
> >  
> > +		for_each_plane_on_pipe(&data->display, pipe, plane)
> > +			igt_plane_set_fb(plane, NULL);
> > +
> > +		for (int x = 0; x < c; x++)
> > +			igt_remove_fb(data->drm_fd, &data->fb[x]);
> > +
> >  		igt_assert_crc_equal(&data->ref_crc, &crc);
> >  
> >  		i++;
> 
> _______________________________________________
> igt-dev mailing list
> igt-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/igt-dev
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

  reply	other threads:[~2019-06-04 10:26 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-05 14:55 [igt-dev] [PATCH i-g-t] tests/kms_plane_multiple: before going testing check how many planes are allowed Juha-Pekka Heikkila
2019-04-05 16:16 ` [igt-dev] ✓ Fi.CI.BAT: success for tests/kms_plane_multiple: Before going testing check how many planes are allowed (rev2) Patchwork
2019-04-06 14:19 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2019-04-09  1:29 ` [igt-dev] [PATCH i-g-t] tests/kms_plane_multiple: before going testing check how many planes are allowed Souza, Jose
2019-04-09 11:47   ` Juha-Pekka Heikkila
2019-04-10 20:06     ` Souza, Jose
2019-04-11 15:36       ` Juha-Pekka Heikkila
2019-04-11  8:35     ` Maarten Lankhorst
2019-04-09 12:47   ` Lisovskiy, Stanislav
2019-04-10 19:55     ` Souza, Jose
2019-04-11  6:38       ` Lisovskiy, Stanislav
2019-05-29 13:39 ` Lisovskiy, Stanislav
2019-06-04 10:26   ` Kahola, Mika [this message]
  -- strict thread matches above, loose matches on Subject: below --
2019-04-02 14:42 [igt-dev] [PATCH i-g-t] tests/kms_plane_multiple: Before " Juha-Pekka Heikkila
2019-04-02 18:22 ` Souza, Jose
2019-04-03 11:26   ` Juha-Pekka Heikkila
2019-04-03  8:38 ` Daniel Vetter
2019-04-03 12:23   ` Juha-Pekka Heikkila

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=980210640b5107a465a070356e1e92854b94939e.camel@intel.com \
    --to=mika.kahola@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=juhapekka.heikkila@gmail.com \
    --cc=stanislav.lisovskiy@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.