From patchwork Tue May 7 15:05:02 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Imre Deak X-Patchwork-Id: 2535661 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork2.kernel.org (Postfix) with ESMTP id DC003DF215 for ; Tue, 7 May 2013 15:05:19 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D8622E61F5 for ; Tue, 7 May 2013 08:05:19 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga14.intel.com (mga14.intel.com [143.182.124.37]) by gabe.freedesktop.org (Postfix) with ESMTP id 5A8E6E5FFB for ; Tue, 7 May 2013 08:05:05 -0700 (PDT) Received: from azsmga002.ch.intel.com ([10.2.17.35]) by azsmga102.ch.intel.com with ESMTP; 07 May 2013 08:05:04 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.87,628,1363158000"; d="scan'208";a="238083801" Received: from intelbox.fi.intel.com (HELO localhost) ([10.237.72.70]) by AZSMGA002.ch.intel.com with ESMTP; 07 May 2013 08:05:03 -0700 From: Imre Deak To: intel-gfx@lists.freedesktop.org Date: Tue, 7 May 2013 18:05:02 +0300 Message-Id: <1367939102-10034-1-git-send-email-imre.deak@intel.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1367587913-13434-1-git-send-email-imre.deak@intel.com> References: <1367587913-13434-1-git-send-email-imre.deak@intel.com> Subject: [Intel-gfx] [PATCH v3] kms_flip: make sure we are unblanked during the test X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org This is one reason for some of the sporadic kms_flip failures. One such is https://bugs.freedesktop.org/show_bug.cgi?id=59834. v2: - use unsigned long for KDSETMODE/KDGETMODE - fix passing the parameter to KDGETMODE as it should be by value - actually testing that it works.. v3: - don't do an explicit DPMS_ON, only switch to graphics mode. Signed-off-by: Imre Deak --- tests/kms_flip.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/tests/kms_flip.c b/tests/kms_flip.c index 39f0043..4993b16 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" @@ -1153,6 +1154,21 @@ static void get_timestamp_format(void) monotonic_timestamp ? "monotonic" : "real"); } +static unsigned long set_vt_mode(unsigned long mode) +{ + int fd; + unsigned long prev_mode; + + fd = open("/dev/tty0", O_RDONLY); + assert(fd >= 0); + + prev_mode = 0; + drmIoctl(fd, KDGETMODE, &prev_mode); + drmIoctl(fd, KDSETMODE, (void *)mode); + + return prev_mode; +} + int main(int argc, char **argv) { struct { @@ -1200,13 +1216,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 long 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 +1240,9 @@ int main(int argc, char **argv) } } + if (!dry_run) + set_vt_mode(prev_vt_mode); + close(drm_fd); return 0;