diff options
Diffstat (limited to 'src/loader')
-rw-r--r-- | src/loader/Android.mk | 2 | ||||
-rw-r--r-- | src/loader/Makefile.am | 13 | ||||
-rw-r--r-- | src/loader/SConscript | 5 | ||||
-rw-r--r-- | src/loader/loader.c | 7 |
4 files changed, 19 insertions, 8 deletions
diff --git a/src/loader/Android.mk b/src/loader/Android.mk index 01699dcc533..6890af47342 100644 --- a/src/loader/Android.mk +++ b/src/loader/Android.mk @@ -35,7 +35,7 @@ LOCAL_SRC_FILES := \ # swrast only ifeq ($(MESA_GPU_DRIVERS),swrast) - LOCAL_CFLAGS += -D_EGL_NO_DRM + LOCAL_CFLAGS += -D__NOT_HAVE_DRM_H else LOCAL_C_INCLUDES += \ $(DRM_TOP)/include/drm \ diff --git a/src/loader/Makefile.am b/src/loader/Makefile.am index a118fef1d9c..371dd575c09 100644 --- a/src/loader/Makefile.am +++ b/src/loader/Makefile.am @@ -27,11 +27,20 @@ libloader_la_CPPFLAGS = \ $(DEFINES) \ -I$(top_srcdir)/include \ $(VISIBILITY_CFLAGS) \ - $(LIBDRM_CFLAGS) \ $(LIBUDEV_CFLAGS) libloader_la_LIBADD = \ - $(LIBDRM_LIBS) \ $(LIBUDEV_LIBS) +if !HAVE_LIBDRM +libloader_la_CPPFLAGS += \ + -D__NOT_HAVE_DRM_H +else +libloader_la_CPPFLAGS += \ + $(LIBDRM_CFLAGS) + +libloader_la_LIBADD += \ + $(LIBDRM_LIBS) +endif + libloader_la_SOURCES = $(LOADER_C_FILES) diff --git a/src/loader/SConscript b/src/loader/SConscript index 76b0871005b..359fc1850fe 100644 --- a/src/loader/SConscript +++ b/src/loader/SConscript @@ -1,15 +1,12 @@ Import('*') -if not env['drm']: - Return() - env = env.Clone() env.Prepend(CPPPATH = [ '#include' ]) -env.PkgUseModules('DRM') +env.Append(CPPDEFINES = ['__NOT_HAVE_DRM_H']) if env['udev']: env.PkgUseModules('UDEV') diff --git a/src/loader/loader.c b/src/loader/loader.c index 108e4440291..6fe8c8fc453 100644 --- a/src/loader/loader.c +++ b/src/loader/loader.c @@ -69,7 +69,9 @@ #include <string.h> #include "loader.h" +#ifndef __NOT_HAVE_DRM_H #include <xf86drm.h> +#endif #define __IS_LOADER #include "pci_ids/pci_id_driver_map.h" @@ -149,7 +151,7 @@ out: return (*chip_id >= 0); } -#elif defined(ANDROID) && !defined(_EGL_NO_DRM) +#elif defined(ANDROID) && !defined(__NOT_HAVE_DRM_H) /* for i915 */ #include <i915_drm.h> @@ -267,6 +269,8 @@ loader_get_driver_for_fd(int fd, unsigned driver_types) driver_types = _LOADER_GALLIUM | _LOADER_DRI; if (!loader_get_pci_id_for_fd(fd, &vendor_id, &chip_id)) { + +#ifndef __NOT_HAVE_DRM_H /* fallback to drmGetVersion(): */ drmVersionPtr version = drmGetVersion(fd); @@ -279,6 +283,7 @@ loader_get_driver_for_fd(int fd, unsigned driver_types) log(_LOADER_INFO, "using driver %s for %d", driver, fd); drmFreeVersion(version); +#endif return driver; } |