From patchwork Wed Feb 3 21:41:36 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Anholt X-Patchwork-Id: 8209281 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.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 284F19F38B for ; Wed, 3 Feb 2016 21:41:48 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 61CF420270 for ; Wed, 3 Feb 2016 21:41:47 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 35BEE2022D for ; Wed, 3 Feb 2016 21:41:46 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5060A6E76A; Wed, 3 Feb 2016 13:41:45 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from annarchy.freedesktop.org (annarchy.freedesktop.org [131.252.210.176]) by gabe.freedesktop.org (Postfix) with ESMTP id 4E8046E432; Wed, 3 Feb 2016 13:41:44 -0800 (PST) Received: from eliezer.anholt.net (annarchy.freedesktop.org [127.0.0.1]) by annarchy.freedesktop.org (Postfix) with ESMTP id 394FB181EC; Wed, 3 Feb 2016 13:41:44 -0800 (PST) Received: by eliezer.anholt.net (Postfix, from userid 1000) id 4EC00F1B133; Wed, 3 Feb 2016 13:41:43 -0800 (PST) From: Eric Anholt To: intel-gfx@lists.freedesktop.org Date: Wed, 3 Feb 2016 13:41:36 -0800 Message-Id: <1454535703-660-2-git-send-email-eric@anholt.net> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1454535703-660-1-git-send-email-eric@anholt.net> References: <1454535703-660-1-git-send-email-eric@anholt.net> Subject: [Intel-gfx] [PATCH igt 2/9] igt: Add support for DRIVER_VC4 flags on tests. 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-Spam-Status: No, score=-4.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 Signed-off-by: Eric Anholt --- lib/drmtest.c | 16 ++++++++++++++-- lib/drmtest.h | 1 + 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/lib/drmtest.c b/lib/drmtest.c index 2896af0..7b2227f 100644 --- a/lib/drmtest.c +++ b/lib/drmtest.c @@ -100,6 +100,16 @@ static bool is_i915_device(int fd) return !ret && strcmp("i915", name) == 0; } +static bool is_vc4_device(int fd) +{ + int ret; + char name[5] = ""; + + ret = __get_drm_device_name(fd, name); + + return !ret && strcmp("vc4", name) == 0; +} + static bool is_intel(int fd) { struct drm_i915_getparam gp; @@ -237,7 +247,7 @@ int __drm_open_driver(int chipset) for (int i = 0; i < 16; i++) { char name[80]; int fd; - bool found_intel; + bool found_intel, found_vc4; sprintf(name, "/dev/dri/card%u", i); fd = open(name, O_RDWR); @@ -246,7 +256,9 @@ int __drm_open_driver(int chipset) found_intel = is_i915_device(fd) && is_intel(fd) && (chipset & DRIVER_INTEL); - if ((chipset & DRIVER_ANY) || found_intel) + found_vc4 = is_vc4_device(fd) && (chipset & DRIVER_VC4); + + if ((chipset & DRIVER_ANY) || found_intel || found_vc4) return fd; close(fd); diff --git a/lib/drmtest.h b/lib/drmtest.h index ed384ff..9fcab93 100644 --- a/lib/drmtest.h +++ b/lib/drmtest.h @@ -40,6 +40,7 @@ #define DRIVER_ANY 0x1 #define DRIVER_INTEL (0x1 << 1) +#define DRIVER_VC4 (0x1 << 2) #ifdef ANDROID #if (!(defined HAVE_MMAP64)) && (!(defined __x86_64__))