From patchwork Wed Jun 15 17:48:32 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: jim.bride@linux.intel.com X-Patchwork-Id: 9179041 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 054C460776 for ; Wed, 15 Jun 2016 17:48:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E358D27D45 for ; Wed, 15 Jun 2016 17:48:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D668F27EED; Wed, 15 Jun 2016 17:48:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7B30127D45 for ; Wed, 15 Jun 2016 17:48:56 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6B2B46E166; Wed, 15 Jun 2016 17:48:54 +0000 (UTC) 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 0EB866E16D for ; Wed, 15 Jun 2016 17:48:52 +0000 (UTC) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga102.jf.intel.com with ESMTP; 15 Jun 2016 10:48:52 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.26,476,1459839600"; d="scan'208";a="976396160" Received: from shiv.jf.intel.com ([10.7.198.83]) by orsmga001.jf.intel.com with ESMTP; 15 Jun 2016 10:48:51 -0700 From: Jim Bride To: intel-gfx@lists.freedesktop.org Date: Wed, 15 Jun 2016 10:48:32 -0700 Message-Id: <1466012912-1582-1-git-send-email-jim.bride@linux.intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1465829466-13735-1-git-send-email-jim.bride@linux.intel.com> References: <1465829466-13735-1-git-send-email-jim.bride@linux.intel.com> Subject: [Intel-gfx] [PATCH v2 i-g-t] demos/intel_sprite_on: Fix connector iteration bug X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP Instead of looping until the first disconnected port is found, now go through all possible connectors, drawing the sprite on any connected display. v2: Print a message if we don't find any valid connectors. Signed-off-by: Jim Bride --- demos/intel_sprite_on.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/demos/intel_sprite_on.c b/demos/intel_sprite_on.c index 6dddded..d3bd420 100644 --- a/demos/intel_sprite_on.c +++ b/demos/intel_sprite_on.c @@ -518,6 +518,8 @@ static void ricochet(int tiled, int sprite_w, int sprite_h, char key; int sprite_plane_count = 0; int i; + int found_count = 0; + // Open up I915 graphics device gfx_fd = drmOpen("i915", NULL); if (gfx_fd < 0) { @@ -564,10 +566,15 @@ static void ricochet(int tiled, int sprite_w, int sprite_h, // Find the native (preferred) display mode connector_find_preferred_mode(gfx_fd, gfx_resources, &curr_connector); if (curr_connector.mode_valid == 0) { - printf("No valid preferred mode detected\n"); - goto out; + + if (((c_index + 1) == gfx_resources->count_connectors) && + (found_count == 0)) + printf("Failed to find any valid connections."); + continue; } + found_count++; + // Determine if sprite hardware is available on pipe // associated with this connector. sprite_plane_count = connector_find_plane(gfx_fd, &curr_connector,