All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeevan B <jeevan.b@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Jeevan B <jeevan.b@intel.com>
Subject: [igt-dev] [PATCH i-g-t 8/8] igt/i915/i915_pm_dc: DC3CO Video Playback Case IGT test
Date: Thu, 12 Sep 2019 13:46:38 +0530	[thread overview]
Message-ID: <1568276198-6363-9-git-send-email-jeevan.b@intel.com> (raw)
In-Reply-To: <1568276198-6363-1-git-send-email-jeevan.b@intel.com>

Add a subtest for DC3CO video playback case
to generate selective frame update and validate
that system stays in DC3CO state during execution.

Signed-off-by: Jeevan B <jeevan.b@intel.com>
---
 tests/i915/i915_pm_dc.c | 138 ++++++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 134 insertions(+), 4 deletions(-)

diff --git a/tests/i915/i915_pm_dc.c b/tests/i915/i915_pm_dc.c
index c1b03a9..4fab152 100644
--- a/tests/i915/i915_pm_dc.c
+++ b/tests/i915/i915_pm_dc.c
@@ -38,9 +38,20 @@
 #define CHECK_DC6	2
 #define CHECK_DC3CO     4
 
+/*Number of Frames Video Playback*/
+#define VIDEO_FRAMES 30
+
 /* PSR2 status 9th bit is the PSR2 idle frame indication */
 #define PSR2_IDLE_FRMAE_STS_MASK (1 << 9)
 
+/*Internal */
+typedef struct {
+	double r, g, b;
+} color_t;
+
+igt_fb_t fb1, fb2;
+igt_plane_t *primary;
+
 typedef struct {
 	int drm_fd;
 	int msr_fd;
@@ -124,6 +135,7 @@ static uint32_t get_psr2_status(int debugfs_fd)
 	ret = sscanf(str + 6, "%*c%*c%*c%x%*c", &psr2_sts);
 	igt_debug("psr2 status 0x%x\n", psr2_sts);
 	igt_assert_eq(ret, 1);
+	return psr2_sts;
 }
 
 static bool psr2_idle_wait_entry(int debugfs_fd)
@@ -134,8 +146,6 @@ static bool psr2_idle_wait_entry(int debugfs_fd)
 
 static void cleanup_dc_psr(data_t *data)
 {
-	igt_plane_t *primary;
-
 	primary = igt_output_get_plane_type(data->output,
 					    DRM_PLANE_TYPE_PRIMARY);
 	igt_plane_set_fb(primary, NULL);
@@ -143,10 +153,30 @@ static void cleanup_dc_psr(data_t *data)
 	igt_remove_fb(data->drm_fd, &data->fb_white);
 }
 
-static void setup_primary(data_t *data)
+static void paint_rectangles(data_t *data,
+				drmModeModeInfo *mode,
+				color_t *colors,
+				igt_fb_t *fb)
 {
-	igt_plane_t *primary;
+	cairo_t *cr = igt_get_cairo_ctx(data->drm_fd, fb);
+	int i, l = mode->hdisplay / 3;
+	int rows_remaining = mode->hdisplay % 3;
+
+	/* Paint 3 solid rectangles. */
+	for (i = 0 ; i < 3; i++) {
+		igt_paint_color(cr, i * l, 0, l, mode->vdisplay,
+				colors[i].r, colors[i].g, colors[i].b);
+	}
+
+	if (rows_remaining > 0)
+		igt_paint_color(cr, i * l, 0, rows_remaining, mode->vdisplay,
 
+	colors[i-1].r, colors[i-1].g, colors[i-1].b);
+	igt_put_cairo_ctx(data->drm_fd, fb, cr);
+}
+
+static void setup_primary(data_t *data)
+{
 	primary = igt_output_get_plane_type(data->output,
 					    DRM_PLANE_TYPE_PRIMARY);
 	igt_plane_set_fb(primary, NULL);
@@ -160,6 +190,53 @@ static void setup_primary(data_t *data)
 	igt_display_commit(&data->display);
 }
 
+static void create_rgb_fb(data_t *data)
+{
+	int fb_id1;
+	color_t red_green_blue[] = {
+		{ 1.0, 0.0, 0.0 },
+		{ 0.0, 1.0, 0.0 },
+		{ 0.0, 0.0, 1.0 },
+	};
+
+	primary = igt_output_get_plane_type(data->output,
+					DRM_PLANE_TYPE_PRIMARY);
+
+	igt_plane_set_fb(primary, NULL);
+	fb_id1 = igt_create_fb(data->drm_fd,
+				data->mode->hdisplay,
+				data->mode->vdisplay,
+				DRM_FORMAT_XRGB8888,
+				LOCAL_DRM_FORMAT_MOD_NONE,
+				&fb1);
+	igt_assert(fb_id1);
+	paint_rectangles(data, data->mode, red_green_blue, &fb1);
+}
+
+static void create_rgr_fb(data_t *data)
+{
+	int fb_id2;
+	color_t red_green_red[] = {
+		{ 1.0, 0.0, 0.0 },
+		{ 0.0, 1.0, 0.0 },
+		{ 1.0, 0.0, 0.0 },
+	};
+
+	primary = igt_output_get_plane_type(data->output,
+	DRM_PLANE_TYPE_PRIMARY);
+
+	igt_plane_set_fb(primary, NULL);
+	fb_id2 = igt_create_fb(data->drm_fd,
+				data->mode->hdisplay,
+				data->mode->vdisplay,
+				DRM_FORMAT_XRGB8888,
+				LOCAL_DRM_FORMAT_MOD_NONE,
+				&fb2);
+
+	igt_assert(fb_id2);
+	paint_rectangles(data, data->mode, red_green_red, &fb2);
+}
+
 static uint32_t get_dc_counter(char *dc_data)
 {
 	char *e;
@@ -216,6 +293,49 @@ static void check_dc_counter(int drm_fd, int dc_flag, uint32_t prev_dc_count)
 		     "%s state is not achieved\n", tmp);
 }
 
+static void test_dc3co_vpb_simulation(data_t *data, int dc_flag)
+{
+	uint32_t dc3co_ctr_before_psr, dc3co_ctr_after_psr;
+	uint32_t dc5_ctr_before, dc5_ctr_after;
+	int i, delay;
+
+	setup_output(data);
+
+	create_rgb_fb(data);
+	create_rgr_fb(data);
+
+	igt_plane_set_fb(primary, NULL);
+
+	dc3co_ctr_before_psr = read_dc_counter(data->drm_fd, dc_flag);
+	dc5_ctr_before = read_dc_counter(data->drm_fd, CHECK_DC5);
+	/*Calculate delay to generate idle frame*/
+	delay = ((1000*1000*2)/data->mode->vrefresh);
+
+	for (i = 0; i < VIDEO_FRAMES; i++) {
+		if (i % 2 == 0) {
+			igt_plane_set_fb(primary, &fb1);
+			igt_display_commit(&data->display);
+		} else {
+			igt_plane_set_fb(primary, &fb2);
+			igt_display_commit(&data->display);
+		}
+
+	if (i == 0)
+		igt_assert(psr2_idle_wait_entry(data->debugfs_fd));
+
+	usleep(delay);
+	dc3co_ctr_after_psr = read_dc_counter(data->drm_fd, dc_flag);
+	igt_assert_f(dc3co_ctr_before_psr <= dc3co_ctr_after_psr,
+			"DC3CO counter got reset\n");
+	dc3co_ctr_before_psr = dc3co_ctr_after_psr;
+	}
+
+	dc5_ctr_after = read_dc_counter(data->drm_fd, CHECK_DC5);
+	igt_assert_f(dc5_ctr_after == dc5_ctr_before,
+			"System moved to DC5 state\n");
+	cleanup_dc_psr(data);
+}
+
 static void test_dc_state_psr(data_t *data, int dc_flag)
 {
 	uint32_t dc_counter_before_psr;
@@ -317,6 +437,16 @@ int main(int argc, char *argv[])
 			     "Can't open /dev/cpu/0/msr.\n");
 	}
 
+	igt_describe("DC3CO igt test for Video Playback Scenario");
+	igt_subtest("dc3co-vpb-simulation") {
+		igt_require(IS_TIGERLAKE(data.devid));
+		data.op_psr_mode = PSR_MODE_2;
+		psr_enable(data.debugfs_fd, data.op_psr_mode);
+		igt_require_f(edp_psr2_enabled(&data),
+				"PSR2 is not enabled\n");
+		test_dc3co_vpb_simulation(&data, CHECK_DC3CO);
+	}
+
 	igt_describe("DC5 igt test with PSR Sleep state");
 	igt_subtest("dc5-psr") {
 		data.op_psr_mode = PSR_MODE_1;
-- 
2.7.4

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

  parent reply	other threads:[~2019-09-12  8:18 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-12  8:16 [igt-dev] [PATCH i-g-t 0/8] Add a new IGT test to validate DC3CO state Jeevan B
2019-09-12  8:16 ` [igt-dev] [PATCH i-g-t 1/8] lib/igt_pm: igt lib helper routines to support DC5/6 tests Jeevan B
2019-09-12  8:16 ` [igt-dev] [PATCH i-g-t 2/8] tests/i915/i915_pm_dc: Added new test to verify Display C States Jeevan B
2019-09-17 11:40   ` Petri Latvala
2019-09-19 17:48     ` Gupta, Anshuman
2019-09-12  8:16 ` [igt-dev] [PATCH i-g-t 3/8] tests/i915/i915_pm_dc: Added test for DC6 during PSR Jeevan B
2019-09-12  8:16 ` [igt-dev] [PATCH i-g-t 4/8] tests/i915/i915_pm_dc: Added test for DC5 during DPMS Jeevan B
2019-09-12  8:16 ` [igt-dev] [PATCH i-g-t 5/8] tests/i915/i915_pm_dc: Added test for DC6 " Jeevan B
2019-09-12  8:16 ` [igt-dev] [PATCH i-g-t 6/8] tests/i915/i915_pm_dc:Skip the DC6 test if BIOS has disabled PC8+ Jeevan B
2019-09-12  8:16 ` [igt-dev] [PATCH i-g-t 7/8] igt/i915/i915_pm_dc: DC3CO PSR2 helpers Jeevan B
2019-09-12  8:16 ` Jeevan B [this message]
2019-09-13  9:03   ` [igt-dev] [PATCH i-g-t 8/8] igt/i915/i915_pm_dc: DC3CO Video Playback Case IGT test Anshuman Gupta
2019-09-13 11:11 ` [igt-dev] ✓ Fi.CI.BAT: success for Add a new IGT test to validate DC3CO state Patchwork
2019-09-14  6:56 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1568276198-6363-9-git-send-email-jeevan.b@intel.com \
    --to=jeevan.b@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is 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.