[Mesa-dev] [PATCH v2 10/15] android: enable the radeonsi driver

Chih-Wei Huang cwhuang at android-x86.org
Tue May 19 20:25:34 PDT 2015


Based on the nice work of Paulo Sergio Travaglia <pstglia at 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 at linux.org.tw>
---
 Android.common.mk                     |  8 ++++++++
 Android.mk                            |  2 ++
 src/gallium/Android.common.mk         |  8 ++++++++
 src/gallium/auxiliary/Android.mk      |  8 ++++++++
 src/gallium/drivers/radeon/Android.mk |  4 ++++
 src/gallium/targets/dri/Android.mk    | 10 ++++++++++
 6 files changed, 40 insertions(+)

diff --git a/Android.common.mk b/Android.common.mk
index edf52d6..43766bf 100644
--- a/Android.common.mk
+++ b/Android.common.mk
@@ -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
diff --git a/Android.mk b/Android.mk
index 6a09a9d..341978a 100644
--- a/Android.mk
+++ b/Android.mk
@@ -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)),)
 
diff --git a/src/gallium/Android.common.mk b/src/gallium/Android.common.mk
index 782510f..7c6c7ac 100644
--- a/src/gallium/Android.common.mk
+++ b/src/gallium/Android.common.mk
@@ -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)
diff --git a/src/gallium/auxiliary/Android.mk b/src/gallium/auxiliary/Android.mk
index 96a2125..2d91752 100644
--- a/src/gallium/auxiliary/Android.mk
+++ b/src/gallium/auxiliary/Android.mk
@@ -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
diff --git a/src/gallium/drivers/radeon/Android.mk b/src/gallium/drivers/radeon/Android.mk
index d615792..6997a6d 100644
--- a/src/gallium/drivers/radeon/Android.mk
+++ b/src/gallium/drivers/radeon/Android.mk
@@ -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
 
diff --git a/src/gallium/targets/dri/Android.mk b/src/gallium/targets/dri/Android.mk
index ac33a6e..78f7b7c 100644
--- a/src/gallium/targets/dri/Android.mk
+++ b/src/gallium/targets/dri/Android.mk
@@ -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)
-- 
1.9.1



More information about the mesa-dev mailing list