Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Swati Sharma <swati2.sharma@intel.com>
To: Kamil Konieczny <kamil.konieczny@linux.intel.com>,
	igt-dev@lists.freedesktop.org,
	Uma Shankar <uma.shankar@intel.com>
Subject: Re: [igt-dev] [PATCH i-g-t v2 1/2] tests/kms_hdr: Add negative test for invalid metadata sizes
Date: Thu, 23 Feb 2023 12:56:31 +0530	[thread overview]
Message-ID: <5082cafe-d957-9012-4b93-845bf68b3ac4@intel.com> (raw)
In-Reply-To: <20230222143507.tt2afueeos3vpf5r@kamilkon-desk1>

Thanks for the reviews! Patch pushed.

On 22-Feb-23 8:05 PM, Kamil Konieczny wrote:
> Hi Swati,
> 
> On 2023-02-22 at 16:18:05 +0530, Swati Sharma wrote:
>> Negative test is added in which HDR output metadata prop is
>> set with invalid sizes.
>>
>> v2: -Fixed nitpicks (Kamil)
>>      -Add cleanup (Kamil)
>>
>> Signed-off-by: Swati Sharma <swati2.sharma@intel.com>
>> Reviewed-by: Uma Shankar <uma.shankar@intel.com>
> 
> Lgtm,
> 
> Acked-by: Kamil Konieczny <kamil.konieczny@linux.intel.com>
> 
>> ---
>>   tests/kms_hdr.c | 35 +++++++++++++++++++++++++++++++++++
>>   1 file changed, 35 insertions(+)
>>
>> diff --git a/tests/kms_hdr.c b/tests/kms_hdr.c
>> index 655c3e14f..63b03089b 100644
>> --- a/tests/kms_hdr.c
>> +++ b/tests/kms_hdr.c
>> @@ -50,6 +50,7 @@ enum {
>>   	TEST_DPMS = 1 << 1,
>>   	TEST_SUSPEND = 1 << 2,
>>   	TEST_SWAP = 1 << 3,
>> +	TEST_INVALID_METADATA_SIZES = 1 << 4,
>>   };
>>   
>>   /* BPC connector state. */
>> @@ -327,6 +328,18 @@ static void set_hdr_output_metadata(data_t *data,
>>   				     meta ? sizeof(*meta) : 0);
>>   }
>>   
>> +/* Sets the HDR output metadata prop with invalid size. */
>> +static int set_invalid_hdr_output_metadata(data_t *data,
>> +					   struct hdr_output_metadata const *meta,
>> +					   size_t length)
>> +{
>> +	igt_output_replace_prop_blob(data->output,
>> +				     IGT_CONNECTOR_HDR_OUTPUT_METADATA, meta,
>> +				     meta ? length : 0);
>> +
>> +	return igt_display_try_commit_atomic(&data->display, DRM_MODE_ATOMIC_ALLOW_MODESET, NULL);
>> +}
>> +
>>   /* Converts a double to 861-G spec FP format. */
>>   static uint16_t calc_hdr_float(double val)
>>   {
>> @@ -518,6 +531,22 @@ static void test_static_swap(data_t *data, enum pipe pipe, igt_output_t *output)
>>   	igt_remove_fb(data->fd, &afb);
>>   }
>>   
>> +static void test_invalid_metadata_sizes(data_t *data, igt_output_t *output)
>> +{
>> +	struct hdr_output_metadata hdr;
>> +	size_t metadata_size = sizeof(hdr);
>> +
>> +	fill_hdr_output_metadata_st2048(&hdr);
>> +
>> +	igt_assert_eq(set_invalid_hdr_output_metadata(data, &hdr, 1), -EINVAL);
>> +	igt_assert_eq(set_invalid_hdr_output_metadata(data, &hdr, metadata_size + 1), -EINVAL);
>> +	igt_assert_eq(set_invalid_hdr_output_metadata(data, &hdr, metadata_size - 1), -EINVAL);
>> +	igt_assert_eq(set_invalid_hdr_output_metadata(data, &hdr, metadata_size * 2), -EINVAL);
>> +
>> +	test_fini(data);
>> +	igt_remove_fb(data->fd, &afb);
>> +}
>> +
>>   /* Returns true if an output supports HDR metadata property. */
>>   static bool has_hdr(igt_output_t *output)
>>   {
>> @@ -565,6 +594,8 @@ static void test_hdr(data_t *data, uint32_t flags)
>>   						test_static_toggle(data, pipe, output, flags);
>>   					if (flags & TEST_SWAP)
>>   						test_static_swap(data, pipe, output);
>> +					if (flags & TEST_INVALID_METADATA_SIZES)
>> +						test_invalid_metadata_sizes(data, output);
>>   				}
>>   
>>   				/* One pipe is enough */
>> @@ -613,6 +644,10 @@ igt_main
>>   	igt_subtest_with_dynamic("static-swap")
>>   		test_hdr(&data, TEST_SWAP);
>>   
>> +	igt_describe("Tests invalid HDR metadata sizes");
>> +	igt_subtest_with_dynamic("invalid-metadata-sizes")
>> +		test_hdr(&data, TEST_INVALID_METADATA_SIZES);
>> +
>>   	igt_fixture {
>>   		igt_display_fini(&data.display);
>>   		close(data.fd);
>> -- 
>> 2.25.1
>>

-- 
~Swati Sharma

  reply	other threads:[~2023-02-23  7:26 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-22 10:48 [igt-dev] [PATCH i-g-t v2 0/2] Add HDR negative tests Swati Sharma
2023-02-22 10:48 ` [igt-dev] [PATCH i-g-t v2 1/2] tests/kms_hdr: Add negative test for invalid metadata sizes Swati Sharma
2023-02-22 14:35   ` Kamil Konieczny
2023-02-23  7:26     ` Swati Sharma [this message]
2023-02-22 10:48 ` [igt-dev] [PATCH i-g-t v2 2/2] tests/kms_hdr: Add negative test to enforce HDR on non-HDR panel Swati Sharma
2023-02-22 14:35   ` Kamil Konieczny
2023-02-23  7:26     ` Swati Sharma
2023-02-22 11:19 ` [igt-dev] ✗ Fi.CI.BUILD: failure for Add HDR negative tests (rev3) Patchwork
  -- strict thread matches above, loose matches on Subject: below --
2023-02-22 11:55 [igt-dev] [PATCH i-g-t v2 0/2] Add HDR negative tests Swati Sharma
2023-02-22 11:55 ` [igt-dev] [PATCH i-g-t v2 1/2] tests/kms_hdr: Add negative test for invalid metadata sizes Swati Sharma

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=5082cafe-d957-9012-4b93-845bf68b3ac4@intel.com \
    --to=swati2.sharma@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=kamil.konieczny@linux.intel.com \
    --cc=uma.shankar@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