For BOARD_GPU_DRIVERS=swrast build, DRM is not needed.
classic_drivers :=
gallium_drivers := swrast i915g nouveau r300g r600g vmwgfx
-MESA_GPU_DRIVERS := $(BOARD_GPU_DRIVERS)
+MESA_GPU_DRIVERS := $(strip $(BOARD_GPU_DRIVERS))
# warn about invalid drivers
invalid_drivers := $(filter-out \
LOCAL_SHARED_LIBRARIES := \
libglapi \
- libdrm \
libdl \
libhardware \
liblog \
libcutils
+# hardware drivers require DRM
+ifneq ($(MESA_GPU_DRIVERS),swrast)
+LOCAL_SHARED_LIBRARIES += libdrm
+endif
+
ifeq ($(strip $(MESA_BUILD_GALLIUM)),true)
gallium_DRIVERS :=
LOCAL_C_INCLUDES := \
$(GALLIUM_TOP)/state_trackers/egl \
$(GALLIUM_TOP)/winsys/sw \
- $(MESA_TOP)/src/egl/main \
- $(DRM_GRALLOC_TOP)
+ $(MESA_TOP)/src/egl/main
+
+# swrast only
+ifeq ($(MESA_GPU_DRIVERS),swrast)
+LOCAL_CFLAGS += -DANDROID_BACKEND_NO_DRM
+else
+LOCAL_C_INCLUDES += $(DRM_GRALLOC_TOP)
+endif
LOCAL_MODULE := libmesa_st_egl
return fmt;
}
+#ifndef ANDROID_BACKEND_NO_DRM
+
#include <gralloc_drm_handle.h>
static int
get_handle_name(buffer_handle_t handle)
return (dh) ? dh->name : 0;
}
+#else
+
+static int
+get_handle_name(buffer_handle_t handle)
+{
+ return 0;
+}
+
+#endif /* ANDROID_BACKEND_NO_DRM */
+
/**
* Import an android_native_buffer_t allocated by the server.
*/
const hw_module_t *mod;
int fd, err;
+#ifndef ANDROID_BACKEND_NO_DRM
/* get the authorized fd from gralloc */
err = hw_get_module(GRALLOC_HARDWARE_MODULE_ID, &mod);
if (!err) {
adpy->base.screen =
adpy->event_handler->new_drm_screen(&adpy->base, NULL, fd);
}
+#endif
if (adpy->base.screen) {
LOGI("using DRM screen");
$(GALLIUM_TOP)/state_trackers/vega \
$(GALLIUM_TOP)/state_trackers/egl \
$(MESA_TOP)/src/egl/main \
- $(MESA_TOP)/src/mesa \
- $(DRM_TOP)/include/drm \
- $(DRM_TOP)
+ $(MESA_TOP)/src/mesa
# swrast
LOCAL_CFLAGS += -DGALLIUM_SOFTPIPE
+# swrast only
+ifeq ($(MESA_GPU_DRIVERS),swrast)
+LOCAL_CFLAGS += -D_EGL_NO_DRM
+else
+LOCAL_C_INCLUDES += \
+ $(DRM_TOP)/include/drm \
+ $(DRM_TOP)
+endif
+
ifneq ($(filter i915g, $(MESA_GPU_DRIVERS)),)
LOCAL_CFLAGS += -D_EGL_PIPE_I915=1
endif
return (*chip_id >= 0);
}
-#elif defined(PIPE_OS_ANDROID)
+#elif defined(PIPE_OS_ANDROID) && !defined(_EGL_NO_DRM)
#include <xf86drm.h>
/* for i915 */