All of lore.kernel.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH i-g-t 0/3] Add FB_DAMAGE_CLIPS prop and new test for Selective fetch
@ 2020-12-08 17:01 Pankaj Bharadiya
  2020-12-08 17:01 ` [igt-dev] [PATCH i-g-t 1/3] lib/kms: Add fb damage clip plane property Pankaj Bharadiya
                   ` (6 more replies)
  0 siblings, 7 replies; 14+ messages in thread
From: Pankaj Bharadiya @ 2020-12-08 17:01 UTC (permalink / raw)
  To: gwan-gyeong.mun, igt-dev, jose.souza

Add new test for selective fetch
 
Pankaj Bharadiya (3):
  lib/kms: Add fb damage clip plane property
  lib/igt_psr: Add function to check PSR2 selective fetch
  tests: Add new PSR2 selective fetch test

 lib/igt_kms.c          |   3 +
 lib/igt_kms.h          |   1 +
 lib/igt_psr.c          |  10 +
 lib/igt_psr.h          |   1 +
 tests/Makefile.sources |   1 +
 tests/kms_psr2_sf.c    | 649 +++++++++++++++++++++++++++++++++++++++++
 tests/meson.build      |   1 +
 7 files changed, 666 insertions(+)
 create mode 100644 tests/kms_psr2_sf.c

-- 
2.29.2

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

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

* [igt-dev] [PATCH i-g-t 1/3] lib/kms: Add fb damage clip plane property
  2020-12-08 17:01 [igt-dev] [PATCH i-g-t 0/3] Add FB_DAMAGE_CLIPS prop and new test for Selective fetch Pankaj Bharadiya
@ 2020-12-08 17:01 ` Pankaj Bharadiya
  2020-12-08 17:01 ` [igt-dev] [PATCH i-g-t 2/3] lib/igt_psr: Add function to check PSR2 selective fetch Pankaj Bharadiya
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 14+ messages in thread
From: Pankaj Bharadiya @ 2020-12-08 17:01 UTC (permalink / raw)
  To: gwan-gyeong.mun, igt-dev, jose.souza

FB_DAMAGE_CLIPS property is been in DRM for a while but was never
added to IGT.
Add support for FB_DAMAGE_CLIPS property so that kms tests can us it.

