From patchwork Wed Mar 6 22:49:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Rodrigo Siqueira X-Patchwork-Id: 10841909 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 4CEEE1390 for ; Wed, 6 Mar 2019 22:49:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 373082E5C1 for ; Wed, 6 Mar 2019 22:49:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2B0842E5CA; Wed, 6 Mar 2019 22:49: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 CE2422E5C1 for ; Wed, 6 Mar 2019 22:49:45 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 44B566E1CD; Wed, 6 Mar 2019 22:49:44 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-qk1-x743.google.com (mail-qk1-x743.google.com [IPv6:2607:f8b0:4864:20::743]) by gabe.freedesktop.org (Postfix) with ESMTPS id 05F6F6E1CD; Wed, 6 Mar 2019 22:49:43 +0000 (UTC) Received: by mail-qk1-x743.google.com with SMTP id z13so7901568qki.2; Wed, 06 Mar 2019 14:49: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=oPYoFxcuVWLwC9Bn2Vo4w7yepTXsnCSj5+Kmpyd+HOg=; b=bhzKTUWvJzaJTXMKLrppbnLfbYXMcdjS5dPyChh6MJR6qQ1KaXPnKKPRiuYfnx00ji bE/xzzTAXeG5x517tz/Orvr0r6eNNQoN5XmB65X8nysGzhf6l731Ay8yBEvLCZWi/UOU LKSbSWVa6hKCoNr2O7H3jZba1EnaQcPJ3HWZZ7ygZCdkrI/FaQ+RrkogmhEyX6PWUBHV PN5MhS/U+h/hl7SBnb/sX8QcltwxTvT4HtS70aYwsPRcvcsKzrglu9eepYTcvMBOG0Df Az/8WgfGmQSo6xx3G1ioWnBT4f3CzV2A1NbiNb9yB13gpc0+QDsJeMlNV2FvMKGMJfKV CAwQ== X-Gm-Message-State: APjAAAWAUFumd9ne6aBxHM6z9hg3EjDq9EwZzDK7OQ+SOF0JdUhNvqNT g6Zt7I3vW+6D/pjXwN8ssDk= X-Google-Smtp-Source: APXvYqxAGXFefS7FCsDun4HftobuSn4ttuoey23QkMMRWmTKskxPbiU1XeXpiAYw+ISLZS+j5osLQA== X-Received: by 2002:a05:620a:1478:: with SMTP id j24mr7217370qkl.343.1551912582086; Wed, 06 Mar 2019 14:49:42 -0800 (PST) Received: from smtp.gmail.com ([143.107.45.1]) by smtp.gmail.com with ESMTPSA id t1sm1873338qki.65.2019.03.06.14.49.40 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 06 Mar 2019 14:49:41 -0800 (PST) Date: Wed, 6 Mar 2019 19:49:38 -0300 From: Rodrigo Siqueira To: Petri Latvala , Arkadiusz Hiler Message-ID: <20190306224938.opisj72oa2kxxrwi@smtp.gmail.com> MIME-Version: 1.0 User-Agent: NeoMutt/20180716 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :user-agent; bh=oPYoFxcuVWLwC9Bn2Vo4w7yepTXsnCSj5+Kmpyd+HOg=; b=Of7CYpCwJvEEHn/BOvcYmhJyKgmWp23+C+esY1v4OCimRMTa5xpoikaud2nhCiu+Ig z1alNp2uEhLmpzH4+/qsMk9whvK3wQab+KHF7oMGIESfZSCyk2PTJTAui7bv6YLYEGr2 IIUMNaS9stgalppZM1MST3ledRpwghjrWGKyOAwlpjhY2FXa8JQDTAAJu4KcKPlyOn3u AirZKJq3EIy0FU3XgbU+C57Fz3nj7DmxbR5U+yf1mR8B3gIFSeeDMGTJz91FZNnynOhe geh9nzHvJGWJgOGCSW1ca66/NVfJBrlQ1za/w7VMxG5TxE3CTRnAq4pCsptyv+8A2tKH HBYw== Subject: [Intel-gfx] [RFC i-g-t] lib/igt_kms: Set capabilities before get resource 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 Hi, I was working on adding the writeback support to VKMS; as a result, I was using the Liviu’s patchset to validate my implementation [1]. However, I consistently failed to pass the requirements in igt_display_require(); more specifically, I couldn't pass this test: igt_skip("No KMS driver or no outputs, pipes: %d, outputs: %d\n", display->n_pipes, display->n_outputs); Next, I made a simple code that does the following three steps: 1. Open the device 2. Collect the resource information with drmModeGetResources() 3. Set writeback capability via drmSetClientCap() 4. Print the total of connectors I noticed that I could not get any connector as well; after some time debugging the issue and thanks to Anholt’s help in the dri-channel I learned that I had to use drmSetClientCap() before drmModeGetResources(). After move all drmSetClientCap() above drmModeGetResources(), my simple coded displayed the connector information. I did the same thing within igt_display_require(), and this test started to pass for me (I did it, in the Liviu’s patch). In this sense, I checked the igt_display_require() code in the master branch; and again, I noticed that capabilities are set after getting the resource information. Is that correct? Is it ok to call drmModeGetResources() before drmSetClientCap() in this case? P.s.: I sent it as a RFC because I’m not 100% sure about the change and the impacts on the tests. If it make sense, I can make a real patch. 1. https://patchwork.freedesktop.org/series/39229/ Signed-off-by: Rodrigo Siqueira --- lib/igt_kms.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/igt_kms.c b/lib/igt_kms.c index 7ebab4ca..2de9ac41 100644 --- a/lib/igt_kms.c +++ b/lib/igt_kms.c @@ -1886,6 +1886,10 @@ void igt_display_require(igt_display_t *display, int drm_fd) display->drm_fd = drm_fd; + drmSetClientCap(drm_fd, DRM_CLIENT_CAP_UNIVERSAL_PLANES, 1); + if (drmSetClientCap(drm_fd, DRM_CLIENT_CAP_ATOMIC, 1) == 0) + display->is_atomic = 1; + resources = drmModeGetResources(display->drm_fd); if (!resources) goto out; @@ -1898,10 +1902,6 @@ void igt_display_require(igt_display_t *display, int drm_fd) display->pipes = calloc(sizeof(igt_pipe_t), display->n_pipes); igt_assert_f(display->pipes, "Failed to allocate memory for %d pipes\n", display->n_pipes); - drmSetClientCap(drm_fd, DRM_CLIENT_CAP_UNIVERSAL_PLANES, 1); - if (drmSetClientCap(drm_fd, DRM_CLIENT_CAP_ATOMIC, 1) == 0) - display->is_atomic = 1; - plane_resources = drmModeGetPlaneResources(display->drm_fd); igt_assert(plane_resources);