All of lore.kernel.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH i-g-t 1/2] lib/igt_fb: check device type before calling intel_get_drm_devid
@ 2021-08-05  3:40 maitreye
  2021-08-05  3:40 ` [igt-dev] [PATCH i-g-t 2/2] lib/igt_fb: add an API to support color square DP CTS pattern maitreye
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: maitreye @ 2021-08-05  3:40 UTC (permalink / raw)
  To: igt-dev
  Cc: maitreye, robdclark, seanpaul, swboyd, nganji, aravindh,
	abhinavk, khsieh, manasi.d.navare, petri.latvala

Check intel device type before calling intel_get_drm_devid
to avoid incorrect assertion failures while trying to use
create_bo_for_fb on non-intel targets. Otherwise it leads
to failures like below :

./msm_dp_compliance
found idx of failsafe mode = 17
(msm_dp_compliance:27338) intel_chipset-CRITICAL: Test assertion failure function
intel_get_drm_devid, file ../igt-gpu-tools-9999/lib/intel_chipset.c:132:
(msm_dp_compliance:27338) intel_chipset-CRITICAL:
Failed assertion: is_i915_device(fd)
(msm_dp_compliance:27338) intel_chipset-CRITICAL: Last errno: 2,
No such file or directory

Signed-off-by: maitreye <maitreye@codeaurora.org>
---
 lib/igt_fb.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index ab52ea9..583cc9e 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -836,9 +836,11 @@ static uint64_t calc_plane_size(struct igt_fb *fb, int plane)
 		 * On ADL_P CCS color planes must be 2MB aligned, until remapping
 		 * support is added for CCS FBs.
 		 */
-		if (IS_ALDERLAKE_P(intel_get_drm_devid(fb->fd)) &&
-		    is_ccs_modifier(fb->modifier))
-			size = ALIGN(size, 2 * 1024 * 1024);
+		if (is_i915_device(fb->fd)) {
+			if (IS_ALDERLAKE_P(intel_get_drm_devid(fb->fd)) &&
+			is_ccs_modifier(fb->modifier))
+			size = ALIGN(size,2 * 1024 * 1024);
+               }
 
 		return size;
 	}
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [igt-dev] [PATCH i-g-t 2/2] lib/igt_fb: add an API to support color square DP CTS pattern
  2021-08-05  3:40 [igt-dev] [PATCH i-g-t 1/2] lib/igt_fb: check device type before calling intel_get_drm_devid maitreye
@ 2021-08-05  3:40 ` maitreye
  2021-08-12 21:00   ` maitreye
  2021-08-13 11:33   ` Petri Latvala
  2021-08-05  3:55 ` [igt-dev] ✗ Fi.CI.BUILD: failure for series starting with [i-g-t,1/2] lib/igt_fb: check device type before calling intel_get_drm_devid Patchwork
  2021-08-06 16:38 ` [igt-dev] [PATCH i-g-t 1/2] " Sean Paul
  2 siblings, 2 replies; 7+ messages in thread
From: maitreye @ 2021-08-05  3:40 UTC (permalink / raw)
  To: igt-dev
  Cc: maitreye, robdclark, seanpaul, swboyd, nganji, aravindh,
	abhinavk, khsieh, manasi.d.navare, petri.latvala

Add an api to support the CTA range color square video test
pattern as explained in section 3.2.5.3 of the DP CTS
specification. This pattern is required for supporting
the CTA range for RGB formats.

Also rename the existing api igt_fill_cts_framebuffer to
igt_fill_cts_color_ramp_framebuffer to higlight the
pattern type.

Signed-off-by: maitreye <maitreye@codeaurora.org>
---
 lib/igt_fb.c                | 125 +++++++++++++++++++++++++++++++++++++++++++-
 lib/igt_fb.h                |   4 +-
 tools/intel_dp_compliance.c |   2 +-
 tools/msm_dp_compliance.c   |  43 +++++++++++----
 4 files changed, 160 insertions(+), 14 deletions(-)

diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index 583cc9e..3d34457 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -1396,7 +1396,128 @@ void igt_paint_color(cairo_t *cr, int x, int y, int w, int h,
 }
 
 /**
- * igt_fill_cts_framebuffer:
+ *
+ * igt_fill_cts_color_square_framebuffer:
+ * @pixmap: handle to mapped buffer
+ * @video_width: required width for pattern
+ * @video_height: required height for pattern
+ * @bitdepth: required bitdepth fot pattern
+ * @alpha: required alpha for the pattern
+ *
+ * This function draws a color square pattern for given width and height
+ * as per the specifications mentioned in section 3.2.5.3 of DP CTS spec.
+ */
+int igt_fill_cts_color_square_framebuffer(uint32_t *pixmap, uint32_t video_width,
+		uint32_t video_height, uint32_t bitdepth, int alpha)
+{
+	uint32_t max_color_val = 0;
+	uint32_t min_color_val = 0;
+	uint32_t* pmax = &max_color_val;
+	uint32_t* pmin = &min_color_val;
+	int tile_width = 64;
+	int tile_height = 64;
+	int reverse = 0;
+
+	switch(bitdepth) {
+	case 8:
+		*pmax  = 235;
+		*pmin  = 16;
+		break;
+	case 10:
+		*pmax  = 940;
+		*pmin  = 64;
+		break;
+        }
+	/* 
+ 	* According to the requirement stated in the 3.2.5.3  DP CTS spec  the required pattern for color 
+	* square should look like below
+	*
+	*      white | yellow | cyan    | green | magenta | red    | blue  | black | white | ... | ..
+	*      -------------------------------------------------------------------------------
+	*      blue  | red    | magenta | green | cyan    | yellow | white | black | blue  | ... | ..
+	*      -------------------------------------------------------------------------------
+	*      white | yellow | cyan    | green | magenta | red    | blue  | black | white | ... | ..
+	*      -------------------------------------------------------------------------------
+	*      blue  | red    | magenta | green | cyan    | yellow | white | black | blue  | ... | ..
+	*      	--------------------------------------------------------------------------------
+	*	.    |   .    |	  .	|  .	|   .     |	.  |   .   |   .   |   .   |  .
+	*
+	*	.    |	 .    |	  .	|  .	|   .	  |	.  |   .   |   .   |   .   |  .
+	*
+	*
+	*/
+        uint32_t colors[8][3] = {
+	/* White Color */
+        {(*pmax), (*pmax), (*pmax)}, 
+	/* Yellow Color */
+        {(*pmax), (*pmax), (*pmin)},
+	/* Cyan Color */
+        {(*pmin), (*pmax), (*pmax)},
+	/* Green Color */  
+        {(*pmin), (*pmax), (*pmin)},
+	/* Magenta Color */
+        {(*pmax), (*pmin), (*pmax)},
+	/* Red Color */
+        {(*pmax), (*pmin), (*pmin)},
+	/* Blue Color */
+        {(*pmin), (*pmin), (*pmax)},
+	/* Black Color */
+        {(*pmin), (*pmin), (*pmin)},
+        };
+
+	uint32_t reverse_colors[8][3] = {
+	/* Blue Color */
+	{(*pmin), (*pmin), (*pmax)},
+	/* Red Color */
+	{(*pmax), (*pmin), (*pmin)},
+	/* Magenta Color */
+	{(*pmax), (*pmin), (*pmax)},
+	/* Green Color */
+	{(*pmin), (*pmax), (*pmin)},
+	/* Cyan Color */  
+	{(*pmin), (*pmax), (*pmax)},
+	/* Yellow Color */
+	{(*pmax), (*pmax), (*pmin)},
+	/* White Color */
+	{(*pmax), (*pmax), (*pmax)},
+	/* Black Color */
+	{(*pmin), (*pmin), (*pmin)},
+	};
+
+	for (uint32_t height = 0; height < video_height; height++) {
+		uint32_t color = 0;
+		uint8_t *temp = pixmap;
+		uint8_t **buffer = &temp;
+		uint32_t (*color_array)[3];
+		temp += (4 * video_width * height);
+		for (uint32_t width = 0; width < video_width; width++) {
+
+			if (reverse == 0)
+				color_array = colors;
+			else
+				color_array = reverse_colors;
+
+			/* using BGRA8888 format */
+			*(*buffer)++ = (((uint8_t)color_array[color][2]) & 0xFF);
+			*(*buffer)++ = (((uint8_t)color_array[color][1]) & 0xFF);
+			*(*buffer)++ = (((uint8_t)color_array[color][0]) & 0xFF);
+			*(*buffer)++ = ((uint8_t)alpha & 0xFF);
+
+			if (((width + 1) % tile_width) == 0)
+				color = (color + 1 ) % 8;
+
+		}
+		if (((height + 1) % tile_height)== 0) {
+			if (reverse == 0)
+				reverse = 1;
+			else
+				reverse = 0;
+		}
+	}
+	return 0;
+}
+/**
+ * igt_fill_cts_color_ramp_framebuffer:
  * @pixmap: handle to the mapped buffer
  * @video_width: required width for the CTS pattern
  * @video_height: required height for the CTS pattern
@@ -1404,7 +1525,7 @@ void igt_paint_color(cairo_t *cr, int x, int y, int w, int h,
  * @alpha: required alpha for the CTS pattern
  * This functions draws the CTS test pattern for a given width, height.
  */
