aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomasz Figa2015-12-14 04:46:34 -0600
committerEmil Velikov2018-03-28 11:08:32 -0500
commitbb0fd5f3b30141e2049a31f9ccd3f806645b21e0 (patch)
tree1e7b81caef1b4574fe4fbf29a670fb423de2c94c
parent00aa37443f32ff22e439093bc4039c21c74d0d2e (diff)
downloadexternal-libdrm-bb0fd5f3b30141e2049a31f9ccd3f806645b21e0.tar.gz
external-libdrm-bb0fd5f3b30141e2049a31f9ccd3f806645b21e0.tar.xz
external-libdrm-bb0fd5f3b30141e2049a31f9ccd3f806645b21e0.zip
intel: Do not use libpciaccess on Android
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: Rob Herring <rob.herring@linaro.org> Signed-off-by: Tomasz Figa <tfiga@google.com> [Emil Velikov: rebase against master. add missing __func__, Eric] Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Acked-by: John Stultz <john.stultz@linaro.org>
-rw-r--r--intel/Android.mk3
-rw-r--r--intel/intel_bufmgr.c12
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
33LOCAL_SRC_FILES := $(LIBDRM_INTEL_FILES) 33LOCAL_SRC_FILES := $(LIBDRM_INTEL_FILES)
34 34
35LOCAL_SHARED_LIBRARIES := \ 35LOCAL_SHARED_LIBRARIES := \
36 libdrm \ 36 libdrm
37 libpciaccess
38 37
39include $(LIBDRM_COMMON_MK) 38include $(LIBDRM_COMMON_MK)
40include $(BUILD_SHARED_LIBRARY) 39include $(BUILD_SHARED_LIBRARY)
diff --git a/intel/intel_bufmgr.c b/intel/intel_bufmgr.c
index bede0a21..192de093 100644
--- a/intel/intel_bufmgr.c
+++ b/intel/intel_bufmgr.c
@@ -32,7 +32,9 @@
32#include <errno.h> 32#include <errno.h>
33#include <drm.h> 33#include <drm.h>
34#include <i915_drm.h> 34#include <i915_drm.h>
35#ifndef __ANDROID__
35#include <pciaccess.h> 36#include <pciaccess.h>
37#endif
36#include "libdrm_macros.h" 38#include "libdrm_macros.h"
37#include "intel_bufmgr.h" 39#include "intel_bufmgr.h"
38#include "intel_bufmgr_priv.h" 40#include "intel_bufmgr_priv.h"
@@ -322,6 +324,7 @@ drm_intel_get_pipe_from_crtc_id(drm_intel_bufmgr *bufmgr, int crtc_id)
322 return -1; 324 return -1;
323} 325}
324 326
327#ifndef __ANDROID__
325static size_t 328static size_t
326drm_intel_probe_agp_aperture_size(int fd) 329drm_intel_probe_agp_aperture_size(int fd)
327{ 330{
@@ -347,6 +350,15 @@ err:
347 pci_system_cleanup (); 350 pci_system_cleanup ();
348 return size; 351 return size;
349} 352}
353#else
354static size_t
355drm_intel_probe_agp_aperture_size(int fd)
356{
357 /* Nothing seems to rely on this value on Android anyway... */
358 fprintf(stderr, "%s: Mappable aperture size hardcoded to 64MiB\n", __func__);
359 return 64 * 1024 * 1024;
360}
361#endif
350 362
351int 363int
352drm_intel_get_aperture_sizes(int fd, size_t *mappable, size_t *total) 364drm_intel_get_aperture_sizes(int fd, size_t *mappable, size_t *total)