<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
++ Bhanu<br>
<br>
Hi Suraj,<br>
<br>
Thank you for your suggestion regarding code sharing via header file. I have tried to share across the test files unfortunately in the current igt setup, we cannot re use with importing the header files.<br>
<br>
<a href="mailto:bhanuprakash.modem@intel.com" id="OWAAM179493" class="tWKOu mention ms-bgc-nlr ms-fcl-b">@Modem, Bhanuprakash</a>,<br>
<br>
Could you please help if these functions can be moved to lib/igt_sysfs or lib/igt_kms ?<br>
<br>
Thanks,<br>
Santhosh</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Kandpal, Suraj <suraj.kandpal@intel.com><br>
<b>Sent:</b> Friday, October 4, 2024 11:14 AM<br>
<b>To:</b> Reddy Guddati, Santhosh <santhosh.reddy.guddati@intel.com>; igt-dev@lists.freedesktop.org <igt-dev@lists.freedesktop.org><br>
<b>Cc:</b> Samala, Pranay <pranay.samala@intel.com><br>
<b>Subject:</b> Re: [PATCH i-g-t v3 1/1] tests/kms_hdr: Test brightness manipulation in HDR mode</font>
<div> </div>
</div>
<div>
<div><br>
</div>
<div id="x_mail-editor-reference-message-container" dir="auto"><br>
<hr style="display:inline-block; width:98%">
<div id="x_divRplyFwdMsg" style="font-size:11pt"><strong>From:</strong> Reddy Guddati, Santhosh <santhosh.reddy.guddati@intel.com><br>
<strong>Sent:</strong> Friday, October 4, 2024 11:02:42 am<br>
<strong>To:</strong> Kandpal, Suraj <suraj.kandpal@intel.com>; igt-dev@lists.freedesktop.org <igt-dev@lists.freedesktop.org><br>
<strong>Cc:</strong> Samala, Pranay <pranay.samala@intel.com><br>
<strong>Subject:</strong> RE: [PATCH i-g-t v3 1/1] tests/kms_hdr: Test brightness manipulation in HDR mode<br>
</div>
<br>
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<div class="x_WordSection1" dir="auto">
<p class="x_MsoNormal" style="margin:0cm; font-size:12pt; font-family:Aptos,sans-serif">
<span style="">Hi Suraj,<br>
<br>
Agreed, we do have similar functionality in kms_brightness, but it requires some adjustments .<br>
I plan to move these functions “backlight_read” , “backlight_write” to lib/igt_sysfs and make the necessary modifications at a later stage.</span></p>
<p class="x_MsoNormal" style="margin:0cm; font-size:12pt; font-family:Aptos,sans-serif">
<span style=""> </span></p>
<p class="x_MsoNormal" style="margin:0cm; font-size:12pt; font-family:Aptos,sans-serif">
<span style="">Please provide your thoughts on this approach.</span></p>
<p class="x_MsoNormal" style="margin:0cm; font-size:12pt; font-family:Aptos,sans-serif">
<span style="">_____________</span></p>
<p class="x_MsoNormal" style="margin:0cm; font-size:12pt; font-family:Aptos,sans-serif">
<span style=""><br>
</span></p>
<p class="x_MsoNormal" style="margin:0cm; font-size:12pt; font-family:Aptos,sans-serif">
<span style="">Why not just some simple code sharing via a header file rather than the whole lib/igt_sysfs complexity.</span></p>
<p class="x_MsoNormal" style="margin:0cm; font-size:12pt; font-family:Aptos,sans-serif">
<span style=""><br>
</span></p>
<p class="x_MsoNormal" style="margin:0cm; font-size:12pt; font-family:Aptos,sans-serif">
<span style="">Regards<span>,<br>
Suraj</span><br>
____________<br>
Regards,<br>
Santhosh</span></p>
<p class="x_MsoNormal" style="margin:0cm; font-size:12pt; font-family:Aptos,sans-serif">
<span style=""> </span></p>
<div>
<div style="border:none; border-top:solid #E1E1E1 1.0pt; padding:3.0pt 0cm 0cm 0cm">
<p class="x_MsoNormal" style="margin:0cm; font-size:12pt; font-family:Aptos,sans-serif">
<b><span lang="EN-US" style="font-size:11.0pt; font-family:"Calibri",sans-serif">From:</span></b><span lang="EN-US" style="font-size:11.0pt; font-family:"Calibri",sans-serif"> Kandpal, Suraj <suraj.kandpal@intel.com>
<br>
<b>Sent:</b> Friday, October 4, 2024 10:50 AM<br>
<b>To:</b> Reddy Guddati, Santhosh <santhosh.reddy.guddati@intel.com>; igt-dev@lists.freedesktop.org<br>
<b>Cc:</b> Samala, Pranay <pranay.samala@intel.com>; Reddy Guddati, Santhosh <santhosh.reddy.guddati@intel.com><br>
<b>Subject:</b> Re: [PATCH i-g-t v3 1/1] tests/kms_hdr: Test brightness manipulation in HDR mode</span></p>
</div>
</div>
<p class="x_MsoNormal" style="margin:0cm; font-size:12pt; font-family:Aptos,sans-serif">
</p>
<div>
<p class="x_MsoNormal" style="margin:0cm; font-size:12pt; font-family:Aptos,sans-serif">
<strong><span style="font-size:11.0pt; font-family:"Aptos",sans-serif">From:</span></strong><span style="font-size:11.0pt"> Reddy Guddati, Santhosh <<a href="mailto:santhosh.reddy.guddati@intel.com" style="text-decoration:underline; color:rgb(70,120,134)">santhosh.reddy.guddati@intel.com</a>></span></p>
</div>
<div id="x_mail-editor-reference-message-container">
<div id="x_divRplyFwdMsg">
<p class="x_MsoNormal" style="margin:0cm; font-size:12pt; font-family:Aptos,sans-serif">
<strong><span style="font-size:11.0pt; font-family:"Aptos",sans-serif">Sent:</span></strong><span style="font-size:11.0pt"> Wednesday, October 2, 2024 8:26:33 pm<br>
<strong><span style="font-family:"Aptos",sans-serif">To:</span></strong> <a href="mailto:igt-dev@lists.freedesktop.org" style="text-decoration:underline; color:rgb(70,120,134)">
igt-dev@lists.freedesktop.org</a> <<a href="mailto:igt-dev@lists.freedesktop.org" style="text-decoration:underline; color:rgb(70,120,134)">igt-dev@lists.freedesktop.org</a>><br>
<strong><span style="font-family:"Aptos",sans-serif">Cc:</span></strong> Samala, Pranay <<a href="mailto:pranay.samala@intel.com" style="text-decoration:underline; color:rgb(70,120,134)">pranay.samala@intel.com</a>>; Kandpal, Suraj <<a href="mailto:suraj.kandpal@intel.com" style="text-decoration:underline; color:rgb(70,120,134)">suraj.kandpal@intel.com</a>>;
Reddy Guddati, Santhosh <<a href="mailto:santhosh.reddy.guddati@intel.com" style="text-decoration:underline; color:rgb(70,120,134)">santhosh.reddy.guddati@intel.com</a>><br>
<strong><span style="font-family:"Aptos",sans-serif">Subject:</span></strong> [PATCH i-g-t v3 1/1] tests/kms_hdr: Test brightness manipulation in HDR mode</span></p>
</div>
<p class="x_MsoNormal" style="margin:0cm; font-size:12pt; font-family:Aptos,sans-serif">
<br>
<br>
<span style="font-size:11.0pt"></span></p>
<div>
<p class="x_MsoNormal" style="margin:0cm; font-size:12pt; font-family:Aptos,sans-serif">
<span style="font-size:11.0pt">Add subtest for backlight control on hdr enabled edp panels<br>
by changing brightness via sysfs.<br>
<br>
v2: adjust brightness range, refactor and restore brightness (Pranay)<br>
<br>
v3: reuse functions, add flags to avoid duplicate code (Suraj)<br>
<br>
Signed-off-by: Santhosh Reddy Guddati <<a href="mailto:santhosh.reddy.guddati@intel.com" style="text-decoration:underline; color:rgb(70,120,134)">santhosh.reddy.guddati@intel.com</a>><br>
---<br>
tests/kms_hdr.c | 83 ++++++++++++++++++++++++++++++++++++++++++++++++-<br>
1 file changed, 82 insertions(+), 1 deletion(-)<br>
<br>
diff --git a/tests/kms_hdr.c b/tests/kms_hdr.c<br>
index f123c6b36..0f07e770b 100644<br>
--- a/tests/kms_hdr.c<br>
+++ b/tests/kms_hdr.c<br>
@@ -64,6 +64,10 @@<br>
* Description: Tests static toggle with suspend<br>
* Functionality: colorspace, static_hdr, suspend<br>
*<br>
+ * SUBTEST: brightness-with-hdr<br>
+ * Description: Tests brightness with HDR<br>
+ * Functionality: colorspace, static_hdr<br>
+ *<br>
* SUBTEST: static-%s<br>
* Description: Tests %arg[1].<br>
* Functionality: colorspace, static_hdr<br>
@@ -81,6 +85,8 @@ IGT_TEST_DESCRIPTION("Test HDR metadata interfaces and bpc switch");<br>
#define HDR_STATIC_METADATA_BLOCK 0x06<br>
#define USE_EXTENDED_TAG 0x07<br>
<br>
+#define INTEL_BACKLIGHT_PATH "/sys/class/backlight/intel_backlight"<br>
+<br>
/* DRM HDR definitions. Not in the UAPI header, unfortunately. */<br>
enum hdmi_metadata_type {<br>
HDMI_STATIC_METADATA_TYPE1 = 0,<br>
@@ -100,6 +106,7 @@ enum {<br>
TEST_SWAP = 1 << 3,<br>
TEST_INVALID_METADATA_SIZES = 1 << 4,<br>
TEST_INVALID_HDR = 1 << 5,<br>
+ TEST_BRIGHTNESS = 1 << 6,<br>
};<br>
<br>
/* BPC connector state. */<br>
@@ -448,6 +455,72 @@ static void fill_hdr_output_metadata_st2048(struct hdr_output_metadata *meta)<br>
meta->hdmi_metadata_type1.max_cll = 500; /* 500 nits */<br>
}<br>
<br>
+/* TODO: Move adjust_brightness to lib/igt_sysfs to reuse in other tests. */<br>
+static void adjust_brightness(data_t *data, uint32_t flags)</span></p>
</div>
<div>
<p class="x_MsoNormal" style="margin:0cm; font-size:12pt; font-family:Aptos,sans-serif">
<span style="font-size:11.0pt"> </span></p>
</div>
<div>
<p class="x_MsoNormal" style="margin:0cm; font-size:12pt; font-family:Aptos,sans-serif">
<span style="font-size:11.0pt">-----------------</span></p>
</div>
<div>
<p class="x_MsoNormal" style="margin:0cm; font-size:12pt; font-family:Aptos,sans-serif">
<span style="font-size:11.0pt"> Do we not have a function in kms_brightness to manipulate brightness let's reuse that rather than writing the whole function here</span></p>
</div>
<div>
<p class="x_MsoNormal" style="margin:0cm; font-size:12pt; font-family:Aptos,sans-serif">
<span style="font-size:11.0pt"> </span></p>
</div>
<div>
<p class="x_MsoNormal" style="margin:0cm; font-size:12pt; font-family:Aptos,sans-serif">
<span style="font-size:11.0pt">Regards,</span></p>
</div>
<div>
<p class="x_MsoNormal" style="margin:0cm; font-size:12pt; font-family:Aptos,sans-serif">
<span style="font-size:11.0pt">Suraj Kandpal</span></p>
</div>
<div>
<p class="x_MsoNormal" style="margin:0cm; font-size:12pt; font-family:Aptos,sans-serif">
<span style="font-size:11.0pt"> </span></p>
</div>
<div>
<p class="x_MsoNormal" style="margin:0cm; font-size:12pt; font-family:Aptos,sans-serif; margin-bottom:12.0pt">
<span style="font-size:11.0pt">----------------------<br>
+{<br>
+ char brightness_path[1024];<br>
+ int brightness_fd;<br>
+ char brightness_value[64];<br>
+ int current_brightness;<br>
+ int max_brightness;<br>
+ int read_brightness;<br>
+ int fd, i;<br>
+<br>
+ /* Get max brightness */<br>
+ snprintf(brightness_path, sizeof(brightness_path),<br>
+ "%s/%s", INTEL_BACKLIGHT_PATH, "max_brightness");<br>
+ fd = open(brightness_path, O_RDONLY);<br>
+ igt_assert_f(fd >= 0, "Failed to open %s\n", brightness_path);<br>
+<br>
+ igt_assert(read(fd, brightness_value, sizeof(brightness_value)) > 0);<br>
+<br>
+ max_brightness = atoi(brightness_value);<br>
+<br>
+ close(fd);<br>
+<br>
+ /* Get current brightness */<br>
+ snprintf(brightness_path, sizeof(brightness_path),<br>
+ "%s/%s", INTEL_BACKLIGHT_PATH, "brightness");<br>
+ fd = open(brightness_path, O_RDONLY);<br>
+ igt_assert_f(fd >= 0, "Failed to open %s\n", brightness_path);<br>
+<br>
+ igt_assert(read(fd, brightness_value, sizeof(brightness_value)) > 0);<br>
+<br>
+ current_brightness = atoi(brightness_value);<br>
+<br>
+ close(fd);<br>
+<br>
+ for (i = 0; i <= max_brightness; i += 50) {<br>
+ fd = open(brightness_path, O_WRONLY);<br>
+ igt_assert_f(fd >= 0, "Failed to open %s\n", brightness_path);<br>
+<br>
+ snprintf(brightness_value, sizeof(brightness_value), "%d", i);<br>
+ igt_assert(write(fd, brightness_value, strlen(brightness_value)) > 0);<br>
+<br>
+ close(fd);<br>
+<br>
+ /* Verify brightness adjustment */<br>
+ fd = open(brightness_path, O_RDONLY);<br>
+ igt_assert(fd >= 0);<br>
+<br>
+ igt_assert(read(fd, brightness_value, sizeof(brightness_value)) > 0);<br>
+<br>
+ read_brightness = atoi(brightness_value);<br>
+<br>
+ igt_assert_eq(read_brightness, i);<br>
+<br>
+ close(fd);<br>
+ }<br>
+<br>
+ fd = open(brightness_path, O_WRONLY);<br>
+ igt_assert_f(fd >= 0, "Failed to open %s\n", brightness_path);<br>
+<br>
+ snprintf(brightness_value, sizeof(brightness_value), "%d", current_brightness);<br>
+ igt_assert(write(brightness_fd, brightness_value, strlen(brightness_value)) > 0);<br>
+<br>
+ close(fd);<br>
+}<br>
+<br>
static void test_static_toggle(data_t *data, enum pipe pipe,<br>
igt_output_t *output,<br>
uint32_t flags)<br>
@@ -483,6 +556,9 @@ static void test_static_toggle(data_t *data, enum pipe pipe,<br>
igt_assert_eq(system("dmesg|tail -n 1000|grep -E \"Unknown EOTF [0-9]+\""), 0);<br>
goto cleanup;<br>
}<br>
+ if (flags & TEST_BRIGHTNESS)<br>
+ adjust_brightness(data, flags);<br>
+<br>
igt_assert_output_bpc_equal(data->fd, pipe, output->name, 10);<br>
<br>
/* Verify that the CRC are equal after DPMS or suspend. */<br>
@@ -685,7 +761,8 @@ static void test_hdr(data_t *data, uint32_t flags)<br>
<br>
igt_dynamic_f("pipe-%s-%s",<br>
kmstest_pipe_name(pipe), output->name) {<br>
- if (flags & (TEST_NONE | TEST_DPMS | TEST_SUSPEND | TEST_INVALID_HDR))<br>
+ if (flags & (TEST_NONE | TEST_DPMS | TEST_SUSPEND |<br>
+ TEST_INVALID_HDR | TEST_BRIGHTNESS))<br>
test_static_toggle(data, pipe, output, flags);<br>
if (flags & TEST_SWAP)<br>
test_static_swap(data, pipe, output);<br>
@@ -734,6 +811,10 @@ igt_main<br>
igt_subtest_with_dynamic("static-toggle-suspend")<br>
test_hdr(&data, TEST_SUSPEND);<br>
<br>
+ igt_describe("Tests brightness while entering and exiting HDR mode");<br>
+ igt_subtest_with_dynamic("brightness-with-hdr")<br>
+ test_hdr(&data, TEST_BRIGHTNESS);<br>
+<br>
igt_describe("Tests swapping static HDR metadata");<br>
igt_subtest_with_dynamic("static-swap")<br>
test_hdr(&data, TEST_SWAP);<br>
-- <br>
2.34.1</span></p>
</div>
<p class="x_MsoNormal" style="margin:0cm; font-size:12pt; font-family:Aptos,sans-serif">
</p>
</div>
</div>
<br>
</div>
</div>
</body>
</html>