Reviewed-by: Jose Roberto de Souza <jose.souza@intel.com>
Signed-off-by: Pankaj Bharadiya <pankaj.laxminarayan.bharadiya@intel.com>
---
 lib/igt_kms.c | 3 +++
 lib/igt_kms.h | 1 +
 2 files changed, 4 insertions(+)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 9175e50fe..1166efcbb 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -396,6 +396,7 @@ const char * const igt_plane_prop_names[IGT_NUM_PLANE_PROPS] = {
 	[IGT_PLANE_PIXEL_BLEND_MODE] = "pixel blend mode",
 	[IGT_PLANE_ALPHA] = "alpha",
 	[IGT_PLANE_ZPOS] = "zpos",
+	[IGT_PLANE_FB_DAMAGE_CLIPS] = "FB_DAMAGE_CLIPS",
 };
 
 const char * const igt_crtc_prop_names[IGT_NUM_CRTC_PROPS] = {
@@ -1775,6 +1776,8 @@ static void igt_plane_reset(igt_plane_t *plane)
 	if (igt_plane_has_prop(plane, IGT_PLANE_ALPHA))
 		igt_plane_set_prop_value(plane, IGT_PLANE_ALPHA, 0xffff);
 
+	if (igt_plane_has_prop(plane, IGT_PLANE_FB_DAMAGE_CLIPS))
+		igt_plane_set_prop_value(plane, IGT_PLANE_FB_DAMAGE_CLIPS, 0);
 
 	igt_plane_clear_prop_changed(plane, IGT_PLANE_IN_FENCE_FD);
 	plane->values[IGT_PLANE_IN_FENCE_FD] = ~0ULL;
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index 1fcae2436..09b10b3e0 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -281,6 +281,7 @@ enum igt_atomic_plane_properties {
        IGT_PLANE_PIXEL_BLEND_MODE,
        IGT_PLANE_ALPHA,
        IGT_PLANE_ZPOS,
+       IGT_PLANE_FB_DAMAGE_CLIPS,
        IGT_NUM_PLANE_PROPS
 };
 
-- 
2.29.2

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

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

* [igt-dev] [PATCH i-g-t 2/3] lib/igt_psr: Add function to check PSR2 selective fetch
  2020-12-08 17:01 [igt-dev] [PATCH i-g-t 0/3] Add FB_DAMAGE_CLIPS prop and new test for Selective fetch Pankaj Bharadiya
  2020-12-08 17:01 ` [igt-dev] [PATCH i-g-t 1/3] lib/kms: Add fb damage clip plane property Pankaj Bharadiya
@ 2020-12-08 17:01 ` Pankaj Bharadiya
  2020-12-08 17:01 ` [igt-dev] [PATCH i-g-t 3/3] tests: Add new PSR2 selective fetch test Pankaj Bharadiya
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 14+ messages in thread
From: Pankaj Bharadiya @ 2020-12-08 17:01 UTC (permalink / raw)
  To: gwan-gyeong.mun, igt-dev, jose.souza

Add a helper function to check whether "PSR2 selective fetch" is
enabled.
This function should be used wherever "PSR2 selective fetch"
status check needed.

Reviewed-by: Jose Roberto de Souza <jose.souza@intel.com>
Signed-off-by: Pankaj Bharadiya <pankaj.laxminarayan.bharadiya@intel.com>
---
 lib/igt_psr.c | 10 ++++++++++
 lib/igt_psr.h |  1 +
 2 files changed, 11 insertions(+)

diff --git a/lib/igt_psr.c b/lib/igt_psr.c
index 6cdb97bcc..d5167fbad 100644
--- a/lib/igt_psr.c
+++ b/lib/igt_psr.c
@@ -36,6 +36,16 @@ bool psr_disabled_check(int debugfs_fd)
 	return strstr(buf, "PSR mode: disabled\n");
 }
 
+bool psr2_selective_fetch_check(int debugfs_fd)
+{
+	char buf[PSR_STATUS_MAX_LEN];
+
+	igt_debugfs_simple_read(debugfs_fd, "i915_edp_psr_status", buf,
+				sizeof(buf));
+
+	return strstr(buf, "PSR2 selective fetch: enabled");
+}
+
 static bool psr_active_check(int debugfs_fd, enum psr_mode mode)
 {
 	char buf[PSR_STATUS_MAX_LEN];
diff --git a/lib/igt_psr.h b/lib/igt_psr.h
index 8368ecb49..25111cc2b 100644
--- a/lib/igt_psr.h
+++ b/lib/igt_psr.h
@@ -36,6 +36,7 @@ enum psr_mode {
 };
 
 bool psr_disabled_check(int debugfs_fd);
+bool psr2_selective_fetch_check(int debugfs_fd);
 bool psr_wait_entry(int debugfs_fd, enum psr_mode mode);
 bool psr_wait_update(int debugfs_fd, enum psr_mode mode);
 bool psr_long_wait_update(int debugfs_fd, enum psr_mode mode);
-- 
2.29.2

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

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

* [igt-dev] [PATCH i-g-t 3/3] tests: Add new PSR2 selective fetch test
  2020-12-08 17:01 [igt-dev] [PATCH i-g-t 0/3] Add FB_DAMAGE_CLIPS prop and new test for Selective fetch Pankaj Bharadiya
  2020-12-08 17:01 ` [igt-dev] [PATCH i-g-t 1/3] lib/kms: Add fb damage clip plane property Pankaj Bharadiya
  2020-12-08 17:01 ` [igt-dev] [PATCH i-g-t 2/3] lib/igt_psr: Add function to check PSR2 selective fetch Pankaj Bharadiya
@ 2020-12-08 17:01 ` Pankaj Bharadiya
  2020-12-16 10:50   ` Mun, Gwan-gyeong
  2020-12-08 17:22 ` [igt-dev] [PATCH i-g-t 0/3] Add FB_DAMAGE_CLIPS prop and new test for Selective fetch Souza, Jose
                   ` (3 subsequent siblings)
  6 siblings, 1 reply; 14+ messages in thread
From: Pankaj Bharadiya @ 2020-12-08 17:01 UTC (permalink / raw)
  To: gwan-gyeong.mun, igt-dev, jose.souza

Selective fetch reduces display engine use of memory bandwidth
by only fetching (reading from memory) the updated regions of the frame
buffer and sending those updated regions to a panel with a PSR2 capability.

The FB_DAMAGE_CLIPS plane property provides user-space a way inform
kernel about the updated regions.

Add new test to verify selective fetch by using FB_DAMAGE_CLIPS property
to send  updated regions.

changes since v1:
* alloc enough clips for all tests in stack and reuse (Jose)
* set damage clip along with draw, refactor code, rename
  variables, etc (Jose)

Signed-off-by: Pankaj Bharadiya <pankaj.laxminarayan.bharadiya@intel.com>
---
 tests/Makefile.sources |   1 +
 tests/kms_psr2_sf.c    | 649 +++++++++++++++++++++++++++++++++++++++++
 tests/meson.build      |   1 +
 3 files changed, 651 insertions(+)
 create mode 100644 tests/kms_psr2_sf.c

diff --git a/tests/Makefile.sources b/tests/Makefile.sources
index 15fb56048..e7e399165 100644
--- a/tests/Makefile.sources
+++ b/tests/Makefile.sources
@@ -80,6 +80,7 @@ TESTS_progs = \
 	kms_properties \
 	kms_psr \
 	kms_psr2_su \
+	kms_psr2_sf \
 	kms_pwrite_crc \
 	kms_rmfb \
 	kms_rotation_crc \
diff --git a/tests/kms_psr2_sf.c b/tests/kms_psr2_sf.c
new file mode 100644
index 000000000..296ed8476
--- /dev/null
+++ b/tests/kms_psr2_sf.c
@@ -0,0 +1,649 @@
+/*
+ * Copyright © 2020 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ *
+ */
+
+#include "igt.h"
+#include "igt_sysfs.h"
+#include "igt_psr.h"
+#include <errno.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <string.h>
+#include "intel_bufmgr.h"
+
+IGT_TEST_DESCRIPTION("Tests to varify PSR2 selective fetch by sending multiple"
+		     " damaged areas");
+
+#define SQUARE_SIZE 100
+
+#define CUR_SIZE 64
+#define MAX_DAMAGE_AREAS 5
+
+enum operations {
+	PLANE_UPDATE,
+	PLANE_MOVE,
+	OVERLAY_PRIM_UPDATE
+};
+
+enum plane_move_postion {
+	POS_TOP_LEFT,
+	POS_TOP_RIGHT,
+	POS_BOTTOM_LEFT,
+	POS_BOTTOM_RIGHT
+};
+
+typedef struct {
+	int drm_fd;
+	int debugfs_fd;
+	igt_display_t display;
+	drm_intel_bufmgr *bufmgr;
+	drmModeModeInfo *mode;
+	igt_output_t *output;
+	struct igt_fb fb_primary, fb_overlay, fb_cursor;
+	struct igt_fb fb_test;
+	int damage_area_count;
+	struct drm_mode_rect plane_update_clip[MAX_DAMAGE_AREAS];
+	struct drm_mode_rect plane_move_clip;
+	struct drm_mode_rect cursor_clip;
+	enum operations op;
+	enum plane_move_postion pos;
+	int test_plane_id;
+	igt_plane_t *test_plane;
+	cairo_t *cr;
+} data_t;
+
+static const char *op_str(enum operations op)
+{
+	static const char * const name[] = {
+		[PLANE_UPDATE] = "plane-update",
+		[PLANE_MOVE] = "plane-move",
+		[OVERLAY_PRIM_UPDATE] = "overlay-primary-update",
+	};
+
+	return name[op];
+}
+
+static void setup_output(data_t *data)
+{
+	igt_display_t *display = &data->display;
+	igt_output_t *output;
+	enum pipe pipe;
+
+	for_each_pipe_with_valid_output(display, pipe, output) {
+		drmModeConnectorPtr c = output->config.connector;
+
+		if (c->connector_type != DRM_MODE_CONNECTOR_eDP)
+			continue;
+
+		igt_output_set_pipe(output, pipe);
+		data->output = output;
+		data->mode = igt_output_get_mode(output);
+
+		return;
+	}
+}
+
+static void display_init(data_t *data)
+{
+	igt_display_require(&data->display, data->drm_fd);
+	setup_output(data);
+}
+
+static void display_fini(data_t *data)
+{
+	igt_display_fini(&data->display);
+}
+
+static void draw_rect(data_t *data, igt_fb_t *fb, int x, int y, int w, int h,
+			double r, double g, double b, double a)
+{
+	cairo_t *cr;
+
+	cr = igt_get_cairo_ctx(data->drm_fd, fb);
+	igt_paint_color_alpha(cr, x, y, w, h, r, g, b, a);
+	igt_put_cairo_ctx(cr);
+}
+
+static void set_clip(struct drm_mode_rect *clip, int x, int y, int width,
+		     int height)
+{
+	clip->x1 = x;
+	clip->y1 = y;
+	clip->x2 = x + width;
+	clip->y2 = y + height;
+}
+
+static void plane_update_setup_squares(data_t *data, igt_fb_t *fb, uint32_t h,
+				       uint32_t v)
+{
+	int x, y;
+	int width = SQUARE_SIZE;
+	int height = SQUARE_SIZE;
+
+	switch (data->damage_area_count) {
+	case 5:
+		/*Bottom right corner*/
+		x = h - SQUARE_SIZE;
+		y = v - SQUARE_SIZE;
+
+		draw_rect(data, fb, x, y, width, height, 1.0, 1.0, 1.0, 1.0);
+		set_clip(&data->plane_update_clip[4], x, y, width, height);
+	case 4:
+		/*Bottom left corner*/
+		x = 0;
+		y = v - SQUARE_SIZE;
+
+		draw_rect(data, fb, x, y, width, height, 1.0, 1.0, 1.0, 1.0);
+		set_clip(&data->plane_update_clip[3], x, y, width, height);
+	case 3:
+		/*Top right corner*/
+		x = h - SQUARE_SIZE;
+		y = 0;
+
+		draw_rect(data, fb, x, y, width, height, 1.0, 1.0, 1.0, 1.0);
+		set_clip(&data->plane_update_clip[2], x, y, width, height);
+	case 2:
+		/*Top left corner*/
+		x = 0;
+		y = 0;
+
+		draw_rect(data, fb, x, y, width, height, 1.0, 1.0, 1.0, 1.0);
+		set_clip(&data->plane_update_clip[1], x, y, width, height);
+	case 1:
+		/*Center*/
+		x = h/2 - SQUARE_SIZE/2;
+		y = v/2 - SQUARE_SIZE/2;
+
+		draw_rect(data, fb, x, y, width, height, 1.0, 1.0, 1.0, 1.0);
+		set_clip(&data->plane_update_clip[0], x, y, width, height);
+		break;
+	default:
+		igt_assert(false);
+	}
+}
+
+static void plane_move_setup_square(data_t *data, igt_fb_t *fb, uint32_t h,
+				       uint32_t v)
+{
+	int x = 0, y = 0;
+
+	switch (data->pos) {
+	case POS_TOP_LEFT:
+		/*Bottom right corner*/
+		x = h - SQUARE_SIZE;
+		y = v - SQUARE_SIZE;
+		break;
+	case POS_TOP_RIGHT:
+		/*Bottom left corner*/
+		x = 0;
+		y = v - SQUARE_SIZE;
+		break;
+	case POS_BOTTOM_LEFT:
+		/*Top right corner*/
+		x = h - SQUARE_SIZE;
+		y = 0;
+		break;
+	case POS_BOTTOM_RIGHT:
+		/*Top left corner*/
+		x = 0;
+		y = 0;
+		break;
+	default:
+		igt_assert(false);
+	}
+
+	draw_rect(data, fb, x, y,
+		  SQUARE_SIZE, SQUARE_SIZE, 1.0, 1.0, 1.0, 1.0);
+	set_clip(&data->plane_move_clip, x, y, SQUARE_SIZE, SQUARE_SIZE);
+}
+
+static void prepare(data_t *data)
+{
+	igt_plane_t *primary, *sprite = NULL, *cursor = NULL;
+
+	/* all green frame */
+	igt_create_color_fb(data->drm_fd,
+			    data->mode->hdisplay, data->mode->vdisplay,
+			    DRM_FORMAT_XRGB8888,
+			    LOCAL_DRM_FORMAT_MOD_NONE,
+			    0.0, 1.0, 0.0,
+			    &data->fb_primary);
+
+	primary = igt_output_get_plane_type(data->output,
+			DRM_PLANE_TYPE_PRIMARY);
+
+	switch (data->test_plane_id) {
+	case DRM_PLANE_TYPE_OVERLAY:
+		sprite = igt_output_get_plane_type(data->output,
+						   DRM_PLANE_TYPE_OVERLAY);
+		/*All blue plane*/
+		igt_create_color_fb(data->drm_fd,
+				    data->mode->hdisplay/2,
+				    data->mode->vdisplay/2,
+				    DRM_FORMAT_XRGB8888,
+				    LOCAL_DRM_FORMAT_MOD_NONE,
+				    0.0, 0.0, 1.0,
+				    &data->fb_overlay);
+
+		igt_create_color_fb(data->drm_fd,
+				    data->mode->hdisplay/2,
+				    data->mode->vdisplay/2,
+				    DRM_FORMAT_XRGB8888,
+				    LOCAL_DRM_FORMAT_MOD_NONE,
+				    0.0, 0.0, 1.0,
+				    &data->fb_test);
+
+		if (data->op == PLANE_MOVE) {
+			plane_move_setup_square(data, &data->fb_test,
+					   data->mode->hdisplay/2,
+					   data->mode->vdisplay/2);
+
+		} else {
+			plane_update_setup_squares(data, &data->fb_test,
+					   data->mode->hdisplay/2,
+					   data->mode->vdisplay/2);
+		}
+
+		igt_plane_set_fb(sprite, &data->fb_overlay);
+		data->test_plane = sprite;
+		break;
+
+	case DRM_PLANE_TYPE_PRIMARY:
+		igt_create_color_fb(data->drm_fd,
+			    data->mode->hdisplay, data->mode->vdisplay,
+			    DRM_FORMAT_XRGB8888,
+			    LOCAL_DRM_FORMAT_MOD_NONE,
+			    0.0, 1.0, 0.0,
+			    &data->fb_test);
+
+		plane_update_setup_squares(data, &data->fb_test,
+					   data->mode->hdisplay,
+					   data->mode->vdisplay);
+		data->test_plane = primary;
+
+		if (data->op == OVERLAY_PRIM_UPDATE) {
+			sprite = igt_output_get_plane_type(data->output,
+						   DRM_PLANE_TYPE_OVERLAY);
+
+			igt_create_color_fb(data->drm_fd,
+					    data->mode->hdisplay,
+					    data->mode->vdisplay,
+					    DRM_FORMAT_XRGB8888,
+					    LOCAL_DRM_FORMAT_MOD_NONE,
+					    0.0, 0.0, 1.0,
+					    &data->fb_overlay);
+
+			igt_plane_set_fb(sprite, &data->fb_overlay);
+			igt_plane_set_prop_value(sprite, IGT_PLANE_ALPHA,
+						 0x6060);
+		}
+		break;
+
+	case DRM_PLANE_TYPE_CURSOR:
+		cursor = igt_output_get_plane_type(data->output,
+						   DRM_PLANE_TYPE_CURSOR);
+		igt_plane_set_position(cursor, 0, 0);
+
+		igt_create_fb(data->drm_fd, CUR_SIZE, CUR_SIZE,
+			      DRM_FORMAT_ARGB8888, LOCAL_DRM_FORMAT_MOD_NONE,
+			      &data->fb_cursor);
+
+		draw_rect(data, &data->fb_cursor, 0, 0, CUR_SIZE, CUR_SIZE,
+			    0.0, 0.0, 1.0, 1.0);
+
+		igt_create_fb(data->drm_fd, CUR_SIZE, CUR_SIZE,
+			      DRM_FORMAT_ARGB8888, LOCAL_DRM_FORMAT_MOD_NONE,
+			      &data->fb_test);
+
+		draw_rect(data, &data->fb_test, 0, 0, CUR_SIZE, CUR_SIZE,
+			    1.0, 1.0, 1.0, 1.0);
+
+		set_clip(&data->cursor_clip, 0, 0, CUR_SIZE, CUR_SIZE);
+		igt_plane_set_fb(cursor, &data->fb_cursor);
+		data->test_plane = cursor;
+		break;
+	default:
+		igt_assert(false);
+	}
+
+	igt_plane_set_fb(primary, &data->fb_primary);
+
+	igt_display_commit2(&data->display, COMMIT_ATOMIC);
+}
+
+static inline void manual(const char *expected)
+{
+	igt_debug_manual_check("all", expected);
+}
+
+static void plane_update_expected_output(int plane_type, int box_count)
+{
+	char expected[64] = {};
+
+	switch (plane_type) {
+	case DRM_PLANE_TYPE_PRIMARY:
+		sprintf(expected, "screen Green with %d White box(es)",
+			box_count);
+		break;
+	case DRM_PLANE_TYPE_OVERLAY:
+		sprintf(expected,
+			"screen Green with Blue box and %d White box(es)",
+			box_count);
+		break;
+	case DRM_PLANE_TYPE_CURSOR:
+		sprintf(expected, "screen Green with %d White box(es)",
+			box_count);
+		break;
+	default:
+		igt_assert(false);
+	}
+
+	manual(expected);
+}
+
+static void plane_move_expected_output(enum plane_move_postion pos)
+{
+	char expected[64] = {};
+
+	switch (pos) {
+	case POS_TOP_LEFT:
+		sprintf(expected,
+			"screen Green with Blue box on top left corner and White box");
+		break;
+	case POS_TOP_RIGHT:
+		sprintf(expected,
+			"screen Green with Blue box on top right corner and White box");
+		break;
+	case POS_BOTTOM_LEFT:
+		sprintf(expected,
+			"screen Green with Blue box on bottom left corner and White box");
+		break;
+	case POS_BOTTOM_RIGHT:
+		sprintf(expected,
+			"screen Green with Blue box on bottom right corner and White box");
+		break;
+	default:
+		igt_assert(false);
+	}
+
+	manual(expected);
+}
+
+static void overlay_prim_update_expected_output(int box_count)
+{
+	char expected[64] = {};
+
+	sprintf(expected,
+		"screen Green with Blue overlay, %d light Blue box(es)",
+		box_count);
+
+	manual(expected);
+
+}
+
+static void expected_output(data_t *data)
+{
+	switch (data->op) {
+	case PLANE_MOVE:
+		plane_move_expected_output(data->pos);
+		break;
+	case PLANE_UPDATE:
+		plane_update_expected_output(data->test_plane_id,
+					     data->damage_area_count);
+		break;
+	case OVERLAY_PRIM_UPDATE:
+		overlay_prim_update_expected_output(data->damage_area_count);
+		break;
+	default:
+		igt_assert(false);
+	}
+}
+
+static void damaged_plane_move(data_t *data)
+{
+	igt_plane_t *test_plane = data->test_plane;
+	uint32_t h = data->mode->hdisplay;
+	uint32_t v = data->mode->vdisplay;
+
+	igt_plane_set_fb(test_plane, &data->fb_test);
+
+	if (data->test_plane_id == DRM_PLANE_TYPE_OVERLAY) {
+		h = h/2;
+		v = v/2;
+	}
+
+	igt_plane_replace_prop_blob(test_plane, IGT_PLANE_FB_DAMAGE_CLIPS,
+				    &data->plane_move_clip,
+				    sizeof(struct drm_mode_rect));
+
+	switch (data->pos) {
+	case POS_TOP_LEFT:
+		igt_plane_set_position(data->test_plane, 0, 0);
+		break;
+	case POS_TOP_RIGHT:
+		igt_plane_set_position(data->test_plane,
+				       data->mode->hdisplay/2, 0);
+		break;
+	case POS_BOTTOM_LEFT:
+		igt_plane_set_position(data->test_plane, 0,
+				       data->mode->vdisplay/2);
+		break;
+	case POS_BOTTOM_RIGHT:
+		igt_plane_set_position(data->test_plane,
+				       data->mode->hdisplay/2,
+				       data->mode->vdisplay/2);
+		break;
+	default:
+		igt_assert(false);
+	}
+
+	igt_display_commit2(&data->display, COMMIT_ATOMIC);
+
+	igt_assert(psr_wait_entry(data->debugfs_fd, PSR_MODE_2));
+
+	expected_output(data);
+}
+
+static void damaged_plane_update(data_t *data)
+{
+	igt_plane_t *test_plane = data->test_plane;
+	uint32_t h = data->mode->hdisplay;
+	uint32_t v = data->mode->vdisplay;
+
+	igt_plane_set_fb(test_plane, &data->fb_test);
+
+	if (data->test_plane_id == DRM_PLANE_TYPE_OVERLAY) {
+		h = h/2;
+		v = v/2;
+	}
+
+	if (data->test_plane_id == DRM_PLANE_TYPE_CURSOR)
+		igt_plane_replace_prop_blob(test_plane,
+					    IGT_PLANE_FB_DAMAGE_CLIPS,
+					    &data->cursor_clip,
+					    sizeof(struct drm_mode_rect));
+	else
+		igt_plane_replace_prop_blob(test_plane,
+					    IGT_PLANE_FB_DAMAGE_CLIPS,
+					    &data->plane_update_clip,
+					    sizeof(struct drm_mode_rect)*
+					    data->damage_area_count);
+
+	igt_plane_set_position(data->test_plane, 0, 0);
+	igt_display_commit2(&data->display, COMMIT_ATOMIC);
+
+	igt_assert(psr_wait_entry(data->debugfs_fd, PSR_MODE_2));
+
+	expected_output(data);
+}
+
+static void run(data_t *data)
+{
+	igt_assert(psr_wait_entry(data->debugfs_fd, PSR_MODE_2));
+
+	switch (data->op) {
+	case PLANE_UPDATE:
+	case OVERLAY_PRIM_UPDATE:
+		damaged_plane_update(data);
+		break;
+	case PLANE_MOVE:
+		damaged_plane_move(data);
+		break;
+	default:
+		igt_assert(false);
+	}
+}
+
+static void cleanup(data_t *data)
+{
+	igt_plane_t *primary;
+	igt_plane_t *sprite;
+
+	primary = igt_output_get_plane_type(data->output,
+					    DRM_PLANE_TYPE_PRIMARY);
+
+	igt_plane_set_fb(primary, NULL);
+
+	if (data->test_plane_id != DRM_PLANE_TYPE_PRIMARY) {
+		igt_plane_set_position(data->test_plane, 0, 0);
+		igt_plane_set_fb(data->test_plane, NULL);
+	}
+
+	if (data->op == OVERLAY_PRIM_UPDATE) {
+		sprite = igt_output_get_plane_type(data->output,
+				DRM_PLANE_TYPE_OVERLAY);
+		igt_plane_set_position(sprite, 0, 0);
+		igt_plane_set_fb(sprite, NULL);
+	}
+
+	igt_display_commit2(&data->display, COMMIT_ATOMIC);
+
+	igt_remove_fb(data->drm_fd, &data->fb_primary);
+	igt_remove_fb(data->drm_fd, &data->fb_overlay);
+	igt_remove_fb(data->drm_fd, &data->fb_cursor);
+	igt_remove_fb(data->drm_fd, &data->fb_test);
+}
+
+igt_main
+{
+	data_t data = {};
+	int i;
+
+	igt_fixture {
+		int r;
+
+		data.drm_fd = drm_open_driver_master(DRIVER_INTEL);
+		data.debugfs_fd = igt_debugfs_dir(data.drm_fd);
+		kmstest_set_vt_graphics_mode();
+
+		igt_require_f(psr_sink_support(data.drm_fd,
+					       data.debugfs_fd, PSR_MODE_2),
+			      "Sink does not support PSR2\n");
+
+		igt_require_f(psr2_selective_fetch_check(data.debugfs_fd),
+			      "PSR2 selective fetch not enabled\n");
+
+		data.bufmgr = drm_intel_bufmgr_gem_init(data.drm_fd, 4096);
+		igt_assert(data.bufmgr);
+		drm_intel_bufmgr_gem_enable_reuse(data.bufmgr);
+
+		display_init(&data);
+
+		/* Test if PSR2 can be enabled */
+		igt_require_f(psr_enable(data.drm_fd,
+					 data.debugfs_fd, PSR_MODE_2),
+			      "Error enabling PSR2\n");
+
+		data.damage_area_count = MAX_DAMAGE_AREAS;
+		data.op = PLANE_UPDATE;
+		data.test_plane_id = DRM_PLANE_TYPE_PRIMARY;
+		prepare(&data);
+		r = psr_wait_entry(data.debugfs_fd, PSR_MODE_2);
+		cleanup(&data);
+		if (!r)
+			psr_print_debugfs(data.debugfs_fd);
+		igt_require_f(r, "PSR2 can not be enabled\n");
+	}
+
+	/* Verify primary plane selective fetch */
+	for (i = 1; i <= MAX_DAMAGE_AREAS; i++) {
+		igt_subtest_f("primary-%s-sf-dmg-area-%d", op_str(data.op), i) {
+			data.damage_area_count = i;
+			data.test_plane_id = DRM_PLANE_TYPE_PRIMARY;
+			prepare(&data);
+			run(&data);
+			cleanup(&data);
+		}
+	}
+
+	/* Verify overlay plane selective fetch */
+	for (i = 1; i <= MAX_DAMAGE_AREAS; i++) {
+		igt_subtest_f("overlay-%s-sf-dmg-area-%d", op_str(data.op), i) {
+			data.damage_area_count = i;
+			data.test_plane_id = DRM_PLANE_TYPE_OVERLAY;
+			prepare(&data);
+			run(&data);
+			cleanup(&data);
+		}
+	}
+
+	/* Verify overlay plane selective fetch */
+	igt_subtest_f("cursor-%s-sf", op_str(data.op)) {
+		data.damage_area_count = 1;
+		data.test_plane_id = DRM_PLANE_TYPE_CURSOR;
+		prepare(&data);
+		run(&data);
+		cleanup(&data);
+	}
+
+	/* Only for overlay plane */
+	data.op = PLANE_MOVE;
+	/* Verify overlay plane move selective fetch */
+	for (i = POS_TOP_LEFT; i <= POS_BOTTOM_RIGHT ; i++) {
+		igt_subtest_f("%s-sf-dmg-area-%d", op_str(data.op), i) {
+			data.pos = i;
+			data.test_plane_id = DRM_PLANE_TYPE_OVERLAY;
+			prepare(&data);
+			run(&data);
+			cleanup(&data);
+		}
+	}
+
+	/* Verify primary plane selective fetch with overplay plane blended */
+	data.op = OVERLAY_PRIM_UPDATE;
+	for (i = 1; i <= MAX_DAMAGE_AREAS; i++) {
+		igt_subtest_f("%s-sf-dmg-area-%d", op_str(data.op), i) {
+			data.damage_area_count = i;
+			data.test_plane_id = DRM_PLANE_TYPE_PRIMARY;
+			prepare(&data);
+			run(&data);
+			cleanup(&data);
+		}
+	}
+
+	igt_fixture {
+		close(data.debugfs_fd);
+		drm_intel_bufmgr_destroy(data.bufmgr);
+		display_fini(&data);
+	}
+}
diff --git a/tests/meson.build b/tests/meson.build
index a2decf4ab..4cab294b8 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -64,6 +64,7 @@ test_progs = [
 	'kms_properties',
 	'kms_psr',
 	'kms_psr2_su',
+	'kms_psr2_sf',
 	'kms_pwrite_crc',
 	'kms_rmfb',
 	'kms_rotation_crc',
-- 
2.29.2

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

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

* Re: [igt-dev] [PATCH i-g-t 0/3] Add FB_DAMAGE_CLIPS prop and new test for Selective fetch
  2020-12-08 17:01 [igt-dev] [PATCH i-g-t 0/3] Add FB_DAMAGE_CLIPS prop and new test for Selective fetch Pankaj Bharadiya
                   ` (2 preceding siblings ...)
  2020-12-08 17:01 ` [igt-dev] [PATCH i-g-t 3/3] tests: Add new PSR2 selective fetch test Pankaj Bharadiya
@ 2020-12-08 17:22 ` Souza, Jose
  2020-12-08 19:31 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 14+ messages in thread
From: Souza, Jose @ 2020-12-08 17:22 UTC (permalink / raw)
  To: Laxminarayan Bharadiya, Pankaj, Mun, Gwan-gyeong, igt-dev

Please go ahead and merge the first 2 patches that are already reviewed.
Send it separated just to make sure that it do not causes any regressions, what I doubt it will.

On Tue, 2020-12-08 at 22:31 +0530, Pankaj Bharadiya wrote:
> Add new test for selective fetch
>  
> 
> Pankaj Bharadiya (3):
>   lib/kms: Add fb damage clip plane property
>   lib/igt_psr: Add function to check PSR2 selective fetch
>   tests: Add new PSR2 selective fetch test
> 
>  lib/igt_kms.c          |   3 +
>  lib/igt_kms.h          |   1 +
>  lib/igt_psr.c          |  10 +
>  lib/igt_psr.h          |   1 +
>  tests/Makefile.sources |   1 +
>  tests/kms_psr2_sf.c    | 649 +++++++++++++++++++++++++++++++++++++++++
>  tests/meson.build      |   1 +
>  7 files changed, 666 insertions(+)
>  create mode 100644 tests/kms_psr2_sf.c
> 

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

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

* [igt-dev] ✓ Fi.CI.BAT: success for Add FB_DAMAGE_CLIPS prop and new test for Selective fetch
  2020-12-08 17:01 [igt-dev] [PATCH i-g-t 0/3] Add FB_DAMAGE_CLIPS prop and new test for Selective fetch Pankaj Bharadiya
                   ` (3 preceding siblings ...)
  2020-12-08 17:22 ` [igt-dev] [PATCH i-g-t 0/3] Add FB_DAMAGE_CLIPS prop and new test for Selective fetch Souza, Jose
@ 2020-12-08 19:31 ` Patchwork
  2020-12-09  0:14 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
  2021-01-08 12:21 ` [igt-dev] [PATCH i-g-t 0/3] " Petri Latvala
  6 siblings, 0 replies; 14+ messages in thread
From: Patchwork @ 2020-12-08 19:31 UTC (permalink / raw)
  To: Pankaj Bharadiya; +Cc: igt-dev


[-- Attachment #1.1: Type: text/plain, Size: 3105 bytes --]

== Series Details ==

Series: Add FB_DAMAGE_CLIPS prop and new test for Selective fetch
URL   : https://patchwork.freedesktop.org/series/84696/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_9462 -> IGTPW_5262
====================================================

Summary
-------

  **SUCCESS**

  No regressions found.

  External URL: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5262/index.html

Known issues
------------

  Here are the changes found in IGTPW_5262 that come from known issues:

### IGT changes ###

#### Issues hit ####

  * igt@i915_pm_rpm@module-reload:
    - fi-kbl-guc:         [PASS][1] -> [SKIP][2] ([fdo#109271])
   [1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9462/fi-kbl-guc/igt@i915_pm_rpm@module-reload.html
   [2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5262/fi-kbl-guc/igt@i915_pm_rpm@module-reload.html

  
#### Possible fixes ####

  * igt@kms_chamelium@dp-crc-fast:
    - fi-kbl-7500u:       [FAIL][3] ([i915#1161] / [i915#262]) -> [PASS][4]
   [3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9462/fi-kbl-7500u/igt@kms_chamelium@dp-crc-fast.html
   [4]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5262/fi-kbl-7500u/igt@kms_chamelium@dp-crc-fast.html

  
  [fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
  [i915#1161]: https://gitlab.freedesktop.org/drm/intel/issues/1161
  [i915#262]: https://gitlab.freedesktop.org/drm/intel/issues/262


Participating hosts (43 -> 38)
------------------------------

  Missing    (5): fi-ilk-m540 fi-hsw-4200u fi-dg1-1 fi-tgl-y fi-bdw-samus 


Build changes
-------------

  * CI: CI-20190529 -> None
  * IGT: IGT_5885 -> IGTPW_5262

  CI-20190529: 20190529
  CI_DRM_9462: b358df960435469848e291bbebbeb4eca1ff32af @ git://anongit.freedesktop.org/gfx-ci/linux
  IGTPW_5262: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5262/index.html
  IGT_5885: d99f644b1868b9c92435b05ebfafa230721cd677 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools



== Testlist changes ==

+igt@kms_psr2_sf@cursor-plane-update-sf
+igt@kms_psr2_sf@overlay-plane-update-sf-dmg-area-1
+igt@kms_psr2_sf@overlay-plane-update-sf-dmg-area-2
+igt@kms_psr2_sf@overlay-plane-update-sf-dmg-area-3
+igt@kms_psr2_sf@overlay-plane-update-sf-dmg-area-4
+igt@kms_psr2_sf@overlay-plane-update-sf-dmg-area-5
+igt@kms_psr2_sf@overlay-primary-update-sf-dmg-area-1
+igt@kms_psr2_sf@overlay-primary-update-sf-dmg-area-2
+igt@kms_psr2_sf@overlay-primary-update-sf-dmg-area-3
+igt@kms_psr2_sf@overlay-primary-update-sf-dmg-area-4
+igt@kms_psr2_sf@overlay-primary-update-sf-dmg-area-5
+igt@kms_psr2_sf@plane-move-sf-dmg-area-0
+igt@kms_psr2_sf@plane-move-sf-dmg-area-1
+igt@kms_psr2_sf@plane-move-sf-dmg-area-2
+igt@kms_psr2_sf@plane-move-sf-dmg-area-3
+igt@kms_psr2_sf@primary-plane-update-sf-dmg-area-1
+igt@kms_psr2_sf@primary-plane-update-sf-dmg-area-2
+igt@kms_psr2_sf@primary-plane-update-sf-dmg-area-3
+igt@kms_psr2_sf@primary-plane-update-sf-dmg-area-4
+igt@kms_psr2_sf@primary-plane-update-sf-dmg-area-5

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5262/index.html

[-- Attachment #1.2: Type: text/html, Size: 3836 bytes --]

[-- Attachment #2: Type: text/plain, Size: 154 bytes --]

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

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

* [igt-dev] ✓ Fi.CI.IGT: success for Add FB_DAMAGE_CLIPS prop and new test for Selective fetch
  2020-12-08 17:01 [igt-dev] [PATCH i-g-t 0/3] Add FB_DAMAGE_CLIPS prop and new test for Selective fetch Pankaj Bharadiya
                   ` (4 preceding siblings ...)
  2020-12-08 19:31 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
@ 2020-12-09  0:14 ` Patchwork
  2021-01-08 12:21 ` [igt-dev] [PATCH i-g-t 0/3] " Petri Latvala
  6 siblings, 0 replies; 14+ messages in thread
From: Patchwork @ 2020-12-09  0:14 UTC (permalink / raw)
  To: Pankaj Bharadiya; +Cc: igt-dev


[-- Attachment #1.1: Type: text/plain, Size: 30275 bytes --]

== Series Details ==

Series: Add FB_DAMAGE_CLIPS prop and new test for Selective fetch
URL   : https://patchwork.freedesktop.org/series/84696/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_9462_full -> IGTPW_5262_full
====================================================

Summary
-------

  **SUCCESS**

  No regressions found.

  External URL: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5262/index.html

Possible new issues
-------------------

  Here are the unknown changes that may have been introduced in IGTPW_5262_full:

### IGT changes ###

#### Possible regressions ####

  * {igt@kms_psr2_sf@cursor-plane-update-sf} (NEW):
    - shard-tglb:         NOTRUN -> [SKIP][1] +19 similar issues
   [1]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5262/shard-tglb5/igt@kms_psr2_sf@cursor-plane-update-sf.html

  * {igt@kms_psr2_sf@primary-plane-update-sf-dmg-area-1} (NEW):
    - shard-iclb:         NOTRUN -> [SKIP][2] +19 similar issues
   [2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5262/shard-iclb3/igt@kms_psr2_sf@primary-plane-update-sf-dmg-area-1.html

  
New tests
---------

  New tests have been introduced between CI_DRM_9462_full and IGTPW_5262_full:

### New IGT tests (20) ###

  * igt@kms_psr2_sf@cursor-plane-update-sf:
    - Statuses : 7 skip(s)
    - Exec time: [0.0] s

  * igt@kms_psr2_sf@overlay-plane-update-sf-dmg-area-1:
    - Statuses : 7 skip(s)
    - Exec time: [0.0] s

  * igt@kms_psr2_sf@overlay-plane-update-sf-dmg-area-2:
    - Statuses : 7 skip(s)
    - Exec time: [0.0] s

  * igt@kms_psr2_sf@overlay-plane-update-sf-dmg-area-3:
    - Statuses : 7 skip(s)
    - Exec time: [0.0] s

  * igt@kms_psr2_sf@overlay-plane-update-sf-dmg-area-4:
    - Statuses : 7 skip(s)
    - Exec time: [0.0] s

  * igt@kms_psr2_sf@overlay-plane-update-sf-dmg-area-5:
    - Statuses : 7 skip(s)
    - Exec time: [0.0] s

  * igt@kms_psr2_sf@overlay-primary-update-sf-dmg-area-1:
    - Statuses : 7 skip(s)
    - Exec time: [0.0] s

  * igt@kms_psr2_sf@overlay-primary-update-sf-dmg-area-2:
    - Statuses : 7 skip(s)
    - Exec time: [0.0] s

  * igt@kms_psr2_sf@overlay-primary-update-sf-dmg-area-3:
    - Statuses : 7 skip(s)
    - Exec time: [0.0] s

  * igt@kms_psr2_sf@overlay-primary-update-sf-dmg-area-4:
    - Statuses : 7 skip(s)
    - Exec time: [0.0] s

  * igt@kms_psr2_sf@overlay-primary-update-sf-dmg-area-5:
    - Statuses : 7 skip(s)
    - Exec time: [0.0] s

  * igt@kms_psr2_sf@plane-move-sf-dmg-area-0:
    - Statuses : 7 skip(s)
    - Exec time: [0.0] s

  * igt@kms_psr2_sf@plane-move-sf-dmg-area-1:
    - Statuses : 7 skip(s)
    - Exec time: [0.0] s

  * igt@kms_psr2_sf@plane-move-sf-dmg-area-2:
    - Statuses : 6 skip(s)
    - Exec time: [0.0] s

  * igt@kms_psr2_sf@plane-move-sf-dmg-area-3:
    - Statuses : 7 skip(s)
    - Exec time: [0.0] s

  * igt@kms_psr2_sf@primary-plane-update-sf-dmg-area-1:
    - Statuses : 7 skip(s)
    - Exec time: [0.0] s

  * igt@kms_psr2_sf@primary-plane-update-sf-dmg-area-2:
    - Statuses : 7 skip(s)
    - Exec time: [0.0] s

  * igt@kms_psr2_sf@primary-plane-update-sf-dmg-area-3:
    - Statuses : 7 skip(s)
    - Exec time: [0.0] s

  * igt@kms_psr2_sf@primary-plane-update-sf-dmg-area-4:
    - Statuses : 7 skip(s)
    - Exec time: [0.0] s

  * igt@kms_psr2_sf@primary-plane-update-sf-dmg-area-5:
    - Statuses : 7 skip(s)
    - Exec time: [0.0] s

  

Known issues
------------

  Here are the changes found in IGTPW_5262_full that come from known issues:

### IGT changes ###

#### Issues hit ####

  * igt@feature_discovery@display-3x:
    - shard-glk:          NOTRUN -> [SKIP][3] ([fdo#109271]) +56 similar issues
   [3]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5262/shard-glk9/igt@feature_discovery@display-3x.html
    - shard-iclb:         NOTRUN -> [SKIP][4] ([i915#1839])
   [4]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5262/shard-iclb6/igt@feature_discovery@display-3x.html
    - shard-tglb:         NOTRUN -> [SKIP][5] ([i915#1839])
   [5]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5262/shard-tglb1/igt@feature_discovery@display-3x.html

  * igt@gem_exec_nop@basic-series:
    - shard-glk:          [PASS][6] -> [DMESG-WARN][7] ([i915#118] / [i915#95])
   [6]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9462/shard-glk6/igt@gem_exec_nop@basic-series.html
   [7]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5262/shard-glk8/igt@gem_exec_nop@basic-series.html

  * igt@gem_exec_params@no-blt:
    - shard-iclb:         NOTRUN -> [SKIP][8] ([fdo#109283])
   [8]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5262/shard-iclb5/igt@gem_exec_params@no-blt.html

  * igt@gem_huc_copy@huc-copy:
    - shard-iclb:         NOTRUN -> [SKIP][9] ([i915#2190])
   [9]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5262/shard-iclb3/igt@gem_huc_copy@huc-copy.html

  * igt@gem_softpin@noreloc-s3:
    - shard-iclb:         [PASS][10] -> [DMESG-WARN][11] ([i915#1602])
   [10]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9462/shard-iclb7/igt@gem_softpin@noreloc-s3.html
   [11]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5262/shard-iclb1/igt@gem_softpin@noreloc-s3.html
    - shard-apl:          [PASS][12] -> [DMESG-WARN][13] ([i915#1602] / [i915#2635])
   [12]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9462/shard-apl7/igt@gem_softpin@noreloc-s3.html
   [13]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5262/shard-apl3/igt@gem_softpin@noreloc-s3.html
    - shard-glk:          [PASS][14] -> [DMESG-WARN][15] ([i915#1602] / [i915#2635])
   [14]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9462/shard-glk9/igt@gem_softpin@noreloc-s3.html
   [15]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5262/shard-glk7/igt@gem_softpin@noreloc-s3.html
    - shard-hsw:          [PASS][16] -> [DMESG-WARN][17] ([i915#2637])
   [16]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9462/shard-hsw4/igt@gem_softpin@noreloc-s3.html
   [17]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5262/shard-hsw2/igt@gem_softpin@noreloc-s3.html
    - shard-kbl:          [PASS][18] -> [INCOMPLETE][19] ([i915#2405])
   [18]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9462/shard-kbl1/igt@gem_softpin@noreloc-s3.html
   [19]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5262/shard-kbl6/igt@gem_softpin@noreloc-s3.html

  * igt@gen9_exec_parse@bb-chained:
    - shard-iclb:         NOTRUN -> [SKIP][20] ([fdo#112306]) +1 similar issue
   [20]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5262/shard-iclb4/igt@gen9_exec_parse@bb-chained.html

  * igt@gen9_exec_parse@bb-secure:
    - shard-tglb:         NOTRUN -> [SKIP][21] ([fdo#112306])
   [21]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5262/shard-tglb5/igt@gen9_exec_parse@bb-secure.html

  * igt@i915_query@query-topology-known-pci-ids:
    - shard-iclb:         NOTRUN -> [SKIP][22] ([fdo#109303])
   [22]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5262/shard-iclb1/igt@i915_query@query-topology-known-pci-ids.html

  * igt@i915_query@query-topology-unsupported:
    - shard-iclb:         NOTRUN -> [SKIP][23] ([fdo#109302])
   [23]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5262/shard-iclb5/igt@i915_query@query-topology-unsupported.html
    - shard-tglb:         NOTRUN -> [SKIP][24] ([fdo#109302])
   [24]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5262/shard-tglb7/igt@i915_query@query-topology-unsupported.html

  * igt@kms_atomic_transition@5x-modeset-transitions-nonblocking-fencing:
    - shard-tglb:         NOTRUN -> [SKIP][25] ([fdo#112025])
   [25]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5262/shard-tglb5/igt@kms_atomic_transition@5x-modeset-transitions-nonblocking-fencing.html

  * igt@kms_big_fb@yf-tiled-64bpp-rotate-180:
    - shard-iclb:         NOTRUN -> [SKIP][26] ([fdo#110723])
   [26]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5262/shard-iclb1/igt@kms_big_fb@yf-tiled-64bpp-rotate-180.html

  * igt@kms_big_fb@yf-tiled-addfb:
    - shard-tglb:         NOTRUN -> [SKIP][27] ([fdo#111615]) +3 similar issues
   [27]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5262/shard-tglb2/igt@kms_big_fb@yf-tiled-addfb.html

  * igt@kms_color@pipe-a-ctm-0-25:
    - shard-iclb:         NOTRUN -> [FAIL][28] ([i915#1149] / [i915#315])
   [28]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5262/shard-iclb4/igt@kms_color@pipe-a-ctm-0-25.html

  * igt@kms_color@pipe-d-degamma:
    - shard-iclb:         NOTRUN -> [SKIP][29] ([fdo#109278] / [i915#1149])
   [29]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5262/shard-iclb1/igt@kms_color@pipe-d-degamma.html
    - shard-tglb:         NOTRUN -> [FAIL][30] ([i915#1149])
   [30]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5262/shard-tglb5/igt@kms_color@pipe-d-degamma.html

  * igt@kms_color_chamelium@pipe-a-ctm-negative:
    - shard-hsw:          NOTRUN -> [SKIP][31] ([fdo#109271] / [fdo#111827])
   [31]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5262/shard-hsw1/igt@kms_color_chamelium@pipe-a-ctm-negative.html
    - shard-glk:          NOTRUN -> [SKIP][32] ([fdo#109271] / [fdo#111827]) +2 similar issues
   [32]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5262/shard-glk7/igt@kms_color_chamelium@pipe-a-ctm-negative.html

  * igt@kms_color_chamelium@pipe-c-ctm-0-25:
    - shard-apl:          NOTRUN -> [SKIP][33] ([fdo#109271] / [fdo#111827]) +2 similar issues
   [33]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5262/shard-apl7/igt@kms_color_chamelium@pipe-c-ctm-0-25.html
    - shard-kbl:          NOTRUN -> [SKIP][34] ([fdo#109271] / [fdo#111827]) +2 similar issues
   [34]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5262/shard-kbl3/igt@kms_color_chamelium@pipe-c-ctm-0-25.html
    - shard-tglb:         NOTRUN -> [SKIP][35] ([fdo#109284] / [fdo#111827]) +3 similar issues
   [35]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5262/shard-tglb6/igt@kms_color_chamelium@pipe-c-ctm-0-25.html

  * igt@kms_color_chamelium@pipe-c-ctm-0-5:
    - shard-iclb:         NOTRUN -> [SKIP][36] ([fdo#109284] / [fdo#111827]) +5 similar issues
   [36]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5262/shard-iclb5/igt@kms_color_chamelium@pipe-c-ctm-0-5.html

  * igt@kms_cursor_crc@pipe-b-cursor-512x170-onscreen:
    - shard-tglb:         NOTRUN -> [SKIP][37] ([fdo#109279]) +1 similar issue
   [37]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5262/shard-tglb2/igt@kms_cursor_crc@pipe-b-cursor-512x170-onscreen.html
    - shard-iclb:         NOTRUN -> [SKIP][38] ([fdo#109278] / [fdo#109279]) +1 similar issue
   [38]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5262/shard-iclb2/igt@kms_cursor_crc@pipe-b-cursor-512x170-onscreen.html

  * igt@kms_cursor_crc@pipe-b-cursor-alpha-opaque:
    - shard-apl:          [PASS][39] -> [FAIL][40] ([i915#54])
   [39]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9462/shard-apl6/igt@kms_cursor_crc@pipe-b-cursor-alpha-opaque.html
   [40]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5262/shard-apl4/igt@kms_cursor_crc@pipe-b-cursor-alpha-opaque.html
    - shard-kbl:          [PASS][41] -> [FAIL][42] ([i915#54])
   [41]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9462/shard-kbl6/igt@kms_cursor_crc@pipe-b-cursor-alpha-opaque.html
   [42]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5262/shard-kbl4/igt@kms_cursor_crc@pipe-b-cursor-alpha-opaque.html

  * igt@kms_cursor_legacy@cursora-vs-flipb-legacy:
    - shard-iclb:         NOTRUN -> [SKIP][43] ([fdo#109274] / [fdo#109278])
   [43]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5262/shard-iclb5/igt@kms_cursor_legacy@cursora-vs-flipb-legacy.html

  * igt@kms_cursor_legacy@flip-vs-cursor-atomic:
    - shard-tglb:         NOTRUN -> [FAIL][44] ([i915#2346])
   [44]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5262/shard-tglb8/igt@kms_cursor_legacy@flip-vs-cursor-atomic.html

  * igt@kms_fbcon_fbt@fbc-suspend:
    - shard-iclb:         [PASS][45] -> [INCOMPLETE][46] ([i915#1185] / [i915#1602])
   [45]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9462/shard-iclb3/igt@kms_fbcon_fbt@fbc-suspend.html
   [46]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5262/shard-iclb7/igt@kms_fbcon_fbt@fbc-suspend.html
    - shard-apl:          [PASS][47] -> [INCOMPLETE][48] ([i915#1602] / [i915#2635])
   [47]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9462/shard-apl8/igt@kms_fbcon_fbt@fbc-suspend.html
   [48]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5262/shard-apl8/igt@kms_fbcon_fbt@fbc-suspend.html
    - shard-glk:          [PASS][49] -> [INCOMPLETE][50] ([i915#1602] / [i915#2635])
   [49]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9462/shard-glk3/igt@kms_fbcon_fbt@fbc-suspend.html
   [50]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5262/shard-glk5/igt@kms_fbcon_fbt@fbc-suspend.html
    - shard-tglb:         [PASS][51] -> [INCOMPLETE][52] ([i915#1436] / [i915#1602] / [i915#1887] / [i915#2411] / [i915#456])
   [51]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9462/shard-tglb1/igt@kms_fbcon_fbt@fbc-suspend.html
   [52]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5262/shard-tglb5/igt@kms_fbcon_fbt@fbc-suspend.html
    - shard-kbl:          [PASS][53] -> [INCOMPLETE][54] ([i915#155] / [i915#636])
   [53]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9462/shard-kbl3/igt@kms_fbcon_fbt@fbc-suspend.html
   [54]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5262/shard-kbl3/igt@kms_fbcon_fbt@fbc-suspend.html

  * igt@kms_flip@2x-flip-vs-rmfb:
    - shard-iclb:         NOTRUN -> [SKIP][55] ([fdo#109274]) +2 similar issues
   [55]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5262/shard-iclb5/igt@kms_flip@2x-flip-vs-rmfb.html

  * igt@kms_flip@flip-vs-blocking-wf-vblank@a-edp1:
    - shard-tglb:         NOTRUN -> [FAIL][56] ([i915#2122])
   [56]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5262/shard-tglb5/igt@kms_flip@flip-vs-blocking-wf-vblank@a-edp1.html

  * igt@kms_frontbuffer_tracking@fbcpsr-2p-primscrn-cur-indfb-onoff:
    - shard-tglb:         NOTRUN -> [SKIP][57] ([fdo#111825]) +15 similar issues
   [57]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5262/shard-tglb5/igt@kms_frontbuffer_tracking@fbcpsr-2p-primscrn-cur-indfb-onoff.html

  * igt@kms_frontbuffer_tracking@fbcpsr-2p-shrfb-fliptrack:
    - shard-iclb:         NOTRUN -> [SKIP][58] ([fdo#109280]) +15 similar issues
   [58]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5262/shard-iclb3/igt@kms_frontbuffer_tracking@fbcpsr-2p-shrfb-fliptrack.html

  * igt@kms_frontbuffer_tracking@psr-1p-primscrn-spr-indfb-draw-mmap-cpu:
    - shard-kbl:          NOTRUN -> [SKIP][59] ([fdo#109271]) +62 similar issues
   [59]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5262/shard-kbl3/igt@kms_frontbuffer_tracking@psr-1p-primscrn-spr-indfb-draw-mmap-cpu.html

  * igt@kms_hdr@static-toggle-dpms:
    - shard-tglb:         NOTRUN -> [SKIP][60] ([i915#1187])
   [60]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5262/shard-tglb2/igt@kms_hdr@static-toggle-dpms.html
    - shard-iclb:         NOTRUN -> [SKIP][61] ([i915#1187]) +1 similar issue
   [61]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5262/shard-iclb2/igt@kms_hdr@static-toggle-dpms.html

  * igt@kms_pipe_crc_basic@suspend-read-crc-pipe-a:
    - shard-tglb:         [PASS][62] -> [DMESG-WARN][63] ([i915#1436] / [i915#1602] / [i915#1887] / [i915#2411]) +1 similar issue
   [62]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9462/shard-tglb3/igt@kms_pipe_crc_basic@suspend-read-crc-pipe-a.html
   [63]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5262/shard-tglb3/igt@kms_pipe_crc_basic@suspend-read-crc-pipe-a.html

  * igt@kms_plane_alpha_blend@pipe-a-constant-alpha-max:
    - shard-glk:          NOTRUN -> [FAIL][64] ([fdo#108145] / [i915#265])
   [64]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5262/shard-glk8/igt@kms_plane_alpha_blend@pipe-a-constant-alpha-max.html
    - shard-kbl:          NOTRUN -> [FAIL][65] ([fdo#108145] / [i915#265])
   [65]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5262/shard-kbl1/igt@kms_plane_alpha_blend@pipe-a-constant-alpha-max.html
    - shard-apl:          NOTRUN -> [FAIL][66] ([fdo#108145] / [i915#265])
   [66]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5262/shard-apl6/igt@kms_plane_alpha_blend@pipe-a-constant-alpha-max.html

  * igt@kms_plane_alpha_blend@pipe-d-coverage-vs-premult-vs-constant:
    - shard-iclb:         NOTRUN -> [SKIP][67] ([fdo#109278]) +8 similar issues
   [67]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5262/shard-iclb3/igt@kms_plane_alpha_blend@pipe-d-coverage-vs-premult-vs-constant.html

  * igt@kms_plane_lowres@pipe-a-tiling-y:
    - shard-hsw:          NOTRUN -> [SKIP][68] ([fdo#109271]) +37 similar issues
   [68]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5262/shard-hsw4/igt@kms_plane_lowres@pipe-a-tiling-y.html

  * igt@kms_properties@connector-properties-legacy:
    - shard-kbl:          [PASS][69] -> [DMESG-WARN][70] ([i915#165] / [i915#180] / [i915#78])
   [69]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9462/shard-kbl4/igt@kms_properties@connector-properties-legacy.html
   [70]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5262/shard-kbl2/igt@kms_properties@connector-properties-legacy.html

  * {igt@kms_psr2_sf@overlay-plane-update-sf-dmg-area-2} (NEW):
    - shard-apl:          NOTRUN -> [SKIP][71] ([fdo#109271]) +62 similar issues
   [71]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5262/shard-apl8/igt@kms_psr2_sf@overlay-plane-update-sf-dmg-area-2.html

  * {igt@kms_psr2_sf@primary-plane-update-sf-dmg-area-3} (NEW):
    - shard-snb:          NOTRUN -> [SKIP][72] ([fdo#109271]) +18 similar issues
   [72]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5262/shard-snb7/igt@kms_psr2_sf@primary-plane-update-sf-dmg-area-3.html

  * igt@kms_psr2_su@page_flip:
    - shard-iclb:         [PASS][73] -> [SKIP][74] ([fdo#109642] / [fdo#111068])
   [73]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9462/shard-iclb2/igt@kms_psr2_su@page_flip.html
   [74]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5262/shard-iclb3/igt@kms_psr2_su@page_flip.html

  * igt@kms_psr@psr2_cursor_plane_onoff:
    - shard-iclb:         [PASS][75] -> [SKIP][76] ([fdo#109441]) +1 similar issue
   [75]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9462/shard-iclb2/igt@kms_psr@psr2_cursor_plane_onoff.html
   [76]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5262/shard-iclb3/igt@kms_psr@psr2_cursor_plane_onoff.html

  * igt@kms_psr@psr2_primary_mmap_cpu:
    - shard-iclb:         NOTRUN -> [SKIP][77] ([fdo#109441]) +1 similar issue
   [77]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5262/shard-iclb1/igt@kms_psr@psr2_primary_mmap_cpu.html

  * igt@kms_vrr@flipline:
    - shard-tglb:         NOTRUN -> [SKIP][78] ([fdo#109502])
   [78]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5262/shard-tglb7/igt@kms_vrr@flipline.html
    - shard-iclb:         NOTRUN -> [SKIP][79] ([fdo#109502])
   [79]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5262/shard-iclb6/igt@kms_vrr@flipline.html

  * igt@nouveau_crc@pipe-a-ctx-flip-detection:
    - shard-iclb:         NOTRUN -> [SKIP][80] ([i915#2530])
   [80]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5262/shard-iclb8/igt@nouveau_crc@pipe-a-ctx-flip-detection.html
    - shard-tglb:         NOTRUN -> [SKIP][81] ([i915#2530])
   [81]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5262/shard-tglb7/igt@nouveau_crc@pipe-a-ctx-flip-detection.html

  * igt@prime_nv_api@nv_i915_reimport_twice_check_flink_name:
    - shard-iclb:         NOTRUN -> [SKIP][82] ([fdo#109291]) +1 similar issue
   [82]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5262/shard-iclb4/igt@prime_nv_api@nv_i915_reimport_twice_check_flink_name.html

  * igt@prime_nv_test@nv_write_i915_cpu_mmap_read:
    - shard-tglb:         NOTRUN -> [SKIP][83] ([fdo#109291]) +1 similar issue
   [83]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5262/shard-tglb2/igt@prime_nv_test@nv_write_i915_cpu_mmap_read.html

  * igt@runner@aborted:
    - shard-snb:          NOTRUN -> [FAIL][84] ([i915#2426])
   [84]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5262/shard-snb2/igt@runner@aborted.html

  * igt@tools_test@sysfs_l3_parity:
    - shard-tglb:         NOTRUN -> [SKIP][85] ([fdo#109307])
   [85]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5262/shard-tglb3/igt@tools_test@sysfs_l3_parity.html

  
#### Possible fixes ####

  * igt@gem_exec_parallel@contexts@rcs0:
    - shard-iclb:         [INCOMPLETE][86] -> [PASS][87]
   [86]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9462/shard-iclb4/igt@gem_exec_parallel@contexts@rcs0.html
   [87]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5262/shard-iclb4/igt@gem_exec_parallel@contexts@rcs0.html

  * igt@gem_exec_reloc@basic-many-active@rcs0:
    - shard-hsw:          [FAIL][88] ([i915#2389]) -> [PASS][89]
   [88]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9462/shard-hsw2/igt@gem_exec_reloc@basic-many-active@rcs0.html
   [89]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5262/shard-hsw6/igt@gem_exec_reloc@basic-many-active@rcs0.html

  * igt@kms_async_flips@test-time-stamp:
    - shard-tglb:         [FAIL][90] ([i915#2597]) -> [PASS][91]
   [90]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9462/shard-tglb3/igt@kms_async_flips@test-time-stamp.html
   [91]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5262/shard-tglb3/igt@kms_async_flips@test-time-stamp.html

  * igt@kms_cursor_legacy@2x-long-cursor-vs-flip-atomic:
    - shard-hsw:          [FAIL][92] ([i915#96]) -> [PASS][93]
   [92]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9462/shard-hsw8/igt@kms_cursor_legacy@2x-long-cursor-vs-flip-atomic.html
   [93]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5262/shard-hsw4/igt@kms_cursor_legacy@2x-long-cursor-vs-flip-atomic.html

  * igt@kms_cursor_legacy@cursor-vs-flip-toggle:
    - shard-hsw:          [FAIL][94] ([i915#2370]) -> [PASS][95]
   [94]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9462/shard-hsw6/igt@kms_cursor_legacy@cursor-vs-flip-toggle.html
   [95]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5262/shard-hsw1/igt@kms_cursor_legacy@cursor-vs-flip-toggle.html

  * igt@kms_cursor_legacy@flip-vs-cursor-legacy:
    - shard-tglb:         [FAIL][96] ([i915#2346]) -> [PASS][97]
   [96]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9462/shard-tglb6/igt@kms_cursor_legacy@flip-vs-cursor-legacy.html
   [97]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5262/shard-tglb8/igt@kms_cursor_legacy@flip-vs-cursor-legacy.html

  * igt@kms_flip@flip-vs-expired-vblank@a-edp1:
    - shard-tglb:         [FAIL][98] ([i915#2598]) -> [PASS][99]
   [98]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9462/shard-tglb8/igt@kms_flip@flip-vs-expired-vblank@a-edp1.html
   [99]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5262/shard-tglb7/igt@kms_flip@flip-vs-expired-vblank@a-edp1.html

  * igt@kms_flip@flip-vs-suspend@a-vga1:
    - shard-snb:          [DMESG-WARN][100] ([i915#42]) -> [PASS][101]
   [100]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9462/shard-snb6/igt@kms_flip@flip-vs-suspend@a-vga1.html
   [101]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5262/shard-snb7/igt@kms_flip@flip-vs-suspend@a-vga1.html

  * igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-draw-mmap-cpu:
    - shard-kbl:          [FAIL][102] ([i915#49]) -> [PASS][103]
   [102]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9462/shard-kbl1/igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-draw-mmap-cpu.html
   [103]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5262/shard-kbl7/igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-draw-mmap-cpu.html
    - shard-glk:          [FAIL][104] ([i915#49]) -> [PASS][105]
   [104]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9462/shard-glk4/igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-draw-mmap-cpu.html
   [105]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5262/shard-glk2/igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-draw-mmap-cpu.html
    - shard-apl:          [FAIL][106] ([i915#49]) -> [PASS][107]
   [106]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9462/shard-apl7/igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-draw-mmap-cpu.html
   [107]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5262/shard-apl3/igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-draw-mmap-cpu.html

  * igt@kms_psr@psr2_cursor_plane_move:
    - shard-iclb:         [SKIP][108] ([fdo#109441]) -> [PASS][109] +2 similar issues
   [108]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9462/shard-iclb1/igt@kms_psr@psr2_cursor_plane_move.html
   [109]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5262/shard-iclb2/igt@kms_psr@psr2_cursor_plane_move.html

  * igt@kms_psr@psr2_suspend:
    - shard-tglb:         [DMESG-WARN][110] ([i915#1436] / [i915#1602] / [i915#1887] / [i915#2411]) -> [PASS][111]
   [110]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9462/shard-tglb2/igt@kms_psr@psr2_suspend.html
   [111]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5262/shard-tglb8/igt@kms_psr@psr2_suspend.html

  * igt@kms_vblank@pipe-c-ts-continuation-dpms-suspend:
    - shard-iclb:         [DMESG-WARN][112] -> [PASS][113]
   [112]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9462/shard-iclb2/igt@kms_vblank@pipe-c-ts-continuation-dpms-suspend.html
   [113]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5262/shard-iclb4/igt@kms_vblank@pipe-c-ts-continuation-dpms-suspend.html
    - shard-kbl:          [INCOMPLETE][114] ([i915#155] / [i915#2405]) -> [PASS][115]
   [114]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9462/shard-kbl2/igt@kms_vblank@pipe-c-ts-continuation-dpms-suspend.html
   [115]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5262/shard-kbl3/igt@kms_vblank@pipe-c-ts-continuation-dpms-suspend.html
    - shard-hsw:          [DMESG-WARN][116] ([i915#2637]) -> [PASS][117]
   [116]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9462/shard-hsw4/igt@kms_vblank@pipe-c-ts-continuation-dpms-suspend.html
   [117]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5262/shard-hsw4/igt@kms_vblank@pipe-c-ts-continuation-dpms-suspend.html
    - shard-glk:          [DMESG-WARN][118] ([i915#2635]) -> [PASS][119]
   [118]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9462/shard-glk6/igt@kms_vblank@pipe-c-ts-continuation-dpms-suspend.html
   [119]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5262/shard-glk4/igt@kms_vblank@pipe-c-ts-continuation-dpms-suspend.html
    - shard-apl:          [DMESG-WARN][120] ([i915#2635]) -> [PASS][121]
   [120]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9462/shard-apl3/igt@kms_vblank@pipe-c-ts-continuation-dpms-suspend.html
   [121]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5262/shard-apl7/igt@kms_vblank@pipe-c-ts-continuation-dpms-suspend.html
    - shard-tglb:         [INCOMPLETE][122] ([i915#1436] / [i915#1602] / [i915#1798] / [i915#1887] / [i915#1982] / [i915#2411] / [i915#456]) -> [PASS][123]
   [122]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9462/shard-tglb8/igt@kms_vblank@pipe-c-ts-continuation-dpms-suspend.html
   [123]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5262/shard-tglb6/igt@kms_vblank@pipe-c-ts-continuation-dpms-suspend.html

  
#### Warnings ####

  * igt@i915_pm_rc6_residency@rc6-fence:
    - shard-iclb:         [WARN][124] ([i915#2684]) -> [WARN][125] ([i915#2681] / [i915#2684])
   [124]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9462/shard-iclb2/igt@i915_pm_rc6_residency@rc6-fence.html
   [125]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5262/shard-iclb1/igt@i915_pm_rc6_residency@rc6-fence.html

  * igt@i915_pm_rc6_residency@rc6-idle:
    - shard-iclb:         [WARN][126] ([i915#1804] / [i915#2684]) -> [WARN][127] ([i915#2684])
   [126]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9462/shard-iclb3/igt@i915_pm_rc6_residency@rc6-idle.html
   [127]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5262/shard-iclb2/igt@i915_pm_rc6_residency@rc6-idle.html

  * igt@runner@aborted:
    - shard-iclb:         ([FAIL][128], [FAIL][129]) ([i915#1814] / [i915#2295] / [i915#2722] / [i915#483]) -> ([FAIL][130], [FAIL][131], [FAIL][132]) ([i915#2295] / [i915#2722] / [i915#483])
   [128]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9462/shard-iclb2/igt@runner@aborted.html
   [129]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9462/shard-iclb1/igt@runner@aborted.html
   [130]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5262/shard-iclb1/igt@runner@aborted.html
   [131]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5262/shard-iclb2/igt@runner@aborted.html
   [132]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5262/shard-iclb7/igt@runner@aborted.html
    - shard-apl:          ([FAIL][133], [FAIL][134]) ([i915#1814] / [i915#2295] / [i915#2722]) -> ([FAIL][135], [FAIL][136], [FAIL][137]) ([i915#2295] / [i915#2722])
   [133]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9462/shard-apl2/igt@runner@aborted.html
   [134]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9462/shard-apl3/igt@runner@aborted.html
   [135]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5262/shard-apl3/igt@runner@aborted.html
   [136]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5262/shard-apl8/igt@runner@aborted.html
   [137]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5262/shard-apl4/igt@runner@aborted.html
    - shard-glk:          ([FAIL][138], [FAIL][139]) ([i915#1814] / [i915#2295] / [i915#2722] / [k.org#202321]) -> ([FAIL][140], [FAIL][141], [FAIL][142]) ([i915#2295] / [i915#2722] / [i915#483] / [i915#86] / [k.org#202321])
   [138]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9462/shard-glk9/igt@runner@aborted.html
   [139]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9462/shard-glk6/igt@runner@aborted.html
   [140]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5262/shard-glk7/igt@runner@aborted.html
   [141]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5262/shard-glk5/igt@runner@aborted.html
   [142]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5262/shard-glk6/igt@runner@aborted.html
    - shard-tglb:         ([FAIL][143], [FAIL][144], [FAIL][145]) ([i915#1602] / [i915#1814] / [i915#2295] / [i915#2722]) -> ([FAIL][146], [FAIL][147], [FAIL][148], [FAIL][149]) ([i915#1602] / [i915#2295] / [i915#2722] / [i915#456])
   [143]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9462

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5262/index.html

[-- Attachment #1.2: Type: text/html, Size: 33679 bytes --]

[-- Attachment #2: Type: text/plain, Size: 154 bytes --]

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

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

* Re: [igt-dev] [PATCH i-g-t 3/3] tests: Add new PSR2 selective fetch test
  2020-12-08 17:01 ` [igt-dev] [PATCH i-g-t 3/3] tests: Add new PSR2 selective fetch test Pankaj Bharadiya
@ 2020-12-16 10:50   ` Mun, Gwan-gyeong
  2020-12-21  4:44     ` Laxminarayan Bharadiya, Pankaj
  0 siblings, 1 reply; 14+ messages in thread
From: Mun, Gwan-gyeong @ 2020-12-16 10:50 UTC (permalink / raw)
  To: Laxminarayan Bharadiya, Pankaj, igt-dev, Souza, Jose

On Tue, 2020-12-08 at 22:31 +0530, Pankaj Bharadiya wrote:
> Selective fetch reduces display engine use of memory bandwidth
> by only fetching (reading from memory) the updated regions of the
> frame
> buffer and sending those updated regions to a panel with a PSR2
> capability.
> 
> The FB_DAMAGE_CLIPS plane property provides user-space a way inform
> kernel about the updated regions.
> 
> Add new test to verify selective fetch by using FB_DAMAGE_CLIPS
> property
> to send  updated regions.
> 
> changes since v1:
> * alloc enough clips for all tests in stack and reuse (Jose)
> * set damage clip along with draw, refactor code, rename
>   variables, etc (Jose)
> 
> Signed-off-by: Pankaj Bharadiya <
> pankaj.laxminarayan.bharadiya@intel.com>
> ---
>  tests/Makefile.sources |   1 +
>  tests/kms_psr2_sf.c    | 649
> +++++++++++++++++++++++++++++++++++++++++
>  tests/meson.build      |   1 +
>  3 files changed, 651 insertions(+)
>  create mode 100644 tests/kms_psr2_sf.c
> 
> diff --git a/tests/Makefile.sources b/tests/Makefile.sources
> index 15fb56048..e7e399165 100644
> --- a/tests/Makefile.sources
> +++ b/tests/Makefile.sources
> @@ -80,6 +80,7 @@ TESTS_progs = \
>  	kms_properties \
>  	kms_psr \
>  	kms_psr2_su \
> +	kms_psr2_sf \
>  	kms_pwrite_crc \
>  	kms_rmfb \
>  	kms_rotation_crc \
> diff --git a/tests/kms_psr2_sf.c b/tests/kms_psr2_sf.c
> new file mode 100644
> index 000000000..296ed8476
> --- /dev/null
> +++ b/tests/kms_psr2_sf.c
> @@ -0,0 +1,649 @@
> +/*
> + * Copyright © 2020 Intel Corporation
> + *
> + * Permission is hereby granted, free of charge, to any person
> obtaining a
> + * copy of this software and associated documentation files (the
> "Software"),
> + * to deal in the Software without restriction, including without
> limitation
> + * the rights to use, copy, modify, merge, publish, distribute,
> sublicense,
> + * and/or sell copies of the Software, and to permit persons to whom
> the
> + * Software is furnished to do so, subject to the following
> conditions:
> + *
> + * The above copyright notice and this permission notice (including
> the next
> + * paragraph) shall be included in all copies or substantial
> portions of the
> + * Software.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
> EXPRESS OR
> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
> MERCHANTABILITY,
> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO
> EVENT SHALL
> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES
> OR OTHER
> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
> ARISING
> + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
> OTHER DEALINGS
> + * IN THE SOFTWARE.
> + *
> + */
> +
> +#include "igt.h"
> +#include "igt_sysfs.h"
> +#include "igt_psr.h"
> +#include <errno.h>
> +#include <stdbool.h>
> +#include <stdio.h>
> +#include <string.h>
> +#include "intel_bufmgr.h"
> +
> +IGT_TEST_DESCRIPTION("Tests to varify PSR2 selective fetch by
> sending multiple"
> +		     " damaged areas");
> +
> +#define SQUARE_SIZE 100
> +
> +#define CUR_SIZE 64
> +#define MAX_DAMAGE_AREAS 5
> +
> +enum operations {
> +	PLANE_UPDATE,
> +	PLANE_MOVE,
> +	OVERLAY_PRIM_UPDATE
> +};
> +
Hi, can you also add use case which uses igt_fb_set_position()?

> +enum plane_move_postion {
> +	POS_TOP_LEFT,
> +	POS_TOP_RIGHT,
> +	POS_BOTTOM_LEFT,
> +	POS_BOTTOM_RIGHT
> +};
> +
> +typedef struct {
> +	int drm_fd;
> +	int debugfs_fd;
> +	igt_display_t display;
> +	drm_intel_bufmgr *bufmgr;
> +	drmModeModeInfo *mode;
> +	igt_output_t *output;
> +	struct igt_fb fb_primary, fb_overlay, fb_cursor;
> +	struct igt_fb fb_test;
> +	int damage_area_count;
> +	struct drm_mode_rect plane_update_clip[MAX_DAMAGE_AREAS];
> +	struct drm_mode_rect plane_move_clip;
> +	struct drm_mode_rect cursor_clip;
> +	enum operations op;
> +	enum plane_move_postion pos;
> +	int test_plane_id;
> +	igt_plane_t *test_plane;
> +	cairo_t *cr;
> +} data_t;
> +
> +static const char *op_str(enum operations op)
> +{
> +	static const char * const name[] = {
> +		[PLANE_UPDATE] = "plane-update",
> +		[PLANE_MOVE] = "plane-move",
> +		[OVERLAY_PRIM_UPDATE] = "overlay-primary-update",
> +	};
> +
> +	return name[op];
> +}
> +
> +static void setup_output(data_t *data)
> +{
> +	igt_display_t *display = &data->display;
> +	igt_output_t *output;
> +	enum pipe pipe;
> +
> +	for_each_pipe_with_valid_output(display, pipe, output) {
> +		drmModeConnectorPtr c = output->config.connector;
> +
> +		if (c->connector_type != DRM_MODE_CONNECTOR_eDP)
> +			continue;
> +
> +		igt_output_set_pipe(output, pipe);
> +		data->output = output;
> +		data->mode = igt_output_get_mode(output);
> +
> +		return;
> +	}
> +}
> +
> +static void display_init(data_t *data)
> +{
> +	igt_display_require(&data->display, data->drm_fd);
> +	setup_output(data);
> +}
> +
> +static void display_fini(data_t *data)
> +{
> +	igt_display_fini(&data->display);
> +}
> +
> +static void draw_rect(data_t *data, igt_fb_t *fb, int x, int y, int
> w, int h,
> +			double r, double g, double b, double a)
> +{
> +	cairo_t *cr;
> +
> +	cr = igt_get_cairo_ctx(data->drm_fd, fb);
> +	igt_paint_color_alpha(cr, x, y, w, h, r, g, b, a);
> +	igt_put_cairo_ctx(cr);
> +}
> +
> +static void set_clip(struct drm_mode_rect *clip, int x, int y, int
> width,
> +		     int height)
> +{
> +	clip->x1 = x;
> +	clip->y1 = y;
> +	clip->x2 = x + width;
> +	clip->y2 = y + height;
> +}
> +
> +static void plane_update_setup_squares(data_t *data, igt_fb_t *fb,
> uint32_t h,
> +				       uint32_t v)
> +{
> +	int x, y;
> +	int width = SQUARE_SIZE;
> +	int height = SQUARE_SIZE;
> +
> +	switch (data->damage_area_count) {
> +	case 5:
> +		/*Bottom right corner*/
> +		x = h - SQUARE_SIZE;
> +		y = v - SQUARE_SIZE;
> +
> +		draw_rect(data, fb, x, y, width, height, 1.0, 1.0, 1.0,
> 1.0);
> +		set_clip(&data->plane_update_clip[4], x, y, width,
> height);
> +	case 4:
> +		/*Bottom left corner*/
> +		x = 0;
> +		y = v - SQUARE_SIZE;
> +
> +		draw_rect(data, fb, x, y, width, height, 1.0, 1.0, 1.0,
> 1.0);
> +		set_clip(&data->plane_update_clip[3], x, y, width,
> height);
> +	case 3:
> +		/*Top right corner*/
> +		x = h - SQUARE_SIZE;
> +		y = 0;
> +
> +		draw_rect(data, fb, x, y, width, height, 1.0, 1.0, 1.0,
> 1.0);
> +		set_clip(&data->plane_update_clip[2], x, y, width,
> height);
> +	case 2:
> +		/*Top left corner*/
> +		x = 0;
> +		y = 0;
> +
> +		draw_rect(data, fb, x, y, width, height, 1.0, 1.0, 1.0,
> 1.0);
> +		set_clip(&data->plane_update_clip[1], x, y, width,
> height);
> +	case 1:
> +		/*Center*/
> +		x = h/2 - SQUARE_SIZE/2;
> +		y = v/2 - SQUARE_SIZE/2;
> +
> +		draw_rect(data, fb, x, y, width, height, 1.0, 1.0, 1.0,
> 1.0);
> +		set_clip(&data->plane_update_clip[0], x, y, width,
> height);
> +		break;
> +	default:
> +		igt_assert(false);
> +	}
> +}
> +
> +static void plane_move_setup_square(data_t *data, igt_fb_t *fb,
> uint32_t h,
> +				       uint32_t v)
> +{
> +	int x = 0, y = 0;
> +
> +	switch (data->pos) {
> +	case POS_TOP_LEFT:
> +		/*Bottom right corner*/
it seems that the comments do not match enum name.
> +		x = h - SQUARE_SIZE;
> +		y = v - SQUARE_SIZE;
> +		break;
> +	case POS_TOP_RIGHT:
> +		/*Bottom left corner*/
> +		x = 0;
> +		y = v - SQUARE_SIZE;
> +		break;
> +	case POS_BOTTOM_LEFT:
> +		/*Top right corner*/
> +		x = h - SQUARE_SIZE;
> +		y = 0;
> +		break;
> +	case POS_BOTTOM_RIGHT:
> +		/*Top left corner*/
> +		x = 0;
> +		y = 0;
> +		break;
> +	default:
> +		igt_assert(false);
> +	}
> +
> +	draw_rect(data, fb, x, y,
> +		  SQUARE_SIZE, SQUARE_SIZE, 1.0, 1.0, 1.0, 1.0);
> +	set_clip(&data->plane_move_clip, x, y, SQUARE_SIZE,
> SQUARE_SIZE);
> +}
> +
> +static void prepare(data_t *data)
> +{
> +	igt_plane_t *primary, *sprite = NULL, *cursor = NULL;
> +
> +	/* all green frame */
> +	igt_create_color_fb(data->drm_fd,
> +			    data->mode->hdisplay, data->mode->vdisplay,
> +			    DRM_FORMAT_XRGB8888,
> +			    LOCAL_DRM_FORMAT_MOD_NONE,
> +			    0.0, 1.0, 0.0,
> +			    &data->fb_primary);
> +
> +	primary = igt_output_get_plane_type(data->output,
> +			DRM_PLANE_TYPE_PRIMARY);
> +
> +	switch (data->test_plane_id) {
> +	case DRM_PLANE_TYPE_OVERLAY:
> +		sprite = igt_output_get_plane_type(data->output,
> +						   DRM_PLANE_TYPE_OVERL
> AY);
> +		/*All blue plane*/
> +		igt_create_color_fb(data->drm_fd,
> +				    data->mode->hdisplay/2,
> +				    data->mode->vdisplay/2,
> +				    DRM_FORMAT_XRGB8888,
> +				    LOCAL_DRM_FORMAT_MOD_NONE,
> +				    0.0, 0.0, 1.0,
> +				    &data->fb_overlay);
> +
> +		igt_create_color_fb(data->drm_fd,
> +				    data->mode->hdisplay/2,
> +				    data->mode->vdisplay/2,
> +				    DRM_FORMAT_XRGB8888,
> +				    LOCAL_DRM_FORMAT_MOD_NONE,
> +				    0.0, 0.0, 1.0,
> +				    &data->fb_test);
> +
> +		if (data->op == PLANE_MOVE) {
> +			plane_move_setup_square(data, &data->fb_test,
> +					   data->mode->hdisplay/2,
> +					   data->mode->vdisplay/2);
> +
> +		} else {
> +			plane_update_setup_squares(data, &data-
> >fb_test,
> +					   data->mode->hdisplay/2,
> +					   data->mode->vdisplay/2);
> +		}
> +
> +		igt_plane_set_fb(sprite, &data->fb_overlay);
> +		data->test_plane = sprite;
> +		break;
> +
> +	case DRM_PLANE_TYPE_PRIMARY:
> +		igt_create_color_fb(data->drm_fd,
> +			    data->mode->hdisplay, data->mode->vdisplay,
> +			    DRM_FORMAT_XRGB8888,
> +			    LOCAL_DRM_FORMAT_MOD_NONE,
> +			    0.0, 1.0, 0.0,
> +			    &data->fb_test);
> +
> +		plane_update_setup_squares(data, &data->fb_test,
> +					   data->mode->hdisplay,
> +					   data->mode->vdisplay);
> +		data->test_plane = primary;
> +
> +		if (data->op == OVERLAY_PRIM_UPDATE) {
> +			sprite = igt_output_get_plane_type(data-
> >output,
> +						   DRM_PLANE_TYPE_OVERL
> AY);
> +
> +			igt_create_color_fb(data->drm_fd,
> +					    data->mode->hdisplay,
> +					    data->mode->vdisplay,
> +					    DRM_FORMAT_XRGB8888,
> +					    LOCAL_DRM_FORMAT_MOD_NONE,
> +					    0.0, 0.0, 1.0,
> +					    &data->fb_overlay);
> +
> +			igt_plane_set_fb(sprite, &data->fb_overlay);
> +			igt_plane_set_prop_value(sprite,
> IGT_PLANE_ALPHA,
> +						 0x6060);
> +		}
> +		break;
> +
> +	case DRM_PLANE_TYPE_CURSOR:
> +		cursor = igt_output_get_plane_type(data->output,
> +						   DRM_PLANE_TYPE_CURSO
> R);
> +		igt_plane_set_position(cursor, 0, 0);
> +
> +		igt_create_fb(data->drm_fd, CUR_SIZE, CUR_SIZE,
> +			      DRM_FORMAT_ARGB8888,
> LOCAL_DRM_FORMAT_MOD_NONE,
> +			      &data->fb_cursor);
> +
> +		draw_rect(data, &data->fb_cursor, 0, 0, CUR_SIZE,
> CUR_SIZE,
> +			    0.0, 0.0, 1.0, 1.0);
> +
> +		igt_create_fb(data->drm_fd, CUR_SIZE, CUR_SIZE,
> +			      DRM_FORMAT_ARGB8888,
> LOCAL_DRM_FORMAT_MOD_NONE,
> +			      &data->fb_test);
> +
> +		draw_rect(data, &data->fb_test, 0, 0, CUR_SIZE,
> CUR_SIZE,
> +			    1.0, 1.0, 1.0, 1.0);
> +
> +		set_clip(&data->cursor_clip, 0, 0, CUR_SIZE, CUR_SIZE);
> +		igt_plane_set_fb(cursor, &data->fb_cursor);
> +		data->test_plane = cursor;
> +		break;
> +	default:
> +		igt_assert(false);
> +	}
> +
> +	igt_plane_set_fb(primary, &data->fb_primary);
> +
> +	igt_display_commit2(&data->display, COMMIT_ATOMIC);
> +}
> +
> +static inline void manual(const char *expected)
> +{
> +	igt_debug_manual_check("all", expected);
> +}
> +
> +static void plane_update_expected_output(int plane_type, int
> box_count)
> +{
> +	char expected[64] = {};
> +
> +	switch (plane_type) {
> +	case DRM_PLANE_TYPE_PRIMARY:
> +		sprintf(expected, "screen Green with %d White box(es)",
> +			box_count);
> +		break;
> +	case DRM_PLANE_TYPE_OVERLAY:
> +		sprintf(expected,
> +			"screen Green with Blue box and %d White
> box(es)",
> +			box_count);
> +		break;
> +	case DRM_PLANE_TYPE_CURSOR:
> +		sprintf(expected, "screen Green with %d White box(es)",
> +			box_count);
> +		break;
> +	default:
> +		igt_assert(false);
> +	}
> +
> +	manual(expected);
> +}
> +
> +static void plane_move_expected_output(enum plane_move_postion pos)
> +{
> +	char expected[64] = {};
> +
> +	switch (pos) {
> +	case POS_TOP_LEFT:
> +		sprintf(expected,
> +			"screen Green with Blue box on top left corner
> and White box");
> +		break;
> +	case POS_TOP_RIGHT:
> +		sprintf(expected,
> +			"screen Green with Blue box on top right corner
> and White box");
> +		break;
> +	case POS_BOTTOM_LEFT:
> +		sprintf(expected,
> +			"screen Green with Blue box on bottom left
> corner and White box");
> +		break;
> +	case POS_BOTTOM_RIGHT:
> +		sprintf(expected,
> +			"screen Green with Blue box on bottom right
> corner and White box");
> +		break;
> +	default:
> +		igt_assert(false);
> +	}
> +
> +	manual(expected);
> +}
> +
> +static void overlay_prim_update_expected_output(int box_count)
> +{
> +	char expected[64] = {};
> +
> +	sprintf(expected,
> +		"screen Green with Blue overlay, %d light Blue
> box(es)",
> +		box_count);
> +
> +	manual(expected);
> +
> +}
> +
> +static void expected_output(data_t *data)
> +{
> +	switch (data->op) {
> +	case PLANE_MOVE:
> +		plane_move_expected_output(data->pos);
> +		break;
> +	case PLANE_UPDATE:
> +		plane_update_expected_output(data->test_plane_id,
> +					     data->damage_area_count);
> +		break;
> +	case OVERLAY_PRIM_UPDATE:
> +		overlay_prim_update_expected_output(data-
> >damage_area_count);
> +		break;
> +	default:
> +		igt_assert(false);
> +	}
> +}
> +
> +static void damaged_plane_move(data_t *data)
> +{
> +	igt_plane_t *test_plane = data->test_plane;
> +	uint32_t h = data->mode->hdisplay;
> +	uint32_t v = data->mode->vdisplay;
> +
> +	igt_plane_set_fb(test_plane, &data->fb_test);
> +
> +	if (data->test_plane_id == DRM_PLANE_TYPE_OVERLAY) {
> +		h = h/2;
> +		v = v/2;
> +	}
> +
> +	igt_plane_replace_prop_blob(test_plane,
> IGT_PLANE_FB_DAMAGE_CLIPS,
> +				    &data->plane_move_clip,
> +				    sizeof(struct drm_mode_rect));
> +
> +	switch (data->pos) {
> +	case POS_TOP_LEFT:
> +		igt_plane_set_position(data->test_plane, 0, 0);
> +		break;
> +	case POS_TOP_RIGHT:
> +		igt_plane_set_position(data->test_plane,
> +				       data->mode->hdisplay/2, 0);
> +		break;
> +	case POS_BOTTOM_LEFT:
> +		igt_plane_set_position(data->test_plane, 0,
> +				       data->mode->vdisplay/2);
> +		break;
> +	case POS_BOTTOM_RIGHT:
> +		igt_plane_set_position(data->test_plane,
> +				       data->mode->hdisplay/2,
> +				       data->mode->vdisplay/2);
> +		break;
> +	default:
> +		igt_assert(false);
> +	}
> +
> +	igt_display_commit2(&data->display, COMMIT_ATOMIC);
> +
> +	igt_assert(psr_wait_entry(data->debugfs_fd, PSR_MODE_2));
> +
> +	expected_output(data);
> +}
> +
> +static void damaged_plane_update(data_t *data)
> +{
> +	igt_plane_t *test_plane = data->test_plane;
> +	uint32_t h = data->mode->hdisplay;
> +	uint32_t v = data->mode->vdisplay;
> +
> +	igt_plane_set_fb(test_plane, &data->fb_test);
> +
> +	if (data->test_plane_id == DRM_PLANE_TYPE_OVERLAY) {
> +		h = h/2;
> +		v = v/2;
> +	}
> +
> +	if (data->test_plane_id == DRM_PLANE_TYPE_CURSOR)
> +		igt_plane_replace_prop_blob(test_plane,
> +					    IGT_PLANE_FB_DAMAGE_CLIPS,
> +					    &data->cursor_clip,
> +					    sizeof(struct
> drm_mode_rect));
> +	else
> +		igt_plane_replace_prop_blob(test_plane,
> +					    IGT_PLANE_FB_DAMAGE_CLIPS,
> +					    &data->plane_update_clip,
> +					    sizeof(struct
> drm_mode_rect)*
> +					    data->damage_area_count);
> +
> +	igt_plane_set_position(data->test_plane, 0, 0);
> +	igt_display_commit2(&data->display, COMMIT_ATOMIC);
> +
> +	igt_assert(psr_wait_entry(data->debugfs_fd, PSR_MODE_2));
> +
> +	expected_output(data);
> +}
> +
> +static void run(data_t *data)
> +{
> +	igt_assert(psr_wait_entry(data->debugfs_fd, PSR_MODE_2));
> +
> +	switch (data->op) {
> +	case PLANE_UPDATE:
> +	case OVERLAY_PRIM_UPDATE:
> +		damaged_plane_update(data);
> +		break;
> +	case PLANE_MOVE:
> +		damaged_plane_move(data);
> +		break;
> +	default:
> +		igt_assert(false);
> +	}
> +}
> +
> +static void cleanup(data_t *data)
> +{
> +	igt_plane_t *primary;
> +	igt_plane_t *sprite;
> +
> +	primary = igt_output_get_plane_type(data->output,
> +					    DRM_PLANE_TYPE_PRIMARY);
> +
> +	igt_plane_set_fb(primary, NULL);
> +
> +	if (data->test_plane_id != DRM_PLANE_TYPE_PRIMARY) {
> +		igt_plane_set_position(data->test_plane, 0, 0);
> +		igt_plane_set_fb(data->test_plane, NULL);
> +	}
> +
> +	if (data->op == OVERLAY_PRIM_UPDATE) {
> +		sprite = igt_output_get_plane_type(data->output,
> +				DRM_PLANE_TYPE_OVERLAY);
> +		igt_plane_set_position(sprite, 0, 0);
> +		igt_plane_set_fb(sprite, NULL);
> +	}
> +
> +	igt_display_commit2(&data->display, COMMIT_ATOMIC);
> +
> +	igt_remove_fb(data->drm_fd, &data->fb_primary);
> +	igt_remove_fb(data->drm_fd, &data->fb_overlay);
> +	igt_remove_fb(data->drm_fd, &data->fb_cursor);
> +	igt_remove_fb(data->drm_fd, &data->fb_test);
> +}
> +
> +igt_main
> +{
> +	data_t data = {};
> +	int i;
> +
> +	igt_fixture {
> +		int r;
> +
> +		data.drm_fd = drm_open_driver_master(DRIVER_INTEL);
> +		data.debugfs_fd = igt_debugfs_dir(data.drm_fd);
> +		kmstest_set_vt_graphics_mode();
> +
> +		igt_require_f(psr_sink_support(data.drm_fd,
> +					       data.debugfs_fd,
> PSR_MODE_2),
> +			      "Sink does not support PSR2\n");
> +
> +		igt_require_f(psr2_selective_fetch_check(data.debugfs_f
> d),
> +			      "PSR2 selective fetch not enabled\n");
> +
> +		data.bufmgr = drm_intel_bufmgr_gem_init(data.drm_fd,
> 4096);
> +		igt_assert(data.bufmgr);
> +		drm_intel_bufmgr_gem_enable_reuse(data.bufmgr);
> +
> +		display_init(&data);
> +
> +		/* Test if PSR2 can be enabled */
> +		igt_require_f(psr_enable(data.drm_fd,
> +					 data.debugfs_fd, PSR_MODE_2),
> +			      "Error enabling PSR2\n");
> +
> +		data.damage_area_count = MAX_DAMAGE_AREAS;
> +		data.op = PLANE_UPDATE;
> +		data.test_plane_id = DRM_PLANE_TYPE_PRIMARY;
> +		prepare(&data);
> +		r = psr_wait_entry(data.debugfs_fd, PSR_MODE_2);
> +		cleanup(&data);
> +		if (!r)
> +			psr_print_debugfs(data.debugfs_fd);
> +		igt_require_f(r, "PSR2 can not be enabled\n");
> +	}
> +
> +	/* Verify primary plane selective fetch */
> +	for (i = 1; i <= MAX_DAMAGE_AREAS; i++) {
> +		igt_subtest_f("primary-%s-sf-dmg-area-%d",
> op_str(data.op), i) {
> +			data.damage_area_count = i;
> +			data.test_plane_id = DRM_PLANE_TYPE_PRIMARY;
> +			prepare(&data);
> +			run(&data);
> +			cleanup(&data);
> +		}
> +	}
> +
> +	/* Verify overlay plane selective fetch */
> +	for (i = 1; i <= MAX_DAMAGE_AREAS; i++) {
> +		igt_subtest_f("overlay-%s-sf-dmg-area-%d",
> op_str(data.op), i) {
> +			data.damage_area_count = i;
> +			data.test_plane_id = DRM_PLANE_TYPE_OVERLAY;
> +			prepare(&data);
> +			run(&data);
> +			cleanup(&data);
> +		}
> +	}
> +
> +	/* Verify overlay plane selective fetch */
> +	igt_subtest_f("cursor-%s-sf", op_str(data.op)) {
> +		data.damage_area_count = 1;
> +		data.test_plane_id = DRM_PLANE_TYPE_CURSOR;
> +		prepare(&data);
> +		run(&data);
> +		cleanup(&data);
> +	}
> +
> +	/* Only for overlay plane */
> +	data.op = PLANE_MOVE;
> +	/* Verify overlay plane move selective fetch */
> +	for (i = POS_TOP_LEFT; i <= POS_BOTTOM_RIGHT ; i++) {
> +		igt_subtest_f("%s-sf-dmg-area-%d", op_str(data.op), i)
> {
> +			data.pos = i;
> +			data.test_plane_id = DRM_PLANE_TYPE_OVERLAY;
> +			prepare(&data);
> +			run(&data);
> +			cleanup(&data);
> +		}
> +	}
> +
> +	/* Verify primary plane selective fetch with overplay plane
> blended */
> +	data.op = OVERLAY_PRIM_UPDATE;
> +	for (i = 1; i <= MAX_DAMAGE_AREAS; i++) {
> +		igt_subtest_f("%s-sf-dmg-area-%d", op_str(data.op), i)
> {
> +			data.damage_area_count = i;
> +			data.test_plane_id = DRM_PLANE_TYPE_PRIMARY;
> +			prepare(&data);
> +			run(&data);
> +			cleanup(&data);
> +		}
> +	}
> +
> +	igt_fixture {
> +		close(data.debugfs_fd);
> +		drm_intel_bufmgr_destroy(data.bufmgr);
> +		display_fini(&data);
> +	}
> +}
> diff --git a/tests/meson.build b/tests/meson.build
> index a2decf4ab..4cab294b8 100644
> --- a/tests/meson.build
> +++ b/tests/meson.build
> @@ -64,6 +64,7 @@ test_progs = [
>  	'kms_properties',
>  	'kms_psr',
>  	'kms_psr2_su',
> +	'kms_psr2_sf',
>  	'kms_pwrite_crc',
>  	'kms_rmfb',
>  	'kms_rotation_crc',

And this igt test case is needed for testing this feature (
https://patchwork.freedesktop.org/series/84910/ )
when it comes to getting the latest revision of the kernel patch, I'll leave more comments which include the
test result.

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

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

* Re: [igt-dev] [PATCH i-g-t 3/3] tests: Add new PSR2 selective fetch test
  2020-12-16 10:50   ` Mun, Gwan-gyeong
@ 2020-12-21  4:44     ` Laxminarayan Bharadiya, Pankaj
  2021-01-04 19:37       ` Mun, Gwan-gyeong
  0 siblings, 1 reply; 14+ messages in thread
From: Laxminarayan Bharadiya, Pankaj @ 2020-12-21  4:44 UTC (permalink / raw)
  To: Mun, Gwan-gyeong, igt-dev, Souza, Jose



> -----Original Message-----
> From: Mun, Gwan-gyeong <gwan-gyeong.mun@intel.com>
> Sent: 16 December 2020 16:21
> To: Laxminarayan Bharadiya, Pankaj
> <pankaj.laxminarayan.bharadiya@intel.com>; igt-dev@lists.freedesktop.org;
> Souza, Jose <jose.souza@intel.com>
> Subject: Re: [PATCH i-g-t 3/3] tests: Add new PSR2 selective fetch test
> 
> On Tue, 2020-12-08 at 22:31 +0530, Pankaj Bharadiya wrote:
> > Selective fetch reduces display engine use of memory bandwidth by only
> > fetching (reading from memory) the updated regions of the frame buffer
> > and sending those updated regions to a panel with a PSR2 capability.
> >
> > The FB_DAMAGE_CLIPS plane property provides user-space a way inform
> > kernel about the updated regions.
> >
> > Add new test to verify selective fetch by using FB_DAMAGE_CLIPS
> > property to send  updated regions.
> >
> > changes since v1:
> > * alloc enough clips for all tests in stack and reuse (Jose)
> > * set damage clip along with draw, refactor code, rename
> >   variables, etc (Jose)
> >
> > Signed-off-by: Pankaj Bharadiya <
> > pankaj.laxminarayan.bharadiya@intel.com>
> > ---
> >  tests/Makefile.sources |   1 +
> >  tests/kms_psr2_sf.c    | 649
> > +++++++++++++++++++++++++++++++++++++++++
> >  tests/meson.build      |   1 +
> >  3 files changed, 651 insertions(+)
> >  create mode 100644 tests/kms_psr2_sf.c
> >
> > diff --git a/tests/Makefile.sources b/tests/Makefile.sources index
> > 15fb56048..e7e399165 100644
> > --- a/tests/Makefile.sources
> > +++ b/tests/Makefile.sources
> > @@ -80,6 +80,7 @@ TESTS_progs = \
> >  	kms_properties \
> >  	kms_psr \
> >  	kms_psr2_su \
> > +	kms_psr2_sf \
> >  	kms_pwrite_crc \
> >  	kms_rmfb \
> >  	kms_rotation_crc \
> > diff --git a/tests/kms_psr2_sf.c b/tests/kms_psr2_sf.c new file mode
> > 100644 index 000000000..296ed8476
> > --- /dev/null
> > +++ b/tests/kms_psr2_sf.c
> > @@ -0,0 +1,649 @@
> > +/*
> > + * Copyright © 2020 Intel Corporation
> > + *
> > + * Permission is hereby granted, free of charge, to any person
> > obtaining a
> > + * copy of this software and associated documentation files (the
> > "Software"),
> > + * to deal in the Software without restriction, including without
> > limitation
> > + * the rights to use, copy, modify, merge, publish, distribute,
> > sublicense,
> > + * and/or sell copies of the Software, and to permit persons to whom
> > the
> > + * Software is furnished to do so, subject to the following
> > conditions:
> > + *
> > + * The above copyright notice and this permission notice (including
> > the next
> > + * paragraph) shall be included in all copies or substantial
> > portions of the
> > + * Software.
> > + *
> > + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
> > EXPRESS OR
> > + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
> > MERCHANTABILITY,
> > + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO
> > EVENT SHALL
> > + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
> DAMAGES
> > OR OTHER
> > + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
> > ARISING
> > + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
> > OTHER DEALINGS
> > + * IN THE SOFTWARE.
> > + *
> > + */
> > +
> > +#include "igt.h"
> > +#include "igt_sysfs.h"
> > +#include "igt_psr.h"
> > +#include <errno.h>
> > +#include <stdbool.h>
> > +#include <stdio.h>
> > +#include <string.h>
> > +#include "intel_bufmgr.h"
> > +
> > +IGT_TEST_DESCRIPTION("Tests to varify PSR2 selective fetch by
> > sending multiple"
> > +		     " damaged areas");
> > +
> > +#define SQUARE_SIZE 100
> > +
> > +#define CUR_SIZE 64
> > +#define MAX_DAMAGE_AREAS 5
> > +
> > +enum operations {
> > +	PLANE_UPDATE,
> > +	PLANE_MOVE,
> > +	OVERLAY_PRIM_UPDATE
> > +};
> > +
> Hi, can you also add use case which uses igt_fb_set_position()?

Plane_move test uses igt_fb_set_position(). Are you suggesting to 
another new test apart from exisiting PLANE_MOVE test?
Will you please brief on how it should function?

I would like to get this patch reviewed and merged first.
Can add new tests once this patch gets merged?

> 
> > +enum plane_move_postion {
> > +	POS_TOP_LEFT,
> > +	POS_TOP_RIGHT,
> > +	POS_BOTTOM_LEFT,
> > +	POS_BOTTOM_RIGHT
> > +};
> > +
> > +typedef struct {
> > +	int drm_fd;
> > +	int debugfs_fd;
> > +	igt_display_t display;
> > +	drm_intel_bufmgr *bufmgr;
> > +	drmModeModeInfo *mode;
> > +	igt_output_t *output;
> > +	struct igt_fb fb_primary, fb_overlay, fb_cursor;
> > +	struct igt_fb fb_test;
> > +	int damage_area_count;
> > +	struct drm_mode_rect plane_update_clip[MAX_DAMAGE_AREAS];
> > +	struct drm_mode_rect plane_move_clip;
> > +	struct drm_mode_rect cursor_clip;
> > +	enum operations op;
> > +	enum plane_move_postion pos;
> > +	int test_plane_id;
> > +	igt_plane_t *test_plane;
> > +	cairo_t *cr;
> > +} data_t;
> > +
> > +static const char *op_str(enum operations op) {
> > +	static const char * const name[] = {
> > +		[PLANE_UPDATE] = "plane-update",
> > +		[PLANE_MOVE] = "plane-move",
> > +		[OVERLAY_PRIM_UPDATE] = "overlay-primary-update",
> > +	};
> > +
> > +	return name[op];
> > +}
> > +
> > +static void setup_output(data_t *data) {
> > +	igt_display_t *display = &data->display;
> > +	igt_output_t *output;
> > +	enum pipe pipe;
> > +
> > +	for_each_pipe_with_valid_output(display, pipe, output) {
> > +		drmModeConnectorPtr c = output->config.connector;
> > +
> > +		if (c->connector_type != DRM_MODE_CONNECTOR_eDP)
> > +			continue;
> > +
> > +		igt_output_set_pipe(output, pipe);
> > +		data->output = output;
> > +		data->mode = igt_output_get_mode(output);
> > +
> > +		return;
> > +	}
> > +}
> > +
> > +static void display_init(data_t *data) {
> > +	igt_display_require(&data->display, data->drm_fd);
> > +	setup_output(data);
> > +}
> > +
> > +static void display_fini(data_t *data) {
> > +	igt_display_fini(&data->display);
> > +}
> > +
> > +static void draw_rect(data_t *data, igt_fb_t *fb, int x, int y, int
> > w, int h,
> > +			double r, double g, double b, double a) {
> > +	cairo_t *cr;
> > +
> > +	cr = igt_get_cairo_ctx(data->drm_fd, fb);
> > +	igt_paint_color_alpha(cr, x, y, w, h, r, g, b, a);
> > +	igt_put_cairo_ctx(cr);
> > +}
> > +
> > +static void set_clip(struct drm_mode_rect *clip, int x, int y, int
> > width,
> > +		     int height)
> > +{
> > +	clip->x1 = x;
> > +	clip->y1 = y;
> > +	clip->x2 = x + width;
> > +	clip->y2 = y + height;
> > +}
> > +
> > +static void plane_update_setup_squares(data_t *data, igt_fb_t *fb,
> > uint32_t h,
> > +				       uint32_t v)
> > +{
> > +	int x, y;
> > +	int width = SQUARE_SIZE;
> > +	int height = SQUARE_SIZE;
> > +
> > +	switch (data->damage_area_count) {
> > +	case 5:
> > +		/*Bottom right corner*/
> > +		x = h - SQUARE_SIZE;
> > +		y = v - SQUARE_SIZE;
> > +
> > +		draw_rect(data, fb, x, y, width, height, 1.0, 1.0, 1.0,
> > 1.0);
> > +		set_clip(&data->plane_update_clip[4], x, y, width,
> > height);
> > +	case 4:
> > +		/*Bottom left corner*/
> > +		x = 0;
> > +		y = v - SQUARE_SIZE;
> > +
> > +		draw_rect(data, fb, x, y, width, height, 1.0, 1.0, 1.0,
> > 1.0);
> > +		set_clip(&data->plane_update_clip[3], x, y, width,
> > height);
> > +	case 3:
> > +		/*Top right corner*/
> > +		x = h - SQUARE_SIZE;
> > +		y = 0;
> > +
> > +		draw_rect(data, fb, x, y, width, height, 1.0, 1.0, 1.0,
> > 1.0);
> > +		set_clip(&data->plane_update_clip[2], x, y, width,
> > height);
> > +	case 2:
> > +		/*Top left corner*/
> > +		x = 0;
> > +		y = 0;
> > +
> > +		draw_rect(data, fb, x, y, width, height, 1.0, 1.0, 1.0,
> > 1.0);
> > +		set_clip(&data->plane_update_clip[1], x, y, width,
> > height);
> > +	case 1:
> > +		/*Center*/
> > +		x = h/2 - SQUARE_SIZE/2;
> > +		y = v/2 - SQUARE_SIZE/2;
> > +
> > +		draw_rect(data, fb, x, y, width, height, 1.0, 1.0, 1.0,
> > 1.0);
> > +		set_clip(&data->plane_update_clip[0], x, y, width,
> > height);
> > +		break;
> > +	default:
> > +		igt_assert(false);
> > +	}
> > +}
> > +
> > +static void plane_move_setup_square(data_t *data, igt_fb_t *fb,
> > uint32_t h,
> > +				       uint32_t v)
> > +{
> > +	int x = 0, y = 0;
> > +
> > +	switch (data->pos) {
> > +	case POS_TOP_LEFT:
> > +		/*Bottom right corner*/
> it seems that the comments do not match enum name.

Yes, because as per design, I am painting square on the opposite 
corner of the plane position.
 
> > +		x = h - SQUARE_SIZE;
> > +		y = v - SQUARE_SIZE;
> > +		break;
> > +	case POS_TOP_RIGHT:
> > +		/*Bottom left corner*/
> > +		x = 0;
> > +		y = v - SQUARE_SIZE;
> > +		break;
> > +	case POS_BOTTOM_LEFT:
> > +		/*Top right corner*/
> > +		x = h - SQUARE_SIZE;
> > +		y = 0;
> > +		break;
> > +	case POS_BOTTOM_RIGHT:
> > +		/*Top left corner*/
> > +		x = 0;
> > +		y = 0;
> > +		break;
> > +	default:
> > +		igt_assert(false);
> > +	}
> > +
> > +	draw_rect(data, fb, x, y,
> > +		  SQUARE_SIZE, SQUARE_SIZE, 1.0, 1.0, 1.0, 1.0);
> > +	set_clip(&data->plane_move_clip, x, y, SQUARE_SIZE,
> > SQUARE_SIZE);
> > +}
> > +
> > +static void prepare(data_t *data)
> > +{
> > +	igt_plane_t *primary, *sprite = NULL, *cursor = NULL;
> > +
> > +	/* all green frame */
> > +	igt_create_color_fb(data->drm_fd,
> > +			    data->mode->hdisplay, data->mode->vdisplay,
> > +			    DRM_FORMAT_XRGB8888,
> > +			    LOCAL_DRM_FORMAT_MOD_NONE,
> > +			    0.0, 1.0, 0.0,
> > +			    &data->fb_primary);
> > +
> > +	primary = igt_output_get_plane_type(data->output,
> > +			DRM_PLANE_TYPE_PRIMARY);
> > +
> > +	switch (data->test_plane_id) {
> > +	case DRM_PLANE_TYPE_OVERLAY:
> > +		sprite = igt_output_get_plane_type(data->output,
> > +						   DRM_PLANE_TYPE_OVERL
> > AY);
> > +		/*All blue plane*/
> > +		igt_create_color_fb(data->drm_fd,
> > +				    data->mode->hdisplay/2,
> > +				    data->mode->vdisplay/2,
> > +				    DRM_FORMAT_XRGB8888,
> > +				    LOCAL_DRM_FORMAT_MOD_NONE,
> > +				    0.0, 0.0, 1.0,
> > +				    &data->fb_overlay);
> > +
> > +		igt_create_color_fb(data->drm_fd,
> > +				    data->mode->hdisplay/2,
> > +				    data->mode->vdisplay/2,
> > +				    DRM_FORMAT_XRGB8888,
> > +				    LOCAL_DRM_FORMAT_MOD_NONE,
> > +				    0.0, 0.0, 1.0,
> > +				    &data->fb_test);
> > +
> > +		if (data->op == PLANE_MOVE) {
> > +			plane_move_setup_square(data, &data->fb_test,
> > +					   data->mode->hdisplay/2,
> > +					   data->mode->vdisplay/2);
> > +
> > +		} else {
> > +			plane_update_setup_squares(data, &data-
> > >fb_test,
> > +					   data->mode->hdisplay/2,
> > +					   data->mode->vdisplay/2);
> > +		}
> > +
> > +		igt_plane_set_fb(sprite, &data->fb_overlay);
> > +		data->test_plane = sprite;
> > +		break;
> > +
> > +	case DRM_PLANE_TYPE_PRIMARY:
> > +		igt_create_color_fb(data->drm_fd,
> > +			    data->mode->hdisplay, data->mode->vdisplay,
> > +			    DRM_FORMAT_XRGB8888,
> > +			    LOCAL_DRM_FORMAT_MOD_NONE,
> > +			    0.0, 1.0, 0.0,
> > +			    &data->fb_test);
> > +
> > +		plane_update_setup_squares(data, &data->fb_test,
> > +					   data->mode->hdisplay,
> > +					   data->mode->vdisplay);
> > +		data->test_plane = primary;
> > +
> > +		if (data->op == OVERLAY_PRIM_UPDATE) {
> > +			sprite = igt_output_get_plane_type(data-
> > >output,
> > +						   DRM_PLANE_TYPE_OVERL
> > AY);
> > +
> > +			igt_create_color_fb(data->drm_fd,
> > +					    data->mode->hdisplay,
> > +					    data->mode->vdisplay,
> > +					    DRM_FORMAT_XRGB8888,
> > +					    LOCAL_DRM_FORMAT_MOD_NONE,
> > +					    0.0, 0.0, 1.0,
> > +					    &data->fb_overlay);
> > +
> > +			igt_plane_set_fb(sprite, &data->fb_overlay);
> > +			igt_plane_set_prop_value(sprite,
> > IGT_PLANE_ALPHA,
> > +						 0x6060);
> > +		}
> > +		break;
> > +
> > +	case DRM_PLANE_TYPE_CURSOR:
> > +		cursor = igt_output_get_plane_type(data->output,
> > +						   DRM_PLANE_TYPE_CURSO
> > R);
> > +		igt_plane_set_position(cursor, 0, 0);
> > +
> > +		igt_create_fb(data->drm_fd, CUR_SIZE, CUR_SIZE,
> > +			      DRM_FORMAT_ARGB8888,
> > LOCAL_DRM_FORMAT_MOD_NONE,
> > +			      &data->fb_cursor);
> > +
> > +		draw_rect(data, &data->fb_cursor, 0, 0, CUR_SIZE,
> > CUR_SIZE,
> > +			    0.0, 0.0, 1.0, 1.0);
> > +
> > +		igt_create_fb(data->drm_fd, CUR_SIZE, CUR_SIZE,
> > +			      DRM_FORMAT_ARGB8888,
> > LOCAL_DRM_FORMAT_MOD_NONE,
> > +			      &data->fb_test);
> > +
> > +		draw_rect(data, &data->fb_test, 0, 0, CUR_SIZE,
> > CUR_SIZE,
> > +			    1.0, 1.0, 1.0, 1.0);
> > +
> > +		set_clip(&data->cursor_clip, 0, 0, CUR_SIZE, CUR_SIZE);
> > +		igt_plane_set_fb(cursor, &data->fb_cursor);
> > +		data->test_plane = cursor;
> > +		break;
> > +	default:
> > +		igt_assert(false);
> > +	}
> > +
> > +	igt_plane_set_fb(primary, &data->fb_primary);
> > +
> > +	igt_display_commit2(&data->display, COMMIT_ATOMIC); }
> > +
> > +static inline void manual(const char *expected) {
> > +	igt_debug_manual_check("all", expected); }
> > +
> > +static void plane_update_expected_output(int plane_type, int
> > box_count)
> > +{
> > +	char expected[64] = {};
> > +
> > +	switch (plane_type) {
> > +	case DRM_PLANE_TYPE_PRIMARY:
> > +		sprintf(expected, "screen Green with %d White box(es)",
> > +			box_count);
> > +		break;
> > +	case DRM_PLANE_TYPE_OVERLAY:
> > +		sprintf(expected,
> > +			"screen Green with Blue box and %d White
> > box(es)",
> > +			box_count);
> > +		break;
> > +	case DRM_PLANE_TYPE_CURSOR:
> > +		sprintf(expected, "screen Green with %d White box(es)",
> > +			box_count);
> > +		break;
> > +	default:
> > +		igt_assert(false);
> > +	}
> > +
> > +	manual(expected);
> > +}
> > +
> > +static void plane_move_expected_output(enum plane_move_postion pos) {
> > +	char expected[64] = {};
> > +
> > +	switch (pos) {
> > +	case POS_TOP_LEFT:
> > +		sprintf(expected,
> > +			"screen Green with Blue box on top left corner
> > and White box");
> > +		break;
> > +	case POS_TOP_RIGHT:
> > +		sprintf(expected,
> > +			"screen Green with Blue box on top right corner
> > and White box");
> > +		break;
> > +	case POS_BOTTOM_LEFT:
> > +		sprintf(expected,
> > +			"screen Green with Blue box on bottom left
> > corner and White box");
> > +		break;
> > +	case POS_BOTTOM_RIGHT:
> > +		sprintf(expected,
> > +			"screen Green with Blue box on bottom right
> > corner and White box");
> > +		break;
> > +	default:
> > +		igt_assert(false);
> > +	}
> > +
> > +	manual(expected);
> > +}
> > +
> > +static void overlay_prim_update_expected_output(int box_count) {
> > +	char expected[64] = {};
> > +
> > +	sprintf(expected,
> > +		"screen Green with Blue overlay, %d light Blue
> > box(es)",
> > +		box_count);
> > +
> > +	manual(expected);
> > +
> > +}
> > +
> > +static void expected_output(data_t *data) {
> > +	switch (data->op) {
> > +	case PLANE_MOVE:
> > +		plane_move_expected_output(data->pos);
> > +		break;
> > +	case PLANE_UPDATE:
> > +		plane_update_expected_output(data->test_plane_id,
> > +					     data->damage_area_count);
> > +		break;
> > +	case OVERLAY_PRIM_UPDATE:
> > +		overlay_prim_update_expected_output(data-
> > >damage_area_count);
> > +		break;
> > +	default:
> > +		igt_assert(false);
> > +	}
> > +}
> > +
> > +static void damaged_plane_move(data_t *data) {
> > +	igt_plane_t *test_plane = data->test_plane;
> > +	uint32_t h = data->mode->hdisplay;
> > +	uint32_t v = data->mode->vdisplay;
> > +
> > +	igt_plane_set_fb(test_plane, &data->fb_test);
> > +
> > +	if (data->test_plane_id == DRM_PLANE_TYPE_OVERLAY) {
> > +		h = h/2;
> > +		v = v/2;
> > +	}
> > +
> > +	igt_plane_replace_prop_blob(test_plane,
> > IGT_PLANE_FB_DAMAGE_CLIPS,
> > +				    &data->plane_move_clip,
> > +				    sizeof(struct drm_mode_rect));
> > +
> > +	switch (data->pos) {
> > +	case POS_TOP_LEFT:
> > +		igt_plane_set_position(data->test_plane, 0, 0);
> > +		break;
> > +	case POS_TOP_RIGHT:
> > +		igt_plane_set_position(data->test_plane,
> > +				       data->mode->hdisplay/2, 0);
> > +		break;
> > +	case POS_BOTTOM_LEFT:
> > +		igt_plane_set_position(data->test_plane, 0,
> > +				       data->mode->vdisplay/2);
> > +		break;
> > +	case POS_BOTTOM_RIGHT:
> > +		igt_plane_set_position(data->test_plane,
> > +				       data->mode->hdisplay/2,
> > +				       data->mode->vdisplay/2);
> > +		break;
> > +	default:
> > +		igt_assert(false);
> > +	}
> > +
> > +	igt_display_commit2(&data->display, COMMIT_ATOMIC);
> > +
> > +	igt_assert(psr_wait_entry(data->debugfs_fd, PSR_MODE_2));
> > +
> > +	expected_output(data);
> > +}
> > +
> > +static void damaged_plane_update(data_t *data) {
> > +	igt_plane_t *test_plane = data->test_plane;
> > +	uint32_t h = data->mode->hdisplay;
> > +	uint32_t v = data->mode->vdisplay;
> > +
> > +	igt_plane_set_fb(test_plane, &data->fb_test);
> > +
> > +	if (data->test_plane_id == DRM_PLANE_TYPE_OVERLAY) {
> > +		h = h/2;
> > +		v = v/2;
> > +	}
> > +
> > +	if (data->test_plane_id == DRM_PLANE_TYPE_CURSOR)
> > +		igt_plane_replace_prop_blob(test_plane,
> > +					    IGT_PLANE_FB_DAMAGE_CLIPS,
> > +					    &data->cursor_clip,
> > +					    sizeof(struct
> > drm_mode_rect));
> > +	else
> > +		igt_plane_replace_prop_blob(test_plane,
> > +					    IGT_PLANE_FB_DAMAGE_CLIPS,
> > +					    &data->plane_update_clip,
> > +					    sizeof(struct
> > drm_mode_rect)*
> > +					    data->damage_area_count);
> > +
> > +	igt_plane_set_position(data->test_plane, 0, 0);
> > +	igt_display_commit2(&data->display, COMMIT_ATOMIC);
> > +
> > +	igt_assert(psr_wait_entry(data->debugfs_fd, PSR_MODE_2));
> > +
> > +	expected_output(data);
> > +}
> > +
> > +static void run(data_t *data)
> > +{
> > +	igt_assert(psr_wait_entry(data->debugfs_fd, PSR_MODE_2));
> > +
> > +	switch (data->op) {
> > +	case PLANE_UPDATE:
> > +	case OVERLAY_PRIM_UPDATE:
> > +		damaged_plane_update(data);
> > +		break;
> > +	case PLANE_MOVE:
> > +		damaged_plane_move(data);
> > +		break;
> > +	default:
> > +		igt_assert(false);
> > +	}
> > +}
> > +
> > +static void cleanup(data_t *data)
> > +{
> > +	igt_plane_t *primary;
> > +	igt_plane_t *sprite;
> > +
> > +	primary = igt_output_get_plane_type(data->output,
> > +					    DRM_PLANE_TYPE_PRIMARY);
> > +
> > +	igt_plane_set_fb(primary, NULL);
> > +
> > +	if (data->test_plane_id != DRM_PLANE_TYPE_PRIMARY) {
> > +		igt_plane_set_position(data->test_plane, 0, 0);
> > +		igt_plane_set_fb(data->test_plane, NULL);
> > +	}
> > +
> > +	if (data->op == OVERLAY_PRIM_UPDATE) {
> > +		sprite = igt_output_get_plane_type(data->output,
> > +				DRM_PLANE_TYPE_OVERLAY);
> > +		igt_plane_set_position(sprite, 0, 0);
> > +		igt_plane_set_fb(sprite, NULL);
> > +	}
> > +
> > +	igt_display_commit2(&data->display, COMMIT_ATOMIC);
> > +
> > +	igt_remove_fb(data->drm_fd, &data->fb_primary);
> > +	igt_remove_fb(data->drm_fd, &data->fb_overlay);
> > +	igt_remove_fb(data->drm_fd, &data->fb_cursor);
> > +	igt_remove_fb(data->drm_fd, &data->fb_test); }
> > +
> > +igt_main
> > +{
> > +	data_t data = {};
> > +	int i;
> > +
> > +	igt_fixture {
> > +		int r;
> > +
> > +		data.drm_fd = drm_open_driver_master(DRIVER_INTEL);
> > +		data.debugfs_fd = igt_debugfs_dir(data.drm_fd);
> > +		kmstest_set_vt_graphics_mode();
> > +
> > +		igt_require_f(psr_sink_support(data.drm_fd,
> > +					       data.debugfs_fd,
> > PSR_MODE_2),
> > +			      "Sink does not support PSR2\n");
> > +
> > +		igt_require_f(psr2_selective_fetch_check(data.debugfs_f
> > d),
> > +			      "PSR2 selective fetch not enabled\n");
> > +
> > +		data.bufmgr = drm_intel_bufmgr_gem_init(data.drm_fd,
> > 4096);
> > +		igt_assert(data.bufmgr);
> > +		drm_intel_bufmgr_gem_enable_reuse(data.bufmgr);
> > +
> > +		display_init(&data);
> > +
> > +		/* Test if PSR2 can be enabled */
> > +		igt_require_f(psr_enable(data.drm_fd,
> > +					 data.debugfs_fd, PSR_MODE_2),
> > +			      "Error enabling PSR2\n");
> > +
> > +		data.damage_area_count = MAX_DAMAGE_AREAS;
> > +		data.op = PLANE_UPDATE;
> > +		data.test_plane_id = DRM_PLANE_TYPE_PRIMARY;
> > +		prepare(&data);
> > +		r = psr_wait_entry(data.debugfs_fd, PSR_MODE_2);
> > +		cleanup(&data);
> > +		if (!r)
> > +			psr_print_debugfs(data.debugfs_fd);
> > +		igt_require_f(r, "PSR2 can not be enabled\n");
> > +	}
> > +
> > +	/* Verify primary plane selective fetch */
> > +	for (i = 1; i <= MAX_DAMAGE_AREAS; i++) {
> > +		igt_subtest_f("primary-%s-sf-dmg-area-%d",
> > op_str(data.op), i) {
> > +			data.damage_area_count = i;
> > +			data.test_plane_id = DRM_PLANE_TYPE_PRIMARY;
> > +			prepare(&data);
> > +			run(&data);
> > +			cleanup(&data);
> > +		}
> > +	}
> > +
> > +	/* Verify overlay plane selective fetch */
> > +	for (i = 1; i <= MAX_DAMAGE_AREAS; i++) {
> > +		igt_subtest_f("overlay-%s-sf-dmg-area-%d",
> > op_str(data.op), i) {
> > +			data.damage_area_count = i;
> > +			data.test_plane_id = DRM_PLANE_TYPE_OVERLAY;
> > +			prepare(&data);
> > +			run(&data);
> > +			cleanup(&data);
> > +		}
> > +	}
> > +
> > +	/* Verify overlay plane selective fetch */
> > +	igt_subtest_f("cursor-%s-sf", op_str(data.op)) {
> > +		data.damage_area_count = 1;
> > +		data.test_plane_id = DRM_PLANE_TYPE_CURSOR;
> > +		prepare(&data);
> > +		run(&data);
> > +		cleanup(&data);
> > +	}
> > +
> > +	/* Only for overlay plane */
> > +	data.op = PLANE_MOVE;
> > +	/* Verify overlay plane move selective fetch */
> > +	for (i = POS_TOP_LEFT; i <= POS_BOTTOM_RIGHT ; i++) {
> > +		igt_subtest_f("%s-sf-dmg-area-%d", op_str(data.op), i)
> > {
> > +			data.pos = i;
> > +			data.test_plane_id = DRM_PLANE_TYPE_OVERLAY;
> > +			prepare(&data);
> > +			run(&data);
> > +			cleanup(&data);
> > +		}
> > +	}
> > +
> > +	/* Verify primary plane selective fetch with overplay plane
> > blended */
> > +	data.op = OVERLAY_PRIM_UPDATE;
> > +	for (i = 1; i <= MAX_DAMAGE_AREAS; i++) {
> > +		igt_subtest_f("%s-sf-dmg-area-%d", op_str(data.op), i)
> > {
> > +			data.damage_area_count = i;
> > +			data.test_plane_id = DRM_PLANE_TYPE_PRIMARY;
> > +			prepare(&data);
> > +			run(&data);
> > +			cleanup(&data);
> > +		}
> > +	}
> > +
> > +	igt_fixture {
> > +		close(data.debugfs_fd);
> > +		drm_intel_bufmgr_destroy(data.bufmgr);
> > +		display_fini(&data);
> > +	}
> > +}
> > diff --git a/tests/meson.build b/tests/meson.build index
> > a2decf4ab..4cab294b8 100644
> > --- a/tests/meson.build
> > +++ b/tests/meson.build
> > @@ -64,6 +64,7 @@ test_progs = [
> >  	'kms_properties',
> >  	'kms_psr',
> >  	'kms_psr2_su',
> > +	'kms_psr2_sf',
> >  	'kms_pwrite_crc',
> >  	'kms_rmfb',
> >  	'kms_rotation_crc',
> 
> And this igt test case is needed for testing this feature (
> https://patchwork.freedesktop.org/series/84910/ ) when it comes to getting the
> latest revision of the kernel patch, I'll leave more comments which include the
> test result.

Ok.

Thanks,
Pankaj

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

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

* Re: [igt-dev] [PATCH i-g-t 3/3] tests: Add new PSR2 selective fetch test
  2020-12-21  4:44     ` Laxminarayan Bharadiya, Pankaj
@ 2021-01-04 19:37       ` Mun, Gwan-gyeong
  0 siblings, 0 replies; 14+ messages in thread
From: Mun, Gwan-gyeong @ 2021-01-04 19:37 UTC (permalink / raw)
  To: Laxminarayan Bharadiya, Pankaj, igt-dev, Souza, Jose

On Mon, 2020-12-21 at 10:14 +0530, Laxminarayan Bharadiya, Pankaj
wrote:
> > -----Original Message-----
> > From: Mun, Gwan-gyeong <gwan-gyeong.mun@intel.com>
> > Sent: 16 December 2020 16:21
> > To: Laxminarayan Bharadiya, Pankaj
> > <pankaj.laxminarayan.bharadiya@intel.com>; 
> > igt-dev@lists.freedesktop.org;
> > Souza, Jose <jose.souza@intel.com>
> > Subject: Re: [PATCH i-g-t 3/3] tests: Add new PSR2 selective fetch
> > test
> > 
> > On Tue, 2020-12-08 at 22:31 +0530, Pankaj Bharadiya wrote:
> > > Selective fetch reduces display engine use of memory bandwidth by
> > > only
> > > fetching (reading from memory) the updated regions of the frame
> > > buffer
> > > and sending those updated regions to a panel with a PSR2
> > > capability.
> > > 
> > > The FB_DAMAGE_CLIPS plane property provides user-space a way
> > > inform
> > > kernel about the updated regions.
> > > 
> > > Add new test to verify selective fetch by using FB_DAMAGE_CLIPS
> > > property to send  updated regions.
> > > 
> > > changes since v1:
> > > * alloc enough clips for all tests in stack and reuse (Jose)
> > > * set damage clip along with draw, refactor code, rename
> > >   variables, etc (Jose)
> > > 
> > > Signed-off-by: Pankaj Bharadiya <
> > > pankaj.laxminarayan.bharadiya@intel.com>
> > > ---
> > >  tests/Makefile.sources |   1 +
> > >  tests/kms_psr2_sf.c    | 649
> > > +++++++++++++++++++++++++++++++++++++++++
> > >  tests/meson.build      |   1 +
> > >  3 files changed, 651 insertions(+)
> > >  create mode 100644 tests/kms_psr2_sf.c
> > > 
> > > diff --git a/tests/Makefile.sources b/tests/Makefile.sources
> > > index
> > > 15fb56048..e7e399165 100644
> > > --- a/tests/Makefile.sources
> > > +++ b/tests/Makefile.sources
> > > @@ -80,6 +80,7 @@ TESTS_progs = \
> > >  	kms_properties \
> > >  	kms_psr \
> > >  	kms_psr2_su \
> > > +	kms_psr2_sf \
> > >  	kms_pwrite_crc \
> > >  	kms_rmfb \
> > >  	kms_rotation_crc \
> > > diff --git a/tests/kms_psr2_sf.c b/tests/kms_psr2_sf.c new file
> > > mode
> > > 100644 index 000000000..296ed8476
> > > --- /dev/null
> > > +++ b/tests/kms_psr2_sf.c
> > > @@ -0,0 +1,649 @@
> > > +/*
> > > + * Copyright © 2020 Intel Corporation
> > > + *
> > > + * Permission is hereby granted, free of charge, to any person
> > > obtaining a
> > > + * copy of this software and associated documentation files (the
> > > "Software"),
> > > + * to deal in the Software without restriction, including
> > > without
> > > limitation
> > > + * the rights to use, copy, modify, merge, publish, distribute,
> > > sublicense,
> > > + * and/or sell copies of the Software, and to permit persons to
> > > whom
> > > the
> > > + * Software is furnished to do so, subject to the following
> > > conditions:
> > > + *
> > > + * The above copyright notice and this permission notice
> > > (including
> > > the next
> > > + * paragraph) shall be included in all copies or substantial
> > > portions of the
> > > + * Software.
> > > + *
> > > + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
> > > KIND,
> > > EXPRESS OR
> > > + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
> > > MERCHANTABILITY,
> > > + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO
> > > EVENT SHALL
> > > + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
> > DAMAGES
> > > OR OTHER
> > > + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
> > > OTHERWISE,
> > > ARISING
> > > + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
> > > OTHER DEALINGS
> > > + * IN THE SOFTWARE.
> > > + *
> > > + */
> > > +
> > > +#include "igt.h"
> > > +#include "igt_sysfs.h"
> > > +#include "igt_psr.h"
> > > +#include <errno.h>
> > > +#include <stdbool.h>
> > > +#include <stdio.h>
> > > +#include <string.h>
> > > +#include "intel_bufmgr.h"
> > > +
> > > +IGT_TEST_DESCRIPTION("Tests to varify PSR2 selective fetch by
> > > sending multiple"
> > > +		     " damaged areas");
> > > +
> > > +#define SQUARE_SIZE 100
> > > +
> > > +#define CUR_SIZE 64
> > > +#define MAX_DAMAGE_AREAS 5
> > > +
> > > +enum operations {
> > > +	PLANE_UPDATE,
> > > +	PLANE_MOVE,
> > > +	OVERLAY_PRIM_UPDATE
> > > +};
> > > +
> > Hi, can you also add use case which uses igt_fb_set_position()?
> 
> Plane_move test uses igt_fb_set_position(). Are you suggesting to 
> another new test apart from exisiting PLANE_MOVE test?
> Will you please brief on how it should function?
> 
current implementation implies framebuffer position to 0,0.
for testing framebuffer move and damage update, we also need to test
with specific x,y position of igt_fb_set_position().

> I would like to get this patch reviewed and merged first.
> Can add new tests once this patch gets merged?
> 
okay.
> > > +enum plane_move_postion {
> > > +	POS_TOP_LEFT,
> > > +	POS_TOP_RIGHT,
> > > +	POS_BOTTOM_LEFT,
> > > +	POS_BOTTOM_RIGHT
> > > +};
> > > +
> > > +typedef struct {
> > > +	int drm_fd;
> > > +	int debugfs_fd;
> > > +	igt_display_t display;
> > > +	drm_intel_bufmgr *bufmgr;
> > > +	drmModeModeInfo *mode;
> > > +	igt_output_t *output;
> > > +	struct igt_fb fb_primary, fb_overlay, fb_cursor;
> > > +	struct igt_fb fb_test;
> > > +	int damage_area_count;
> > > +	struct drm_mode_rect plane_update_clip[MAX_DAMAGE_AREAS];
> > > +	struct drm_mode_rect plane_move_clip;
> > > +	struct drm_mode_rect cursor_clip;
> > > +	enum operations op;
> > > +	enum plane_move_postion pos;
> > > +	int test_plane_id;
> > > +	igt_plane_t *test_plane;
> > > +	cairo_t *cr;
> > > +} data_t;
> > > +
> > > +static const char *op_str(enum operations op) {
> > > +	static const char * const name[] = {
> > > +		[PLANE_UPDATE] = "plane-update",
> > > +		[PLANE_MOVE] = "plane-move",
> > > +		[OVERLAY_PRIM_UPDATE] = "overlay-primary-update",
> > > +	};
> > > +
> > > +	return name[op];
> > > +}
> > > +
> > > +static void setup_output(data_t *data) {
> > > +	igt_display_t *display = &data->display;
> > > +	igt_output_t *output;
> > > +	enum pipe pipe;
> > > +
> > > +	for_each_pipe_with_valid_output(display, pipe, output) {
> > > +		drmModeConnectorPtr c = output->config.connector;
> > > +
> > > +		if (c->connector_type != DRM_MODE_CONNECTOR_eDP)
> > > +			continue;
> > > +
> > > +		igt_output_set_pipe(output, pipe);
> > > +		data->output = output;
> > > +		data->mode = igt_output_get_mode(output);
> > > +
> > > +		return;
> > > +	}
> > > +}
> > > +
> > > +static void display_init(data_t *data) {
> > > +	igt_display_require(&data->display, data->drm_fd);
> > > +	setup_output(data);
> > > +}
> > > +
> > > +static void display_fini(data_t *data) {
> > > +	igt_display_fini(&data->display);
> > > +}
> > > +
> > > +static void draw_rect(data_t *data, igt_fb_t *fb, int x, int y,
> > > int
> > > w, int h,
> > > +			double r, double g, double b, double a) {
> > > +	cairo_t *cr;
> > > +
> > > +	cr = igt_get_cairo_ctx(data->drm_fd, fb);
> > > +	igt_paint_color_alpha(cr, x, y, w, h, r, g, b, a);
> > > +	igt_put_cairo_ctx(cr);
> > > +}
> > > +
> > > +static void set_clip(struct drm_mode_rect *clip, int x, int y,
> > > int
> > > width,
> > > +		     int height)
> > > +{
> > > +	clip->x1 = x;
> > > +	clip->y1 = y;
> > > +	clip->x2 = x + width;
> > > +	clip->y2 = y + height;
> > > +}
> > > +
> > > +static void plane_update_setup_squares(data_t *data, igt_fb_t
> > > *fb,
> > > uint32_t h,
> > > +				       uint32_t v)
> > > +{
> > > +	int x, y;
> > > +	int width = SQUARE_SIZE;
> > > +	int height = SQUARE_SIZE;
> > > +
> > > +	switch (data->damage_area_count) {
> > > +	case 5:
> > > +		/*Bottom right corner*/
> > > +		x = h - SQUARE_SIZE;
> > > +		y = v - SQUARE_SIZE;
> > > +
> > > +		draw_rect(data, fb, x, y, width, height, 1.0, 1.0, 1.0,
> > > 1.0);
> > > +		set_clip(&data->plane_update_clip[4], x, y, width,
> > > height);
> > > +	case 4:
> > > +		/*Bottom left corner*/
> > > +		x = 0;
> > > +		y = v - SQUARE_SIZE;
> > > +
> > > +		draw_rect(data, fb, x, y, width, height, 1.0, 1.0, 1.0,
> > > 1.0);
> > > +		set_clip(&data->plane_update_clip[3], x, y, width,
> > > height);
> > > +	case 3:
> > > +		/*Top right corner*/
> > > +		x = h - SQUARE_SIZE;
> > > +		y = 0;
> > > +
> > > +		draw_rect(data, fb, x, y, width, height, 1.0, 1.0, 1.0,
> > > 1.0);
> > > +		set_clip(&data->plane_update_clip[2], x, y, width,
> > > height);
> > > +	case 2:
> > > +		/*Top left corner*/
> > > +		x = 0;
> > > +		y = 0;
> > > +
> > > +		draw_rect(data, fb, x, y, width, height, 1.0, 1.0, 1.0,
> > > 1.0);
> > > +		set_clip(&data->plane_update_clip[1], x, y, width,
> > > height);
> > > +	case 1:
> > > +		/*Center*/
> > > +		x = h/2 - SQUARE_SIZE/2;
> > > +		y = v/2 - SQUARE_SIZE/2;
> > > +
> > > +		draw_rect(data, fb, x, y, width, height, 1.0, 1.0, 1.0,
> > > 1.0);
> > > +		set_clip(&data->plane_update_clip[0], x, y, width,
> > > height);
> > > +		break;
> > > +	default:
> > > +		igt_assert(false);
> > > +	}
> > > +}
> > > +
> > > +static void plane_move_setup_square(data_t *data, igt_fb_t *fb,
> > > uint32_t h,
> > > +				       uint32_t v)
> > > +{
> > > +	int x = 0, y = 0;
> > > +
> > > +	switch (data->pos) {
> > > +	case POS_TOP_LEFT:
> > > +		/*Bottom right corner*/
> > it seems that the comments do not match enum name.
> 
> Yes, because as per design, I am painting square on the opposite 
> corner of the plane position.
>  
> > > +		x = h - SQUARE_SIZE;
> > > +		y = v - SQUARE_SIZE;
> > > +		break;
> > > +	case POS_TOP_RIGHT:
> > > +		/*Bottom left corner*/
> > > +		x = 0;
> > > +		y = v - SQUARE_SIZE;
> > > +		break;
> > > +	case POS_BOTTOM_LEFT:
> > > +		/*Top right corner*/
> > > +		x = h - SQUARE_SIZE;
> > > +		y = 0;
> > > +		break;
> > > +	case POS_BOTTOM_RIGHT:
> > > +		/*Top left corner*/
> > > +		x = 0;
> > > +		y = 0;
> > > +		break;
> > > +	default:
> > > +		igt_assert(false);
> > > +	}
> > > +
> > > +	draw_rect(data, fb, x, y,
> > > +		  SQUARE_SIZE, SQUARE_SIZE, 1.0, 1.0, 1.0, 1.0);
> > > +	set_clip(&data->plane_move_clip, x, y, SQUARE_SIZE,
> > > SQUARE_SIZE);
> > > +}
> > > +
> > > +static void prepare(data_t *data)
> > > +{
> > > +	igt_plane_t *primary, *sprite = NULL, *cursor = NULL;
> > > +
> > > +	/* all green frame */
> > > +	igt_create_color_fb(data->drm_fd,
> > > +			    data->mode->hdisplay, data->mode->vdisplay,
> > > +			    DRM_FORMAT_XRGB8888,
> > > +			    LOCAL_DRM_FORMAT_MOD_NONE,
> > > +			    0.0, 1.0, 0.0,
> > > +			    &data->fb_primary);
> > > +
> > > +	primary = igt_output_get_plane_type(data->output,
> > > +			DRM_PLANE_TYPE_PRIMARY);
> > > +
> > > +	switch (data->test_plane_id) {
> > > +	case DRM_PLANE_TYPE_OVERLAY:
> > > +		sprite = igt_output_get_plane_type(data->output,
> > > +						   DRM_PLANE_TYPE_OVERL
> > > AY);
> > > +		/*All blue plane*/
> > > +		igt_create_color_fb(data->drm_fd,
> > > +				    data->mode->hdisplay/2,
> > > +				    data->mode->vdisplay/2,
> > > +				    DRM_FORMAT_XRGB8888,
> > > +				    LOCAL_DRM_FORMAT_MOD_NONE,
> > > +				    0.0, 0.0, 1.0,
> > > +				    &data->fb_overlay);
> > > +
> > > +		igt_create_color_fb(data->drm_fd,
> > > +				    data->mode->hdisplay/2,
> > > +				    data->mode->vdisplay/2,
> > > +				    DRM_FORMAT_XRGB8888,
> > > +				    LOCAL_DRM_FORMAT_MOD_NONE,
> > > +				    0.0, 0.0, 1.0,
> > > +				    &data->fb_test);
> > > +
> > > +		if (data->op == PLANE_MOVE) {
> > > +			plane_move_setup_square(data, &data->fb_test,
> > > +					   data->mode->hdisplay/2,
> > > +					   data->mode->vdisplay/2);
> > > +
> > > +		} else {
> > > +			plane_update_setup_squares(data, &data-
> > > > fb_test,
> > > +					   data->mode->hdisplay/2,
> > > +					   data->mode->vdisplay/2);
> > > +		}
> > > +
> > > +		igt_plane_set_fb(sprite, &data->fb_overlay);
> > > +		data->test_plane = sprite;
> > > +		break;
> > > +
> > > +	case DRM_PLANE_TYPE_PRIMARY:
> > > +		igt_create_color_fb(data->drm_fd,
> > > +			    data->mode->hdisplay, data->mode->vdisplay,
> > > +			    DRM_FORMAT_XRGB8888,
> > > +			    LOCAL_DRM_FORMAT_MOD_NONE,
> > > +			    0.0, 1.0, 0.0,
> > > +			    &data->fb_test);
> > > +
> > > +		plane_update_setup_squares(data, &data->fb_test,
> > > +					   data->mode->hdisplay,
> > > +					   data->mode->vdisplay);
> > > +		data->test_plane = primary;
> > > +
> > > +		if (data->op == OVERLAY_PRIM_UPDATE) {
> > > +			sprite = igt_output_get_plane_type(data-
> > > > output,
> > > +						   DRM_PLANE_TYPE_OVERL
> > > AY);
> > > +
> > > +			igt_create_color_fb(data->drm_fd,
> > > +					    data->mode->hdisplay,
> > > +					    data->mode->vdisplay,
> > > +					    DRM_FORMAT_XRGB8888,
> > > +					    LOCAL_DRM_FORMAT_MOD_NONE,
> > > +					    0.0, 0.0, 1.0,
> > > +					    &data->fb_overlay);
> > > +
> > > +			igt_plane_set_fb(sprite, &data->fb_overlay);
> > > +			igt_plane_set_prop_value(sprite,
> > > IGT_PLANE_ALPHA,
> > > +						 0x6060);
> > > +		}
> > > +		break;
> > > +
> > > +	case DRM_PLANE_TYPE_CURSOR:
> > > +		cursor = igt_output_get_plane_type(data->output,
> > > +						   DRM_PLANE_TYPE_CURSO
> > > R);
> > > +		igt_plane_set_position(cursor, 0, 0);
> > > +
> > > +		igt_create_fb(data->drm_fd, CUR_SIZE, CUR_SIZE,
> > > +			      DRM_FORMAT_ARGB8888,
> > > LOCAL_DRM_FORMAT_MOD_NONE,
> > > +			      &data->fb_cursor);
> > > +
> > > +		draw_rect(data, &data->fb_cursor, 0, 0, CUR_SIZE,
> > > CUR_SIZE,
> > > +			    0.0, 0.0, 1.0, 1.0);
> > > +
> > > +		igt_create_fb(data->drm_fd, CUR_SIZE, CUR_SIZE,
> > > +			      DRM_FORMAT_ARGB8888,
> > > LOCAL_DRM_FORMAT_MOD_NONE,
> > > +			      &data->fb_test);
> > > +
> > > +		draw_rect(data, &data->fb_test, 0, 0, CUR_SIZE,
> > > CUR_SIZE,
> > > +			    1.0, 1.0, 1.0, 1.0);
> > > +
> > > +		set_clip(&data->cursor_clip, 0, 0, CUR_SIZE, CUR_SIZE);
> > > +		igt_plane_set_fb(cursor, &data->fb_cursor);
> > > +		data->test_plane = cursor;
> > > +		break;
> > > +	default:
> > > +		igt_assert(false);
> > > +	}
> > > +
> > > +	igt_plane_set_fb(primary, &data->fb_primary);
> > > +
> > > +	igt_display_commit2(&data->display, COMMIT_ATOMIC); }
> > > +
> > > +static inline void manual(const char *expected) {
> > > +	igt_debug_manual_check("all", expected); }
> > > +
> > > +static void plane_update_expected_output(int plane_type, int
> > > box_count)
> > > +{
> > > +	char expected[64] = {};
> > > +
> > > +	switch (plane_type) {
> > > +	case DRM_PLANE_TYPE_PRIMARY:
> > > +		sprintf(expected, "screen Green with %d White box(es)",
> > > +			box_count);
> > > +		break;
> > > +	case DRM_PLANE_TYPE_OVERLAY:
> > > +		sprintf(expected,
> > > +			"screen Green with Blue box and %d White
> > > box(es)",
> > > +			box_count);
> > > +		break;
> > > +	case DRM_PLANE_TYPE_CURSOR:
> > > +		sprintf(expected, "screen Green with %d White box(es)",
> > > +			box_count);
> > > +		break;
> > > +	default:
> > > +		igt_assert(false);
> > > +	}
> > > +
> > > +	manual(expected);
> > > +}
> > > +
> > > +static void plane_move_expected_output(enum plane_move_postion
> > > pos) {
> > > +	char expected[64] = {};
> > > +
> > > +	switch (pos) {
> > > +	case POS_TOP_LEFT:
> > > +		sprintf(expected,
> > > +			"screen Green with Blue box on top left corner
> > > and White box");
> > > +		break;
> > > +	case POS_TOP_RIGHT:
> > > +		sprintf(expected,
> > > +			"screen Green with Blue box on top right corner
> > > and White box");
> > > +		break;
> > > +	case POS_BOTTOM_LEFT:
> > > +		sprintf(expected,
> > > +			"screen Green with Blue box on bottom left
> > > corner and White box");
> > > +		break;
> > > +	case POS_BOTTOM_RIGHT:
> > > +		sprintf(expected,
> > > +			"screen Green with Blue box on bottom right
> > > corner and White box");
> > > +		break;
> > > +	default:
> > > +		igt_assert(false);
> > > +	}
> > > +
> > > +	manual(expected);
> > > +}
> > > +
> > > +static void overlay_prim_update_expected_output(int box_count) {
> > > +	char expected[64] = {};
> > > +
> > > +	sprintf(expected,
> > > +		"screen Green with Blue overlay, %d light Blue
> > > box(es)",
> > > +		box_count);
> > > +
> > > +	manual(expected);
> > > +
> > > +}
> > > +
> > > +static void expected_output(data_t *data) {
> > > +	switch (data->op) {
> > > +	case PLANE_MOVE:
> > > +		plane_move_expected_output(data->pos);
> > > +		break;
> > > +	case PLANE_UPDATE:
> > > +		plane_update_expected_output(data->test_plane_id,
> > > +					     data->damage_area_count);
> > > +		break;
> > > +	case OVERLAY_PRIM_UPDATE:
> > > +		overlay_prim_update_expected_output(data-
> > > > damage_area_count);
> > > +		break;
> > > +	default:
> > > +		igt_assert(false);
> > > +	}
> > > +}
> > > +
> > > +static void damaged_plane_move(data_t *data) {
> > > +	igt_plane_t *test_plane = data->test_plane;
> > > +	uint32_t h = data->mode->hdisplay;
> > > +	uint32_t v = data->mode->vdisplay;
> > > +
> > > +	igt_plane_set_fb(test_plane, &data->fb_test);
> > > +
> > > +	if (data->test_plane_id == DRM_PLANE_TYPE_OVERLAY) {
> > > +		h = h/2;
> > > +		v = v/2;
> > > +	}
> > > +
> > > +	igt_plane_replace_prop_blob(test_plane,
> > > IGT_PLANE_FB_DAMAGE_CLIPS,
> > > +				    &data->plane_move_clip,
> > > +				    sizeof(struct drm_mode_rect));
> > > +
> > > +	switch (data->pos) {
> > > +	case POS_TOP_LEFT:
> > > +		igt_plane_set_position(data->test_plane, 0, 0);
> > > +		break;
> > > +	case POS_TOP_RIGHT:
> > > +		igt_plane_set_position(data->test_plane,
> > > +				       data->mode->hdisplay/2, 0);
> > > +		break;
> > > +	case POS_BOTTOM_LEFT:
> > > +		igt_plane_set_position(data->test_plane, 0,
> > > +				       data->mode->vdisplay/2);
> > > +		break;
> > > +	case POS_BOTTOM_RIGHT:
> > > +		igt_plane_set_position(data->test_plane,
> > > +				       data->mode->hdisplay/2,
> > > +				       data->mode->vdisplay/2);
> > > +		break;
> > > +	default:
> > > +		igt_assert(false);
> > > +	}
> > > +
> > > +	igt_display_commit2(&data->display, COMMIT_ATOMIC);
> > > +
> > > +	igt_assert(psr_wait_entry(data->debugfs_fd, PSR_MODE_2));
> > > +
> > > +	expected_output(data);
> > > +}
> > > +
> > > +static void damaged_plane_update(data_t *data) {
> > > +	igt_plane_t *test_plane = data->test_plane;
> > > +	uint32_t h = data->mode->hdisplay;
> > > +	uint32_t v = data->mode->vdisplay;
> > > +
> > > +	igt_plane_set_fb(test_plane, &data->fb_test);
> > > +
> > > +	if (data->test_plane_id == DRM_PLANE_TYPE_OVERLAY) {
> > > +		h = h/2;
> > > +		v = v/2;
> > > +	}
> > > +
> > > +	if (data->test_plane_id == DRM_PLANE_TYPE_CURSOR)
> > > +		igt_plane_replace_prop_blob(test_plane,
> > > +					    IGT_PLANE_FB_DAMAGE_CLIPS,
> > > +					    &data->cursor_clip,
> > > +					    sizeof(struct
> > > drm_mode_rect));
> > > +	else
> > > +		igt_plane_replace_prop_blob(test_plane,
> > > +					    IGT_PLANE_FB_DAMAGE_CLIPS,
> > > +					    &data->plane_update_clip,
> > > +					    sizeof(struct
> > > drm_mode_rect)*
> > > +					    data->damage_area_count);
> > > +
> > > +	igt_plane_set_position(data->test_plane, 0, 0);
> > > +	igt_display_commit2(&data->display, COMMIT_ATOMIC);
> > > +
> > > +	igt_assert(psr_wait_entry(data->debugfs_fd, PSR_MODE_2));
> > > +
> > > +	expected_output(data);
> > > +}
> > > +
> > > +static void run(data_t *data)
> > > +{
> > > +	igt_assert(psr_wait_entry(data->debugfs_fd, PSR_MODE_2));
> > > +
> > > +	switch (data->op) {
> > > +	case PLANE_UPDATE:
> > > +	case OVERLAY_PRIM_UPDATE:
> > > +		damaged_plane_update(data);
> > > +		break;
> > > +	case PLANE_MOVE:
> > > +		damaged_plane_move(data);
> > > +		break;
> > > +	default:
> > > +		igt_assert(false);
> > > +	}
> > > +}
> > > +
> > > +static void cleanup(data_t *data)
> > > +{
> > > +	igt_plane_t *primary;
> > > +	igt_plane_t *sprite;
> > > +
> > > +	primary = igt_output_get_plane_type(data->output,
> > > +					    DRM_PLANE_TYPE_PRIMARY);
> > > +
> > > +	igt_plane_set_fb(primary, NULL);
> > > +
> > > +	if (data->test_plane_id != DRM_PLANE_TYPE_PRIMARY) {
> > > +		igt_plane_set_position(data->test_plane, 0, 0);
> > > +		igt_plane_set_fb(data->test_plane, NULL);
> > > +	}
> > > +
> > > +	if (data->op == OVERLAY_PRIM_UPDATE) {
> > > +		sprite = igt_output_get_plane_type(data->output,
> > > +				DRM_PLANE_TYPE_OVERLAY);
> > > +		igt_plane_set_position(sprite, 0, 0);
> > > +		igt_plane_set_fb(sprite, NULL);
> > > +	}
> > > +
> > > +	igt_display_commit2(&data->display, COMMIT_ATOMIC);
> > > +
> > > +	igt_remove_fb(data->drm_fd, &data->fb_primary);
> > > +	igt_remove_fb(data->drm_fd, &data->fb_overlay);
> > > +	igt_remove_fb(data->drm_fd, &data->fb_cursor);
> > > +	igt_remove_fb(data->drm_fd, &data->fb_test); }
> > > +
> > > +igt_main
> > > +{
> > > +	data_t data = {};
> > > +	int i;
> > > +
> > > +	igt_fixture {
> > > +		int r;
> > > +
> > > +		data.drm_fd = drm_open_driver_master(DRIVER_INTEL);
> > > +		data.debugfs_fd = igt_debugfs_dir(data.drm_fd);
> > > +		kmstest_set_vt_graphics_mode();
> > > +
> > > +		igt_require_f(psr_sink_support(data.drm_fd,
> > > +					       data.debugfs_fd,
> > > PSR_MODE_2),
> > > +			      "Sink does not support PSR2\n");
> > > +
> > > +		igt_require_f(psr2_selective_fetch_check(data.debugfs_f
> > > d),
> > > +			      "PSR2 selective fetch not enabled\n");
> > > +
> > > +		data.bufmgr = drm_intel_bufmgr_gem_init(data.drm_fd,
> > > 4096);
> > > +		igt_assert(data.bufmgr);
> > > +		drm_intel_bufmgr_gem_enable_reuse(data.bufmgr);
> > > +
> > > +		display_init(&data);
> > > +
> > > +		/* Test if PSR2 can be enabled */
> > > +		igt_require_f(psr_enable(data.drm_fd,
> > > +					 data.debugfs_fd, PSR_MODE_2),
> > > +			      "Error enabling PSR2\n");
> > > +
> > > +		data.damage_area_count = MAX_DAMAGE_AREAS;
> > > +		data.op = PLANE_UPDATE;
> > > +		data.test_plane_id = DRM_PLANE_TYPE_PRIMARY;
> > > +		prepare(&data);
> > > +		r = psr_wait_entry(data.debugfs_fd, PSR_MODE_2);
> > > +		cleanup(&data);
> > > +		if (!r)
> > > +			psr_print_debugfs(data.debugfs_fd);
> > > +		igt_require_f(r, "PSR2 can not be enabled\n");
> > > +	}
> > > +
> > > +	/* Verify primary plane selective fetch */
> > > +	for (i = 1; i <= MAX_DAMAGE_AREAS; i++) {
> > > +		igt_subtest_f("primary-%s-sf-dmg-area-%d",
> > > op_str(data.op), i) {
> > > +			data.damage_area_count = i;
> > > +			data.test_plane_id = DRM_PLANE_TYPE_PRIMARY;
> > > +			prepare(&data);
> > > +			run(&data);
> > > +			cleanup(&data);
> > > +		}
> > > +	}
> > > +
> > > +	/* Verify overlay plane selective fetch */
> > > +	for (i = 1; i <= MAX_DAMAGE_AREAS; i++) {
> > > +		igt_subtest_f("overlay-%s-sf-dmg-area-%d",
> > > op_str(data.op), i) {
> > > +			data.damage_area_count = i;
> > > +			data.test_plane_id = DRM_PLANE_TYPE_OVERLAY;
> > > +			prepare(&data);
> > > +			run(&data);
> > > +			cleanup(&data);
> > > +		}
> > > +	}
> > > +
> > > +	/* Verify overlay plane selective fetch */
> > > +	igt_subtest_f("cursor-%s-sf", op_str(data.op)) {
> > > +		data.damage_area_count = 1;
> > > +		data.test_plane_id = DRM_PLANE_TYPE_CURSOR;
> > > +		prepare(&data);
> > > +		run(&data);
> > > +		cleanup(&data);
> > > +	}
> > > +
> > > +	/* Only for overlay plane */
> > > +	data.op = PLANE_MOVE;
> > > +	/* Verify overlay plane move selective fetch */
> > > +	for (i = POS_TOP_LEFT; i <= POS_BOTTOM_RIGHT ; i++) {
> > > +		igt_subtest_f("%s-sf-dmg-area-%d", op_str(data.op), i)
> > > {
> > > +			data.pos = i;
> > > +			data.test_plane_id = DRM_PLANE_TYPE_OVERLAY;
> > > +			prepare(&data);
> > > +			run(&data);
> > > +			cleanup(&data);
> > > +		}
> > > +	}
> > > +
> > > +	/* Verify primary plane selective fetch with overplay plane
> > > blended */
> > > +	data.op = OVERLAY_PRIM_UPDATE;
> > > +	for (i = 1; i <= MAX_DAMAGE_AREAS; i++) {
> > > +		igt_subtest_f("%s-sf-dmg-area-%d", op_str(data.op), i)
> > > {
> > > +			data.damage_area_count = i;
> > > +			data.test_plane_id = DRM_PLANE_TYPE_PRIMARY;
> > > +			prepare(&data);
> > > +			run(&data);
> > > +			cleanup(&data);
> > > +		}
> > > +	}
> > > +
> > > +	igt_fixture {
> > > +		close(data.debugfs_fd);
> > > +		drm_intel_bufmgr_destroy(data.bufmgr);
> > > +		display_fini(&data);
> > > +	}
> > > +}
> > > diff --git a/tests/meson.build b/tests/meson.build index
> > > a2decf4ab..4cab294b8 100644
> > > --- a/tests/meson.build
> > > +++ b/tests/meson.build
> > > @@ -64,6 +64,7 @@ test_progs = [
> > >  	'kms_properties',
> > >  	'kms_psr',
> > >  	'kms_psr2_su',
> > > +	'kms_psr2_sf',
> > >  	'kms_pwrite_crc',
> > >  	'kms_rmfb',
> > >  	'kms_rotation_crc',
> > 
> > And this igt test case is needed for testing this feature (
> > https://patchwork.freedesktop.org/series/84910/ ) when it comes to
> > getting the
> > latest revision of the kernel patch, I'll leave more comments which
> > include the
> > test result.
> 
> Ok.
> 
> Thanks,
> Pankaj
> 
Reviewed-by: Gwan-gyeong Mun <gwan-gyeong.mun@intel.com>
> > Br,
> > G.G.
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* Re: [igt-dev] [PATCH i-g-t 0/3] Add FB_DAMAGE_CLIPS prop and new test for Selective fetch
  2020-12-08 17:01 [igt-dev] [PATCH i-g-t 0/3] Add FB_DAMAGE_CLIPS prop and new test for Selective fetch Pankaj Bharadiya
                   ` (5 preceding siblings ...)
  2020-12-09  0:14 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
@ 2021-01-08 12:21 ` Petri Latvala
  6 siblings, 0 replies; 14+ messages in thread
From: Petri Latvala @ 2021-01-08 12:21 UTC (permalink / raw)
  To: Pankaj Bharadiya; +Cc: igt-dev

On Tue, Dec 08, 2020 at 10:31:06PM +0530, Pankaj Bharadiya wrote:
> Add new test for selective fetch
>  
> Pankaj Bharadiya (3):
>   lib/kms: Add fb damage clip plane property
>   lib/igt_psr: Add function to check PSR2 selective fetch
>   tests: Add new PSR2 selective fetch test
> 
>  lib/igt_kms.c          |   3 +
>  lib/igt_kms.h          |   1 +
>  lib/igt_psr.c          |  10 +
>  lib/igt_psr.h          |   1 +
>  tests/Makefile.sources |   1 +
>  tests/kms_psr2_sf.c    | 649 +++++++++++++++++++++++++++++++++++++++++
>  tests/meson.build      |   1 +
>  7 files changed, 666 insertions(+)
>  create mode 100644 tests/kms_psr2_sf.c

Merged the series btw.


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

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

* Re: [igt-dev] [PATCH i-g-t 3/3] tests: Add new PSR2 selective fetch test
  2020-11-18 20:20   ` Souza, Jose
@ 2020-11-19 18:36     ` Laxminarayan Bharadiya, Pankaj
  0 siblings, 0 replies; 14+ messages in thread
From: Laxminarayan Bharadiya, Pankaj @ 2020-11-19 18:36 UTC (permalink / raw)
  To: Souza, Jose, Mun, Gwan-gyeong, igt-dev



> -----Original Message-----
> From: Souza, Jose <jose.souza@intel.com>
> Sent: 19 November 2020 01:50
> To: Laxminarayan Bharadiya, Pankaj
> <pankaj.laxminarayan.bharadiya@intel.com>; Mun, Gwan-gyeong <gwan-
> gyeong.mun@intel.com>; igt-dev@lists.freedesktop.org
> Subject: Re: [PATCH i-g-t 3/3] tests: Add new PSR2 selective fetch test
> 
> On Wed, 2020-11-18 at 13:44 +0530, Pankaj Bharadiya wrote:
> > Selective fetch reduces display engine use of memory bandwidth by only
> > fetching (reading from memory) the updated regions of the frame buffer
> > and sending those updated regions to a panel with a PSR2 capability.
> >
> > The FB_DAMAGE_CLIPS plane property provides user-space a way inform
> > kernel about the updated regions.
> >
> > Add new test to verify selective fetch by using FB_DAMAGE_CLIPS
> > property to send  updated regions.
> >
> > Signed-off-by: Pankaj Bharadiya
> > <pankaj.laxminarayan.bharadiya@intel.com>
> > ---
> >  tests/Makefile.sources |   1 +
> >  tests/kms_psr2_sf.c    | 717
> +++++++++++++++++++++++++++++++++++++++++
> >  tests/meson.build      |   1 +
> >  3 files changed, 719 insertions(+)
> >  create mode 100644 tests/kms_psr2_sf.c
> >
> > diff --git a/tests/Makefile.sources b/tests/Makefile.sources index
> > 96d835820..4e653c8b2 100644
> > --- a/tests/Makefile.sources
> > +++ b/tests/Makefile.sources
> > @@ -79,6 +79,7 @@ TESTS_progs = \
> >  	kms_properties \
> >  	kms_psr \
> >  	kms_psr2_su \
> > +	kms_psr2_sf \
> >  	kms_pwrite_crc \
> >  	kms_rmfb \
> >  	kms_rotation_crc \
> > diff --git a/tests/kms_psr2_sf.c b/tests/kms_psr2_sf.c new file mode
> > 100644 index 000000000..baa640851
> > --- /dev/null
> > +++ b/tests/kms_psr2_sf.c
> > @@ -0,0 +1,717 @@
> > +/*
> > + * Copyright © 2020 Intel Corporation
> > + *
> > + * Permission is hereby granted, free of charge, to any person
> > +obtaining a
> > + * copy of this software and associated documentation files (the
> > +"Software"),
> > + * to deal in the Software without restriction, including without
> > +limitation
> > + * the rights to use, copy, modify, merge, publish, distribute,
> > +sublicense,
> > + * and/or sell copies of the Software, and to permit persons to whom
> > +the
> > + * Software is furnished to do so, subject to the following conditions:
> > + *
> > + * The above copyright notice and this permission notice (including
> > +the next
> > + * paragraph) shall be included in all copies or substantial portions
> > +of the
> > + * Software.
> > + *
> > + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
> > +EXPRESS OR
> > + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
> > +MERCHANTABILITY,
> > + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO
> EVENT
> > +SHALL
> > + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
> DAMAGES
> > +OR OTHER
> > + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
> > +ARISING
> > + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
> > +OTHER DEALINGS
> > + * IN THE SOFTWARE.
> > + *
> > + */
> > +
> > +#include "igt.h"
> > +#include "igt_sysfs.h"
> > +#include "igt_psr.h"
> > +#include <errno.h>
> > +#include <stdbool.h>
> > +#include <stdio.h>
> > +#include <string.h>
> > +#include "intel_bufmgr.h"
> > +
> > +IGT_TEST_DESCRIPTION("Test PSR2 selective fetch");
> > +
> > +#define SQUARE_SIZE 100
> > +
> > +#define CUR_SIZE 64
> > +
> > +enum operations {
> > +	PLANE_UPDATE,
> > +	PLANE_MOVE,
> > +	OVERLAY_PRIM_UPDATE
> > +};
> > +
> > +enum plane_move_postion {
> > +	POS_TOP_LEFT,
> > +	POS_TOP_RIGHT,
> > +	POS_BOTTOM_LEFT,
> > +	POS_BOTTOM_RIGHT
> > +};
> > +
> > +typedef struct {
> > +	int drm_fd;
> > +	int debugfs_fd;
> > +	igt_display_t display;
> > +	drm_intel_bufmgr *bufmgr;
> > +	drmModeModeInfo *mode;
> > +	igt_output_t *output;
> > +	struct igt_fb fb[3];
> > +	int damage_area_count;
> > +	enum operations op;
> > +	enum plane_move_postion pos;
> > +	int test_plane_id;
> > +	igt_plane_t *test_plane;
> > +	cairo_t *cr;
> > +} data_t;
> > +
> > +static const char *op_str(enum operations op) {
> > +	static const char * const name[] = {
> > +		[PLANE_UPDATE] = "plane-update",
> > +		[PLANE_MOVE] = "plane-move",
> > +		[OVERLAY_PRIM_UPDATE] = "overlay-primary-update",
> > +	};
> > +
> > +	return name[op];
> > +}
> > +
> > +static void setup_output(data_t *data) {
> > +	igt_display_t *display = &data->display;
> > +	igt_output_t *output;
> > +	enum pipe pipe;
> > +
> > +	for_each_pipe_with_valid_output(display, pipe, output) {
> > +		drmModeConnectorPtr c = output->config.connector;
> > +
> > +		if (c->connector_type != DRM_MODE_CONNECTOR_eDP)
> > +			continue;
> > +
> > +		igt_output_set_pipe(output, pipe);
> > +		data->output = output;
> > +		data->mode = igt_output_get_mode(output);
> > +
> > +		return;
> > +	}
> > +}
> > +
> > +static void display_init(data_t *data) {
> > +	igt_display_require(&data->display, data->drm_fd);
> > +	setup_output(data);
> > +}
> > +
> > +static void display_fini(data_t *data) {
> > +	igt_display_fini(&data->display);
> > +}
> > +
> > +static void draw_rect(data_t *data, igt_fb_t *fb, int x, int y, int w, int h,
> > +			double r, double g, double b, double a) {
> > +	cairo_t *cr;
> > +
> > +	cr = igt_get_cairo_ctx(data->drm_fd, fb);
> > +	igt_paint_color_alpha(cr, x, y, w, h, r, g, b, a);
> > +	igt_put_cairo_ctx(cr);
> > +}
> > +
> > +static void plane_update_paint_squares(data_t *data, igt_fb_t *fb, uint32_t
> h,
> > +				       uint32_t v)
> > +{
> > +
> > +	switch (data->damage_area_count) {
> > +	case 5:
> > +		/*Bottom right corner*/
> > +		draw_rect(data, fb, h - SQUARE_SIZE, v - SQUARE_SIZE,
> > +			  SQUARE_SIZE, SQUARE_SIZE, 1.0, 1.0, 1.0, 1.0);
> > +	case 4:
> > +		/*Bottom left corner*/
> > +		draw_rect(data, fb, h - SQUARE_SIZE, 0,
> > +			  SQUARE_SIZE, SQUARE_SIZE,
> > +			  1.0, 1.0, 1.0, 1.0);
> > +	case 3:
> > +		/*Top right corner*/
> > +		draw_rect(data, fb, 0, v - SQUARE_SIZE,
> > +			  SQUARE_SIZE, SQUARE_SIZE, 1.0, 1.0, 1.0, 1.0);
> > +	case 2:
> > +		/*Top left corner*/
> > +		draw_rect(data, fb, 0, 0, SQUARE_SIZE, SQUARE_SIZE,
> > +			  1.0, 1.0, 1.0, 1.0);
> > +
> > +	case 1:
> > +		/*Center*/
> > +		draw_rect(data, fb, h/2 - SQUARE_SIZE/2, v/2 -
> SQUARE_SIZE/2,
> > +			  SQUARE_SIZE, SQUARE_SIZE, 1.0, 1.0, 1.0, 1.0);
> > +	}
> 
> Want to see a damage clip being set every time you draw in the fb, together
> calls. Even better if you set int x, y, w and h variables and reuse to it to call
> draw_rect() and set clips(clip[x].x2 = clip[x].x1 + w);
> 
> Also you are only setting the damage area of the places you are drawing to, you
> need also to mark the regions of the previous fb that was draw and in the new fb
> have the background color, example:
> 
> FB0
> |------|
> |O     |
> |      |
> --------
> 
> FB1
> |------|
> |      |
> |      |
> --------
> 
> When flipping to FB1 you need to mark as damaged the region that had a 0 but
> now is only background.

This scenario will not occur as new areas are drawn along with the previous ones.
Previous areas are also part of new damaged FB update.

Did I miss anything?

> 
> > +}
> > +
> > +static void plane_move_paint_square(data_t *data, igt_fb_t *fb, uint32_t h,
> > +				       uint32_t v)
> > +{
> > +
> > +	switch (data->pos) {
> > +	case POS_TOP_LEFT:
> > +		/*Bottom right corner*/
> > +		draw_rect(data, fb, h - SQUARE_SIZE, v - SQUARE_SIZE,
> > +			  SQUARE_SIZE, SQUARE_SIZE, 1.0, 1.0, 1.0, 1.0);
> > +		break;
> > +	case POS_TOP_RIGHT:
> > +		/*Bottom left corner*/
> > +		draw_rect(data, fb, 0, v - SQUARE_SIZE,
> > +			  SQUARE_SIZE, SQUARE_SIZE, 1.0, 1.0, 1.0, 1.0);
> > +		break;
> > +	case POS_BOTTOM_LEFT:
> > +		/*Top right corner*/
> > +		draw_rect(data, fb, h - SQUARE_SIZE, 0,
> > +			  SQUARE_SIZE, SQUARE_SIZE, 1.0, 1.0, 1.0, 1.0);
> > +		break;
> > +	case POS_BOTTOM_RIGHT:
> > +		/*Top left corner*/
> > +		draw_rect(data, fb, 0, 0, SQUARE_SIZE, SQUARE_SIZE,
> > +			  1.0, 1.0, 1.0, 1.0);
> > +		break;
> > +	}
> > +}
> > +
> > +static struct drm_mode_rect *plane_update_setup_damage_areas(data_t
> *data,
> > +							     uint32_t h,
> > +							     uint32_t v)
> > +{
> > +	struct drm_mode_rect *clip;
> > +
> > +	if (data->test_plane_id == DRM_PLANE_TYPE_CURSOR) {
> > +		clip = (struct drm_mode_rect *) malloc(sizeof(struct
> > +							      drm_mode_rect));
> > +		igt_assert(clip);
> > +
> > +		clip->x1 = clip->y1 = 0;
> > +		clip->x2 = clip->y2 = CUR_SIZE;
> > +
> > +	} else {
> > +		clip = (struct drm_mode_rect *) malloc(sizeof(struct
> > +							      drm_mode_rect) *
> > +						       data-
> >damage_area_count);
> 
> alloc enough clips for all tests in stack and reuse in every update.
> 
> 
> > +		igt_assert(clip);
> > +
> > +		switch (data->damage_area_count) {
> > +		case 5:
> > +			/*Bottom right corner*/
> > +			clip[4].x1 = h - SQUARE_SIZE;
> > +			clip[4].y1 = v - SQUARE_SIZE;
> > +			clip[4].x2 = clip[4].x1 + SQUARE_SIZE;
> > +			clip[4].y2 = clip[4].y1 + SQUARE_SIZE;
> > +		case 4:
> > +			/*Bottom left corner*/
> > +			clip[3].x1 = h - SQUARE_SIZE;
> > +			clip[3].y1 = 0;
> > +			clip[3].x2 = clip[3].x1 + SQUARE_SIZE;
> > +			clip[3].y2 = clip[3].y1 + SQUARE_SIZE;
> > +		case 3:
> > +			/*Top right corner*/
> > +			clip[2].x1 = 0;
> > +			clip[2].y1 = v - SQUARE_SIZE;
> > +			clip[2].x2 = clip[2].x1 + SQUARE_SIZE;
> > +			clip[2].y2 = clip[2].y1 + SQUARE_SIZE;
> > +		case 2:
> > +			/*Top left corner*/
> > +			clip[1].x1 = 0;
> > +			clip[1].y1 = 0;
> > +			clip[1].x2 = clip[1].x1 + SQUARE_SIZE;
> > +			clip[1].y2 = clip[1].y1 + SQUARE_SIZE;
> > +
> > +		case 1:
> > +			/*Center*/
> > +			clip[0].x1 = h/2 - SQUARE_SIZE/2;
> > +			clip[0].y1 = v/2 - SQUARE_SIZE/2;
> > +			clip[0].x2 = clip[0].x1 + SQUARE_SIZE;
> > +			clip[0].y2 = clip[0].y1 + SQUARE_SIZE;
> > +		}
> > +	}
> > +
> > +	return clip;
> > +}
> > +
> > +static struct drm_mode_rect *plane_move_setup_damage_area(data_t
> *data,
> > +							  uint32_t h,
> > +							  uint32_t v)
> > +{
> > +	struct drm_mode_rect *clip;
> > +
> > +	clip = (struct drm_mode_rect *) malloc(sizeof(struct drm_mode_rect));
> > +	igt_assert(clip);
> > +
> > +	switch (data->pos) {
> > +	case POS_TOP_LEFT:
> > +		/*Bottom right corner*/
> > +		clip->x1 = h - SQUARE_SIZE;
> > +		clip->y1 = v - SQUARE_SIZE;
> > +		clip->x2 = clip->x1 + SQUARE_SIZE;
> > +		clip->y2 = clip->y1 + SQUARE_SIZE;
> > +
> > +		break;
> > +	case POS_TOP_RIGHT:
> > +		/*Bottom left corner*/
> > +		clip->x1 = h - SQUARE_SIZE;
> > +		clip->y1 = 0;
> > +		clip->x2 = clip->x1 + SQUARE_SIZE;
> > +		clip->y2 = clip->y1 + SQUARE_SIZE;
> > +
> > +		break;
> > +	case POS_BOTTOM_LEFT:
> > +		/*Top right corner*/
> > +		clip->x1 = 0;
> > +		clip->y1 = v - SQUARE_SIZE;
> > +		clip->x2 = clip->x1 + SQUARE_SIZE;
> > +		clip->y2 = clip->y1 + SQUARE_SIZE;
> > +
> > +		break;
> > +	case POS_BOTTOM_RIGHT:
> > +		/*Top left corner*/
> > +		clip->x1 = 0;
> > +		clip->y1 = 0;
> > +		clip->x2 = clip->x1 + SQUARE_SIZE;
> > +		clip->y2 = clip->y1 + SQUARE_SIZE;
> > +	}
> > +
> > +	return clip;
> > +}
> > +
> > +static void free_damage_areas(struct drm_mode_rect *clip) {
> > +	if (!clip)
> > +		return;
> > +
> > +	free(clip);
> > +}
> > +
> > +static void prepare(data_t *data)
> > +{
> > +	igt_plane_t *primary, *sprite = NULL, *cursor = NULL;
> > +
> > +	/* all green frame */
> > +	igt_create_color_fb(data->drm_fd,
> > +			    data->mode->hdisplay, data->mode->vdisplay,
> > +			    DRM_FORMAT_XRGB8888,
> > +			    LOCAL_DRM_FORMAT_MOD_NONE,
> > +			    0.0, 1.0, 0.0,
> > +			    &data->fb[0]);
> > +
> > +	primary = igt_output_get_plane_type(data->output,
> > +			DRM_PLANE_TYPE_PRIMARY);
> > +
> > +	switch (data->test_plane_id) {
> > +	case DRM_PLANE_TYPE_OVERLAY:
> > +		sprite = igt_output_get_plane_type(data->output,
> > +
> DRM_PLANE_TYPE_OVERLAY);
> > +		/*All blue plane*/
> > +		igt_create_color_fb(data->drm_fd,
> > +				    data->mode->hdisplay/2,
> > +				    data->mode->vdisplay/2,
> > +				    DRM_FORMAT_XRGB8888,
> > +				    LOCAL_DRM_FORMAT_MOD_NONE,
> > +				    0.0, 0.0, 1.0,
> > +				    &data->fb[1]);
> 
> Kinda of confusing data->fb, add data->fb_primary[], data->fb_overlay[] and
> data->fb_cursor[].
> 
> > +
> > +		igt_create_color_fb(data->drm_fd,
> > +				    data->mode->hdisplay/2,
> > +				    data->mode->vdisplay/2,
> > +				    DRM_FORMAT_XRGB8888,
> > +				    LOCAL_DRM_FORMAT_MOD_NONE,
> > +				    0.0, 0.0, 1.0,
> > +				    &data->fb[2]);
> > +
> > +		if (data->op == PLANE_MOVE) {
> > +			plane_move_paint_square(data, &data->fb[2],
> > +					   data->mode->hdisplay/2,
> > +					   data->mode->vdisplay/2);
> > +
> > +		} else {
> > +			plane_update_paint_squares(data, &data->fb[2],
> > +					   data->mode->hdisplay/2,
> > +					   data->mode->vdisplay/2);
> > +		}
> > +
> > +		igt_plane_set_fb(sprite, &data->fb[1]);
> > +		data->test_plane = sprite;
> > +		break;
> > +
> > +	case DRM_PLANE_TYPE_PRIMARY:
> > +		igt_create_color_fb(data->drm_fd,
> > +			    data->mode->hdisplay, data->mode->vdisplay,
> > +			    DRM_FORMAT_XRGB8888,
> > +			    LOCAL_DRM_FORMAT_MOD_NONE,
> > +			    0.0, 1.0, 0.0,
> > +			    &data->fb[2]);
> > +
> > +		plane_update_paint_squares(data, &data->fb[2],
> > +					   data->mode->hdisplay,
> > +					   data->mode->vdisplay);
> > +		data->test_plane = primary;
> > +
> > +		if (data->op == OVERLAY_PRIM_UPDATE) {
> > +			sprite = igt_output_get_plane_type(data->output,
> > +
> DRM_PLANE_TYPE_OVERLAY);
> > +
> > +			igt_create_color_fb(data->drm_fd,
> > +					    data->mode->hdisplay,
> > +					    data->mode->vdisplay,
> > +					    DRM_FORMAT_XRGB8888,
> > +					    LOCAL_DRM_FORMAT_MOD_NONE,
> > +					    0.0, 0.0, 1.0,
> > +					    &data->fb[1]);
> > +
> > +			igt_plane_set_fb(sprite, &data->fb[1]);
> > +			igt_plane_set_prop_value(sprite, IGT_PLANE_ALPHA,
> > +						 0x6060);
> > +		}
> > +		break;
> > +
> > +	case DRM_PLANE_TYPE_CURSOR:
> > +		cursor = igt_output_get_plane_type(data->output,
> > +
> DRM_PLANE_TYPE_CURSOR);
> > +		igt_plane_set_position(cursor, 0, 0);
> > +
> > +		igt_create_fb(data->drm_fd, CUR_SIZE, CUR_SIZE,
> > +			      DRM_FORMAT_ARGB8888,
> LOCAL_DRM_FORMAT_MOD_NONE,
> > +			      &data->fb[1]);
> > +
> > +		draw_rect(data, &data->fb[1], 0, 0, CUR_SIZE, CUR_SIZE,
> > +			    0.0, 0.0, 1.0, 1.0);
> > +
> > +		igt_create_fb(data->drm_fd, CUR_SIZE, CUR_SIZE,
> > +			      DRM_FORMAT_ARGB8888,
> LOCAL_DRM_FORMAT_MOD_NONE,
> > +			      &data->fb[2]);
> > +
> > +		draw_rect(data, &data->fb[2], 0, 0, CUR_SIZE, CUR_SIZE,
> > +			    1.0, 1.0, 1.0, 1.0);
> > +
> > +		igt_plane_set_fb(cursor, &data->fb[1]);
> > +		data->test_plane = cursor;
> > +		break;
> > +	}
> > +
> > +	igt_plane_set_fb(primary, &data->fb[0]);
> > +
> > +	igt_display_commit2(&data->display, COMMIT_ATOMIC); }
> > +
> > +static inline void manual(const char *expected) {
> > +	igt_debug_manual_check("all", expected); }
> > +
> > +static void plane_update_expected_output(int plane_type, int
> > +box_count) {
> > +	char expected[64] = {};
> > +
> > +	switch (plane_type) {
> > +	case DRM_PLANE_TYPE_PRIMARY:
> > +		sprintf(expected, "screen Green with %d White box(es)",
> > +			box_count);
> > +		break;
> > +	case DRM_PLANE_TYPE_OVERLAY:
> > +		sprintf(expected,
> > +			"screen Green with Blue box and %d White box(es)",
> > +			box_count);
> > +		break;
> > +	case DRM_PLANE_TYPE_CURSOR:
> > +		sprintf(expected, "screen Green with %d White box(es)",
> > +			box_count);
> > +		break;
> > +	}
> > +
> > +	manual(expected);
> > +}
> > +
> > +static void plane_move_expected_output(enum plane_move_postion pos) {
> > +	char expected[64] = {};
> > +
> > +	switch (pos) {
> > +	case POS_TOP_LEFT:
> > +		sprintf(expected,
> > +			"screen Green with Blue box on top left corner and
> White box");
> > +		break;
> > +	case POS_TOP_RIGHT:
> > +		sprintf(expected,
> > +			"screen Green with Blue box on top right corner and
> White box");
> > +		break;
> > +	case POS_BOTTOM_LEFT:
> > +		sprintf(expected,
> > +			"screen Green with Blue box on bottom left corner and
> White box");
> > +		break;
> > +	case POS_BOTTOM_RIGHT:
> > +		sprintf(expected,
> > +			"screen Green with Blue box on bottom right corner
> and White box");
> > +		break;
> > +	}
> > +
> > +	manual(expected);
> > +}
> > +
> > +static void overlay_prim_update_expected_output(int box_count) {
> > +	char expected[64] = {};
> > +
> > +	sprintf(expected,
> > +		"screen Green with Blue overlay, %d light Blue box(es)",
> > +		box_count);
> > +
> > +	manual(expected);
> > +
> > +}
> > +
> > +static void expected_output(data_t *data) {
> > +	switch (data->op) {
> > +	case PLANE_MOVE:
> > +		plane_move_expected_output(data->pos);
> > +		break;
> > +	case PLANE_UPDATE:
> > +		plane_update_expected_output(data->test_plane_id,
> > +					     data->damage_area_count);
> > +		break;
> > +	case OVERLAY_PRIM_UPDATE:
> > +		overlay_prim_update_expected_output(data-
> >damage_area_count);
> > +		break;
> > +	}
> > +}
> > +
> > +static void damaged_plane_move(data_t *data) {
> > +	igt_plane_t *test_plane = data->test_plane;
> > +	struct drm_mode_rect *clip;
> > +	uint32_t h = data->mode->hdisplay;
> > +	uint32_t v = data->mode->vdisplay;
> > +
> > +	igt_plane_set_fb(test_plane, &data->fb[2]);
> > +
> > +	if (data->test_plane_id == DRM_PLANE_TYPE_OVERLAY) {
> > +		h = h/2;
> > +		v = v/2;
> > +	}
> > +
> > +	clip = plane_move_setup_damage_area(data, h, v);
> 
> This property is in relation to the plane, this damage areas you are setting in the
> function makes no sense.

If I understood correctly after discussion with GG,  we can setup the damaged 
areas in plane w.r.t plane co-ordinates irrespective  set the plane position

Is this correct?

> When moving a plane or set the whole visible plane area as damaged or
> nothing(it should be one of the cases handled by driver).

I did not quite get it. Are you saying to setup damage area for the entire
overplay plane where it is being moved?  Will you please share example.

> 
> > +	igt_plane_replace_prop_blob(test_plane,
> IGT_PLANE_FB_DAMAGE_CLIPS, clip,
> > +				    sizeof(struct drm_mode_rect));
> > +
> > +	switch (data->pos) {
> > +	case POS_TOP_LEFT:
> > +		igt_plane_set_position(data->test_plane, 0, 0);
> > +		break;
> > +	case POS_TOP_RIGHT:
> > +		igt_plane_set_position(data->test_plane,
> > +				       data->mode->hdisplay/2, 0);
> > +		break;
> > +	case POS_BOTTOM_LEFT:
> > +		igt_plane_set_position(data->test_plane, 0,
> > +				       data->mode->vdisplay/2);
> > +		break;
> > +	case POS_BOTTOM_RIGHT:
> > +		igt_plane_set_position(data->test_plane,
> > +				       data->mode->hdisplay/2,
> > +				       data->mode->vdisplay/2);
> > +		break;
> > +	}
> > +
> > +	igt_display_commit2(&data->display, COMMIT_ATOMIC);
> > +
> > +	igt_assert(psr_wait_entry(data->debugfs_fd, PSR_MODE_2));
> > +
> > +	expected_output(data);
> > +
> > +	free_damage_areas(clip);
> > +}
> > +
> > +static void damaged_plane_update(data_t *data) {
> > +	igt_plane_t *test_plane = data->test_plane;
> > +	struct drm_mode_rect *clip;
> > +	uint32_t h = data->mode->hdisplay;
> > +	uint32_t v = data->mode->vdisplay;
> > +
> > +	igt_plane_set_fb(test_plane, &data->fb[2]);
> > +
> > +	if (data->test_plane_id == DRM_PLANE_TYPE_OVERLAY) {
> > +		h = h/2;
> > +		v = v/2;
> > +	}
> > +
> > +	clip = plane_update_setup_damage_areas(data, h, v);
> > +	igt_plane_replace_prop_blob(test_plane,
> IGT_PLANE_FB_DAMAGE_CLIPS, clip,
> > +				    sizeof(struct drm_mode_rect)*
> > +				    data->damage_area_count);
> > +	igt_plane_set_position(data->test_plane, 0, 0);
> > +	igt_display_commit2(&data->display, COMMIT_ATOMIC);
> > +
> > +	igt_assert(psr_wait_entry(data->debugfs_fd, PSR_MODE_2));
> > +
> > +	expected_output(data);
> > +
> > +	free_damage_areas(clip);
> > +}
> > +
> > +static void update_screen_and_test(data_t *data) {
> > +	switch (data->op) {
> > +	case PLANE_UPDATE:
> > +	case OVERLAY_PRIM_UPDATE:
> > +		damaged_plane_update(data);
> > +		break;
> > +	case PLANE_MOVE:
> > +		damaged_plane_move(data);
> > +		break;
> > +	}
> > +}
> > +
> > +static void screen_reset(data_t  *data) {
> > +	igt_plane_t *test_plane = data->test_plane;
> > +
> > +	if (data->test_plane_id == DRM_PLANE_TYPE_PRIMARY)
> > +		igt_plane_set_fb(test_plane, &data->fb[0]);
> > +	else
> > +		igt_plane_set_fb(test_plane, &data->fb[1]);
> > +
> > +	igt_plane_set_position(data->test_plane, 0, 0);
> > +	igt_display_commit2(&data->display, COMMIT_ATOMIC); }
> > +
> > +static void run(data_t *data)
> > +{
> > +	igt_assert(psr_wait_entry(data->debugfs_fd, PSR_MODE_2));
> > +
> > +	screen_reset(data);
> 
> why you need this if you have committed already in the prepare()?

Yeah will remove it.
Was experimenting with loop for with multiple screen changes.

> 
> > +	update_screen_and_test(data);
> 
> Content of this function could be moved to here.

Yes.

> 
> 
> > +}
> > +
> > +static void cleanup(data_t *data)
> > +{
> > +	igt_plane_t *primary;
> > +	igt_plane_t *sprite;
> > +
> > +	primary = igt_output_get_plane_type(data->output,
> > +					    DRM_PLANE_TYPE_PRIMARY);
> > +
> > +	igt_plane_set_fb(primary, NULL);
> > +
> > +	if (data->test_plane_id != DRM_PLANE_TYPE_PRIMARY) {
> > +		igt_plane_set_position(data->test_plane, 0, 0);
> > +		igt_plane_set_fb(data->test_plane, NULL);
> > +	}
> > +
> > +	if (data->op == OVERLAY_PRIM_UPDATE) {
> > +		sprite = igt_output_get_plane_type(data->output,
> > +				DRM_PLANE_TYPE_OVERLAY);
> > +		igt_plane_set_position(sprite, 0, 0);
> > +		igt_plane_set_fb(sprite, NULL);
> > +	}
> > +
> > +	igt_display_commit2(&data->display, COMMIT_ATOMIC);
> > +
> > +	igt_remove_fb(data->drm_fd, &data->fb[0]);
> > +	igt_remove_fb(data->drm_fd, &data->fb[1]);
> > +	igt_remove_fb(data->drm_fd, &data->fb[2]); }
> > +
> > +igt_main
> > +{
> > +	data_t data = {};
> > +	int i;
> > +
> > +	igt_fixture {
> > +		int r;
> > +
> > +		data.drm_fd = drm_open_driver_master(DRIVER_INTEL);
> > +		data.debugfs_fd = igt_debugfs_dir(data.drm_fd);
> > +		kmstest_set_vt_graphics_mode();
> > +
> > +		igt_require_f(psr_sink_support(data.drm_fd,
> > +					       data.debugfs_fd, PSR_MODE_2),
> > +			      "Sink does not support PSR2\n");
> > +
> > +		igt_require_f(psr2_selective_fetch_check(data.debugfs_fd),
> > +			      "PSR2 selective fetch not enabled\n");
> > +
> > +		data.bufmgr = drm_intel_bufmgr_gem_init(data.drm_fd, 4096);
> > +		igt_assert(data.bufmgr);
> > +		drm_intel_bufmgr_gem_enable_reuse(data.bufmgr);
> > +
> > +		display_init(&data);
> > +
> > +		/* Test if PSR2 can be enabled */
> > +		igt_require_f(psr_enable(data.drm_fd,
> > +					 data.debugfs_fd, PSR_MODE_2),
> > +			      "Error enabling PSR2\n");
> > +
> > +		data.damage_area_count = 5;
> > +		data.op = PLANE_UPDATE;
> > +		data.test_plane_id = DRM_PLANE_TYPE_PRIMARY;
> > +		prepare(&data);
> > +		r = psr_wait_entry(data.debugfs_fd, PSR_MODE_2);
> > +		cleanup(&data);
> > +		if (!r)
> > +			psr_print_debugfs(data.debugfs_fd);
> > +		igt_require_f(r, "PSR2 can not be enabled\n");
> > +	}
> > +
> 
> Missing some description of what each subtest will, also a better name.
> What we will see in CI would be: primary-plane-update-sf-5, 5 what?

Any suggestions here?

Thanks,
Pankaj

> 
> > +	for (i = 1; i <= 5; i++) {
> > +		igt_subtest_f("primary-%s-sf-%d", op_str(data.op), i) {
> > +			data.damage_area_count = i;
> > +			data.test_plane_id = DRM_PLANE_TYPE_PRIMARY;
> > +			prepare(&data);
> > +			run(&data);
> > +			cleanup(&data);
> > +		}
> > +	}
> > +
> > +	for (i = 1; i <= 5; i++) {
> > +		igt_subtest_f("overlay-%s-sf-%d", op_str(data.op), i) {
> > +			data.damage_area_count = i;
> > +			data.test_plane_id = DRM_PLANE_TYPE_OVERLAY;
> > +			prepare(&data);
> > +			run(&data);
> > +			cleanup(&data);
> > +		}
> > +	}
> > +
> > +	igt_subtest_f("cursor-%s-sf", op_str(data.op)) {
> > +		data.damage_area_count = 1;
> > +		data.test_plane_id = DRM_PLANE_TYPE_CURSOR;
> > +		prepare(&data);
> > +		run(&data);
> > +		cleanup(&data);
> > +	}
> > +
> > +	/* Only for overlay plane */
> > +	data.op = PLANE_MOVE;
> > +	for (i = POS_TOP_LEFT; i <= POS_BOTTOM_RIGHT ; i++) {
> > +		igt_subtest_f("%s-sf-%d", op_str(data.op), i) {
> > +			data.pos = i;
> > +			data.test_plane_id = DRM_PLANE_TYPE_OVERLAY;
> > +			prepare(&data);
> > +			run(&data);
> > +			cleanup(&data);
> > +		}
> > +	}
> > +
> > +	data.op = OVERLAY_PRIM_UPDATE;
> > +	for (i = 1; i <= 5; i++) {
> > +		igt_subtest_f("%s-sf-%d", op_str(data.op), i) {
> > +			data.damage_area_count = i;
> > +			data.test_plane_id = DRM_PLANE_TYPE_PRIMARY;
> > +			prepare(&data);
> > +			run(&data);
> > +			cleanup(&data);
> > +		}
> > +	}
> > +
> > +	igt_fixture {
> > +		close(data.debugfs_fd);
> > +		drm_intel_bufmgr_destroy(data.bufmgr);
> > +		display_fini(&data);
> > +	}
> > +}
> > diff --git a/tests/meson.build b/tests/meson.build index
> > cc79ac228..b33cfb63f 100644
> > --- a/tests/meson.build
> > +++ b/tests/meson.build
> > @@ -63,6 +63,7 @@ test_progs = [
> >  	'kms_properties',
> >  	'kms_psr',
> >  	'kms_psr2_su',
> > +	'kms_psr2_sf',
> >  	'kms_pwrite_crc',
> >  	'kms_rmfb',
> >  	'kms_rotation_crc',

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

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

* Re: [igt-dev] [PATCH i-g-t 3/3] tests: Add new PSR2 selective fetch test
  2020-11-18  8:14 ` [igt-dev] [PATCH i-g-t 3/3] tests: Add new PSR2 selective fetch test Pankaj Bharadiya
@ 2020-11-18 20:20   ` Souza, Jose
  2020-11-19 18:36     ` Laxminarayan Bharadiya, Pankaj
  0 siblings, 1 reply; 14+ messages in thread
From: Souza, Jose @ 2020-11-18 20:20 UTC (permalink / raw)
  To: Laxminarayan Bharadiya, Pankaj, Mun, Gwan-gyeong, igt-dev

On Wed, 2020-11-18 at 13:44 +0530, Pankaj Bharadiya wrote:
> Selective fetch reduces display engine use of memory bandwidth
> by only fetching (reading from memory) the updated regions of the frame
> buffer and sending those updated regions to a panel with a PSR2 capability.
> 
> The FB_DAMAGE_CLIPS plane property provides user-space a way inform
> kernel about the updated regions.
> 
> Add new test to verify selective fetch by using FB_DAMAGE_CLIPS property
> to send  updated regions.
> 
> Signed-off-by: Pankaj Bharadiya <pankaj.laxminarayan.bharadiya@intel.com>
> ---
>  tests/Makefile.sources |   1 +
>  tests/kms_psr2_sf.c    | 717 +++++++++++++++++++++++++++++++++++++++++
>  tests/meson.build      |   1 +
>  3 files changed, 719 insertions(+)
>  create mode 100644 tests/kms_psr2_sf.c
> 
> diff --git a/tests/Makefile.sources b/tests/Makefile.sources
> index 96d835820..4e653c8b2 100644
> --- a/tests/Makefile.sources
> +++ b/tests/Makefile.sources
> @@ -79,6 +79,7 @@ TESTS_progs = \
>  	kms_properties \
>  	kms_psr \
>  	kms_psr2_su \
> +	kms_psr2_sf \
>  	kms_pwrite_crc \
>  	kms_rmfb \
>  	kms_rotation_crc \
> diff --git a/tests/kms_psr2_sf.c b/tests/kms_psr2_sf.c
> new file mode 100644
> index 000000000..baa640851
> --- /dev/null
> +++ b/tests/kms_psr2_sf.c
> @@ -0,0 +1,717 @@
> +/*
> + * Copyright © 2020 Intel Corporation
> + *
> + * Permission is hereby granted, free of charge, to any person obtaining a
> + * copy of this software and associated documentation files (the "Software"),
> + * to deal in the Software without restriction, including without limitation
> + * the rights to use, copy, modify, merge, publish, distribute, sublicense,
> + * and/or sell copies of the Software, and to permit persons to whom the
> + * Software is furnished to do so, subject to the following conditions:
> + *
> + * The above copyright notice and this permission notice (including the next
> + * paragraph) shall be included in all copies or substantial portions of the
> + * Software.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
> + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
> + * IN THE SOFTWARE.
> + *
> + */
> +
> +#include "igt.h"
> +#include "igt_sysfs.h"
> +#include "igt_psr.h"
> +#include <errno.h>
> +#include <stdbool.h>
> +#include <stdio.h>
> +#include <string.h>
> +#include "intel_bufmgr.h"
> +
> +IGT_TEST_DESCRIPTION("Test PSR2 selective fetch");
> +
> +#define SQUARE_SIZE 100
> +
> +#define CUR_SIZE 64
> +
> +enum operations {
> +	PLANE_UPDATE,
> +	PLANE_MOVE,
> +	OVERLAY_PRIM_UPDATE
> +};
> +
> +enum plane_move_postion {
> +	POS_TOP_LEFT,
> +	POS_TOP_RIGHT,
> +	POS_BOTTOM_LEFT,
> +	POS_BOTTOM_RIGHT
> +};
> +
> +typedef struct {
> +	int drm_fd;
> +	int debugfs_fd;
> +	igt_display_t display;
> +	drm_intel_bufmgr *bufmgr;
> +	drmModeModeInfo *mode;
> +	igt_output_t *output;
> +	struct igt_fb fb[3];
> +	int damage_area_count;
> +	enum operations op;
> +	enum plane_move_postion pos;
> +	int test_plane_id;
> +	igt_plane_t *test_plane;
> +	cairo_t *cr;
> +} data_t;
> +
> +static const char *op_str(enum operations op)
> +{
> +	static const char * const name[] = {
> +		[PLANE_UPDATE] = "plane-update",
> +		[PLANE_MOVE] = "plane-move",
> +		[OVERLAY_PRIM_UPDATE] = "overlay-primary-update",
> +	};
> +
> +	return name[op];
> +}
> +
> +static void setup_output(data_t *data)
> +{
> +	igt_display_t *display = &data->display;
> +	igt_output_t *output;
> +	enum pipe pipe;
> +
> +	for_each_pipe_with_valid_output(display, pipe, output) {
> +		drmModeConnectorPtr c = output->config.connector;
> +
> +		if (c->connector_type != DRM_MODE_CONNECTOR_eDP)
> +			continue;
> +
> +		igt_output_set_pipe(output, pipe);
> +		data->output = output;
> +		data->mode = igt_output_get_mode(output);
> +
> +		return;
> +	}
> +}
> +
> +static void display_init(data_t *data)
> +{
> +	igt_display_require(&data->display, data->drm_fd);
> +	setup_output(data);
> +}
> +
> +static void display_fini(data_t *data)
> +{
> +	igt_display_fini(&data->display);
> +}
> +
> +static void draw_rect(data_t *data, igt_fb_t *fb, int x, int y, int w, int h,
> +			double r, double g, double b, double a)
> +{
> +	cairo_t *cr;
> +
> +	cr = igt_get_cairo_ctx(data->drm_fd, fb);
> +	igt_paint_color_alpha(cr, x, y, w, h, r, g, b, a);
> +	igt_put_cairo_ctx(cr);
> +}
> +
> +static void plane_update_paint_squares(data_t *data, igt_fb_t *fb, uint32_t h,
> +				       uint32_t v)
> +{
> +
> +	switch (data->damage_area_count) {
> +	case 5:
> +		/*Bottom right corner*/
> +		draw_rect(data, fb, h - SQUARE_SIZE, v - SQUARE_SIZE,
> +			  SQUARE_SIZE, SQUARE_SIZE, 1.0, 1.0, 1.0, 1.0);
> +	case 4:
> +		/*Bottom left corner*/
> +		draw_rect(data, fb, h - SQUARE_SIZE, 0,
> +			  SQUARE_SIZE, SQUARE_SIZE,
> +			  1.0, 1.0, 1.0, 1.0);
> +	case 3:
> +		/*Top right corner*/
> +		draw_rect(data, fb, 0, v - SQUARE_SIZE,
> +			  SQUARE_SIZE, SQUARE_SIZE, 1.0, 1.0, 1.0, 1.0);
> +	case 2:
> +		/*Top left corner*/
> +		draw_rect(data, fb, 0, 0, SQUARE_SIZE, SQUARE_SIZE,
> +			  1.0, 1.0, 1.0, 1.0);
> +
> +	case 1:
> +		/*Center*/
> +		draw_rect(data, fb, h/2 - SQUARE_SIZE/2, v/2 - SQUARE_SIZE/2,
> +			  SQUARE_SIZE, SQUARE_SIZE, 1.0, 1.0, 1.0, 1.0);
> +	}

Want to see a damage clip being set every time you draw in the fb, together calls. Even better if you set int x, y, w and h variables and reuse to it
to call draw_rect() and set clips(clip[x].x2 = clip[x].x1 + w);

Also you are only setting the damage area of the places you are drawing to, you need also to mark the regions of the previous fb that was draw and in
the new fb have the background color, example:

FB0
|------|
|O     |
|      |
--------

FB1
|------|
|      |
|      |
--------

When flipping to FB1 you need to mark as damaged the region that had a 0 but now is only background.

> +}
> +
> +static void plane_move_paint_square(data_t *data, igt_fb_t *fb, uint32_t h,
> +				       uint32_t v)
> +{
> +
> +	switch (data->pos) {
> +	case POS_TOP_LEFT:
> +		/*Bottom right corner*/
> +		draw_rect(data, fb, h - SQUARE_SIZE, v - SQUARE_SIZE,
> +			  SQUARE_SIZE, SQUARE_SIZE, 1.0, 1.0, 1.0, 1.0);
> +		break;
> +	case POS_TOP_RIGHT:
> +		/*Bottom left corner*/
> +		draw_rect(data, fb, 0, v - SQUARE_SIZE,
> +			  SQUARE_SIZE, SQUARE_SIZE, 1.0, 1.0, 1.0, 1.0);
> +		break;
> +	case POS_BOTTOM_LEFT:
> +		/*Top right corner*/
> +		draw_rect(data, fb, h - SQUARE_SIZE, 0,
> +			  SQUARE_SIZE, SQUARE_SIZE, 1.0, 1.0, 1.0, 1.0);
> +		break;
> +	case POS_BOTTOM_RIGHT:
> +		/*Top left corner*/
> +		draw_rect(data, fb, 0, 0, SQUARE_SIZE, SQUARE_SIZE,
> +			  1.0, 1.0, 1.0, 1.0);
> +		break;
> +	}
> +}
> +
> +static struct drm_mode_rect *plane_update_setup_damage_areas(data_t *data,
> +							     uint32_t h,
> +							     uint32_t v)
> +{
> +	struct drm_mode_rect *clip;
> +
> +	if (data->test_plane_id == DRM_PLANE_TYPE_CURSOR) {
> +		clip = (struct drm_mode_rect *) malloc(sizeof(struct
> +							      drm_mode_rect));
> +		igt_assert(clip);
> +
> +		clip->x1 = clip->y1 = 0;
> +		clip->x2 = clip->y2 = CUR_SIZE;
> +
> +	} else {
> +		clip = (struct drm_mode_rect *) malloc(sizeof(struct
> +							      drm_mode_rect) *
> +						       data->damage_area_count);

alloc enough clips for all tests in stack and reuse in every update.


> +		igt_assert(clip);
> +
> +		switch (data->damage_area_count) {
> +		case 5:
> +			/*Bottom right corner*/
> +			clip[4].x1 = h - SQUARE_SIZE;
> +			clip[4].y1 = v - SQUARE_SIZE;
> +			clip[4].x2 = clip[4].x1 + SQUARE_SIZE;
> +			clip[4].y2 = clip[4].y1 + SQUARE_SIZE;
> +		case 4:
> +			/*Bottom left corner*/
> +			clip[3].x1 = h - SQUARE_SIZE;
> +			clip[3].y1 = 0;
> +			clip[3].x2 = clip[3].x1 + SQUARE_SIZE;
> +			clip[3].y2 = clip[3].y1 + SQUARE_SIZE;
> +		case 3:
> +			/*Top right corner*/
> +			clip[2].x1 = 0;
> +			clip[2].y1 = v - SQUARE_SIZE;
> +			clip[2].x2 = clip[2].x1 + SQUARE_SIZE;
> +			clip[2].y2 = clip[2].y1 + SQUARE_SIZE;
> +		case 2:
> +			/*Top left corner*/
> +			clip[1].x1 = 0;
> +			clip[1].y1 = 0;
> +			clip[1].x2 = clip[1].x1 + SQUARE_SIZE;
> +			clip[1].y2 = clip[1].y1 + SQUARE_SIZE;
> +
> +		case 1:
> +			/*Center*/
> +			clip[0].x1 = h/2 - SQUARE_SIZE/2;
> +			clip[0].y1 = v/2 - SQUARE_SIZE/2;
> +			clip[0].x2 = clip[0].x1 + SQUARE_SIZE;
> +			clip[0].y2 = clip[0].y1 + SQUARE_SIZE;
> +		}
> +	}
> +
> +	return clip;
> +}
> +
> +static struct drm_mode_rect *plane_move_setup_damage_area(data_t *data,
> +							  uint32_t h,
> +							  uint32_t v)
> +{
> +	struct drm_mode_rect *clip;
> +
> +	clip = (struct drm_mode_rect *) malloc(sizeof(struct drm_mode_rect));
> +	igt_assert(clip);
> +
> +	switch (data->pos) {
> +	case POS_TOP_LEFT:
> +		/*Bottom right corner*/
> +		clip->x1 = h - SQUARE_SIZE;
> +		clip->y1 = v - SQUARE_SIZE;
> +		clip->x2 = clip->x1 + SQUARE_SIZE;
> +		clip->y2 = clip->y1 + SQUARE_SIZE;
> +
> +		break;
> +	case POS_TOP_RIGHT:
> +		/*Bottom left corner*/
> +		clip->x1 = h - SQUARE_SIZE;
> +		clip->y1 = 0;
> +		clip->x2 = clip->x1 + SQUARE_SIZE;
> +		clip->y2 = clip->y1 + SQUARE_SIZE;
> +
> +		break;
> +	case POS_BOTTOM_LEFT:
> +		/*Top right corner*/
> +		clip->x1 = 0;
> +		clip->y1 = v - SQUARE_SIZE;
> +		clip->x2 = clip->x1 + SQUARE_SIZE;
> +		clip->y2 = clip->y1 + SQUARE_SIZE;
> +
> +		break;
> +	case POS_BOTTOM_RIGHT:
> +		/*Top left corner*/
> +		clip->x1 = 0;
> +		clip->y1 = 0;
> +		clip->x2 = clip->x1 + SQUARE_SIZE;
> +		clip->y2 = clip->y1 + SQUARE_SIZE;
> +	}
> +
> +	return clip;
> +}
> +
> +static void free_damage_areas(struct drm_mode_rect *clip)
> +{
> +	if (!clip)
> +		return;
> +
> +	free(clip);
> +}
> +
> +static void prepare(data_t *data)
> +{
> +	igt_plane_t *primary, *sprite = NULL, *cursor = NULL;
> +
> +	/* all green frame */
> +	igt_create_color_fb(data->drm_fd,
> +			    data->mode->hdisplay, data->mode->vdisplay,
> +			    DRM_FORMAT_XRGB8888,
> +			    LOCAL_DRM_FORMAT_MOD_NONE,
> +			    0.0, 1.0, 0.0,
> +			    &data->fb[0]);
> +
> +	primary = igt_output_get_plane_type(data->output,
> +			DRM_PLANE_TYPE_PRIMARY);
> +
> +	switch (data->test_plane_id) {
> +	case DRM_PLANE_TYPE_OVERLAY:
> +		sprite = igt_output_get_plane_type(data->output,
> +						   DRM_PLANE_TYPE_OVERLAY);
> +		/*All blue plane*/
> +		igt_create_color_fb(data->drm_fd,
> +				    data->mode->hdisplay/2,
> +				    data->mode->vdisplay/2,
> +				    DRM_FORMAT_XRGB8888,
> +				    LOCAL_DRM_FORMAT_MOD_NONE,
> +				    0.0, 0.0, 1.0,
> +				    &data->fb[1]);

Kinda of confusing data->fb, add data->fb_primary[], data->fb_overlay[] and data->fb_cursor[].

> +
> +		igt_create_color_fb(data->drm_fd,
> +				    data->mode->hdisplay/2,
> +				    data->mode->vdisplay/2,
> +				    DRM_FORMAT_XRGB8888,
> +				    LOCAL_DRM_FORMAT_MOD_NONE,
> +				    0.0, 0.0, 1.0,
> +				    &data->fb[2]);
> +
> +		if (data->op == PLANE_MOVE) {
> +			plane_move_paint_square(data, &data->fb[2],
> +					   data->mode->hdisplay/2,
> +					   data->mode->vdisplay/2);
> +
> +		} else {
> +			plane_update_paint_squares(data, &data->fb[2],
> +					   data->mode->hdisplay/2,
> +					   data->mode->vdisplay/2);
> +		}
> +
> +		igt_plane_set_fb(sprite, &data->fb[1]);
> +		data->test_plane = sprite;
> +		break;
> +
> +	case DRM_PLANE_TYPE_PRIMARY:
> +		igt_create_color_fb(data->drm_fd,
> +			    data->mode->hdisplay, data->mode->vdisplay,
> +			    DRM_FORMAT_XRGB8888,
> +			    LOCAL_DRM_FORMAT_MOD_NONE,
> +			    0.0, 1.0, 0.0,
> +			    &data->fb[2]);
> +
> +		plane_update_paint_squares(data, &data->fb[2],
> +					   data->mode->hdisplay,
> +					   data->mode->vdisplay);
> +		data->test_plane = primary;
> +
> +		if (data->op == OVERLAY_PRIM_UPDATE) {
> +			sprite = igt_output_get_plane_type(data->output,
> +						   DRM_PLANE_TYPE_OVERLAY);
> +
> +			igt_create_color_fb(data->drm_fd,
> +					    data->mode->hdisplay,
> +					    data->mode->vdisplay,
> +					    DRM_FORMAT_XRGB8888,
> +					    LOCAL_DRM_FORMAT_MOD_NONE,
> +					    0.0, 0.0, 1.0,
> +					    &data->fb[1]);
> +
> +			igt_plane_set_fb(sprite, &data->fb[1]);
> +			igt_plane_set_prop_value(sprite, IGT_PLANE_ALPHA,
> +						 0x6060);
> +		}
> +		break;
> +
> +	case DRM_PLANE_TYPE_CURSOR:
> +		cursor = igt_output_get_plane_type(data->output,
> +						   DRM_PLANE_TYPE_CURSOR);
> +		igt_plane_set_position(cursor, 0, 0);
> +
> +		igt_create_fb(data->drm_fd, CUR_SIZE, CUR_SIZE,
> +			      DRM_FORMAT_ARGB8888, LOCAL_DRM_FORMAT_MOD_NONE,
> +			      &data->fb[1]);
> +
> +		draw_rect(data, &data->fb[1], 0, 0, CUR_SIZE, CUR_SIZE,
> +			    0.0, 0.0, 1.0, 1.0);
> +
> +		igt_create_fb(data->drm_fd, CUR_SIZE, CUR_SIZE,
> +			      DRM_FORMAT_ARGB8888, LOCAL_DRM_FORMAT_MOD_NONE,
> +			      &data->fb[2]);
> +
> +		draw_rect(data, &data->fb[2], 0, 0, CUR_SIZE, CUR_SIZE,
> +			    1.0, 1.0, 1.0, 1.0);
> +
> +		igt_plane_set_fb(cursor, &data->fb[1]);
> +		data->test_plane = cursor;
> +		break;
> +	}
> +
> +	igt_plane_set_fb(primary, &data->fb[0]);
> +
> +	igt_display_commit2(&data->display, COMMIT_ATOMIC);
> +}
> +
> +static inline void manual(const char *expected)
> +{
> +	igt_debug_manual_check("all", expected);
> +}
> +
> +static void plane_update_expected_output(int plane_type, int box_count)
> +{
> +	char expected[64] = {};
> +
> +	switch (plane_type) {
> +	case DRM_PLANE_TYPE_PRIMARY:
> +		sprintf(expected, "screen Green with %d White box(es)",
> +			box_count);
> +		break;
> +	case DRM_PLANE_TYPE_OVERLAY:
> +		sprintf(expected,
> +			"screen Green with Blue box and %d White box(es)",
> +			box_count);
> +		break;
> +	case DRM_PLANE_TYPE_CURSOR:
> +		sprintf(expected, "screen Green with %d White box(es)",
> +			box_count);
> +		break;
> +	}
> +
> +	manual(expected);
> +}
> +
> +static void plane_move_expected_output(enum plane_move_postion pos)
> +{
> +	char expected[64] = {};
> +
> +	switch (pos) {
> +	case POS_TOP_LEFT:
> +		sprintf(expected,
> +			"screen Green with Blue box on top left corner and White box");
> +		break;
> +	case POS_TOP_RIGHT:
> +		sprintf(expected,
> +			"screen Green with Blue box on top right corner and White box");
> +		break;
> +	case POS_BOTTOM_LEFT:
> +		sprintf(expected,
> +			"screen Green with Blue box on bottom left corner and White box");
> +		break;
> +	case POS_BOTTOM_RIGHT:
> +		sprintf(expected,
> +			"screen Green with Blue box on bottom right corner and White box");
> +		break;
> +	}
> +
> +	manual(expected);
> +}
> +
> +static void overlay_prim_update_expected_output(int box_count)
> +{
> +	char expected[64] = {};
> +
> +	sprintf(expected,
> +		"screen Green with Blue overlay, %d light Blue box(es)",
> +		box_count);
> +
> +	manual(expected);
> +
> +}
> +
> +static void expected_output(data_t *data)
> +{
> +	switch (data->op) {
> +	case PLANE_MOVE:
> +		plane_move_expected_output(data->pos);
> +		break;
> +	case PLANE_UPDATE:
> +		plane_update_expected_output(data->test_plane_id,
> +					     data->damage_area_count);
> +		break;
> +	case OVERLAY_PRIM_UPDATE:
> +		overlay_prim_update_expected_output(data->damage_area_count);
> +		break;
> +	}
> +}
> +
> +static void damaged_plane_move(data_t *data)
> +{
> +	igt_plane_t *test_plane = data->test_plane;
> +	struct drm_mode_rect *clip;
> +	uint32_t h = data->mode->hdisplay;
> +	uint32_t v = data->mode->vdisplay;
> +
> +	igt_plane_set_fb(test_plane, &data->fb[2]);
> +
> +	if (data->test_plane_id == DRM_PLANE_TYPE_OVERLAY) {
> +		h = h/2;
> +		v = v/2;
> +	}
> +
> +	clip = plane_move_setup_damage_area(data, h, v);

This property is in relation to the plane, this damage areas you are setting in the function makes no sense.
When moving a plane or set the whole visible plane area as damaged or nothing(it should be one of the cases handled by driver).

> +	igt_plane_replace_prop_blob(test_plane, IGT_PLANE_FB_DAMAGE_CLIPS, clip,
> +				    sizeof(struct drm_mode_rect));
> +
> +	switch (data->pos) {
> +	case POS_TOP_LEFT:
> +		igt_plane_set_position(data->test_plane, 0, 0);
> +		break;
> +	case POS_TOP_RIGHT:
> +		igt_plane_set_position(data->test_plane,
> +				       data->mode->hdisplay/2, 0);
> +		break;
> +	case POS_BOTTOM_LEFT:
> +		igt_plane_set_position(data->test_plane, 0,
> +				       data->mode->vdisplay/2);
> +		break;
> +	case POS_BOTTOM_RIGHT:
> +		igt_plane_set_position(data->test_plane,
> +				       data->mode->hdisplay/2,
> +				       data->mode->vdisplay/2);
> +		break;
> +	}
> +
> +	igt_display_commit2(&data->display, COMMIT_ATOMIC);
> +
> +	igt_assert(psr_wait_entry(data->debugfs_fd, PSR_MODE_2));
> +
> +	expected_output(data);
> +
> +	free_damage_areas(clip);
> +}
> +
> +static void damaged_plane_update(data_t *data)
> +{
> +	igt_plane_t *test_plane = data->test_plane;
> +	struct drm_mode_rect *clip;
> +	uint32_t h = data->mode->hdisplay;
> +	uint32_t v = data->mode->vdisplay;
> +
> +	igt_plane_set_fb(test_plane, &data->fb[2]);
> +
> +	if (data->test_plane_id == DRM_PLANE_TYPE_OVERLAY) {
> +		h = h/2;
> +		v = v/2;
> +	}
> +
> +	clip = plane_update_setup_damage_areas(data, h, v);
> +	igt_plane_replace_prop_blob(test_plane, IGT_PLANE_FB_DAMAGE_CLIPS, clip,
> +				    sizeof(struct drm_mode_rect)*
> +				    data->damage_area_count);
> +	igt_plane_set_position(data->test_plane, 0, 0);
> +	igt_display_commit2(&data->display, COMMIT_ATOMIC);
> +
> +	igt_assert(psr_wait_entry(data->debugfs_fd, PSR_MODE_2));
> +
> +	expected_output(data);
> +
> +	free_damage_areas(clip);
> +}
> +
> +static void update_screen_and_test(data_t *data)
> +{
> +	switch (data->op) {
> +	case PLANE_UPDATE:
> +	case OVERLAY_PRIM_UPDATE:
> +		damaged_plane_update(data);
> +		break;
> +	case PLANE_MOVE:
> +		damaged_plane_move(data);
> +		break;
> +	}
> +}
> +
> +static void screen_reset(data_t  *data)
> +{
> +	igt_plane_t *test_plane = data->test_plane;
> +
> +	if (data->test_plane_id == DRM_PLANE_TYPE_PRIMARY)
> +		igt_plane_set_fb(test_plane, &data->fb[0]);
> +	else
> +		igt_plane_set_fb(test_plane, &data->fb[1]);
> +
> +	igt_plane_set_position(data->test_plane, 0, 0);
> +	igt_display_commit2(&data->display, COMMIT_ATOMIC);
> +}
> +
> +static void run(data_t *data)
> +{
> +	igt_assert(psr_wait_entry(data->debugfs_fd, PSR_MODE_2));
> +
> +	screen_reset(data);

why you need this if you have committed already in the prepare()?

> +	update_screen_and_test(data);

Content of this function could be moved to here.


> +}
> +
> +static void cleanup(data_t *data)
> +{
> +	igt_plane_t *primary;
> +	igt_plane_t *sprite;
> +
> +	primary = igt_output_get_plane_type(data->output,
> +					    DRM_PLANE_TYPE_PRIMARY);
> +
> +	igt_plane_set_fb(primary, NULL);
> +
> +	if (data->test_plane_id != DRM_PLANE_TYPE_PRIMARY) {
> +		igt_plane_set_position(data->test_plane, 0, 0);
> +		igt_plane_set_fb(data->test_plane, NULL);
> +	}
> +
> +	if (data->op == OVERLAY_PRIM_UPDATE) {
> +		sprite = igt_output_get_plane_type(data->output,
> +				DRM_PLANE_TYPE_OVERLAY);
> +		igt_plane_set_position(sprite, 0, 0);
> +		igt_plane_set_fb(sprite, NULL);
> +	}
> +
> +	igt_display_commit2(&data->display, COMMIT_ATOMIC);
> +
> +	igt_remove_fb(data->drm_fd, &data->fb[0]);
> +	igt_remove_fb(data->drm_fd, &data->fb[1]);
> +	igt_remove_fb(data->drm_fd, &data->fb[2]);
> +}
> +
> +igt_main
> +{
> +	data_t data = {};
> +	int i;
> +
> +	igt_fixture {
> +		int r;
> +
> +		data.drm_fd = drm_open_driver_master(DRIVER_INTEL);
> +		data.debugfs_fd = igt_debugfs_dir(data.drm_fd);
> +		kmstest_set_vt_graphics_mode();
> +
> +		igt_require_f(psr_sink_support(data.drm_fd,
> +					       data.debugfs_fd, PSR_MODE_2),
> +			      "Sink does not support PSR2\n");
> +
> +		igt_require_f(psr2_selective_fetch_check(data.debugfs_fd),
> +			      "PSR2 selective fetch not enabled\n");
> +
> +		data.bufmgr = drm_intel_bufmgr_gem_init(data.drm_fd, 4096);
> +		igt_assert(data.bufmgr);
> +		drm_intel_bufmgr_gem_enable_reuse(data.bufmgr);
> +
> +		display_init(&data);
> +
> +		/* Test if PSR2 can be enabled */
> +		igt_require_f(psr_enable(data.drm_fd,
> +					 data.debugfs_fd, PSR_MODE_2),
> +			      "Error enabling PSR2\n");
> +
> +		data.damage_area_count = 5;
> +		data.op = PLANE_UPDATE;
> +		data.test_plane_id = DRM_PLANE_TYPE_PRIMARY;
> +		prepare(&data);
> +		r = psr_wait_entry(data.debugfs_fd, PSR_MODE_2);
> +		cleanup(&data);
> +		if (!r)
> +			psr_print_debugfs(data.debugfs_fd);
> +		igt_require_f(r, "PSR2 can not be enabled\n");
> +	}
> +

Missing some description of what each subtest will, also a better name.
What we will see in CI would be: primary-plane-update-sf-5, 5 what?

> +	for (i = 1; i <= 5; i++) {
> +		igt_subtest_f("primary-%s-sf-%d", op_str(data.op), i) {
> +			data.damage_area_count = i;
> +			data.test_plane_id = DRM_PLANE_TYPE_PRIMARY;
> +			prepare(&data);
> +			run(&data);
> +			cleanup(&data);
> +		}
> +	}
> +
> +	for (i = 1; i <= 5; i++) {
> +		igt_subtest_f("overlay-%s-sf-%d", op_str(data.op), i) {
> +			data.damage_area_count = i;
> +			data.test_plane_id = DRM_PLANE_TYPE_OVERLAY;
> +			prepare(&data);
> +			run(&data);
> +			cleanup(&data);
> +		}
> +	}
> +
> +	igt_subtest_f("cursor-%s-sf", op_str(data.op)) {
> +		data.damage_area_count = 1;
> +		data.test_plane_id = DRM_PLANE_TYPE_CURSOR;
> +		prepare(&data);
> +		run(&data);
> +		cleanup(&data);
> +	}
> +
> +	/* Only for overlay plane */
> +	data.op = PLANE_MOVE;
> +	for (i = POS_TOP_LEFT; i <= POS_BOTTOM_RIGHT ; i++) {
> +		igt_subtest_f("%s-sf-%d", op_str(data.op), i) {
> +			data.pos = i;
> +			data.test_plane_id = DRM_PLANE_TYPE_OVERLAY;
> +			prepare(&data);
> +			run(&data);
> +			cleanup(&data);
> +		}
> +	}
> +
> +	data.op = OVERLAY_PRIM_UPDATE;
> +	for (i = 1; i <= 5; i++) {
> +		igt_subtest_f("%s-sf-%d", op_str(data.op), i) {
> +			data.damage_area_count = i;
> +			data.test_plane_id = DRM_PLANE_TYPE_PRIMARY;
> +			prepare(&data);
> +			run(&data);
> +			cleanup(&data);
> +		}
> +	}
> +
> +	igt_fixture {
> +		close(data.debugfs_fd);
> +		drm_intel_bufmgr_destroy(data.bufmgr);
> +		display_fini(&data);
> +	}
> +}
> diff --git a/tests/meson.build b/tests/meson.build
> index cc79ac228..b33cfb63f 100644
> --- a/tests/meson.build
> +++ b/tests/meson.build
> @@ -63,6 +63,7 @@ test_progs = [
>  	'kms_properties',
>  	'kms_psr',
>  	'kms_psr2_su',
> +	'kms_psr2_sf',
>  	'kms_pwrite_crc',
>  	'kms_rmfb',
>  	'kms_rotation_crc',

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

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

* [igt-dev] [PATCH i-g-t 3/3] tests: Add new PSR2 selective fetch test
  2020-11-18  8:14 Pankaj Bharadiya
@ 2020-11-18  8:14 ` Pankaj Bharadiya
  2020-11-18 20:20   ` Souza, Jose
  0 siblings, 1 reply; 14+ messages in thread
From: Pankaj Bharadiya @ 2020-11-18  8:14 UTC (permalink / raw)
  To: gwan-gyeong.mun, igt-dev, jose.souza

Selective fetch reduces display engine use of memory bandwidth
by only fetching (reading from memory) the updated regions of the frame
buffer and sending those updated regions to a panel with a PSR2 capability.

The FB_DAMAGE_CLIPS plane property provides user-space a way inform
kernel about the updated regions.

Add new test to verify selective fetch by using FB_DAMAGE_CLIPS property
to send  updated regions.

Signed-off-by: Pankaj Bharadiya <pankaj.laxminarayan.bharadiya@intel.com>
---
 tests/Makefile.sources |   1 +
 tests/kms_psr2_sf.c    | 717 +++++++++++++++++++++++++++++++++++++++++
 tests/meson.build      |   1 +
 3 files changed, 719 insertions(+)
 create mode 100644 tests/kms_psr2_sf.c

diff --git a/tests/Makefile.sources b/tests/Makefile.sources
index 96d835820..4e653c8b2 100644
--- a/tests/Makefile.sources
+++ b/tests/Makefile.sources
@@ -79,6 +79,7 @@ TESTS_progs = \
 	kms_properties \
 	kms_psr \
 	kms_psr2_su \
+	kms_psr2_sf \
 	kms_pwrite_crc \
 	kms_rmfb \
 	kms_rotation_crc \
diff --git a/tests/kms_psr2_sf.c b/tests/kms_psr2_sf.c
new file mode 100644
index 000000000..baa640851
--- /dev/null
+++ b/tests/kms_psr2_sf.c
@@ -0,0 +1,717 @@
+/*
+ * Copyright © 2020 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ *
+ */
+
+#include "igt.h"
+#include "igt_sysfs.h"
+#include "igt_psr.h"
+#include <errno.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <string.h>
+#include "intel_bufmgr.h"
+
+IGT_TEST_DESCRIPTION("Test PSR2 selective fetch");
+
+#define SQUARE_SIZE 100
+
+#define CUR_SIZE 64
+
+enum operations {
+	PLANE_UPDATE,
+	PLANE_MOVE,
+	OVERLAY_PRIM_UPDATE
+};
+
+enum plane_move_postion {
+	POS_TOP_LEFT,
+	POS_TOP_RIGHT,
+	POS_BOTTOM_LEFT,
+	POS_BOTTOM_RIGHT
+};
+
+typedef struct {
+	int drm_fd;
+	int debugfs_fd;
+	igt_display_t display;
+	drm_intel_bufmgr *bufmgr;
+	drmModeModeInfo *mode;
+	igt_output_t *output;
+	struct igt_fb fb[3];
+	int damage_area_count;
+	enum operations op;
+	enum plane_move_postion pos;
+	int test_plane_id;
+	igt_plane_t *test_plane;
+	cairo_t *cr;
+} data_t;
+
+static const char *op_str(enum operations op)
+{
+	static const char * const name[] = {
+		[PLANE_UPDATE] = "plane-update",
+		[PLANE_MOVE] = "plane-move",
+		[OVERLAY_PRIM_UPDATE] = "overlay-primary-update",
+	};
+
+	return name[op];
+}
+
+static void setup_output(data_t *data)
+{
+	igt_display_t *display = &data->display;
+	igt_output_t *output;
+	enum pipe pipe;
+
+	for_each_pipe_with_valid_output(display, pipe, output) {
+		drmModeConnectorPtr c = output->config.connector;
+
+		if (c->connector_type != DRM_MODE_CONNECTOR_eDP)
+			continue;
+
+		igt_output_set_pipe(output, pipe);
+		data->output = output;
+		data->mode = igt_output_get_mode(output);
+
+		return;
+	}
+}
+
+static void display_init(data_t *data)
+{
+	igt_display_require(&data->display, data->drm_fd);
+	setup_output(data);
+}
+
+static void display_fini(data_t *data)
+{
+	igt_display_fini(&data->display);
+}
+
+static void draw_rect(data_t *data, igt_fb_t *fb, int x, int y, int w, int h,
+			double r, double g, double b, double a)
+{
+	cairo_t *cr;
+
+	cr = igt_get_cairo_ctx(data->drm_fd, fb);
+	igt_paint_color_alpha(cr, x, y, w, h, r, g, b, a);
+	igt_put_cairo_ctx(cr);
+}
+
+static void plane_update_paint_squares(data_t *data, igt_fb_t *fb, uint32_t h,
+				       uint32_t v)
+{
+
+	switch (data->damage_area_count) {
+	case 5:
+		/*Bottom right corner*/
+		draw_rect(data, fb, h - SQUARE_SIZE, v - SQUARE_SIZE,
+			  SQUARE_SIZE, SQUARE_SIZE, 1.0, 1.0, 1.0, 1.0);
+	case 4:
+		/*Bottom left corner*/
+		draw_rect(data, fb, h - SQUARE_SIZE, 0,
+			  SQUARE_SIZE, SQUARE_SIZE,
+			  1.0, 1.0, 1.0, 1.0);
+	case 3:
+		/*Top right corner*/
+		draw_rect(data, fb, 0, v - SQUARE_SIZE,
+			  SQUARE_SIZE, SQUARE_SIZE, 1.0, 1.0, 1.0, 1.0);
+	case 2:
+		/*Top left corner*/
+		draw_rect(data, fb, 0, 0, SQUARE_SIZE, SQUARE_SIZE,
+			  1.0, 1.0, 1.0, 1.0);
+
+	case 1:
+		/*Center*/
+		draw_rect(data, fb, h/2 - SQUARE_SIZE/2, v/2 - SQUARE_SIZE/2,
+			  SQUARE_SIZE, SQUARE_SIZE, 1.0, 1.0, 1.0, 1.0);
+	}
+}
+
+static void plane_move_paint_square(data_t *data, igt_fb_t *fb, uint32_t h,
+				       uint32_t v)
+{
+
+	switch (data->pos) {
+	case POS_TOP_LEFT:
+		/*Bottom right corner*/
+		draw_rect(data, fb, h - SQUARE_SIZE, v - SQUARE_SIZE,
+			  SQUARE_SIZE, SQUARE_SIZE, 1.0, 1.0, 1.0, 1.0);
+		break;
+	case POS_TOP_RIGHT:
+		/*Bottom left corner*/
+		draw_rect(data, fb, 0, v - SQUARE_SIZE,
+			  SQUARE_SIZE, SQUARE_SIZE, 1.0, 1.0, 1.0, 1.0);
+		break;
+	case POS_BOTTOM_LEFT:
+		/*Top right corner*/
+		draw_rect(data, fb, h - SQUARE_SIZE, 0,
+			  SQUARE_SIZE, SQUARE_SIZE, 1.0, 1.0, 1.0, 1.0);
+		break;
+	case POS_BOTTOM_RIGHT:
+		/*Top left corner*/
+		draw_rect(data, fb, 0, 0, SQUARE_SIZE, SQUARE_SIZE,
+			  1.0, 1.0, 1.0, 1.0);
+		break;
+	}
+}
+
+static struct drm_mode_rect *plane_update_setup_damage_areas(data_t *data,
+							     uint32_t h,
+							     uint32_t v)
+{
+	struct drm_mode_rect *clip;
+
+	if (data->test_plane_id == DRM_PLANE_TYPE_CURSOR) {
+		clip = (struct drm_mode_rect *) malloc(sizeof(struct
+							      drm_mode_rect));
+		igt_assert(clip);
+
+		clip->x1 = clip->y1 = 0;
+		clip->x2 = clip->y2 = CUR_SIZE;
+
+	} else {
+		clip = (struct drm_mode_rect *) malloc(sizeof(struct
+							      drm_mode_rect) *
+						       data->damage_area_count);
+		igt_assert(clip);
+
+		switch (data->damage_area_count) {
+		case 5:
+			/*Bottom right corner*/
+			clip[4].x1 = h - SQUARE_SIZE;
+			clip[4].y1 = v - SQUARE_SIZE;
+			clip[4].x2 = clip[4].x1 + SQUARE_SIZE;
+			clip[4].y2 = clip[4].y1 + SQUARE_SIZE;
+		case 4:
+			/*Bottom left corner*/
+			clip[3].x1 = h - SQUARE_SIZE;
+			clip[3].y1 = 0;
+			clip[3].x2 = clip[3].x1 + SQUARE_SIZE;
+			clip[3].y2 = clip[3].y1 + SQUARE_SIZE;
+		case 3:
+			/*Top right corner*/
+			clip[2].x1 = 0;
+			clip[2].y1 = v - SQUARE_SIZE;
+			clip[2].x2 = clip[2].x1 + SQUARE_SIZE;
+			clip[2].y2 = clip[2].y1 + SQUARE_SIZE;
+		case 2:
+			/*Top left corner*/
+			clip[1].x1 = 0;
+			clip[1].y1 = 0;
+			clip[1].x2 = clip[1].x1 + SQUARE_SIZE;
+			clip[1].y2 = clip[1].y1 + SQUARE_SIZE;
+
+		case 1:
+			/*Center*/
+			clip[0].x1 = h/2 - SQUARE_SIZE/2;
+			clip[0].y1 = v/2 - SQUARE_SIZE/2;
+			clip[0].x2 = clip[0].x1 + SQUARE_SIZE;
+			clip[0].y2 = clip[0].y1 + SQUARE_SIZE;
+		}
+	}
+
+	return clip;
+}
+
+static struct drm_mode_rect *plane_move_setup_damage_area(data_t *data,
+							  uint32_t h,
+							  uint32_t v)
+{
+	struct drm_mode_rect *clip;
+
+	clip = (struct drm_mode_rect *) malloc(sizeof(struct drm_mode_rect));
+	igt_assert(clip);
+
+	switch (data->pos) {
+	case POS_TOP_LEFT:
+		/*Bottom right corner*/
+		clip->x1 = h - SQUARE_SIZE;
+		clip->y1 = v - SQUARE_SIZE;
+		clip->x2 = clip->x1 + SQUARE_SIZE;
+		clip->y2 = clip->y1 + SQUARE_SIZE;
+
+		break;
+	case POS_TOP_RIGHT:
+		/*Bottom left corner*/
+		clip->x1 = h - SQUARE_SIZE;
+		clip->y1 = 0;
+		clip->x2 = clip->x1 + SQUARE_SIZE;
+		clip->y2 = clip->y1 + SQUARE_SIZE;
+
+		break;
+	case POS_BOTTOM_LEFT:
+		/*Top right corner*/
+		clip->x1 = 0;
+		clip->y1 = v - SQUARE_SIZE;
+		clip->x2 = clip->x1 + SQUARE_SIZE;
+		clip->y2 = clip->y1 + SQUARE_SIZE;
+
+		break;
+	case POS_BOTTOM_RIGHT:
+		/*Top left corner*/
+		clip->x1 = 0;
+		clip->y1 = 0;
+		clip->x2 = clip->x1 + SQUARE_SIZE;
+		clip->y2 = clip->y1 + SQUARE_SIZE;
+	}
+
+	return clip;
+}
+
+static void free_damage_areas(struct drm_mode_rect *clip)
+{
+	if (!clip)
+		return;
+
+	free(clip);
+}
+
+static void prepare(data_t *data)
+{
+	igt_plane_t *primary, *sprite = NULL, *cursor = NULL;
+
+	/* all green frame */
+	igt_create_color_fb(data->drm_fd,
+			    data->mode->hdisplay, data->mode->vdisplay,
+			    DRM_FORMAT_XRGB8888,
+			    LOCAL_DRM_FORMAT_MOD_NONE,
+			    0.0, 1.0, 0.0,
+			    &data->fb[0]);
+
+	primary = igt_output_get_plane_type(data->output,
+			DRM_PLANE_TYPE_PRIMARY);
+
+	switch (data->test_plane_id) {
+	case DRM_PLANE_TYPE_OVERLAY:
+		sprite = igt_output_get_plane_type(data->output,
+						   DRM_PLANE_TYPE_OVERLAY);
+		/*All blue plane*/
+		igt_create_color_fb(data->drm_fd,
+				    data->mode->hdisplay/2,
+				    data->mode->vdisplay/2,
+				    DRM_FORMAT_XRGB8888,
+				    LOCAL_DRM_FORMAT_MOD_NONE,
+				    0.0, 0.0, 1.0,
+				    &data->fb[1]);
+
+		igt_create_color_fb(data->drm_fd,
+				    data->mode->hdisplay/2,
+				    data->mode->vdisplay/2,
+				    DRM_FORMAT_XRGB8888,
+				    LOCAL_DRM_FORMAT_MOD_NONE,
+				    0.0, 0.0, 1.0,
+				    &data->fb[2]);
+
+		if (data->op == PLANE_MOVE) {
+			plane_move_paint_square(data, &data->fb[2],
+					   data->mode->hdisplay/2,
+					   data->mode->vdisplay/2);
+
+		} else {
+			plane_update_paint_squares(data, &data->fb[2],
+					   data->mode->hdisplay/2,
+					   data->mode->vdisplay/2);
+		}
+
+		igt_plane_set_fb(sprite, &data->fb[1]);
+		data->test_plane = sprite;
+		break;
+
+	case DRM_PLANE_TYPE_PRIMARY:
+		igt_create_color_fb(data->drm_fd,
+			    data->mode->hdisplay, data->mode->vdisplay,
+			    DRM_FORMAT_XRGB8888,
+			    LOCAL_DRM_FORMAT_MOD_NONE,
+			    0.0, 1.0, 0.0,
+			    &data->fb[2]);
+
+		plane_update_paint_squares(data, &data->fb[2],
+					   data->mode->hdisplay,
+					   data->mode->vdisplay);
+		data->test_plane = primary;
+
+		if (data->op == OVERLAY_PRIM_UPDATE) {
+			sprite = igt_output_get_plane_type(data->output,
+						   DRM_PLANE_TYPE_OVERLAY);
+
+			igt_create_color_fb(data->drm_fd,
+					    data->mode->hdisplay,
+					    data->mode->vdisplay,
+					    DRM_FORMAT_XRGB8888,
+					    LOCAL_DRM_FORMAT_MOD_NONE,
+					    0.0, 0.0, 1.0,
+					    &data->fb[1]);
+
+			igt_plane_set_fb(sprite, &data->fb[1]);
+			igt_plane_set_prop_value(sprite, IGT_PLANE_ALPHA,
+						 0x6060);
+		}
+		break;
+
+	case DRM_PLANE_TYPE_CURSOR:
+		cursor = igt_output_get_plane_type(data->output,
+						   DRM_PLANE_TYPE_CURSOR);
+		igt_plane_set_position(cursor, 0, 0);
+
+		igt_create_fb(data->drm_fd, CUR_SIZE, CUR_SIZE,
+			      DRM_FORMAT_ARGB8888, LOCAL_DRM_FORMAT_MOD_NONE,
+			      &data->fb[1]);
+
+		draw_rect(data, &data->fb[1], 0, 0, CUR_SIZE, CUR_SIZE,
+			    0.0, 0.0, 1.0, 1.0);
+
+		igt_create_fb(data->drm_fd, CUR_SIZE, CUR_SIZE,
+			      DRM_FORMAT_ARGB8888, LOCAL_DRM_FORMAT_MOD_NONE,
+			      &data->fb[2]);
+
+		draw_rect(data, &data->fb[2], 0, 0, CUR_SIZE, CUR_SIZE,
+			    1.0, 1.0, 1.0, 1.0);
+
+		igt_plane_set_fb(cursor, &data->fb[1]);
+		data->test_plane = cursor;
+		break;
+	}
+
+	igt_plane_set_fb(primary, &data->fb[0]);
+
+	igt_display_commit2(&data->display, COMMIT_ATOMIC);
+}
+
+static inline void manual(const char *expected)
+{
+	igt_debug_manual_check("all", expected);
+}
+
+static void plane_update_expected_output(int plane_type, int box_count)
+{
+	char expected[64] = {};
+
+	switch (plane_type) {
+	case DRM_PLANE_TYPE_PRIMARY:
+		sprintf(expected, "screen Green with %d White box(es)",
+			box_count);
+		break;
+	case DRM_PLANE_TYPE_OVERLAY:
+		sprintf(expected,
+			"screen Green with Blue box and %d White box(es)",
+			box_count);
+		break;
+	case DRM_PLANE_TYPE_CURSOR:
+		sprintf(expected, "screen Green with %d White box(es)",
+			box_count);
+		break;
+	}
+
+	manual(expected);
+}
+
+static void plane_move_expected_output(enum plane_move_postion pos)
+{
+	char expected[64] = {};
+
+	switch (pos) {
+	case POS_TOP_LEFT:
+		sprintf(expected,
+			"screen Green with Blue box on top left corner and White box");
+		break;
+	case POS_TOP_RIGHT:
+		sprintf(expected,
+			"screen Green with Blue box on top right corner and White box");
+		break;
+	case POS_BOTTOM_LEFT:
+		sprintf(expected,
+			"screen Green with Blue box on bottom left corner and White box");
+		break;
+	case POS_BOTTOM_RIGHT:
+		sprintf(expected,
+			"screen Green with Blue box on bottom right corner and White box");
+		break;
+	}
+
+	manual(expected);
+}
+
+static void overlay_prim_update_expected_output(int box_count)
+{
+	char expected[64] = {};
+
+	sprintf(expected,
+		"screen Green with Blue overlay, %d light Blue box(es)",
+		box_count);
+
+	manual(expected);
+
+}
+
+static void expected_output(data_t *data)
+{
+	switch (data->op) {
+	case PLANE_MOVE:
+		plane_move_expected_output(data->pos);
+		break;
+	case PLANE_UPDATE:
+		plane_update_expected_output(data->test_plane_id,
+					     data->damage_area_count);
+		break;
+	case OVERLAY_PRIM_UPDATE:
+		overlay_prim_update_expected_output(data->damage_area_count);
+		break;
+	}
+}
+
+static void damaged_plane_move(data_t *data)
+{
+	igt_plane_t *test_plane = data->test_plane;
+	struct drm_mode_rect *clip;
+	uint32_t h = data->mode->hdisplay;
+	uint32_t v = data->mode->vdisplay;
+
+	igt_plane_set_fb(test_plane, &data->fb[2]);
+
+	if (data->test_plane_id == DRM_PLANE_TYPE_OVERLAY) {
+		h = h/2;
+		v = v/2;
+	}
+
+	clip = plane_move_setup_damage_area(data, h, v);
+	igt_plane_replace_prop_blob(test_plane, IGT_PLANE_FB_DAMAGE_CLIPS, clip,
+				    sizeof(struct drm_mode_rect));
+
+	switch (data->pos) {
+	case POS_TOP_LEFT:
+		igt_plane_set_position(data->test_plane, 0, 0);
+		break;
+	case POS_TOP_RIGHT:
+		igt_plane_set_position(data->test_plane,
+				       data->mode->hdisplay/2, 0);
+		break;
+	case POS_BOTTOM_LEFT:
+		igt_plane_set_position(data->test_plane, 0,
+				       data->mode->vdisplay/2);
+		break;
+	case POS_BOTTOM_RIGHT:
+		igt_plane_set_position(data->test_plane,
+				       data->mode->hdisplay/2,
+				       data->mode->vdisplay/2);
+		break;
+	}
+
+	igt_display_commit2(&data->display, COMMIT_ATOMIC);
+
+	igt_assert(psr_wait_entry(data->debugfs_fd, PSR_MODE_2));
+
+	expected_output(data);
+
+	free_damage_areas(clip);
+}
+
+static void damaged_plane_update(data_t *data)
+{
+	igt_plane_t *test_plane = data->test_plane;
+	struct drm_mode_rect *clip;
+	uint32_t h = data->mode->hdisplay;
+	uint32_t v = data->mode->vdisplay;
+
+	igt_plane_set_fb(test_plane, &data->fb[2]);
+
+	if (data->test_plane_id == DRM_PLANE_TYPE_OVERLAY) {
+		h = h/2;
+		v = v/2;
+	}
+
+	clip = plane_update_setup_damage_areas(data, h, v);
+	igt_plane_replace_prop_blob(test_plane, IGT_PLANE_FB_DAMAGE_CLIPS, clip,
+				    sizeof(struct drm_mode_rect)*
+				    data->damage_area_count);
+	igt_plane_set_position(data->test_plane, 0, 0);
+	igt_display_commit2(&data->display, COMMIT_ATOMIC);
+
+	igt_assert(psr_wait_entry(data->debugfs_fd, PSR_MODE_2));
+
+	expected_output(data);
+
+	free_damage_areas(clip);
+}
+
+static void update_screen_and_test(data_t *data)
+{
+	switch (data->op) {
+	case PLANE_UPDATE:
+	case OVERLAY_PRIM_UPDATE:
+		damaged_plane_update(data);
+		break;
+	case PLANE_MOVE:
+		damaged_plane_move(data);
+		break;
+	}
+}
+
+static void screen_reset(data_t  *data)
+{
+	igt_plane_t *test_plane = data->test_plane;
+
+	if (data->test_plane_id == DRM_PLANE_TYPE_PRIMARY)
+		igt_plane_set_fb(test_plane, &data->fb[0]);
+	else
+		igt_plane_set_fb(test_plane, &data->fb[1]);
+
+	igt_plane_set_position(data->test_plane, 0, 0);
+	igt_display_commit2(&data->display, COMMIT_ATOMIC);
+}
+
+static void run(data_t *data)
+{
+	igt_assert(psr_wait_entry(data->debugfs_fd, PSR_MODE_2));
+
+	screen_reset(data);
+	update_screen_and_test(data);
+}
+
+static void cleanup(data_t *data)
+{
+	igt_plane_t *primary;
+	igt_plane_t *sprite;
+
+	primary = igt_output_get_plane_type(data->output,
+					    DRM_PLANE_TYPE_PRIMARY);
+
+	igt_plane_set_fb(primary, NULL);
+
+	if (data->test_plane_id != DRM_PLANE_TYPE_PRIMARY) {
+		igt_plane_set_position(data->test_plane, 0, 0);
+		igt_plane_set_fb(data->test_plane, NULL);
+	}
+
+	if (data->op == OVERLAY_PRIM_UPDATE) {
+		sprite = igt_output_get_plane_type(data->output,
+				DRM_PLANE_TYPE_OVERLAY);
+		igt_plane_set_position(sprite, 0, 0);
+		igt_plane_set_fb(sprite, NULL);
+	}
+
+	igt_display_commit2(&data->display, COMMIT_ATOMIC);
+
+	igt_remove_fb(data->drm_fd, &data->fb[0]);
+	igt_remove_fb(data->drm_fd, &data->fb[1]);
+	igt_remove_fb(data->drm_fd, &data->fb[2]);
+}
+
+igt_main
+{
+	data_t data = {};
+	int i;
+
+	igt_fixture {
+		int r;
+
+		data.drm_fd = drm_open_driver_master(DRIVER_INTEL);
+		data.debugfs_fd = igt_debugfs_dir(data.drm_fd);
+		kmstest_set_vt_graphics_mode();
+
+		igt_require_f(psr_sink_support(data.drm_fd,
+					       data.debugfs_fd, PSR_MODE_2),
+			      "Sink does not support PSR2\n");
+
+		igt_require_f(psr2_selective_fetch_check(data.debugfs_fd),
+			      "PSR2 selective fetch not enabled\n");
+
+		data.bufmgr = drm_intel_bufmgr_gem_init(data.drm_fd, 4096);
+		igt_assert(data.bufmgr);
+		drm_intel_bufmgr_gem_enable_reuse(data.bufmgr);
+
+		display_init(&data);
+
+		/* Test if PSR2 can be enabled */
+		igt_require_f(psr_enable(data.drm_fd,
+					 data.debugfs_fd, PSR_MODE_2),
+			      "Error enabling PSR2\n");
+
+		data.damage_area_count = 5;
+		data.op = PLANE_UPDATE;
+		data.test_plane_id = DRM_PLANE_TYPE_PRIMARY;
+		prepare(&data);
+		r = psr_wait_entry(data.debugfs_fd, PSR_MODE_2);
+		cleanup(&data);
+		if (!r)
+			psr_print_debugfs(data.debugfs_fd);
+		igt_require_f(r, "PSR2 can not be enabled\n");
+	}
+
+	for (i = 1; i <= 5; i++) {
+		igt_subtest_f("primary-%s-sf-%d", op_str(data.op), i) {
+			data.damage_area_count = i;
+			data.test_plane_id = DRM_PLANE_TYPE_PRIMARY;
+			prepare(&data);
+			run(&data);
+			cleanup(&data);
+		}
+	}
+
+	for (i = 1; i <= 5; i++) {
+		igt_subtest_f("overlay-%s-sf-%d", op_str(data.op), i) {
+			data.damage_area_count = i;
+			data.test_plane_id = DRM_PLANE_TYPE_OVERLAY;
+			prepare(&data);
+			run(&data);
+			cleanup(&data);
+		}
+	}
+
+	igt_subtest_f("cursor-%s-sf", op_str(data.op)) {
+		data.damage_area_count = 1;
+		data.test_plane_id = DRM_PLANE_TYPE_CURSOR;
+		prepare(&data);
+		run(&data);
+		cleanup(&data);
+	}
+
+	/* Only for overlay plane */
+	data.op = PLANE_MOVE;
+	for (i = POS_TOP_LEFT; i <= POS_BOTTOM_RIGHT ; i++) {
+		igt_subtest_f("%s-sf-%d", op_str(data.op), i) {
+			data.pos = i;
+			data.test_plane_id = DRM_PLANE_TYPE_OVERLAY;
+			prepare(&data);
+			run(&data);
+			cleanup(&data);
+		}
+	}
+
+	data.op = OVERLAY_PRIM_UPDATE;
+	for (i = 1; i <= 5; i++) {
+		igt_subtest_f("%s-sf-%d", op_str(data.op), i) {
+			data.damage_area_count = i;
+			data.test_plane_id = DRM_PLANE_TYPE_PRIMARY;
+			prepare(&data);
+			run(&data);
+			cleanup(&data);
+		}
+	}
+
+	igt_fixture {
+		close(data.debugfs_fd);
+		drm_intel_bufmgr_destroy(data.bufmgr);
+		display_fini(&data);
+	}
+}
diff --git a/tests/meson.build b/tests/meson.build
index cc79ac228..b33cfb63f 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -63,6 +63,7 @@ test_progs = [
 	'kms_properties',
 	'kms_psr',
 	'kms_psr2_su',
+	'kms_psr2_sf',
 	'kms_pwrite_crc',
 	'kms_rmfb',
 	'kms_rotation_crc',
-- 
2.29.2

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

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

end of thread, other threads:[~2021-01-08 12:21 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-08 17:01 [igt-dev] [PATCH i-g-t 0/3] Add FB_DAMAGE_CLIPS prop and new test for Selective fetch Pankaj Bharadiya
2020-12-08 17:01 ` [igt-dev] [PATCH i-g-t 1/3] lib/kms: Add fb damage clip plane property Pankaj Bharadiya
2020-12-08 17:01 ` [igt-dev] [PATCH i-g-t 2/3] lib/igt_psr: Add function to check PSR2 selective fetch Pankaj Bharadiya
2020-12-08 17:01 ` [igt-dev] [PATCH i-g-t 3/3] tests: Add new PSR2 selective fetch test Pankaj Bharadiya
2020-12-16 10:50   ` Mun, Gwan-gyeong
2020-12-21  4:44     ` Laxminarayan Bharadiya, Pankaj
2021-01-04 19:37       ` Mun, Gwan-gyeong
2020-12-08 17:22 ` [igt-dev] [PATCH i-g-t 0/3] Add FB_DAMAGE_CLIPS prop and new test for Selective fetch Souza, Jose
2020-12-08 19:31 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
2020-12-09  0:14 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2021-01-08 12:21 ` [igt-dev] [PATCH i-g-t 0/3] " Petri Latvala
  -- strict thread matches above, loose matches on Subject: below --
2020-11-18  8:14 Pankaj Bharadiya
2020-11-18  8:14 ` [igt-dev] [PATCH i-g-t 3/3] tests: Add new PSR2 selective fetch test Pankaj Bharadiya
2020-11-18 20:20   ` Souza, Jose
2020-11-19 18:36     ` Laxminarayan Bharadiya, Pankaj

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.