summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChia-I Wu <olv@lunarg.com>2011-08-25 14:03:37 +0800
committerChia-I Wu <olv@lunarg.com>2011-12-03 12:43:59 +0800
commitdcc330e455d6c3351321eae41c77ed727a811973 (patch)
tree858b84413c764269d342b1dcbdc6f893ac0f3444
parentc9bb92f24eec3bef9702baef66b2e7bb257bf30e (diff)
android: add llvmpipe support
Disabled by default. It requires llvm, stlport, gralloc, and mesa itself to be patched.
-rw-r--r--Android.llvm.mk90
-rw-r--r--Android.mk4
-rw-r--r--src/egl/main/Android.mk6
-rw-r--r--src/gallium/Android.mk3
-rw-r--r--src/gallium/auxiliary/Android.mk8
-rw-r--r--src/gallium/drivers/llvmpipe/Android.mk91
-rw-r--r--src/gallium/targets/egl-static/Android.mk3
7 files changed, 204 insertions, 1 deletions
diff --git a/Android.llvm.mk b/Android.llvm.mk
new file mode 100644
index 0000000000..f9e6e9e784
--- /dev/null
+++ b/Android.llvm.mk
@@ -0,0 +1,90 @@
+#
+# Centralized place for LLVM configuration.
+#
+
+ifeq ($(strip $(MESA_LLVM)),true)
+
+major := $(word 1, $(subst ., , $(PLATFORM_VERSION)))
+
+ifneq ($(filter 3 4, $(major)),)
+
+# LLVM 3.0svn
+LLVM_VERSION := 0x0300
+
+llvm_static_libraries_1 := \
+ libLLVMMCJIT \
+ libLLVMRuntimeDyld \
+ libLLVMObject \
+ libLLVMMCDisassembler \
+ libLLVMLinker \
+ libLLVMipo \
+ libLLVMInterpreter \
+ libLLVMInstrumentation \
+ libLLVMJIT \
+ libLLVMExecutionEngine \
+ libLLVMBitWriter
+
+llvm_static_libraries_x86 := \
+ libLLVMX86Disassembler \
+ libLLVMX86AsmParser \
+ libLLVMX86CodeGen \
+ libLLVMX86Desc \
+ libLLVMSelectionDAG \
+ libLLVMX86AsmPrinter \
+ libLLVMX86Utils \
+ libLLVMX86Info
+
+llvm_static_libraries_arm := \
+ libLLVMARMDisassembler \
+ libLLVMARMCodeGen \
+ libLLVMARMDesc \
+ libLLVMSelectionDAG \
+ libLLVMARMAsmPrinter \
+ libLLVMARMInfo
+
+llvm_static_libraries_2 += \
+ libLLVMAsmPrinter \
+ libLLVMMCParser \
+ libLLVMCodeGen \
+ libLLVMScalarOpts \
+ libLLVMInstCombine \
+ libLLVMTransformUtils \
+ libLLVMipa \
+ libLLVMAsmParser \
+ libLLVMArchive \
+ libLLVMBitReader \
+ libLLVMAnalysis \
+ libLLVMTarget \
+ libLLVMMC \
+ libLLVMCore \
+ libLLVMSupport
+
+endif # major 3 or 4
+
+ifeq ($(llvm_static_libraries_$(TARGET_ARCH)),)
+$(error LLVM not available for Android $(PLATFORM_VERSION) on $(TARGET_ARCH))
+endif
+
+endif # MESA_LLVM
+
+ifeq ($(strip $(MESA_LLVM)),true)
+
+# this is a static library
+ifeq ($(strip $(LOCAL_MODULE_CLASS)),STATIC_LIBRARIES)
+LOCAL_CFLAGS += -DHAVE_LLVM=$(LLVM_VERSION)
+
+LLVM_ROOT_PATH := external/llvm
+include $(LLVM_ROOT_PATH)/llvm-device-build.mk
+endif
+
+# this is a shared library
+ifeq ($(strip $(LOCAL_MODULE_CLASS)),SHARED_LIBRARIES)
+LOCAL_SHARED_LIBRARIES += libstlport
+
+LOCAL_STATIC_LIBRARIES += \
+ $(llvm_static_libraries_1) \
+ $(llvm_static_libraries_$(TARGET_ARCH)) \
+ $(llvm_static_libraries_2)
+endif
+
+endif # MESA_LLVM
diff --git a/Android.mk b/Android.mk
index 0d5917ce5f..c1be083754 100644
--- a/Android.mk
+++ b/Android.mk
@@ -31,8 +31,12 @@
MESA_TOP := $(call my-dir)
MESA_COMMON_MK := $(MESA_TOP)/Android.common.mk
+MESA_LLVM_MK := $(MESA_TOP)/Android.llvm.mk
MESA_PYTHON2 := python
+# enable or disable the use of LLVM
+MESA_LLVM := false
+
DRM_TOP := external/drm
DRM_GRALLOC_TOP := hardware/drm_gralloc
diff --git a/src/egl/main/Android.mk b/src/egl/main/Android.mk
index d96da228aa..b36882afe3 100644
--- a/src/egl/main/Android.mk
+++ b/src/egl/main/Android.mk
@@ -89,6 +89,9 @@ gallium_DRIVERS :=
# swrast
gallium_DRIVERS += libmesa_pipe_softpipe libmesa_winsys_sw_android
+ifeq ($(strip $(MESA_LLVM)),true)
+gallium_DRIVERS += libmesa_pipe_llvmpipe
+endif
# i915g
ifneq ($(filter i915g, $(MESA_GPU_DRIVERS)),)
@@ -144,6 +147,9 @@ LOCAL_STATIC_LIBRARIES := \
endif # MESA_BUILD_GALLIUM
+LOCAL_MODULE_CLASS := SHARED_LIBRARIES
+include $(MESA_LLVM_MK)
+
LOCAL_MODULE := libGLES_mesa
LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/egl
diff --git a/src/gallium/Android.mk b/src/gallium/Android.mk
index 41c59b13c6..40b10e7eb5 100644
--- a/src/gallium/Android.mk
+++ b/src/gallium/Android.mk
@@ -33,6 +33,9 @@ SUBDIRS := \
# swrast
SUBDIRS += winsys/sw/android drivers/softpipe
+ifeq ($(strip $(MESA_LLVM)),true)
+SUBDIRS += drivers/llvmpipe
+endif
# i915g
ifneq ($(filter i915g, $(MESA_GPU_DRIVERS)),)
diff --git a/src/gallium/auxiliary/Android.mk b/src/gallium/auxiliary/Android.mk
index 0c37dd31ab..e25615cea0 100644
--- a/src/gallium/auxiliary/Android.mk
+++ b/src/gallium/auxiliary/Android.mk
@@ -23,7 +23,7 @@
LOCAL_PATH := $(call my-dir)
-# get C_SOURCES and GENERATED_SOURCES
+# get source lists
include $(LOCAL_PATH)/Makefile.sources
include $(CLEAR_VARS)
@@ -51,5 +51,11 @@ $(intermediates)/util/u_half.c: $(intermediates)/%.c: $(LOCAL_PATH)/%.py
$(intermediates)/util/u_format_table.c: $(intermediates)/%.c: $(LOCAL_PATH)/%.py $(LOCAL_PATH)/util/u_format.csv
$(transform-generated-source)
+ifeq ($(strip $(MESA_LLVM)),true)
+LOCAL_SRC_FILES += $(GALLIVM_SOURCES) $(GALLIVM_CPP_SOURCES)
+endif
+
+include $(MESA_LLVM_MK)
+
include $(GALLIUM_COMMON_MK)
include $(BUILD_STATIC_LIBRARY)
diff --git a/src/gallium/drivers/llvmpipe/Android.mk b/src/gallium/drivers/llvmpipe/Android.mk
new file mode 100644
index 0000000000..803464cfd2
--- /dev/null
+++ b/src/gallium/drivers/llvmpipe/Android.mk
@@ -0,0 +1,91 @@
+# Mesa 3-D graphics library
+#
+# Copyright (C) 2010-2011 Chia-I Wu <olvaffe@gmail.com>
+# Copyright (C) 2010-2011 LunarG Inc.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+# DEALINGS IN THE SOFTWARE.
+
+LOCAL_PATH := $(call my-dir)
+
+# from Makefile
+C_SOURCES = \
+ lp_bld_alpha.c \
+ lp_bld_blend_aos.c \
+ lp_bld_blend_logicop.c \
+ lp_bld_blend_soa.c \
+ lp_bld_depth.c \
+ lp_bld_interp.c \
+ lp_clear.c \
+ lp_context.c \
+ lp_draw_arrays.c \
+ lp_fence.c \
+ lp_flush.c \
+ lp_jit.c \
+ lp_memory.c \
+ lp_perf.c \
+ lp_query.c \
+ lp_rast.c \
+ lp_rast_debug.c \
+ lp_rast_tri.c \
+ lp_scene.c \
+ lp_scene_queue.c \
+ lp_screen.c \
+ lp_setup.c \
+ lp_setup_line.c \
+ lp_setup_point.c \
+ lp_setup_tri.c \
+ lp_setup_vbuf.c \
+ lp_state_blend.c \
+ lp_state_clip.c \
+ lp_state_derived.c \
+ lp_state_fs.c \
+ lp_state_setup.c \
+ lp_state_gs.c \
+ lp_state_rasterizer.c \
+ lp_state_sampler.c \
+ lp_state_so.c \
+ lp_state_surface.c \
+ lp_state_vertex.c \
+ lp_state_vs.c \
+ lp_surface.c \
+ lp_tex_sample.c \
+ lp_texture.c \
+ lp_tile_image.c \
+ lp_tile_soa.c
+
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := \
+ $(filter-out lp_tile_soa.c, $(C_SOURCES))
+
+LOCAL_MODULE := libmesa_pipe_llvmpipe
+
+# generate lp_tile_soa.c
+LOCAL_MODULE_CLASS := STATIC_LIBRARIES
+intermediates := $(call local-intermediates-dir)
+LOCAL_GENERATED_SOURCES := $(intermediates)/lp_tile_soa.c
+
+$(intermediates)/lp_tile_soa.c: PRIVATE_CUSTOM_TOOL = python $^ > $@
+$(intermediates)/lp_tile_soa.c: $(LOCAL_PATH)/lp_tile_soa.py $(GALLIUM_TOP)/auxiliary/util/u_format.csv
+ $(transform-generated-source)
+
+include $(MESA_LLVM_MK)
+
+include $(GALLIUM_COMMON_MK)
+include $(BUILD_STATIC_LIBRARY)
diff --git a/src/gallium/targets/egl-static/Android.mk b/src/gallium/targets/egl-static/Android.mk
index 21b6dc2792..9c2e19f778 100644
--- a/src/gallium/targets/egl-static/Android.mk
+++ b/src/gallium/targets/egl-static/Android.mk
@@ -43,6 +43,9 @@ LOCAL_C_INCLUDES := \
# swrast
LOCAL_CFLAGS += -DGALLIUM_SOFTPIPE
+ifeq ($(strip $(MESA_LLVM)),true)
+LOCAL_CFLAGS += -DGALLIUM_LLVMPIPE
+endif
# swrast only
ifeq ($(MESA_GPU_DRIVERS),swrast)