From patchwork Fri Sep 6 19:08:47 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lespiau, Damien" X-Patchwork-Id: 2855021 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id DB9399F2D6 for ; Fri, 6 Sep 2013 19:18:05 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EEFDC20319 for ; Fri, 6 Sep 2013 19:18:04 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id C8FF820318 for ; Fri, 6 Sep 2013 19:18:03 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B5F54E768F for ; Fri, 6 Sep 2013 12:18:03 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by gabe.freedesktop.org (Postfix) with ESMTP id F30CFE7658 for ; Fri, 6 Sep 2013 12:09:36 -0700 (PDT) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP; 06 Sep 2013 12:09:36 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.90,856,1371106800"; d="scan'208";a="374565001" Received: from unknown (HELO strange.amr.corp.intel.com) ([10.255.14.105]) by orsmga001.jf.intel.com with ESMTP; 06 Sep 2013 12:09:11 -0700 From: Damien Lespiau To: intel-gfx@lists.freedesktop.org Date: Fri, 6 Sep 2013 20:08:47 +0100 Message-Id: <1378494530-3600-10-git-send-email-damien.lespiau@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1378494530-3600-1-git-send-email-damien.lespiau@intel.com> References: <1378494530-3600-1-git-send-email-damien.lespiau@intel.com> Subject: [Intel-gfx] [PATCH i-g-t 09/12] testdisplay: Untangle dump_info() from the main testing loop 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 X-Spam-Status: No, score=-6.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP -i is just supposed to show some information about the DRM resources. Right now it works in a quite convoluted way. Untangle this to call dump_info() when -i is given, exit the program and be done with it. Signed-off-by: Damien Lespiau --- tests/testdisplay.c | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/tests/testdisplay.c b/tests/testdisplay.c index f94e5c4..3a9eab7 100644 --- a/tests/testdisplay.c +++ b/tests/testdisplay.c @@ -53,6 +53,7 @@ #include #include #include +#include #include #include #include @@ -67,8 +68,8 @@ drmModeRes *resources; int drm_fd, modes; -int dump_info = 0, test_all_modes =0, test_preferred_mode = 0, force_mode = 0, - test_plane, enable_tiling; +int test_all_modes = 0, test_preferred_mode = 0, force_mode = 0, test_plane, + enable_tiling; int sleep_between_modes = 5; uint32_t depth = 24, stride, bpp; int qr_code = 0; @@ -181,6 +182,12 @@ static void dump_crtcs_fd(int drmfd) drmModeFreeResources(mode_resources); } +static void dump_info(void) +{ + dump_connectors_fd(drm_fd); + dump_crtcs_fd(drm_fd); +} + static void connector_find_preferred_mode(uint32_t connector_id, unsigned long crtc_idx_mask, int mode_num, struct connector *c) @@ -423,11 +430,6 @@ int update_display(void) if (!connectors) return 0; - if (dump_info) { - dump_connectors_fd(drm_fd); - dump_crtcs_fd(drm_fd); - } - if (test_preferred_mode || test_all_modes || force_mode || specified_disp_id != -1) { unsigned long crtc_idx_mask = -1UL; @@ -523,6 +525,7 @@ int main(int argc, char **argv) GIOChannel *stdinchannel; GMainLoop *mainloop; float force_clock; + bool opt_dump_info = false; igt_skip_on_simulation(); @@ -532,7 +535,7 @@ int main(int argc, char **argv) while ((c = getopt(argc, argv, optstr)) != -1) { switch (c) { case 'i': - dump_info = 1; + opt_dump_info = true; break; case 'a': test_all_modes = 1; @@ -588,12 +591,17 @@ int main(int argc, char **argv) else if (depth <= 32) bpp = 32; - if (!test_all_modes && !force_mode && !dump_info && - !test_preferred_mode && specified_mode_num == -1) + if (!test_all_modes && !force_mode && !test_preferred_mode && + specified_mode_num == -1) test_all_modes = 1; drm_fd = drm_open_any(); + if (opt_dump_info) { + dump_info(); + goto out_close; + } + do_or_die(igt_set_vt_graphics_mode()); mainloop = g_main_loop_new(NULL, FALSE); @@ -628,7 +636,7 @@ int main(int argc, char **argv) goto out_stdio; } - if (dump_info || test_all_modes) + if (test_all_modes) goto out_stdio; g_main_loop_run(mainloop);