android: enable the radeonsi driver
authorChih-Wei Huang <cwhuang@android-x86.org>
Wed, 20 May 2015 03:25:34 +0000 (11:25 +0800)
committerEric Anholt <eric@anholt.net>
Tue, 9 Jun 2015 19:25:50 +0000 (12:25 -0700)
Based on the nice work of Paulo Sergio Travaglia <pstglia@gmail.com>.

The main modifications are:

- Include paths for LLVM header files and shared/static libraries
- Set C++ flag "c++11" to avoid compiling errors on LLVM header files
- Set defines for LLVM
- Add GALLIVM source files
- Changes path of libelf library for lollipop

Signed-off-by: Chih-Wei Huang <cwhuang@linux.org.tw>
Acked-by: Eric Anholt <eric@anholt.net>
Android.common.mk
Android.mk
src/gallium/Android.common.mk
src/gallium/auxiliary/Android.mk
src/gallium/drivers/radeon/Android.mk
src/gallium/targets/dri/Android.mk

index edf52d6fabbbb4aa6f69034701119fa220aacea6..43766bf8c57a9b383c0d30cd054adddfa93e6877 100644 (file)
@@ -68,6 +68,14 @@ LOCAL_CFLAGS += \
 endif
 endif
 
+ifeq ($(MESA_ENABLE_LLVM),true)
+LOCAL_CFLAGS += \
+       -DHAVE_LLVM=0x0305 -DLLVM_VERSION_PATCH=2 \
+       -D__STDC_CONSTANT_MACROS \
+       -D__STDC_FORMAT_MACROS \
+       -D__STDC_LIMIT_MACROS
+endif
+
 LOCAL_CPPFLAGS += \
        -Wno-error=non-virtual-dtor \
        -Wno-non-virtual-dtor
index 6a09a9db177118bf41d00282824644dd8af88eeb..341978a68c61c9ec8abe1fdda8b0476863c989a8 100644 (file)
@@ -80,6 +80,8 @@ else
 MESA_BUILD_GALLIUM := false
 endif
 
+MESA_ENABLE_LLVM := $(if $(filter radeonsi,$(MESA_GPU_DRIVERS)),true,false)
+
 # add subdirectories
 ifneq ($(strip $(MESA_GPU_DRIVERS)),)
 
index 782510ff0f47dc0d2fa7b34cd8b5c3811948c8a6..7c6c7ac68202e2704b51883735d16a7978a0b3d7 100644 (file)
@@ -29,4 +29,12 @@ LOCAL_C_INCLUDES += \
        $(GALLIUM_TOP)/winsys \
        $(GALLIUM_TOP)/drivers
 
+ifeq ($(MESA_ENABLE_LLVM),true)
+LOCAL_C_INCLUDES += \
+       external/llvm/include \
+       external/llvm/device/include \
+       external/libcxx/include \
+       external/elfutils/$(if $(filter true,$(MESA_LOLLIPOP_BUILD)),0.153/)libelf
+endif
+
 include $(MESA_COMMON_MK)
index 96a2125defba90236059ee19cf1b6ba7d34d8ac5..2d91752595cc66163c3600074ab0268a24d35e9f 100644 (file)
@@ -35,6 +35,14 @@ LOCAL_SRC_FILES := \
 LOCAL_C_INCLUDES := \
        $(GALLIUM_TOP)/auxiliary/util
 
+ifeq ($(MESA_ENABLE_LLVM),true)
+LOCAL_SRC_FILES += \
+       $(GALLIVM_SOURCES) \
+       $(GALLIVM_CPP_SOURCES)
+
+LOCAL_CPPFLAGS := -std=c++11
+endif
+
 LOCAL_MODULE := libmesa_gallium
 
 # generate sources
index d61579280eadad00cfd56efa1aadd96838f9b6d5..6997a6d3ec36cc3b3892e45e10dd0cdb215f2c25 100644 (file)
@@ -30,6 +30,10 @@ include $(CLEAR_VARS)
 
 LOCAL_SRC_FILES := $(C_SOURCES)
 
+ifeq ($(MESA_ENABLE_LLVM),true)
+LOCAL_SRC_FILES += $(LLVM_C_FILES)
+endif
+
 LOCAL_SHARED_LIBRARIES := libdrm libdrm_radeon
 LOCAL_MODULE := libmesa_pipe_radeon
 
index ac33a6ed32f09cb9358d4fb32a27f3d2db5f79cd..78f7b7c61f9375273aa974e2b46b9815812a1f78 100644 (file)
@@ -80,6 +80,7 @@ LOCAL_CFLAGS += -DGALLIUM_R600
 endif
 ifneq ($(filter radeonsi,$(MESA_GPU_DRIVERS)),)
 gallium_DRIVERS += libmesa_pipe_radeonsi
+LOCAL_SHARED_LIBRARIES += libLLVM
 LOCAL_CFLAGS += -DGALLIUM_RADEONSI
 endif
 gallium_DRIVERS += libmesa_winsys_radeon libmesa_pipe_radeon
@@ -108,5 +109,14 @@ LOCAL_STATIC_LIBRARIES := \
        libmesa_util \
        libmesa_loader \
 
+ifeq ($(MESA_ENABLE_LLVM),true)
+LOCAL_STATIC_LIBRARIES += \
+       libLLVMR600CodeGen \
+       libLLVMR600Desc \
+       libLLVMR600Info \
+       libLLVMR600AsmPrinter \
+       libelf
+endif
+
 include $(GALLIUM_COMMON_MK)
 include $(BUILD_SHARED_LIBRARY)