From mboxrd@z Thu Jan 1 00:00:00 1970 From: Imre Deak Subject: [i-g-t PATCH] kms_flip: make sure we are unblanked during the test Date: Fri, 3 May 2013 15:48:16 +0300 Message-ID: <1367585296-9071-1-git-send-email-imre.deak@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mga03.intel.com (mga03.intel.com [143.182.124.21]) by gabe.freedesktop.org (Postfix) with ESMTP id 9894EE5C74 for ; Fri, 3 May 2013 05:48:18 -0700 (PDT) List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org To: intel-gfx@lists.freedesktop.org List-Id: intel-gfx@lists.freedesktop.org This is a probable reason for some of the sporadic kms_flip failures. One such is https://bugs.freedesktop.org/show_bug.cgi?id=59834. Signed-off-by: Imre Deak --- tests/kms_flip.c | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/tests/kms_flip.c b/tests/kms_flip.c index 39f0043..34c53b7 100644 --- a/tests/kms_flip.c +++ b/tests/kms_flip.c @@ -36,6 +36,7 @@ #include #include #include +#include #include "i915_drm.h" #include "drmtest.h" @@ -1072,6 +1073,13 @@ static void run_test_on_crtc(struct test_output *o, int crtc, int duration) } assert(fb_is_bound(o, o->fb_ids[0])); + /* + * Make sure we're unblanked if for example the test was started with + * the console blanked. In this case the kernel might do a DPMS_ON in + * the above mode set call, but it's not guaranteed. + */ + do_or_die(set_dpms(o, DRM_MODE_DPMS_ON)); + /* quiescent the hw a bit so ensure we don't miss a single frame */ if (o->flags & TEST_CHECK_TS) sleep(1); @@ -1153,6 +1161,20 @@ static void get_timestamp_format(void) monotonic_timestamp ? "monotonic" : "real"); } +static unsigned set_vt_mode(unsigned mode) +{ + int fd; + unsigned long prev_mode; + + fd = open("/dev/tty0", O_RDONLY); + assert(fd >= 0); + + drmIoctl(fd, KDGETMODE, &prev_mode); + drmIoctl(fd, KDSETMODE, &mode); + + return prev_mode; +} + int main(int argc, char **argv) { struct { @@ -1200,13 +1222,18 @@ int main(int argc, char **argv) { 1, TEST_FLIP | TEST_EINVAL | TEST_FB_BAD_TILING, "flip-vs-bad-tiling" }, }; int i; + bool dry_run; + unsigned prev_vt_mode; drmtest_subtest_init(argc, argv); drm_fd = drm_open_any(); - if (!drmtest_only_list_subtests()) + dry_run = drmtest_only_list_subtests(); + if (!dry_run) { + prev_vt_mode = set_vt_mode(KD_GRAPHICS); get_timestamp_format(); + } bufmgr = drm_intel_bufmgr_gem_init(drm_fd, 4096); devid = intel_get_drm_devid(drm_fd); @@ -1219,6 +1246,9 @@ int main(int argc, char **argv) } } + if (!dry_run) + set_vt_mode(prev_vt_mode); + close(drm_fd); return 0; -- 1.7.10.4