public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
To: "Souza, Jose" <jose.souza@intel.com>,
	"igt-dev@lists.freedesktop.org" <igt-dev@lists.freedesktop.org>
Cc: "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: Wed, 3 Apr 2019 14:26:14 +0300	[thread overview]
Message-ID: <63756a48-f90d-9333-5d34-7e0e4466689b@gmail.com> (raw)
In-Reply-To: <60168d80010b68c46291d42f6cae547345dc024a.camel@intel.com>

On 2.4.2019 21.22, Souza, Jose wrote:
> On Tue, 2019-04-02 at 17:42 +0300, Juha-Pekka Heikkila wrote:
>> Before start testing try out how many planes kernel will allow
>> simultaneously to be used.
>>
>> Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
>> ---
>>   tests/kms_plane_multiple.c | 32 ++++++++++++++++++++++++++------
>>   1 file changed, 26 insertions(+), 6 deletions(-)
>>
>> diff --git a/tests/kms_plane_multiple.c b/tests/kms_plane_multiple.c
>> index bfaeede..5107d9d 100644
>> --- a/tests/kms_plane_multiple.c
>> +++ b/tests/kms_plane_multiple.c
>> @@ -260,7 +260,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,17 +276,35 @@ 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);
>> +	} while (!err && c < n_planes);
>> +
>> +	if(err)
>> +		c--;
> 
> "do {} while()" does the job but "for()" would be better suitable:
> 
> for (planes_allowed = 0; planes_allowed < n_planes; planes_allowed++) {
> 	int err;
> 
> 	prepare_planes(data, pipe, &blue, tiling, planes_allowed,
> output);
> 	err = igt_display_try_commit2(&data->display, COMMIT_ATOMIC);
> 	if (err)
> 		break;
> }

I don't have strong preference on this issue. For such loops I normally 
use do{}..while() to make it certain loop is ran at least once in any 
situation and underline it for 'the next guy'.

Anyway your for loop wouldn't do the trick. I think it will become 
somewhat more complex and need different handling for 'all planes did 
work' and 'not all planes did work'. Loop cannot start with zero planes, 
then if n_planes is just one it will never be tested unless specially 
taken care of.

> 
> 
> Also you are leaking a bunch o memory here, each call to
> prepare_planes() will leak max_planes framebuffers, this could cause
> test to fail due no GPU memory available.
> 
> Actually this test is already leaking a bunch as test_fini() is only
> freeing the first framebuffer, there is other leaks here too like:
> data->fb, prepare_planes().x, prepare_planes().y and
> prepare_planes().size.
> 
> Can you take care of that too?
> 

yea, I did see those in Valgrind already while writing this patch. 
Reason why I didn't go after them yet is below 'clean up failed state' 
is something I shouldn't need to do. Last commit in my loop can fail and 
IGT has mechanism to do cleaning, for some reason IGT mechanism misses 
it here. I want to find out how IGT lost the cleaning information and 
this test can show it to me.

> 
>> +
>> +	/*
>> +	 * clean up failed state.
>> +	 */
>> +	for_each_plane_on_pipe(&data->display, pipe, plane)
>> +		igt_plane_set_fb(plane, NULL);
>> +
>> +	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);
>> +	while ((i < iterations || loop_forever) && c > 0) {
> 
> We actually want to fail the test if it can not even test one plane, so
> add this before this while()
> 
> igt_assert_lt(0, planes_allowed);

On after thought checking here for zero is useless, I'll throw it away. 
If there was not a single plane this test would've asserted already 
during setup where it get reference crc.

> 
>> +		prepare_planes(data, pipe, &blue, tiling, c, output);
>>   
>>   		igt_display_commit2(&data->display, COMMIT_ATOMIC);
>>   

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

  reply	other threads:[~2019-04-03 11:26 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-02 14:42 [igt-dev] [PATCH i-g-t] tests/kms_plane_multiple: Before going testing check how many planes are allowed Juha-Pekka Heikkila
2019-04-02 17:12 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
2019-04-02 18:22 ` [igt-dev] [PATCH i-g-t] " Souza, Jose
2019-04-03 11:26   ` Juha-Pekka Heikkila [this message]
2019-04-03  4:25 ` [igt-dev] ✓ Fi.CI.IGT: success for " Patchwork
2019-04-03  8:38 ` [igt-dev] [PATCH i-g-t] " Daniel Vetter
2019-04-03 12:23   ` Juha-Pekka Heikkila
  -- strict thread matches above, loose matches on Subject: below --
2019-04-05 14:55 [igt-dev] [PATCH i-g-t] tests/kms_plane_multiple: before " Juha-Pekka Heikkila
2019-04-09  1:29 ` 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

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=63756a48-f90d-9333-5d34-7e0e4466689b@gmail.com \
    --to=juhapekka.heikkila@gmail.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=jose.souza@intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox