[Intel-gfx] [PATCH i-g-t 7/9] tests/kms_psr_sink_crc: Add manual mode.
Rodrigo Vivi
rodrigo.vivi at intel.com
Tue Dec 9 18:01:55 PST 2014
Sink CRC is the most reliable way to test PSR. However in some platforms
apparently auto generated packages force panel to keep calculating CRC invalidating
our current sink crc check over debugfs.
So, this manual test help us to find possible gaps on this platforms where we cannot
trust on sink crc checks.
v2: Accept Daniel's suggestions:
* Avoid strcpy
* don't override assert definition
* Make --interactive-debug for every testcases instead using local --manual
Cc: Daniel Vetter <daniel.vetter at ffwll.ch>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi at intel.com>
---
tests/kms_psr_sink_crc.c | 48 ++++++++++++++++++++++++++++++++++++++++++------
1 file changed, 42 insertions(+), 6 deletions(-)
diff --git a/tests/kms_psr_sink_crc.c b/tests/kms_psr_sink_crc.c
index 155c25f..e7a2ef4 100644
--- a/tests/kms_psr_sink_crc.c
+++ b/tests/kms_psr_sink_crc.c
@@ -244,6 +244,9 @@ static void get_sink_crc(data_t *data, char *crc) {
int ret;
FILE *file;
+ if (igt_interactive_debug)
+ return;
+
file = igt_debugfs_fopen("i915_sink_crc_eDP1", "r");
igt_require(file);
@@ -271,6 +274,9 @@ static bool is_green(char *crc)
unsigned int rh, gh, bh, mask;
int ret;
+ if (igt_interactive_debug)
+ return false;
+
sscanf(color_mask, "%4x", &mask);
memcpy(rs, &crc[0], 4);
@@ -293,6 +299,16 @@ static bool is_green(char *crc)
(bh & mask) == 0);
}
+static void assert_or_manual(bool condition, const char *expected)
+{
+ if (igt_interactive_debug)
+ igt_info("Is %s?\n", expected);
+ else
+ igt_debug("%s\n", expected);
+ igt_debug_wait_for_keypress("manual");
+ igt_assert(igt_interactive_debug || condition);
+}
+
static void test_crc(data_t *data)
{
uint32_t handle = data->fb_white.gem_handle;
@@ -300,18 +316,19 @@ static void test_crc(data_t *data)
void *ptr;
char ref_crc[12];
char crc[12];
+ const char *expected = "";
igt_plane_set_fb(data->primary, &data->fb_green);
igt_display_commit(&data->display);
/* Confirm that screen became Green */
get_sink_crc(data, ref_crc);
- igt_assert(is_green(ref_crc));
+ assert_or_manual(is_green(ref_crc), "screen GREEN");
/* Confirm screen stays Green after PSR got active */
igt_assert(wait_psr_entry(data, 10));
get_sink_crc(data, ref_crc);
- igt_assert(is_green(ref_crc));
+ assert_or_manual(is_green(ref_crc), "screen GREEN");
/* Setting a secondary fb/plane */
switch (data->test_plane) {
@@ -325,7 +342,10 @@ static void test_crc(data_t *data)
/* Confirm it is not Green anymore */
igt_assert(wait_psr_entry(data, 10));
get_sink_crc(data, ref_crc);
- igt_assert(!is_green(ref_crc));
+ if (data->test_plane == PRIMARY)
+ assert_or_manual(!is_green(ref_crc), "screen WHITE");
+ else
+ assert_or_manual(!is_green(ref_crc), "GREEN background with WHITE box");
switch (data->op) {
case PAGE_FLIP:
@@ -333,7 +353,8 @@ static void test_crc(data_t *data)
igt_assert(drmModePageFlip(data->drm_fd, data->crtc_id,
data->fb_green.fb_id, 0, NULL) == 0);
get_sink_crc(data, crc);
- igt_assert(is_green(crc));
+ assert_or_manual(is_green(crc), "screen GREEN");
+ expected = "still GREEN";
break;
case MMAP_GTT:
ptr = gem_mmap__gtt(data->drm_fd, handle, data->mod_size,
@@ -342,6 +363,7 @@ static void test_crc(data_t *data)
I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT);
memset(ptr, 0xcc, data->mod_size);
munmap(ptr, data->mod_size);
+ expected = "BLACK or TRANSPARENT mark on top of plane in test";
break;
case MMAP_GTT_WAITING:
ptr = gem_mmap__gtt(data->drm_fd, handle, data->mod_size,
@@ -352,7 +374,11 @@ static void test_crc(data_t *data)
/* Printing white on white so the screen shouldn't change */
memset(ptr, 0xff, data->mod_size);
get_sink_crc(data, crc);
- igt_assert(strcmp(ref_crc, crc) == 0);
+ if (data->test_plane == PRIMARY)
+ assert_or_manual(strcmp(ref_crc, crc) == 0, "screen WHITE");
+ else
+ assert_or_manual(strcmp(ref_crc, crc) == 0,
+ "GREEN background with WHITE box");
igt_info("Waiting 10s...\n");
sleep(10);
@@ -360,6 +386,7 @@ static void test_crc(data_t *data)
/* Now lets print black to change the screen */
memset(ptr, 0, data->mod_size);
munmap(ptr, data->mod_size);
+ expected = "BLACK or TRANSPARENT mark on top of plane in test";
break;
case MMAP_CPU:
ptr = gem_mmap__cpu(data->drm_fd, handle, 0, data->mod_size, PROT_WRITE);
@@ -368,26 +395,31 @@ static void test_crc(data_t *data)
memset(ptr, 0, data->mod_size);
munmap(ptr, data->mod_size);
gem_sw_finish(data->drm_fd, handle);
+ expected = "BLACK or TRANSPARENT mark on top of plane in test";
break;
case BLT:
fill_blt(data, handle, 0);
+ expected = "BLACK or TRANSPARENT mark on top of plane in test";
break;
case RENDER:
fill_render(data, handle, 0);
+ expected = "BLACK or TRANSPARENT mark on top of plane in test";
break;
case PLANE_MOVE:
/* Only in use when testing Sprite and Cursor */
igt_plane_set_position(test_plane, 500, 500);
igt_display_commit(&data->display);
+ expected = "White box moved to 500x500";
break;
case PLANE_ONOFF:
/* Only in use when testing Sprite and Cursor */
igt_plane_set_fb(test_plane, NULL);
igt_display_commit(&data->display);
+ expected = "screen GREEN";
break;
}
get_sink_crc(data, crc);
- igt_assert(strcmp(ref_crc, crc) != 0);
+ assert_or_manual(strcmp(ref_crc, crc) != 0, expected);
}
static void test_cleanup(data_t *data) {
@@ -507,6 +539,10 @@ int main(int argc, char *argv[])
kmstest_set_vt_graphics_mode();
data.devid = intel_get_drm_devid(data.drm_fd);
+ if ((IS_VALLEYVIEW(data.devid) || IS_CHERRYVIEW(data.devid)) &&
+ !igt_interactive_debug)
+ igt_skip("Sink CRC is unreliable on this platform when PSR is enabled. Test available only on manual interactive debug mode. Run again with --interactive-debug=manual\n");
+
igt_skip_on(!psr_enabled(&data));
data.bufmgr = drm_intel_bufmgr_gem_init(data.drm_fd, 4096);
--
1.9.3
More information about the Intel-gfx
mailing list