[PATCH libdrm 1/2] intel: Do not use libpciaccess on Android

Emil Velikov emil.l.velikov at gmail.com
Tue Mar 20 17:36:51 UTC 2018


From: Tomasz Figa <tfiga at google.com>

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 <john.stultz at linaro.org>
Cc: Rob Herring <rob.herring at linaro.org>
Cc: John Stultz <john.stultz at linaro.org>
Cc: Tomasz Figa <tfiga at google.com>
Signed-off-by: Tomasz Figa <tfiga at google.com>
[Emil Velikov: rebase against master]
Signed-off-by: Emil Velikov <emil.velikov at collabora.com>
---
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 <errno.h>
 #include <drm.h>
 #include <i915_drm.h>
+#ifndef __ANDROID__
 #include <pciaccess.h>
+#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)
-- 
2.16.0



More information about the dri-devel mailing list