Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Thasleem, Mohammed" <mohammed.thasleem@intel.com>
To: Santhosh Reddy Guddati <santhosh.reddy.guddati@intel.com>,
	<igt-dev@lists.freedesktop.org>
Cc: <bhanuprakash.modem@intel.com>, <suraj.kandpal@intel.com>,
	<pranay.samala@intel.com>
Subject: Re: [PATCH i-g-t v4 3/3] tests/kms_hdr: Test brightness manipulation in HDR mode
Date: Thu, 24 Oct 2024 12:07:28 +0530	[thread overview]
Message-ID: <b5e50109-061f-42b7-b2e8-fe8f93923a73@intel.com> (raw)
In-Reply-To: <20241024045212.1697869-4-santhosh.reddy.guddati@intel.com>


On 10/24/2024 10:22 AM, Santhosh Reddy Guddati wrote:
> Add subtests for backlight control on hdr enabled edp panels
> by changing brightness via sysfs.
>
> use igt_backlight_read and igt_backlight_write from library.
> -->Please format discription correctly.
>
> v4: improve the test description and cosmetics (Suraj).
>
> Signed-off-by: Santhosh Reddy Guddati <santhosh.reddy.guddati@intel.com>
> ---
>   tests/kms_hdr.c | 42 +++++++++++++++++++++++++++++++++++++++++-
>   1 file changed, 41 insertions(+), 1 deletion(-)
>
> diff --git a/tests/kms_hdr.c b/tests/kms_hdr.c
> index f123c6b36..b67902d43 100644
> --- a/tests/kms_hdr.c
> +++ b/tests/kms_hdr.c
> @@ -64,6 +64,10 @@
>    * Description: Tests static toggle with suspend
>    * Functionality: colorspace, static_hdr, suspend
>    *
> + * SUBTEST: brightness-with-hdr
> + * Description: Tests brightness with HDR
> + * Functionality: colorspace, static_hdr
> + *
>    * SUBTEST: static-%s
>    * Description: Tests %arg[1].
>    * Functionality: colorspace, static_hdr
> @@ -81,6 +85,8 @@ IGT_TEST_DESCRIPTION("Test HDR metadata interfaces and bpc switch");
>   #define HDR_STATIC_METADATA_BLOCK       0x06
>   #define USE_EXTENDED_TAG		0x07
>   
> +#define BACKLIGHT_PATH "/sys/class/backlight"
> +
>   /* DRM HDR definitions. Not in the UAPI header, unfortunately. */
>   enum hdmi_metadata_type {
>   	HDMI_STATIC_METADATA_TYPE1 = 0,
> @@ -100,6 +106,7 @@ enum {
>   	TEST_SWAP = 1 << 3,
>   	TEST_INVALID_METADATA_SIZES = 1 << 4,
>   	TEST_INVALID_HDR = 1 << 5,
> +	TEST_BRIGHTNESS = 1 << 6,
>   };
>   
>   /* BPC connector state. */
> @@ -448,6 +455,28 @@ static void fill_hdr_output_metadata_st2048(struct hdr_output_metadata *meta)
>   	meta->hdmi_metadata_type1.max_cll = 500;   /* 500 nits */
>   }
>   
> +static void adjust_brightness(data_t *data, uint32_t flags)
> +{
> +	igt_backlight_context_t context;
> +	int r_bright, w_bright;
> +
> +	snprintf(context.path, PATH_MAX, "intel_backlight");
> +	snprintf(context.backlight_dir_path, PATH_MAX, "%s", BACKLIGHT_PATH);
> +
> +	igt_assert(igt_backlight_read(&context.max, "max_brightness", &context) > -1);
> +	igt_assert(context.max);
> +	igt_assert(igt_backlight_read(&context.old, "brightness", &context) > -1);
> +
> +	for (w_bright = 0; w_bright <= context.max ; w_bright += 50) {
> +		igt_assert_eq(igt_backlight_write(w_bright, "brightness", &context), 0);
> +		igt_display_commit_atomic(&data->display, DRM_MODE_ATOMIC_ALLOW_MODESET, NULL);
> +		igt_assert_eq(igt_backlight_read(&r_bright, "brightness", &context), 0);
> +		igt_assert_eq(w_bright, r_bright);
> +	}
> +
> +	igt_assert_eq(igt_backlight_write(context.old, "brightness", &context), 0);
> +}
> +
>   static void test_static_toggle(data_t *data, enum pipe pipe,
>   			       igt_output_t *output,
>   			       uint32_t flags)
> @@ -483,6 +512,12 @@ static void test_static_toggle(data_t *data, enum pipe pipe,
>   		igt_assert_eq(system("dmesg|tail -n 1000|grep -E \"Unknown EOTF [0-9]+\""), 0);
>   		goto cleanup;
>   	}
> +
> +	if (flags & TEST_BRIGHTNESS) {
> +		igt_require_f(is_intel_device(data->fd), "Only supported on Intel devices\n");
> +		adjust_brightness(data, flags);
> +	}
> +
>   	igt_assert_output_bpc_equal(data->fd, pipe, output->name, 10);
>   
>   	/* Verify that the CRC are equal after DPMS or suspend. */
> @@ -685,7 +720,8 @@ static void test_hdr(data_t *data, uint32_t flags)
>   
>   			igt_dynamic_f("pipe-%s-%s",
>   				      kmstest_pipe_name(pipe), output->name) {
> -				if (flags & (TEST_NONE | TEST_DPMS | TEST_SUSPEND | TEST_INVALID_HDR))
> +				if (flags & (TEST_NONE | TEST_DPMS | TEST_SUSPEND |
> +					     TEST_INVALID_HDR | TEST_BRIGHTNESS))
>   					test_static_toggle(data, pipe, output, flags);
>   				if (flags & TEST_SWAP)
>   					test_static_swap(data, pipe, output);
> @@ -734,6 +770,10 @@ igt_main
>   	igt_subtest_with_dynamic("static-toggle-suspend")
>   		test_hdr(&data, TEST_SUSPEND);
>   
> +	igt_describe("Tests brightness while in HDR mode");
> +	igt_subtest_with_dynamic("brightness-with-hdr")
> +		test_hdr(&data, TEST_BRIGHTNESS);
> +
>   	igt_describe("Tests swapping static HDR metadata");
>   	igt_subtest_with_dynamic("static-swap")
>   		test_hdr(&data, TEST_SWAP);

  parent reply	other threads:[~2024-10-24  6:37 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-24  4:52 [PATCH i-g-t v4 0/3] Move backlight read, write to lib Santhosh Reddy Guddati
2024-10-24  4:52 ` [PATCH i-g-t v4 1/3] lib/igt_kms: Move backlight read and " Santhosh Reddy Guddati
2024-10-24  6:35   ` Thasleem, Mohammed
2024-10-24  6:53     ` Reddy Guddati, Santhosh
2024-10-24  4:52 ` [PATCH i-g-t v4 2/3] tests/intel/kms_pm_backlight: Refactor and use functions from lib Santhosh Reddy Guddati
2024-10-24  6:36   ` Thasleem, Mohammed
2024-10-24  4:52 ` [PATCH i-g-t v4 3/3] tests/kms_hdr: Test brightness manipulation in HDR mode Santhosh Reddy Guddati
2024-10-24  4:59   ` Kandpal, Suraj
2024-10-24  6:37   ` Thasleem, Mohammed [this message]
2024-10-24  9:40 ` ✓ Fi.CI.BAT: success for Move backlight read, write to lib (rev4) Patchwork
2024-10-24 10:21 ` ✓ CI.xeBAT: " Patchwork
2024-10-24 12:09 ` ✗ Fi.CI.IGT: failure " Patchwork
2024-10-24 22:47 ` ✓ CI.xeFULL: success " Patchwork
2024-10-25 15:11 ` ✓ Fi.CI.IGT: " Patchwork

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=b5e50109-061f-42b7-b2e8-fe8f93923a73@intel.com \
    --to=mohammed.thasleem@intel.com \
    --cc=bhanuprakash.modem@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=pranay.samala@intel.com \
    --cc=santhosh.reddy.guddati@intel.com \
    --cc=suraj.kandpal@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