From patchwork Fri Jan 11 13:13:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rodrigo Siqueira X-Patchwork-Id: 10758001 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 781F31390 for ; Fri, 11 Jan 2019 13:13:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 62F4F298E6 for ; Fri, 11 Jan 2019 13:13:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 52081298E9; Fri, 11 Jan 2019 13:13:46 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 23CAC298E6 for ; Fri, 11 Jan 2019 13:13:45 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7C6FF6E13C; Fri, 11 Jan 2019 13:13:43 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-qk1-x741.google.com (mail-qk1-x741.google.com [IPv6:2607:f8b0:4864:20::741]) by gabe.freedesktop.org (Postfix) with ESMTPS id 433726E13C; Fri, 11 Jan 2019 13:13:42 +0000 (UTC) Received: by mail-qk1-x741.google.com with SMTP id a1so6476753qkc.5; Fri, 11 Jan 2019 05:13:42 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:user-agent; bh=tesuUFRidVBwNz+7POlXt3/9Uooy5c6Hao9HHrAGE7I=; b=YlphTShobHRz6Kvdrtwo7rZD0fchFsxMpHapT+dhjoLGMvjDzbFRnUP438wnAv7u0P znty8WWjqotxU8Fxv2p8eM07qhaPLpub6ToxKUVtUo8JSkfZQWHMTmzDp55FwYXu5OQB ukzurV44Yo8Jfw/HKSZNL7g7qYxJWBOHfCp5JSFUwDSixYeFfV7gmcavzTgJnklSoeNW YtHgAW8HqSYEulmdrXLjSE1o14iOeXLEE4FU+p3YCKqUlvW+yZvlLqBjZKNNOnIIUxBc OaDZkwza8Ljd7fV11jiKOC2CnSegWv74mq8VQE0Sz399179x/MhUFQpfDMNaL/AUv6PB 8bVA== X-Gm-Message-State: AJcUukeEWVrVzFkVgGshfQ6nGZVcbzy4QvqyH4ravmxM7JDb8hOgXqmf +sXRpT+/bfaL2wgMCHG9N1U= X-Google-Smtp-Source: ALg8bN4CjJdvhXBfIdsq/jaXyShEAXus4QSudrkQd6MZ/poGWQwbp8zdoWUqSOPszQQ9ibBilIf/DA== X-Received: by 2002:a37:79c5:: with SMTP id u188mr12598193qkc.259.1547212421090; Fri, 11 Jan 2019 05:13:41 -0800 (PST) Received: from smtp.gmail.com ([143.107.45.1]) by smtp.gmail.com with ESMTPSA id o65sm39476346qkl.11.2019.01.11.05.13.39 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 11 Jan 2019 05:13:40 -0800 (PST) Date: Fri, 11 Jan 2019 11:13:37 -0200 From: Rodrigo Siqueira To: Petri Latvala , Arkadiusz Hiler Message-ID: <20190111131337.vrsiq5hk32eramdm@smtp.gmail.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: NeoMutt/20180716 Subject: [Intel-gfx] [PATCH i-g-t] Make force work with multiple drivers available X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: igt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP The force option allows users to specify which driver they want that IGT uses. Nonetheless, if the user has two or more loaded drivers in his system, the force option will not work as expected because IGT will take the first driver found at /dev/dri. This problem can be reproduced in a QEMU VM that using Bochs and VKMS. This patch handles this scenario by ensuring that IGT uses the forced module specified via IGT_FORCE_DRIVER. Signed-off-by: Rodrigo Siqueira Reviewed-by: Petri Latvala --- lib/drmtest.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/drmtest.c b/lib/drmtest.c index 35914c50..7c124ac6 100644 --- a/lib/drmtest.c +++ b/lib/drmtest.c @@ -250,10 +250,8 @@ static int open_device(const char *name, unsigned int chipset) goto err; forced = forced_driver(); - if (forced && chipset == DRIVER_ANY && !strcmp(forced, dev_name)) { - igt_debug("Force option used: Using driver %s\n", dev_name); - return fd; - } + if (forced && chipset == DRIVER_ANY && strcmp(forced, dev_name)) + goto err; for (int start = 0, end = ARRAY_SIZE(modules) - 1; start < end; ){ int mid = start + (end - start) / 2; @@ -277,6 +275,12 @@ err: static int __search_and_open(const char *base, int offset, unsigned int chipset) { + const char *forced; + + forced = forced_driver(); + if (forced) + igt_info("Force option used: Using driver %s\n", forced); + for (int i = 0; i < 16; i++) { char name[80]; int fd;