From patchwork Wed Nov 30 20:35:08 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emil Velikov X-Patchwork-Id: 9454875 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 101176074E for ; Wed, 30 Nov 2016 20:35:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 03BE828484 for ; Wed, 30 Nov 2016 20:35:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EB1E9284A2; Wed, 30 Nov 2016 20:35:42 +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.1 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID 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 5982628484 for ; Wed, 30 Nov 2016 20:35:42 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7650E6E541; Wed, 30 Nov 2016 20:35:37 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wj0-x241.google.com (mail-wj0-x241.google.com [IPv6:2a00:1450:400c:c01::241]) by gabe.freedesktop.org (Postfix) with ESMTPS id 05BFF6E52E for ; Wed, 30 Nov 2016 20:35:35 +0000 (UTC) Received: by mail-wj0-x241.google.com with SMTP id kp2so23890003wjc.0 for ; Wed, 30 Nov 2016 12:35:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=cmRS8EmLhGpVv6II3zSJIjhTQZ9kwe3jGF8eDkwMw7Y=; b=cVcdnAMcC1gnbCnO2Fg8pPcPJtzdgVROoLZDe2zYSVji2ynvwNraleOMI49Mrep5jf W0Yfoaasm7NTEdD3X+T5/1auPj6u4WawsSDwKOmyzP5fLvGtHg8Zga2fm657OL6pLhVP mc43XfFL1nf5WG1kfvjXNduTmppdEXjNxz4Z6i5y/lTz8OIYYXv9qxcpMNSHdWQIXzCB J81w6gh9XHtVSgRWmqy8fjo1CUzwOK91MU3XrFQpiywHOGFVCxO1yKEO4m8gXyZjo56U wCZ8uQhb+S5Xl91brfjcQsAXpVuON/LY/SW0p4tGiFMG13g0YHYMy2I81xpl6wSXj8zw wzLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=cmRS8EmLhGpVv6II3zSJIjhTQZ9kwe3jGF8eDkwMw7Y=; b=W7tbLZtXMwSOxNzIh6ofp6nD6z9KS0HLKT5QuKFqcSi0FmclZX9g2+zbfE46LNNu0M ZNLh4WcujOcNig7hbTaiEyNhXtf6RLfP6tcvJ0drOG8bd4NW0bqqzI5BM5eFM6+MqlIu AOIo3XD10It2ZraIodmGmvjS82iYrlCO333OPEzkKF0cXwwKFawrDL063Ai3e/mqzmQj DnguwJ85mC+ABumPNGgaaTkr3VE4YEMBlJqdGXbZ1XRi2/b83NF8JP/n4Ed29445lRAg UHUQ2nYwBTeb+5zStcdRA40N+Hwgtk3N/mM+dmvjgoUzGbTJCbhIRS8Fzh8gfEn2fmMm lf6A== X-Gm-Message-State: AKaTC02n2j4tCDzm8xtWnDw+r5bGyoSuVJ04yZDve9uwAKXAKdcimmuoSJOxylRnJEu4Eg== X-Received: by 10.194.221.4 with SMTP id qa4mr35170653wjc.179.1480538133335; Wed, 30 Nov 2016 12:35:33 -0800 (PST) Received: from arch-x1c3.cbg.collabora.co.uk ([2a00:1098:5:0:9665:9cff:feee:aa4d]) by smtp.gmail.com with ESMTPSA id ei2sm74572607wjd.47.2016.11.30.12.35.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 30 Nov 2016 12:35:32 -0800 (PST) From: Emil Velikov To: dri-devel@lists.freedesktop.org Subject: [PATCH libdrm 2/5] xf86drm: add plumbing to not retrieve PCI device revision Date: Wed, 30 Nov 2016 20:35:08 +0000 Message-Id: <20161130203511.18910-2-emil.l.velikov@gmail.com> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20161130203511.18910-1-emil.l.velikov@gmail.com> References: <20161130203511.18910-1-emil.l.velikov@gmail.com> MIME-Version: 1.0 Cc: Mauro Santos , =?UTF-8?q?Michel=20D=C3=A4nzer?= , emil.l.velikov@gmail.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Emil Velikov Will be used with the drmGetDevice[s]2 API. Cc: Michel Dänzer Cc: Nicolai Hähnle Cc: Mauro Santos Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98502 Signed-off-by: Emil Velikov --- xf86drm.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/xf86drm.c b/xf86drm.c index c788c93..ddb8f9f 100644 --- a/xf86drm.c +++ b/xf86drm.c @@ -2947,7 +2947,8 @@ static int drmGetMaxNodeName(void) } static int drmParsePciDeviceInfo(int maj, int min, - drmPciDeviceInfoPtr device) + drmPciDeviceInfoPtr device, + uint32_t flags) { #ifdef __linux__ char path[PATH_MAX + 1]; @@ -3000,7 +3001,8 @@ void drmFreeDevices(drmDevicePtr devices[], int count) static int drmProcessPciDevice(drmDevicePtr *device, const char *node, int node_type, - int maj, int min, bool fetch_deviceinfo) + int maj, int min, bool fetch_deviceinfo, + uint32_t flags) { const int max_node_str = ALIGN(drmGetMaxNodeName(), sizeof(void *)); int ret, i; @@ -3039,7 +3041,7 @@ static int drmProcessPciDevice(drmDevicePtr *device, addr += sizeof(drmPciBusInfo); (*device)->deviceinfo.pci = (drmPciDeviceInfoPtr)addr; - ret = drmParsePciDeviceInfo(maj, min, (*device)->deviceinfo.pci); + ret = drmParsePciDeviceInfo(maj, min, (*device)->deviceinfo.pci, flags); if (ret) goto free_device; } @@ -3095,6 +3097,7 @@ int drmGetDevice(int fd, drmDevicePtr *device) int ret, i, node_count; int max_count = 16; dev_t find_rdev; + uint32_t flags = 0; if (fd == -1 || device == NULL) return -EINVAL; @@ -3142,7 +3145,7 @@ int drmGetDevice(int fd, drmDevicePtr *device) switch (subsystem_type) { case DRM_BUS_PCI: - ret = drmProcessPciDevice(&d, node, node_type, maj, min, true); + ret = drmProcessPciDevice(&d, node, node_type, maj, min, true, flags); if (ret) goto free_devices; @@ -3216,6 +3219,7 @@ int drmGetDevices(drmDevicePtr devices[], int max_devices) int maj, min; int ret, i, node_count, device_count; int max_count = 16; + uint32_t flags = 0; local_devices = calloc(max_count, sizeof(drmDevicePtr)); if (local_devices == NULL) @@ -3251,7 +3255,7 @@ int drmGetDevices(drmDevicePtr devices[], int max_devices) switch (subsystem_type) { case DRM_BUS_PCI: ret = drmProcessPciDevice(&device, node, node_type, - maj, min, devices != NULL); + maj, min, devices != NULL, flags); if (ret) goto free_devices;