From patchwork Wed May 22 14:40:47 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Imre Deak X-Patchwork-Id: 2602271 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 6718ADF215 for ; Wed, 22 May 2013 14:41:53 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7DCB2E5DF4 for ; Wed, 22 May 2013 07:41:53 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by gabe.freedesktop.org (Postfix) with ESMTP id 116FEE63EE for ; Wed, 22 May 2013 07:40:57 -0700 (PDT) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP; 22 May 2013 07:38:51 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.87,721,1363158000"; d="scan'208";a="341425293" Received: from intelbox.fi.intel.com (HELO localhost) ([10.237.72.70]) by orsmga002.jf.intel.com with ESMTP; 22 May 2013 07:40:54 -0700 From: Imre Deak To: intel-gfx@lists.freedesktop.org Date: Wed, 22 May 2013 17:40:47 +0300 Message-Id: <1369233648-5873-3-git-send-email-imre.deak@intel.com> X-Mailer: git-send-email 1.8.1.2 In-Reply-To: <1369233648-5873-1-git-send-email-imre.deak@intel.com> References: <1369233648-5873-1-git-send-email-imre.deak@intel.com> Subject: [Intel-gfx] [PATCH 3/4] kms_flip: do a DPMS ON when exiting with error 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 Currently when exiting with error, we'll get stuck in a DPMS OFF state if the error happens while we have DPMS OFF set in the test sequence. This happens even though we switch back to text mode at exit. This might be a bug in itself to be fixed later, but in any case we want a working console, so do an explicit DPMS ON. Signed-off-by: Imre Deak --- tests/kms_flip.c | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/tests/kms_flip.c b/tests/kms_flip.c index 85e5c11..83293ba 100644 --- a/tests/kms_flip.c +++ b/tests/kms_flip.c @@ -78,6 +78,8 @@ uint32_t devid; int test_time = 3; static bool monotonic_timestamp; +static drmModeConnector *last_connector; + uint32_t *fb_ptr; struct type_name { @@ -190,14 +192,14 @@ static void emit_dummy_load(struct test_output *o) drm_intel_bo_unreference(target_bo); } -static int set_dpms(struct test_output *o, int mode) +static int set_connector_dpms(drmModeConnector *connector, int mode) { int i, dpms = 0; - for (i = 0; i < o->connector->count_props; i++) { + for (i = 0; i < connector->count_props; i++) { struct drm_mode_get_property prop; - prop.prop_id = o->connector->props[i]; + prop.prop_id = connector->props[i]; prop.count_values = 0; prop.count_enum_blobs = 0; if (drmIoctl(drm_fd, DRM_IOCTL_MODE_GETPROPERTY, &prop)) @@ -210,12 +212,19 @@ static int set_dpms(struct test_output *o, int mode) break; } if (!dpms) { - fprintf(stderr, "DPMS property not found on %d\n", o->id); + fprintf(stderr, "DPMS property not found on %d\n", + connector->connector_id); errno = ENOENT; return -1; } - return drmModeConnectorSetProperty(drm_fd, o->id, dpms, mode); + return drmModeConnectorSetProperty(drm_fd, connector->connector_id, + dpms, mode); +} + +static int set_dpms(struct test_output *o, int mode) +{ + return set_connector_dpms(o->connector, mode); } static void set_flag(unsigned int *v, unsigned int flag) @@ -1037,6 +1046,8 @@ static void run_test_on_crtc(struct test_output *o, int crtc, int duration) if (!o->mode_valid) return; + last_connector = o->connector; + fprintf(stdout, "Beginning %s on crtc %d, connector %d\n", o->test_name, crtc, o->id); @@ -1104,6 +1115,8 @@ static void run_test_on_crtc(struct test_output *o, int crtc, int duration) kmstest_remove_fb(drm_fd, o->fb_ids[1]); kmstest_remove_fb(drm_fd, o->fb_ids[0]); + last_connector = NULL; + drmModeFreeEncoder(o->encoder); drmModeFreeConnector(o->connector); } @@ -1154,6 +1167,12 @@ static void get_timestamp_format(void) monotonic_timestamp ? "monotonic" : "real"); } +static void kms_flip_exit_handler(int sig) +{ + if (last_connector) + set_connector_dpms(last_connector, DRM_MODE_DPMS_ON); +} + int main(int argc, char **argv) { struct { @@ -1208,6 +1227,7 @@ int main(int argc, char **argv) if (!drmtest_only_list_subtests()) { do_or_die(drmtest_set_vt_graphics_mode()); + do_or_die(drmtest_install_exit_handler(kms_flip_exit_handler)); get_timestamp_format(); }