diff options
author | Paulo Zanoni <paulo.r.zanoni@intel.com> | 2014-08-06 18:50:57 -0300 |
---|---|---|
committer | Paulo Zanoni <paulo.r.zanoni@intel.com> | 2014-08-07 15:44:28 -0300 |
commit | a17f0604ef31ed310fbdcbb64324fcb39f08b908 (patch) | |
tree | 79ed8baffa1c0e147f2a64bb49e38cc387f7c260 /tests/pm_rpm.c | |
parent | d52365677ef808ffa43bf5e9d53ed0814edd3dd5 (diff) |
tests/pm_rpm: add subtests for fences
Daniel thought fences were not surviving runtime PM on DPMS, so we
wrote this test to check. The good news is that the test passed, so
there's no need for a Kernel patch, at least on the Kernel I tested.
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Diffstat (limited to 'tests/pm_rpm.c')
-rw-r--r-- | tests/pm_rpm.c | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/tests/pm_rpm.c b/tests/pm_rpm.c index cd260636..0a4bc76e 100644 --- a/tests/pm_rpm.c +++ b/tests/pm_rpm.c @@ -1704,6 +1704,74 @@ static void planes_subtest(bool universal, bool dpms) } } +static void fences_subtest(bool dpms) +{ + uint32_t connector_id, crtc_id = 0; + drmModeModeInfoPtr mode; + struct igt_fb scanout_fb; + int rc, i; + uint32_t *buf_ptr; + uint32_t tiling = false, swizzle; + + disable_all_screens(&ms_data); + igt_assert(wait_for_suspended()); + + igt_require(find_connector_for_modeset(&ms_data, SCREEN_TYPE_ANY, + &connector_id, &mode)); + + crtc_id = ms_data.res->crtcs[0]; + igt_assert(crtc_id); + + igt_create_fb(drm_fd, mode->hdisplay, mode->vdisplay, + DRM_FORMAT_XRGB8888, true, &scanout_fb); + + /* Even though we passed "true" as the tiling argument, double-check + * that the fb is really tiled. */ + gem_get_tiling(drm_fd, scanout_fb.gem_handle, &tiling, &swizzle); + igt_assert(tiling); + + buf_ptr = gem_mmap__gtt(drm_fd, scanout_fb.gem_handle, + scanout_fb.size, PROT_WRITE | PROT_READ); + for (i = 0; i < scanout_fb.size/sizeof(uint32_t); i++) + buf_ptr[i] = i; + + rc = drmModeSetCrtc(drm_fd, crtc_id, scanout_fb.fb_id, 0, 0, + &connector_id, 1, mode); + igt_assert(rc == 0); + igt_assert(wait_for_active()); + + if (dpms) + disable_all_screens_dpms(&ms_data); + else + disable_all_screens(&ms_data); + igt_assert(wait_for_suspended()); + + for (i = 0; i < scanout_fb.size/sizeof(uint32_t); i++) + igt_assert_eq(buf_ptr[i], i); + igt_assert(wait_for_suspended()); + + if (dpms) { + drmModeConnectorPtr c = NULL; + + for (i = 0; i < ms_data.res->count_connectors; i++) + if (ms_data.connectors[i]->connector_id == connector_id) + c = ms_data.connectors[i]; + igt_assert(c); + + kmstest_set_connector_dpms(drm_fd, c, DRM_MODE_DPMS_ON); + } else { + rc = drmModeSetCrtc(drm_fd, crtc_id, scanout_fb.fb_id, 0, 0, + &connector_id, 1, mode); + igt_assert(rc == 0); + } + igt_assert(wait_for_active()); + + for (i = 0; i < scanout_fb.size/sizeof(uint32_t); i++) + igt_assert_eq(buf_ptr[i], i); + + igt_assert(munmap(buf_ptr, scanout_fb.size) == 0); +} + int rounds = 50; bool stay = false; @@ -1808,6 +1876,10 @@ int main(int argc, char *argv[]) dpms_mode_unset_subtest(SCREEN_TYPE_LPSP); igt_subtest("dpms-mode-unset-non-lpsp") dpms_mode_unset_subtest(SCREEN_TYPE_NON_LPSP); + igt_subtest("fences") + fences_subtest(false); + igt_subtest("fences-dpms") + fences_subtest(true); /* Modeset stress */ igt_subtest("modeset-lpsp-stress") |