From patchwork Fri Dec 2 16:32:35 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emil Velikov X-Patchwork-Id: 9458875 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 0D95A60515 for ; Fri, 2 Dec 2016 16:33:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F112B28568 for ; Fri, 2 Dec 2016 16:33:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E60D128575; Fri, 2 Dec 2016 16:33:10 +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 251B628568 for ; Fri, 2 Dec 2016 16:33:10 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7B7AD6E97D; Fri, 2 Dec 2016 16:33:08 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm0-x242.google.com (mail-wm0-x242.google.com [IPv6:2a00:1450:400c:c09::242]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7878F6E94D for ; Fri, 2 Dec 2016 16:33:04 +0000 (UTC) Received: by mail-wm0-x242.google.com with SMTP id m203so3515065wma.3 for ; Fri, 02 Dec 2016 08:33:04 -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=nywV6RmWh9Dm35YyuIbZXwI+uW0MHlahkMPv9r/rN5Ih0HqkT9BBIkuFa45XqNzZDZ B3hptbeZirvIfhh12jh8+tUS0KYoaoXjU8WPBF9Sm09JFOyZyB9QGspNRVTBnoUOVPzI 6PXKu9Q54pxUcP2qbs5d2uNOVBbs4papjI9DJURTAIZEdJmSiP0KhMRxODbG0agPTGby 6qVC+HP0AFHXgzjIWfROzfuSFdWoNMhZ8V9uLWgjMo8NlWF4sQFXcPOzmJP/CBuAFrhJ pMTcmZQV0wqualm1Ix55Ted/7aBW9pJubODOM+Fj1IQ+CLLvRfDpcQsmmtpI/GFyClVh ONiQ== 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=EaeLqQsWSPONK5B52WFbrtVymdhYT7Y/f73QMUL1QrOligXiTQVhaWivCVYQ2Dnb6y OZ30ZRCLi3KBclBjIg8hwyeIycUoNjv7LaJGuwLDvMQl8g8smCJJJjoOLG4eB42jFPO1 uw4A+ivpPctghUg16nHCAx2YpDStf82V5ypzIlBLLY1ZsMDlg+C5Dly8V4OsgHCFwIJz K4TpOQEmp2RViIdJp8UvC6wATgk5SuBuLQ7z78UNlE3UYpmeoFRRjaJJQaaVDjHSlyq2 4P3+8rZO7Clc39LPLCwzU0GcWIsCmfsV3r4TEGJus8Hh86D2nd8bUtCmBzR/QuWJNzNo 47MQ== X-Gm-Message-State: AKaTC01B0EtaOfW7f+dPLnY9/ImEmeQOcpuCiicaUVHe4cmDCITO1ALqHTuhw4tGX4OLqQ== X-Received: by 10.28.128.198 with SMTP id b189mr3644517wmd.105.1480696382721; Fri, 02 Dec 2016 08:33:02 -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 b7sm6331517wjm.39.2016.12.02.08.33.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 02 Dec 2016 08:33:02 -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: Fri, 2 Dec 2016 16:32:35 +0000 Message-Id: <20161202163238.15849-2-emil.l.velikov@gmail.com> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20161202163238.15849-1-emil.l.velikov@gmail.com> References: <20161202163238.15849-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;