-int igt_fill_cts_framebuffer(uint32_t *pixmap, uint32_t video_width,
+int igt_fill_cts_color_ramp_framebuffer(uint32_t *pixmap, uint32_t video_width,
 		uint32_t video_height, uint32_t bitdepth, int alpha)
 {
 	uint32_t tile_height, tile_width;
diff --git a/lib/igt_fb.h b/lib/igt_fb.h
index 2c2b826..e6f2840 100644
--- a/lib/igt_fb.h
+++ b/lib/igt_fb.h
@@ -213,8 +213,10 @@ bool igt_format_is_fp16(uint32_t drm_format);
 int igt_format_plane_bpp(uint32_t drm_format, int plane);
 void igt_format_array_fill(uint32_t **formats_array, unsigned int *count,
 			   bool allow_yuv);
-int igt_fill_cts_framebuffer(uint32_t *pixmap, uint32_t video_width,
+int igt_fill_cts_color_ramp_framebuffer(uint32_t *pixmap, uint32_t video_width,
 		uint32_t video_height, uint32_t bitdepth, int alpha);
+int igt_fill_cts_color_square_framebuffer(uint32_t *pixmap,  uint32_t video_width,
+                uint32_t video_height, uint32_t bitdepth, int alpha);
 
 int igt_fb_get_fnv1a_crc(struct igt_fb *fb, igt_crc_t *crc);
 
diff --git a/tools/intel_dp_compliance.c b/tools/intel_dp_compliance.c
index fb94605..20216e7 100644
--- a/tools/intel_dp_compliance.c
+++ b/tools/intel_dp_compliance.c
@@ -532,7 +532,7 @@ static int set_test_mode(struct connector *dp_conn)
 			return ret;
 		}
 
-		ret = igt_fill_cts_framebuffer(dp_conn->test_pattern.pixmap,
+		ret = igt_fill_cts_color_ramp_framebuffer(dp_conn->test_pattern.pixmap,
 				dp_conn->test_pattern.hdisplay,
 				dp_conn->test_pattern.vdisplay,
 				dp_conn->test_pattern.bitdepth,
diff --git a/tools/msm_dp_compliance.c b/tools/msm_dp_compliance.c
index 7bc2bfa..144dfee 100644
--- a/tools/msm_dp_compliance.c
+++ b/tools/msm_dp_compliance.c
@@ -143,6 +143,10 @@
 /* DRM definitions - must be kept in sync with the DRM header */
 #define DP_TEST_LINK_VIDEO_PATTERN	(1 << 1)
 
+
+/* DP CTS PATTERN TYPE */
+#define PATTERN_COLOR_RAMP 1
+#define PATTERN_COLOR_SQUARE 3
 /* Global file pointers for the sysfs files */
 FILE *test_active_fp, *test_data_fp, *test_type_fp;
 
@@ -153,6 +157,7 @@ uint16_t hdisplay;
 uint16_t vdisplay;
 uint8_t bitdepth;
 
+uint16_t pattern;
 drmModeRes *resources;
 int drm_fd, modes, gen;
 uint64_t tiling = LOCAL_DRM_FORMAT_MOD_NONE;
@@ -172,6 +177,7 @@ struct test_video_pattern {
 	uint16_t hdisplay;
 	uint16_t vdisplay;
 	uint8_t bitdepth;
+	uint16_t pattern;
 	uint32_t fb;
 	uint32_t size;
 	struct igt_fb fb_pattern;
@@ -244,15 +250,15 @@ static unsigned long get_test_type(void)
 static void get_test_videopattern_data(void)
 {
 	int count = 0;
-	uint16_t video_pattern_value[3];
-	char video_pattern_attribute[15];
+	uint16_t video_pattern_value[5];
+	char video_pattern_attribute[20];
 	int ret;
 
 	if (!test_data_fp)
 		fprintf(stderr, "Invalid test_data file\n");
 
 	rewind(test_data_fp);
-	while (!feof(test_data_fp) && count < 3) {
+	while (!feof(test_data_fp) && count < 4) {
 		ret = fscanf(test_data_fp, "%s %u\n", video_pattern_attribute,
 		       (unsigned int *)&video_pattern_value[count++]);
 		if (ret < 2) {
@@ -264,10 +270,11 @@ static void get_test_videopattern_data(void)
 	hdisplay = video_pattern_value[0];
 	vdisplay = video_pattern_value[1];
 	bitdepth = video_pattern_value[2];
+	pattern = video_pattern_value[3];
 	igt_info("Hdisplay = %d\n", hdisplay);
 	igt_info("Vdisplay = %d\n", vdisplay);
 	igt_info("BitDepth = %u\n", bitdepth);
-
+	igt_info("pattern = %d\n", pattern);
 }
 
 static int process_test_request(int test_type)
@@ -325,6 +332,7 @@ static int setup_video_pattern_framebuffer(struct connector *dp_conn)
 
 	dp_conn->test_pattern.size = dp_conn->test_pattern.fb_pattern.size;
 	memset(dp_conn->test_pattern.pixmap, 0, dp_conn->test_pattern.size);
+	igt_info("size: %d \n",dp_conn->test_pattern.size);
 	return 0;
 
 }
@@ -374,6 +382,8 @@ static int set_test_mode(struct connector *dp_conn)
 		dp_conn->test_pattern.hdisplay = hdisplay;
 		dp_conn->test_pattern.vdisplay = vdisplay;
 		dp_conn->test_pattern.bitdepth = bitdepth;
+		dp_conn->test_pattern.pattern = pattern;
+		igt_info("Pattern :%d\n", dp_conn->test_pattern.pattern);
 
 		ret = setup_video_pattern_framebuffer(dp_conn);
 		if (ret) {
@@ -381,16 +391,29 @@ static int set_test_mode(struct connector *dp_conn)
 				 c->connector_id, ret);
 			return ret;
 		}
-
-		ret = igt_fill_cts_framebuffer(dp_conn->test_pattern.pixmap,
+		if(dp_conn->test_pattern.pattern == PATTERN_COLOR_RAMP) {
+			ret = igt_fill_cts_color_ramp_framebuffer(dp_conn->test_pattern.pixmap,
 				dp_conn->test_pattern.hdisplay,
 				dp_conn->test_pattern.vdisplay,
 				dp_conn->test_pattern.bitdepth,
 				0);
-		if (ret) {
-			igt_warn("Filling framebuffer for connector %u failed (%d)\n",
-				 c->connector_id, ret);
-			return ret;
+			if (ret) {
+				igt_warn("Filling framebuffer for connector %u failed (%d)\n",
+					c->connector_id, ret);
+				return ret;
+			}
+		}
+		if(dp_conn->test_pattern.pattern == PATTERN_COLOR_SQUARE) {
+			ret = igt_fill_cts_color_square_framebuffer(dp_conn->test_pattern.pixmap,
+                                dp_conn->test_pattern.hdisplay,
+                                dp_conn->test_pattern.vdisplay,
+                                dp_conn->test_pattern.bitdepth,
+                                0);
+			if(ret) {
+				igt_warn("Filling framebuffer for connector %u failed (%d)\n",
+					c->connector_id, ret);
+				return ret;
+			}
 		}
 		/* unmapping the buffer previously mapped during setup */
 		munmap(dp_conn->test_pattern.pixmap,
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [igt-dev] ✗ Fi.CI.BUILD: failure for series starting with [i-g-t,1/2] lib/igt_fb: check device type before calling intel_get_drm_devid
  2021-08-05  3:40 [igt-dev] [PATCH i-g-t 1/2] lib/igt_fb: check device type before calling intel_get_drm_devid maitreye
  2021-08-05  3:40 ` [igt-dev] [PATCH i-g-t 2/2] lib/igt_fb: add an API to support color square DP CTS pattern maitreye
@ 2021-08-05  3:55 ` Patchwork
  2021-08-06 16:38 ` [igt-dev] [PATCH i-g-t 1/2] " Sean Paul
  2 siblings, 0 replies; 7+ messages in thread
From: Patchwork @ 2021-08-05  3:55 UTC (permalink / raw)
  To: maitreye; +Cc: igt-dev

== Series Details ==

Series: series starting with [i-g-t,1/2] lib/igt_fb: check device type before calling intel_get_drm_devid
URL   : https://patchwork.freedesktop.org/series/93400/
State : failure

== Summary ==

Applying: lib/igt_fb: check device type before calling intel_get_drm_devid
Using index info to reconstruct a base tree...
M	lib/igt_fb.c
Falling back to patching base and 3-way merge...
Auto-merging lib/igt_fb.c
CONFLICT (content): Merge conflict in lib/igt_fb.c
Patch failed at 0001 lib/igt_fb: check device type before calling intel_get_drm_devid
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [igt-dev] [PATCH i-g-t 1/2] lib/igt_fb: check device type before calling intel_get_drm_devid
  2021-08-05  3:40 [igt-dev] [PATCH i-g-t 1/2] lib/igt_fb: check device type before calling intel_get_drm_devid maitreye
  2021-08-05  3:40 ` [igt-dev] [PATCH i-g-t 2/2] lib/igt_fb: add an API to support color square DP CTS pattern maitreye
  2021-08-05  3:55 ` [igt-dev] ✗ Fi.CI.BUILD: failure for series starting with [i-g-t,1/2] lib/igt_fb: check device type before calling intel_get_drm_devid Patchwork
@ 2021-08-06 16:38 ` Sean Paul
  2 siblings, 0 replies; 7+ messages in thread
From: Sean Paul @ 2021-08-06 16:38 UTC (permalink / raw)
  To: maitreye
  Cc: igt-dev, Rob Clark, Stephen Boyd, nganji, aravindh, abhinavk,
	khsieh, Manasi Navare, Petri Latvala

On Wed, Aug 4, 2021 at 11:40 PM maitreye <maitreye@codeaurora.org> wrote:
>
> Check intel device type before calling intel_get_drm_devid
> to avoid incorrect assertion failures while trying to use
> create_bo_for_fb on non-intel targets. Otherwise it leads
> to failures like below :
>
> ./msm_dp_compliance
> found idx of failsafe mode = 17
> (msm_dp_compliance:27338) intel_chipset-CRITICAL: Test assertion failure function
> intel_get_drm_devid, file ../igt-gpu-tools-9999/lib/intel_chipset.c:132:
> (msm_dp_compliance:27338) intel_chipset-CRITICAL:
> Failed assertion: is_i915_device(fd)
> (msm_dp_compliance:27338) intel_chipset-CRITICAL: Last errno: 2,
> No such file or directory
>
> Signed-off-by: maitreye <maitreye@codeaurora.org>
> ---
>  lib/igt_fb.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/lib/igt_fb.c b/lib/igt_fb.c
> index ab52ea9..583cc9e 100644
> --- a/lib/igt_fb.c
> +++ b/lib/igt_fb.c
> @@ -836,9 +836,11 @@ static uint64_t calc_plane_size(struct igt_fb *fb, int plane)
>                  * On ADL_P CCS color planes must be 2MB aligned, until remapping
>                  * support is added for CCS FBs.
>                  */
> -               if (IS_ALDERLAKE_P(intel_get_drm_devid(fb->fd)) &&
> -                   is_ccs_modifier(fb->modifier))
> -                       size = ALIGN(size, 2 * 1024 * 1024);
> +               if (is_i915_device(fb->fd)) {
> +                       if (IS_ALDERLAKE_P(intel_get_drm_devid(fb->fd)) &&
> +                       is_ccs_modifier(fb->modifier))

Not sure if my email client is rendering incorrectly, but I think you
lost indentation here.

With that fixed,

Reviewed-by: Sean Paul <seanpaul@chromium.org>


>
> +                       size = ALIGN(size,2 * 1024 * 1024);
> +               }
>
>                 return size;
>         }
> --
> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
> a Linux Foundation Collaborative Project
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [igt-dev] [PATCH i-g-t 2/2] lib/igt_fb: add an API to support color square DP CTS pattern
  2021-08-05  3:40 ` [igt-dev] [PATCH i-g-t 2/2] lib/igt_fb: add an API to support color square DP CTS pattern maitreye
@ 2021-08-12 21:00   ` maitreye
  2021-08-13 11:33   ` Petri Latvala
  1 sibling, 0 replies; 7+ messages in thread
From: maitreye @ 2021-08-12 21:00 UTC (permalink / raw)
  To: igt-dev
  Cc: robdclark, seanpaul, swboyd, nganji, aravindh, abhinavk, khsieh,
	manasi.d.navare, petri.latvala

Hi Petri/all,
Will you be able to review this patch please.



On 2021-08-04 20:40, maitreye wrote:
> Add an api to support the CTA range color square video test
> pattern as explained in section 3.2.5.3 of the DP CTS
> specification. This pattern is required for supporting
> the CTA range for RGB formats.
> 
> Also rename the existing api igt_fill_cts_framebuffer to
> igt_fill_cts_color_ramp_framebuffer to higlight the
> pattern type.
> 
> Signed-off-by: maitreye <maitreye@codeaurora.org>
> ---
>  lib/igt_fb.c                | 125 
> +++++++++++++++++++++++++++++++++++++++++++-
>  lib/igt_fb.h                |   4 +-
>  tools/intel_dp_compliance.c |   2 +-
>  tools/msm_dp_compliance.c   |  43 +++++++++++----
>  4 files changed, 160 insertions(+), 14 deletions(-)
> 
> diff --git a/lib/igt_fb.c b/lib/igt_fb.c
> index 583cc9e..3d34457 100644
> --- a/lib/igt_fb.c
> +++ b/lib/igt_fb.c
> @@ -1396,7 +1396,128 @@ void igt_paint_color(cairo_t *cr, int x, int
> y, int w, int h,
>  }
> 
>  /**
> - * igt_fill_cts_framebuffer:
> + *
> + * igt_fill_cts_color_square_framebuffer:
> + * @pixmap: handle to mapped buffer
> + * @video_width: required width for pattern
> + * @video_height: required height for pattern
> + * @bitdepth: required bitdepth fot pattern
> + * @alpha: required alpha for the pattern
> + *
> + * This function draws a color square pattern for given width and 
> height
> + * as per the specifications mentioned in section 3.2.5.3 of DP CTS 
> spec.
> + */
> +int igt_fill_cts_color_square_framebuffer(uint32_t *pixmap, uint32_t
> video_width,
> +		uint32_t video_height, uint32_t bitdepth, int alpha)
> +{
> +	uint32_t max_color_val = 0;
> +	uint32_t min_color_val = 0;
> +	uint32_t* pmax = &max_color_val;
> +	uint32_t* pmin = &min_color_val;
> +	int tile_width = 64;
> +	int tile_height = 64;
> +	int reverse = 0;
> +
> +	switch(bitdepth) {
> +	case 8:
> +		*pmax  = 235;
> +		*pmin  = 16;
> +		break;
> +	case 10:
> +		*pmax  = 940;
> +		*pmin  = 64;
> +		break;
> +        }
> +	/*
> + 	* According to the requirement stated in the 3.2.5.3  DP CTS spec
> the required pattern for color
> +	* square should look like below
> +	*
> +	*      white | yellow | cyan    | green | magenta | red    | blue  |
> black | white | ... | ..
> +	*
> -------------------------------------------------------------------------------
> +	*      blue  | red    | magenta | green | cyan    | yellow | white |
> black | blue  | ... | ..
> +	*
> -------------------------------------------------------------------------------
> +	*      white | yellow | cyan    | green | magenta | red    | blue  |
> black | white | ... | ..
> +	*
> -------------------------------------------------------------------------------
> +	*      blue  | red    | magenta | green | cyan    | yellow | white |
> black | blue  | ... | ..
> +	*
> 	--------------------------------------------------------------------------------
> +	*	.    |   .    |	  .	|  .	|   .     |	.  |   .   |   .   |   .   |  
> .
> +	*
> +	*	.    |	 .    |	  .	|  .	|   .	  |	.  |   .   |   .   |   .   |  .
> +	*
> +	*
> +	*/
> +        uint32_t colors[8][3] = {
> +	/* White Color */
> +        {(*pmax), (*pmax), (*pmax)},
> +	/* Yellow Color */
> +        {(*pmax), (*pmax), (*pmin)},
> +	/* Cyan Color */
> +        {(*pmin), (*pmax), (*pmax)},
> +	/* Green Color */
> +        {(*pmin), (*pmax), (*pmin)},
> +	/* Magenta Color */
> +        {(*pmax), (*pmin), (*pmax)},
> +	/* Red Color */
> +        {(*pmax), (*pmin), (*pmin)},
> +	/* Blue Color */
> +        {(*pmin), (*pmin), (*pmax)},
> +	/* Black Color */
> +        {(*pmin), (*pmin), (*pmin)},
> +        };
> +
> +	uint32_t reverse_colors[8][3] = {
> +	/* Blue Color */
> +	{(*pmin), (*pmin), (*pmax)},
> +	/* Red Color */
> +	{(*pmax), (*pmin), (*pmin)},
> +	/* Magenta Color */
> +	{(*pmax), (*pmin), (*pmax)},
> +	/* Green Color */
> +	{(*pmin), (*pmax), (*pmin)},
> +	/* Cyan Color */
> +	{(*pmin), (*pmax), (*pmax)},
> +	/* Yellow Color */
> +	{(*pmax), (*pmax), (*pmin)},
> +	/* White Color */
> +	{(*pmax), (*pmax), (*pmax)},
> +	/* Black Color */
> +	{(*pmin), (*pmin), (*pmin)},
> +	};
> +
> +	for (uint32_t height = 0; height < video_height; height++) {
> +		uint32_t color = 0;
> +		uint8_t *temp = pixmap;
> +		uint8_t **buffer = &temp;
> +		uint32_t (*color_array)[3];
> +		temp += (4 * video_width * height);
> +		for (uint32_t width = 0; width < video_width; width++) {
> +
> +			if (reverse == 0)
> +				color_array = colors;
> +			else
> +				color_array = reverse_colors;
> +
> +			/* using BGRA8888 format */
> +			*(*buffer)++ = (((uint8_t)color_array[color][2]) & 0xFF);
> +			*(*buffer)++ = (((uint8_t)color_array[color][1]) & 0xFF);
> +			*(*buffer)++ = (((uint8_t)color_array[color][0]) & 0xFF);
> +			*(*buffer)++ = ((uint8_t)alpha & 0xFF);
> +
> +			if (((width + 1) % tile_width) == 0)
> +				color = (color + 1 ) % 8;
> +
> +		}
> +		if (((height + 1) % tile_height)== 0) {
> +			if (reverse == 0)
> +				reverse = 1;
> +			else
> +				reverse = 0;
> +		}
> +	}
> +	return 0;
> +}
> +/**
> + * igt_fill_cts_color_ramp_framebuffer:
>   * @pixmap: handle to the mapped buffer
>   * @video_width: required width for the CTS pattern
>   * @video_height: required height for the CTS pattern
> @@ -1404,7 +1525,7 @@ void igt_paint_color(cairo_t *cr, int x, int y,
> int w, int h,
>   * @alpha: required alpha for the CTS pattern
>   * This functions draws the CTS test pattern for a given width, 
> height.
>   */
> -int igt_fill_cts_framebuffer(uint32_t *pixmap, uint32_t video_width,
> +int igt_fill_cts_color_ramp_framebuffer(uint32_t *pixmap, uint32_t 
> video_width,
>  		uint32_t video_height, uint32_t bitdepth, int alpha)
>  {
>  	uint32_t tile_height, tile_width;
> diff --git a/lib/igt_fb.h b/lib/igt_fb.h
> index 2c2b826..e6f2840 100644
> --- a/lib/igt_fb.h
> +++ b/lib/igt_fb.h
> @@ -213,8 +213,10 @@ bool igt_format_is_fp16(uint32_t drm_format);
>  int igt_format_plane_bpp(uint32_t drm_format, int plane);
>  void igt_format_array_fill(uint32_t **formats_array, unsigned int 
> *count,
>  			   bool allow_yuv);
> -int igt_fill_cts_framebuffer(uint32_t *pixmap, uint32_t video_width,
> +int igt_fill_cts_color_ramp_framebuffer(uint32_t *pixmap, uint32_t 
> video_width,
>  		uint32_t video_height, uint32_t bitdepth, int alpha);
> +int igt_fill_cts_color_square_framebuffer(uint32_t *pixmap,  uint32_t
> video_width,
> +                uint32_t video_height, uint32_t bitdepth, int alpha);
> 
>  int igt_fb_get_fnv1a_crc(struct igt_fb *fb, igt_crc_t *crc);
> 
> diff --git a/tools/intel_dp_compliance.c b/tools/intel_dp_compliance.c
> index fb94605..20216e7 100644
> --- a/tools/intel_dp_compliance.c
> +++ b/tools/intel_dp_compliance.c
> @@ -532,7 +532,7 @@ static int set_test_mode(struct connector *dp_conn)
>  			return ret;
>  		}
> 
> -		ret = igt_fill_cts_framebuffer(dp_conn->test_pattern.pixmap,
> +		ret = 
> igt_fill_cts_color_ramp_framebuffer(dp_conn->test_pattern.pixmap,
>  				dp_conn->test_pattern.hdisplay,
>  				dp_conn->test_pattern.vdisplay,
>  				dp_conn->test_pattern.bitdepth,
> diff --git a/tools/msm_dp_compliance.c b/tools/msm_dp_compliance.c
> index 7bc2bfa..144dfee 100644
> --- a/tools/msm_dp_compliance.c
> +++ b/tools/msm_dp_compliance.c
> @@ -143,6 +143,10 @@
>  /* DRM definitions - must be kept in sync with the DRM header */
>  #define DP_TEST_LINK_VIDEO_PATTERN	(1 << 1)
> 
> +
> +/* DP CTS PATTERN TYPE */
> +#define PATTERN_COLOR_RAMP 1
> +#define PATTERN_COLOR_SQUARE 3
>  /* Global file pointers for the sysfs files */
>  FILE *test_active_fp, *test_data_fp, *test_type_fp;
> 
> @@ -153,6 +157,7 @@ uint16_t hdisplay;
>  uint16_t vdisplay;
>  uint8_t bitdepth;
> 
> +uint16_t pattern;
>  drmModeRes *resources;
>  int drm_fd, modes, gen;
>  uint64_t tiling = LOCAL_DRM_FORMAT_MOD_NONE;
> @@ -172,6 +177,7 @@ struct test_video_pattern {
>  	uint16_t hdisplay;
>  	uint16_t vdisplay;
>  	uint8_t bitdepth;
> +	uint16_t pattern;
>  	uint32_t fb;
>  	uint32_t size;
>  	struct igt_fb fb_pattern;
> @@ -244,15 +250,15 @@ static unsigned long get_test_type(void)
>  static void get_test_videopattern_data(void)
>  {
>  	int count = 0;
> -	uint16_t video_pattern_value[3];
> -	char video_pattern_attribute[15];
> +	uint16_t video_pattern_value[5];
> +	char video_pattern_attribute[20];
>  	int ret;
> 
>  	if (!test_data_fp)
>  		fprintf(stderr, "Invalid test_data file\n");
> 
>  	rewind(test_data_fp);
> -	while (!feof(test_data_fp) && count < 3) {
> +	while (!feof(test_data_fp) && count < 4) {
>  		ret = fscanf(test_data_fp, "%s %u\n", video_pattern_attribute,
>  		       (unsigned int *)&video_pattern_value[count++]);
>  		if (ret < 2) {
> @@ -264,10 +270,11 @@ static void get_test_videopattern_data(void)
>  	hdisplay = video_pattern_value[0];
>  	vdisplay = video_pattern_value[1];
>  	bitdepth = video_pattern_value[2];
> +	pattern = video_pattern_value[3];
>  	igt_info("Hdisplay = %d\n", hdisplay);
>  	igt_info("Vdisplay = %d\n", vdisplay);
>  	igt_info("BitDepth = %u\n", bitdepth);
> -
> +	igt_info("pattern = %d\n", pattern);
>  }
> 
>  static int process_test_request(int test_type)
> @@ -325,6 +332,7 @@ static int setup_video_pattern_framebuffer(struct
> connector *dp_conn)
> 
>  	dp_conn->test_pattern.size = dp_conn->test_pattern.fb_pattern.size;
>  	memset(dp_conn->test_pattern.pixmap, 0, dp_conn->test_pattern.size);
> +	igt_info("size: %d \n",dp_conn->test_pattern.size);
>  	return 0;
> 
>  }
> @@ -374,6 +382,8 @@ static int set_test_mode(struct connector *dp_conn)
>  		dp_conn->test_pattern.hdisplay = hdisplay;
>  		dp_conn->test_pattern.vdisplay = vdisplay;
>  		dp_conn->test_pattern.bitdepth = bitdepth;
> +		dp_conn->test_pattern.pattern = pattern;
> +		igt_info("Pattern :%d\n", dp_conn->test_pattern.pattern);
> 
>  		ret = setup_video_pattern_framebuffer(dp_conn);
>  		if (ret) {
> @@ -381,16 +391,29 @@ static int set_test_mode(struct connector 
> *dp_conn)
>  				 c->connector_id, ret);
>  			return ret;
>  		}
> -
> -		ret = igt_fill_cts_framebuffer(dp_conn->test_pattern.pixmap,
> +		if(dp_conn->test_pattern.pattern == PATTERN_COLOR_RAMP) {
> +			ret = 
> igt_fill_cts_color_ramp_framebuffer(dp_conn->test_pattern.pixmap,
>  				dp_conn->test_pattern.hdisplay,
>  				dp_conn->test_pattern.vdisplay,
>  				dp_conn->test_pattern.bitdepth,
>  				0);
> -		if (ret) {
> -			igt_warn("Filling framebuffer for connector %u failed (%d)\n",
> -				 c->connector_id, ret);
> -			return ret;
> +			if (ret) {
> +				igt_warn("Filling framebuffer for connector %u failed (%d)\n",
> +					c->connector_id, ret);
> +				return ret;
> +			}
> +		}
> +		if(dp_conn->test_pattern.pattern == PATTERN_COLOR_SQUARE) {
> +			ret = 
> igt_fill_cts_color_square_framebuffer(dp_conn->test_pattern.pixmap,
> +                                dp_conn->test_pattern.hdisplay,
> +                                dp_conn->test_pattern.vdisplay,
> +                                dp_conn->test_pattern.bitdepth,
> +                                0);
> +			if(ret) {
> +				igt_warn("Filling framebuffer for connector %u failed (%d)\n",
> +					c->connector_id, ret);
> +				return ret;
> +			}
>  		}
>  		/* unmapping the buffer previously mapped during setup */
>  		munmap(dp_conn->test_pattern.pixmap,

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [igt-dev] [PATCH i-g-t 2/2] lib/igt_fb: add an API to support color square DP CTS pattern
  2021-08-05  3:40 ` [igt-dev] [PATCH i-g-t 2/2] lib/igt_fb: add an API to support color square DP CTS pattern maitreye
  2021-08-12 21:00   ` maitreye
@ 2021-08-13 11:33   ` Petri Latvala
       [not found]     ` <4951ee20ab1d8446e08de1c6dc09bd93@codeaurora.org>
  1 sibling, 1 reply; 7+ messages in thread
From: Petri Latvala @ 2021-08-13 11:33 UTC (permalink / raw)
  To: maitreye
  Cc: igt-dev, robdclark, seanpaul, swboyd, nganji, aravindh, abhinavk,
	khsieh, manasi.d.navare

On Wed, Aug 04, 2021 at 08:40:23PM -0700, maitreye wrote:
> Add an api to support the CTA range color square video test
> pattern as explained in section 3.2.5.3 of the DP CTS
> specification. This pattern is required for supporting
> the CTA range for RGB formats.
> 
> Also rename the existing api igt_fill_cts_framebuffer to
> igt_fill_cts_color_ramp_framebuffer to higlight the
> pattern type.
> 
> Signed-off-by: maitreye <maitreye@codeaurora.org>

Can you use your real name here?

> ---
>  lib/igt_fb.c                | 125 +++++++++++++++++++++++++++++++++++++++++++-
>  lib/igt_fb.h                |   4 +-
>  tools/intel_dp_compliance.c |   2 +-
>  tools/msm_dp_compliance.c   |  43 +++++++++++----
>  4 files changed, 160 insertions(+), 14 deletions(-)
> 
> diff --git a/lib/igt_fb.c b/lib/igt_fb.c
> index 583cc9e..3d34457 100644
> --- a/lib/igt_fb.c
> +++ b/lib/igt_fb.c
> @@ -1396,7 +1396,128 @@ void igt_paint_color(cairo_t *cr, int x, int y, int w, int h,
>  }
>  
>  /**
> - * igt_fill_cts_framebuffer:
> + *
> + * igt_fill_cts_color_square_framebuffer:
> + * @pixmap: handle to mapped buffer
> + * @video_width: required width for pattern
> + * @video_height: required height for pattern
> + * @bitdepth: required bitdepth fot pattern
> + * @alpha: required alpha for the pattern
> + *
> + * This function draws a color square pattern for given width and height
> + * as per the specifications mentioned in section 3.2.5.3 of DP CTS spec.
> + */
> +int igt_fill_cts_color_square_framebuffer(uint32_t *pixmap, uint32_t video_width,
> +		uint32_t video_height, uint32_t bitdepth, int alpha)
> +{
> +	uint32_t max_color_val = 0;
> +	uint32_t min_color_val = 0;
> +	uint32_t* pmax = &max_color_val;
> +	uint32_t* pmin = &min_color_val;


I'm not fully understanding why these pointers are used?



-- 
Petri Latvala


> +	int tile_width = 64;
> +	int tile_height = 64;
> +	int reverse = 0;
> +
> +	switch(bitdepth) {
> +	case 8:
> +		*pmax  = 235;
> +		*pmin  = 16;
> +		break;
> +	case 10:
> +		*pmax  = 940;
> +		*pmin  = 64;
> +		break;
> +        }
> +	/* 
> + 	* According to the requirement stated in the 3.2.5.3  DP CTS spec  the required pattern for color 
> +	* square should look like below
> +	*
> +	*      white | yellow | cyan    | green | magenta | red    | blue  | black | white | ... | ..
> +	*      -------------------------------------------------------------------------------
> +	*      blue  | red    | magenta | green | cyan    | yellow | white | black | blue  | ... | ..
> +	*      -------------------------------------------------------------------------------
> +	*      white | yellow | cyan    | green | magenta | red    | blue  | black | white | ... | ..
> +	*      -------------------------------------------------------------------------------
> +	*      blue  | red    | magenta | green | cyan    | yellow | white | black | blue  | ... | ..
> +	*      	--------------------------------------------------------------------------------
> +	*	.    |   .    |	  .	|  .	|   .     |	.  |   .   |   .   |   .   |  .
> +	*
> +	*	.    |	 .    |	  .	|  .	|   .	  |	.  |   .   |   .   |   .   |  .
> +	*
> +	*
> +	*/
> +        uint32_t colors[8][3] = {
> +	/* White Color */
> +        {(*pmax), (*pmax), (*pmax)}, 
> +	/* Yellow Color */
> +        {(*pmax), (*pmax), (*pmin)},
> +	/* Cyan Color */
> +        {(*pmin), (*pmax), (*pmax)},
> +	/* Green Color */  
> +        {(*pmin), (*pmax), (*pmin)},
> +	/* Magenta Color */
> +        {(*pmax), (*pmin), (*pmax)},
> +	/* Red Color */
> +        {(*pmax), (*pmin), (*pmin)},
> +	/* Blue Color */
> +        {(*pmin), (*pmin), (*pmax)},
> +	/* Black Color */
> +        {(*pmin), (*pmin), (*pmin)},
> +        };
> +
> +	uint32_t reverse_colors[8][3] = {
> +	/* Blue Color */
> +	{(*pmin), (*pmin), (*pmax)},
> +	/* Red Color */
> +	{(*pmax), (*pmin), (*pmin)},
> +	/* Magenta Color */
> +	{(*pmax), (*pmin), (*pmax)},
> +	/* Green Color */
> +	{(*pmin), (*pmax), (*pmin)},
> +	/* Cyan Color */  
> +	{(*pmin), (*pmax), (*pmax)},
> +	/* Yellow Color */
> +	{(*pmax), (*pmax), (*pmin)},
> +	/* White Color */
> +	{(*pmax), (*pmax), (*pmax)},
> +	/* Black Color */
> +	{(*pmin), (*pmin), (*pmin)},
> +	};
> +
> +	for (uint32_t height = 0; height < video_height; height++) {
> +		uint32_t color = 0;
> +		uint8_t *temp = pixmap;
> +		uint8_t **buffer = &temp;
> +		uint32_t (*color_array)[3];
> +		temp += (4 * video_width * height);
> +		for (uint32_t width = 0; width < video_width; width++) {
> +
> +			if (reverse == 0)
> +				color_array = colors;
> +			else
> +				color_array = reverse_colors;
> +
> +			/* using BGRA8888 format */
> +			*(*buffer)++ = (((uint8_t)color_array[color][2]) & 0xFF);
> +			*(*buffer)++ = (((uint8_t)color_array[color][1]) & 0xFF);
> +			*(*buffer)++ = (((uint8_t)color_array[color][0]) & 0xFF);
> +			*(*buffer)++ = ((uint8_t)alpha & 0xFF);
> +
> +			if (((width + 1) % tile_width) == 0)
> +				color = (color + 1 ) % 8;
> +
> +		}
> +		if (((height + 1) % tile_height)== 0) {
> +			if (reverse == 0)
> +				reverse = 1;
> +			else
> +				reverse = 0;
> +		}
> +	}
> +	return 0;
> +}
> +/**
> + * igt_fill_cts_color_ramp_framebuffer:
>   * @pixmap: handle to the mapped buffer
>   * @video_width: required width for the CTS pattern
>   * @video_height: required height for the CTS pattern
> @@ -1404,7 +1525,7 @@ void igt_paint_color(cairo_t *cr, int x, int y, int w, int h,
>   * @alpha: required alpha for the CTS pattern
>   * This functions draws the CTS test pattern for a given width, height.
>   */
> -int igt_fill_cts_framebuffer(uint32_t *pixmap, uint32_t video_width,
> +int igt_fill_cts_color_ramp_framebuffer(uint32_t *pixmap, uint32_t video_width,
>  		uint32_t video_height, uint32_t bitdepth, int alpha)
>  {
>  	uint32_t tile_height, tile_width;
> diff --git a/lib/igt_fb.h b/lib/igt_fb.h
> index 2c2b826..e6f2840 100644
> --- a/lib/igt_fb.h
> +++ b/lib/igt_fb.h
> @@ -213,8 +213,10 @@ bool igt_format_is_fp16(uint32_t drm_format);
>  int igt_format_plane_bpp(uint32_t drm_format, int plane);
>  void igt_format_array_fill(uint32_t **formats_array, unsigned int *count,
>  			   bool allow_yuv);
> -int igt_fill_cts_framebuffer(uint32_t *pixmap, uint32_t video_width,
> +int igt_fill_cts_color_ramp_framebuffer(uint32_t *pixmap, uint32_t video_width,
>  		uint32_t video_height, uint32_t bitdepth, int alpha);
> +int igt_fill_cts_color_square_framebuffer(uint32_t *pixmap,  uint32_t video_width,
> +                uint32_t video_height, uint32_t bitdepth, int alpha);
>  
>  int igt_fb_get_fnv1a_crc(struct igt_fb *fb, igt_crc_t *crc);
>  
> diff --git a/tools/intel_dp_compliance.c b/tools/intel_dp_compliance.c
> index fb94605..20216e7 100644
> --- a/tools/intel_dp_compliance.c
> +++ b/tools/intel_dp_compliance.c
> @@ -532,7 +532,7 @@ static int set_test_mode(struct connector *dp_conn)
>  			return ret;
>  		}
>  
> -		ret = igt_fill_cts_framebuffer(dp_conn->test_pattern.pixmap,
> +		ret = igt_fill_cts_color_ramp_framebuffer(dp_conn->test_pattern.pixmap,
>  				dp_conn->test_pattern.hdisplay,
>  				dp_conn->test_pattern.vdisplay,
>  				dp_conn->test_pattern.bitdepth,
> diff --git a/tools/msm_dp_compliance.c b/tools/msm_dp_compliance.c
> index 7bc2bfa..144dfee 100644
> --- a/tools/msm_dp_compliance.c
> +++ b/tools/msm_dp_compliance.c
> @@ -143,6 +143,10 @@
>  /* DRM definitions - must be kept in sync with the DRM header */
>  #define DP_TEST_LINK_VIDEO_PATTERN	(1 << 1)
>  
> +
> +/* DP CTS PATTERN TYPE */
> +#define PATTERN_COLOR_RAMP 1
> +#define PATTERN_COLOR_SQUARE 3
>  /* Global file pointers for the sysfs files */
>  FILE *test_active_fp, *test_data_fp, *test_type_fp;
>  
> @@ -153,6 +157,7 @@ uint16_t hdisplay;
>  uint16_t vdisplay;
>  uint8_t bitdepth;
>  
> +uint16_t pattern;
>  drmModeRes *resources;
>  int drm_fd, modes, gen;
>  uint64_t tiling = LOCAL_DRM_FORMAT_MOD_NONE;
> @@ -172,6 +177,7 @@ struct test_video_pattern {
>  	uint16_t hdisplay;
>  	uint16_t vdisplay;
>  	uint8_t bitdepth;
> +	uint16_t pattern;
>  	uint32_t fb;
>  	uint32_t size;
>  	struct igt_fb fb_pattern;
> @@ -244,15 +250,15 @@ static unsigned long get_test_type(void)
>  static void get_test_videopattern_data(void)
>  {
>  	int count = 0;
> -	uint16_t video_pattern_value[3];
> -	char video_pattern_attribute[15];
> +	uint16_t video_pattern_value[5];
> +	char video_pattern_attribute[20];
>  	int ret;
>  
>  	if (!test_data_fp)
>  		fprintf(stderr, "Invalid test_data file\n");
>  
>  	rewind(test_data_fp);
> -	while (!feof(test_data_fp) && count < 3) {
> +	while (!feof(test_data_fp) && count < 4) {
>  		ret = fscanf(test_data_fp, "%s %u\n", video_pattern_attribute,
>  		       (unsigned int *)&video_pattern_value[count++]);
>  		if (ret < 2) {
> @@ -264,10 +270,11 @@ static void get_test_videopattern_data(void)
>  	hdisplay = video_pattern_value[0];
>  	vdisplay = video_pattern_value[1];
>  	bitdepth = video_pattern_value[2];
> +	pattern = video_pattern_value[3];
>  	igt_info("Hdisplay = %d\n", hdisplay);
>  	igt_info("Vdisplay = %d\n", vdisplay);
>  	igt_info("BitDepth = %u\n", bitdepth);
> -
> +	igt_info("pattern = %d\n", pattern);
>  }
>  
>  static int process_test_request(int test_type)
> @@ -325,6 +332,7 @@ static int setup_video_pattern_framebuffer(struct connector *dp_conn)
>  
>  	dp_conn->test_pattern.size = dp_conn->test_pattern.fb_pattern.size;
>  	memset(dp_conn->test_pattern.pixmap, 0, dp_conn->test_pattern.size);
> +	igt_info("size: %d \n",dp_conn->test_pattern.size);
>  	return 0;
>  
>  }
> @@ -374,6 +382,8 @@ static int set_test_mode(struct connector *dp_conn)
>  		dp_conn->test_pattern.hdisplay = hdisplay;
>  		dp_conn->test_pattern.vdisplay = vdisplay;
>  		dp_conn->test_pattern.bitdepth = bitdepth;
> +		dp_conn->test_pattern.pattern = pattern;
> +		igt_info("Pattern :%d\n", dp_conn->test_pattern.pattern);
>  
>  		ret = setup_video_pattern_framebuffer(dp_conn);
>  		if (ret) {
> @@ -381,16 +391,29 @@ static int set_test_mode(struct connector *dp_conn)
>  				 c->connector_id, ret);
>  			return ret;
>  		}
> -
> -		ret = igt_fill_cts_framebuffer(dp_conn->test_pattern.pixmap,
> +		if(dp_conn->test_pattern.pattern == PATTERN_COLOR_RAMP) {
> +			ret = igt_fill_cts_color_ramp_framebuffer(dp_conn->test_pattern.pixmap,
>  				dp_conn->test_pattern.hdisplay,
>  				dp_conn->test_pattern.vdisplay,
>  				dp_conn->test_pattern.bitdepth,
>  				0);
> -		if (ret) {
> -			igt_warn("Filling framebuffer for connector %u failed (%d)\n",
> -				 c->connector_id, ret);
> -			return ret;
> +			if (ret) {
> +				igt_warn("Filling framebuffer for connector %u failed (%d)\n",
> +					c->connector_id, ret);
> +				return ret;
> +			}
> +		}
> +		if(dp_conn->test_pattern.pattern == PATTERN_COLOR_SQUARE) {
> +			ret = igt_fill_cts_color_square_framebuffer(dp_conn->test_pattern.pixmap,
> +                                dp_conn->test_pattern.hdisplay,
> +                                dp_conn->test_pattern.vdisplay,
> +                                dp_conn->test_pattern.bitdepth,
> +                                0);
> +			if(ret) {
> +				igt_warn("Filling framebuffer for connector %u failed (%d)\n",
> +					c->connector_id, ret);
> +				return ret;
> +			}
>  		}
>  		/* unmapping the buffer previously mapped during setup */
>  		munmap(dp_conn->test_pattern.pixmap,
> -- 
> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
> a Linux Foundation Collaborative Project
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [igt-dev] [PATCH i-g-t 2/2] lib/igt_fb: add an API to support color square DP CTS pattern
       [not found]     ` <4951ee20ab1d8446e08de1c6dc09bd93@codeaurora.org>
@ 2022-02-15  1:49       ` Abhinav Kumar
  0 siblings, 0 replies; 7+ messages in thread
From: Abhinav Kumar @ 2022-02-15  1:49 UTC (permalink / raw)
  To: Petri Latvala; +Cc: quic_khsieh, swboyd, igt-dev, nganji, seanpaul, aravindh

Hi Petri

Thanks for the comments and sorry for the late response.

Once Maitreyee left, this patch got abandoned.

I will take this over and address your comments.

Thanks

Abhinav

On 2/14/2022 5:46 PM, abhinavk@codeaurora.org wrote:
> 
> 
> -------- Original Message --------
> Subject: Re: [PATCH i-g-t 2/2] lib/igt_fb: add an API to support color 
> square DP CTS pattern
> Date: 2021-08-13 04:33
> From: Petri Latvala <petri.latvala@intel.com>
> To: maitreye <maitreye@codeaurora.org>
> Cc: igt-dev@lists.freedesktop.org, robdclark@gmail.com, 
> seanpaul@chromium.org, swboyd@chromium.org, nganji@codeaurora.org, 
> aravindh@codeaurora.org, abhinavk@codeaurora.org, khsieh@codeaurora.org, 
> manasi.d.navare@intel.com
> 
> On Wed, Aug 04, 2021 at 08:40:23PM -0700, maitreye wrote:
>> Add an api to support the CTA range color square video test
>> pattern as explained in section 3.2.5.3 of the DP CTS
>> specification. This pattern is required for supporting
>> the CTA range for RGB formats.
>>
>> Also rename the existing api igt_fill_cts_framebuffer to
>> igt_fill_cts_color_ramp_framebuffer to higlight the
>> pattern type.
>>
>> Signed-off-by: maitreye <maitreye@codeaurora.org>
> 
> Can you use your real name here?
> 
>> ---
>>  lib/igt_fb.c                | 125 
>> +++++++++++++++++++++++++++++++++++++++++++-
>>  lib/igt_fb.h                |   4 +-
>>  tools/intel_dp_compliance.c |   2 +-
>>  tools/msm_dp_compliance.c   |  43 +++++++++++----
>>  4 files changed, 160 insertions(+), 14 deletions(-)
>>
>> diff --git a/lib/igt_fb.c b/lib/igt_fb.c
>> index 583cc9e..3d34457 100644
>> --- a/lib/igt_fb.c
>> +++ b/lib/igt_fb.c
>> @@ -1396,7 +1396,128 @@ void igt_paint_color(cairo_t *cr, int x, int 
>> y, int w, int h,
>>  }
>>
>>  /**
>> - * igt_fill_cts_framebuffer:
>> + *
>> + * igt_fill_cts_color_square_framebuffer:
>> + * @pixmap: handle to mapped buffer
>> + * @video_width: required width for pattern
>> + * @video_height: required height for pattern
>> + * @bitdepth: required bitdepth fot pattern
>> + * @alpha: required alpha for the pattern
>> + *
>> + * This function draws a color square pattern for given width and height
>> + * as per the specifications mentioned in section 3.2.5.3 of DP CTS 
>> spec.
>> + */
>> +int igt_fill_cts_color_square_framebuffer(uint32_t *pixmap, uint32_t 
>> video_width,
>> +        uint32_t video_height, uint32_t bitdepth, int alpha)
>> +{
>> +    uint32_t max_color_val = 0;
>> +    uint32_t min_color_val = 0;
>> +    uint32_t* pmax = &max_color_val;
>> +    uint32_t* pmin = &min_color_val;
> 
> 
> I'm not fully understanding why these pointers are used?
> 
> 
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-02-15  1:49 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-05  3:40 [igt-dev] [PATCH i-g-t 1/2] lib/igt_fb: check device type before calling intel_get_drm_devid maitreye
2021-08-05  3:40 ` [igt-dev] [PATCH i-g-t 2/2] lib/igt_fb: add an API to support color square DP CTS pattern maitreye
2021-08-12 21:00   ` maitreye
2021-08-13 11:33   ` Petri Latvala
     [not found]     ` <4951ee20ab1d8446e08de1c6dc09bd93@codeaurora.org>
2022-02-15  1:49       ` Abhinav Kumar
2021-08-05  3:55 ` [igt-dev] ✗ Fi.CI.BUILD: failure for series starting with [i-g-t,1/2] lib/igt_fb: check device type before calling intel_get_drm_devid Patchwork
2021-08-06 16:38 ` [igt-dev] [PATCH i-g-t 1/2] " Sean Paul

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.