From patchwork Tue Mar 20 17:36:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emil Velikov X-Patchwork-Id: 10297601 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 EA744600F6 for ; Tue, 20 Mar 2018 17:42:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DB5A628BDF for ; Tue, 20 Mar 2018 17:42:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D001C28E91; Tue, 20 Mar 2018 17:42:05 +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 418A128BDF for ; Tue, 20 Mar 2018 17:42:04 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id DE3646E814; Tue, 20 Mar 2018 17:42:01 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm0-x243.google.com (mail-wm0-x243.google.com [IPv6:2a00:1450:400c:c09::243]) by gabe.freedesktop.org (Postfix) with ESMTPS id 15BD16E32F for ; Tue, 20 Mar 2018 17:41:59 +0000 (UTC) Received: by mail-wm0-x243.google.com with SMTP id x82so5133557wmg.1 for ; Tue, 20 Mar 2018 10:41:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=imiexLA/oubSY91/OTCcomeudHImnVxfqgG7cEuFDSA=; b=NqgQtiJ8rlb/Thm1nhMFA0uurvAr4sDLYnxzmjXRnz4PqCkfGMiH2wA93D5YgSCUNj wrgkLbJXzGzy/daTZCKJEQcfk2UCFzBQESdeKvzjJ7di1wuv4ANx+f8ETGB3NI40vl77 tnmK4uoxa6POwpnYywl06a6ea13f3q2KXSFlVYPKy9D0Ih5UJDMr0xldNIPZE60I3C4u YFKW2g8j30l7P9TXEj6NsBOM2fb70QCSCpAUSlZd2ITW/S8U/I0bjl6GwatvoRh6Z1cB WaKBijTlsdTh7+r/kbwei4GazaGVexKE2RTDsojxfCqdVBsBU8McUYAlCCnrK93nnLCs x3XA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=imiexLA/oubSY91/OTCcomeudHImnVxfqgG7cEuFDSA=; b=be9hx3s/GFyjqw1PB+ylH83nkdGq5cp7BybiiR6s2ytn+7UQSvVHZT64PFajXANtQ9 xVlOviAhLxVMIeQWY08u0WIkAQDTPv/jKSn2NpMq+lVDoMcv8KhT+e8DvqgWgK/tsVaT jGhEytxf4h/8knfzy6FDLLPK0m+9azkK7USChNeJv+uP/81FiNx0Ut8DyButyaa/Wnwc 4Bikbi7xMV0gBB3tMvLPDqVBL7cmjWGNmqVshvNEtNQLKGqhiHRcD4Tyqn/ub/UUUUj6 1uP8YocGDenPDhOZveJmPKnQvdDFX3GEtuwOTmafuShdIzcYWBGXULOKI2s0w6fnstnN GOBQ== X-Gm-Message-State: AElRT7FCa4tOcq6SdCgwjO4cOY0evCDX40ehyUowgSMkNlgY48SUpU4V WLSP8R3TI3lhVfRaTEThPhHI/g== X-Google-Smtp-Source: AG47ELvmXJhc0Lnz+Hb9zi/aZvqN7lMNHzcJzGw1dL7XPl43vrcKipqWfVeSmovp0qfMPWbFANlq2A== X-Received: by 10.28.153.133 with SMTP id b127mr362434wme.105.1521567718362; Tue, 20 Mar 2018 10:41:58 -0700 (PDT) Received: from arch-x1c3.cbg.collabora.co.uk ([2a00:5f00:102:0:9665:9cff:feee:aa4d]) by smtp.gmail.com with ESMTPSA id y68sm2419059wrb.73.2018.03.20.10.41.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 20 Mar 2018 10:41:57 -0700 (PDT) From: Emil Velikov To: dri-devel@lists.freedesktop.org Subject: [PATCH libdrm 1/2] intel: Do not use libpciaccess on Android Date: Tue, 20 Mar 2018 17:36:51 +0000 Message-Id: <20180320173652.5917-1-emil.l.velikov@gmail.com> X-Mailer: git-send-email 2.16.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Tomasz Figa , emil.l.velikov@gmail.com, Rob Herring MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Tomasz Figa This patch makes the code not rely anymore on libpciaccess when compiled for Android to eliminate ioperm() and iopl() syscalls required by that library. As a side effect, the mappable aperture size is hardcoded to 64 MiB on Android, however nothing seems to rely on this value anyway, as checked be grepping relevant code in drm_gralloc and Mesa. Cc: John Stultz Cc: Rob Herring Cc: John Stultz Cc: Tomasz Figa Signed-off-by: Tomasz Figa [Emil Velikov: rebase against master] Signed-off-by: Emil Velikov Acked-by: John Stultz --- Tomasz, I've taken the liberty of pulling the patch from the Android tree. Hope you don't mind. --- intel/Android.mk | 3 +-- intel/intel_bufmgr.c | 12 ++++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/intel/Android.mk b/intel/Android.mk index 3f9db785..dd881688 100644 --- a/intel/Android.mk +++ b/intel/Android.mk @@ -33,8 +33,7 @@ LOCAL_MODULE := libdrm_intel LOCAL_SRC_FILES := $(LIBDRM_INTEL_FILES) LOCAL_SHARED_LIBRARIES := \ - libdrm \ - libpciaccess + libdrm include $(LIBDRM_COMMON_MK) include $(BUILD_SHARED_LIBRARY) diff --git a/intel/intel_bufmgr.c b/intel/intel_bufmgr.c index a2853400..42f5f62c 100644 --- a/intel/intel_bufmgr.c +++ b/intel/intel_bufmgr.c @@ -36,7 +36,9 @@ #include #include #include +#ifndef __ANDROID__ #include +#endif #include "libdrm_macros.h" #include "intel_bufmgr.h" #include "intel_bufmgr_priv.h" @@ -326,6 +328,7 @@ drm_intel_get_pipe_from_crtc_id(drm_intel_bufmgr *bufmgr, int crtc_id) return -1; } +#ifndef __ANDROID__ static size_t drm_intel_probe_agp_aperture_size(int fd) { @@ -351,6 +354,15 @@ err: pci_system_cleanup (); return size; } +#else +static size_t +drm_intel_probe_agp_aperture_size(int fd) +{ + /* Nothing seems to rely on this value on Android anyway... */ + fprintf(stderr, "%s: Mappable aperture size hardcoded to 64MiB\n"); + return 64 * 1024 * 1024; +} +#endif int drm_intel_get_aperture_sizes(int fd, size_t *mappable, size_t *total)