Discussion:
[PATCH v2 00/15] More Android patches
(too old to reply)
Chih-Wei Huang
2015-05-20 03:25:24 UTC
Permalink
This is the v2 series of patches for Android.
Tested OK with Android-x86 lollipop-x86 branch.
Summary of the changes:

* Use C++11 compliant unordered_set to fix nouveau driver with Android stlport and libcxx (lollipop).
* Add gallium_dri.so for Android. This fixes gallium support since 5564c36.
* Enable radeonsi driver for Android.
* Miscellaneous fixes.

Chih-Wei Huang (15):
android: loader: export the path to be included
android: export more dirs from libmesa_dri_common
android: add rules to build gallium/state_trackers/dri
android: add rules to build gallium_dri.so
android: enable the rules to build gallium st/dri
android: try to load gallium_dri.so directly
android: clean up the makefile of libGLES_mesa
egl/main: let EGL_RECORDABLE_ANDROID be a valid attrib
android: generate files by $(call es-gen)
android: enable the radeonsi driver
android: avoid building errors with stlport
nv50/ir: optimize the use of std::tr1::unordered_set
nv50/ir: use C++11 compliant unordered_set if possible
android: nv50/ir: make the code be compatible with stlport
android: build with libcxx of android lollipop

Android.common.mk | 10 ++
Android.mk | 8 +-
CleanSpec.mk | 1 +
src/egl/drivers/dri2/Android.mk | 1 -
src/egl/drivers/dri2/egl_dri2.c | 4 +
src/egl/main/Android.mk | 83 +-------------
src/egl/main/eglconfig.h | 2 +
src/gallium/Android.common.mk | 8 ++
src/gallium/Android.mk | 10 +-
src/gallium/auxiliary/Android.mk | 6 +
src/gallium/drivers/nouveau/Android.mk | 4 +
src/gallium/drivers/nouveau/codegen/nv50_ir.h | 37 ++++++-
.../nouveau/codegen/nv50_ir_lowering_nvc0.cpp | 4 +-
.../nouveau/codegen/nv50_ir_lowering_nvc0.h | 4 +-
src/gallium/drivers/nouveau/codegen/nv50_ir_ra.cpp | 5 +-
src/gallium/drivers/r600/Android.mk | 4 +
src/gallium/drivers/radeon/Android.mk | 4 +
src/gallium/state_trackers/dri/Android.mk | 64 +++++++++++
src/gallium/targets/dri/Android.mk | 123 +++++++++++++++++++++
src/gallium/winsys/sw/dri/Android.mk | 35 ++++++
src/gallium/winsys/sw/kms-dri/Android.mk | 37 +++++++
src/glsl/Android.mk | 1 -
src/loader/Android.mk | 2 +
src/mesa/Android.gen.mk | 16 ++-
src/mesa/drivers/dri/common/Android.mk | 4 +-
src/util/list.h | 2 +
26 files changed, 373 insertions(+), 106 deletions(-)
create mode 100644 src/gallium/state_trackers/dri/Android.mk
create mode 100644 src/gallium/targets/dri/Android.mk
create mode 100644 src/gallium/winsys/sw/dri/Android.mk
create mode 100644 src/gallium/winsys/sw/kms-dri/Android.mk
--
1.9.1
Chih-Wei Huang
2015-05-20 03:25:26 UTC
Permalink
The include paths of libmesa_dri_common are also used by modules
that need libmesa_dri_common.

Signed-off-by: Chih-Wei Huang <***@linux.org.tw>
---
src/mesa/drivers/dri/common/Android.mk | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/common/Android.mk b/src/mesa/drivers/dri/common/Android.mk
index a7fcd6d..c003c94 100644
--- a/src/mesa/drivers/dri/common/Android.mk
+++ b/src/mesa/drivers/dri/common/Android.mk
@@ -39,7 +39,9 @@ intermediates := $(call local-generated-sources-dir)
LOCAL_C_INCLUDES := \
$(MESA_DRI_C_INCLUDES)

-LOCAL_EXPORT_C_INCLUDE_DIRS := $(intermediates)
+LOCAL_EXPORT_C_INCLUDE_DIRS := \
+ $(LOCAL_PATH) \
+ $(intermediates)

# swrast only
ifeq ($(MESA_GPU_DRIVERS),swrast)
--
1.9.1
Chih-Wei Huang
2015-05-20 03:25:27 UTC
Permalink
Signed-off-by: Chih-Wei Huang <***@linux.org.tw>
---
src/gallium/Android.mk | 5 ++-
src/gallium/state_trackers/dri/Android.mk | 64 +++++++++++++++++++++++++++++++
2 files changed, 67 insertions(+), 2 deletions(-)
create mode 100644 src/gallium/state_trackers/dri/Android.mk

diff --git a/src/gallium/Android.mk b/src/gallium/Android.mk
index b2662ff..aaa07bc 100644
--- a/src/gallium/Android.mk
+++ b/src/gallium/Android.mk
@@ -79,5 +79,6 @@ ifneq ($(filter vmwgfx, $(MESA_GPU_DRIVERS)),)
SUBDIRS += winsys/svga/drm drivers/svga
endif

-mkfiles := $(patsubst %,$(GALLIUM_TOP)/%/Android.mk,$(SUBDIRS))
-include $(mkfiles)
+SUBDIRS += state_trackers/dri
+
+include $(call all-named-subdir-makefiles,$(SUBDIRS))
diff --git a/src/gallium/state_trackers/dri/Android.mk b/src/gallium/state_trackers/dri/Android.mk
new file mode 100644
index 0000000..188e4a1
--- /dev/null
+++ b/src/gallium/state_trackers/dri/Android.mk
@@ -0,0 +1,64 @@
+# Mesa 3-D graphics library
+#
+# Copyright (C) 2015 Chih-Wei Huang <***@linux.org.tw>
+# Copyright (C) 2015 Android-x86 Open Source Project
+#
+# 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)
+
+include $(LOCAL_PATH)/Makefile.sources
+
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := $(common_SOURCES)
+
+LOCAL_CFLAGS := \
+ -DGALLIUM_STATIC_TARGETS=1 \
+
+LOCAL_C_INCLUDES := \
+ $(MESA_TOP)/src/mapi \
+ $(MESA_TOP)/src/mesa \
+
+LOCAL_EXPORT_C_INCLUDE_DIRS := \
+ $(LOCAL_PATH) \
+ $(LOCAL_C_INCLUDES) \
+
+LOCAL_STATIC_LIBRARIES := \
+ libmesa_dri_common \
+
+ifneq ($(filter swrast,$(MESA_GPU_DRIVERS)),)
+LOCAL_CFLAGS += -DGALLIUM_SOFTPIPE
+LOCAL_SRC_FILES += $(drisw_SOURCES)
+endif
+
+# swrast only?
+ifeq ($(MESA_GPU_DRIVERS),swrast)
+LOCAL_CFLAGS += -D__NOT_HAVE_DRM_H
+else
+LOCAL_SRC_FILES += $(dri2_SOURCES)
+LOCAL_SHARED_LIBRARIES := libdrm
+endif
+
+LOCAL_MODULE := libmesa_st_dri
+
+LOCAL_GENERATED_SOURCES := $(MESA_DRI_OPTIONS_H)
+
+include $(GALLIUM_COMMON_MK)
+include $(BUILD_STATIC_LIBRARY)
--
1.9.1
Chih-Wei Huang
2015-05-20 03:25:25 UTC
Permalink
Signed-off-by: Chih-Wei Huang <***@linux.org.tw>
---
src/egl/drivers/dri2/Android.mk | 1 -
src/loader/Android.mk | 2 ++
2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/egl/drivers/dri2/Android.mk b/src/egl/drivers/dri2/Android.mk
index 5931ce8..d4d809b 100644
--- a/src/egl/drivers/dri2/Android.mk
+++ b/src/egl/drivers/dri2/Android.mk
@@ -45,7 +45,6 @@ endif
LOCAL_C_INCLUDES := \
$(MESA_TOP)/src/mapi \
$(MESA_TOP)/src/egl/main \
- $(MESA_TOP)/src/loader \
$(DRM_GRALLOC_TOP)

LOCAL_STATIC_LIBRARIES := \
diff --git a/src/loader/Android.mk b/src/loader/Android.mk
index 8e215de..92d9fd2 100644
--- a/src/loader/Android.mk
+++ b/src/loader/Android.mk
@@ -40,6 +40,8 @@ else
LOCAL_SHARED_LIBRARIES := libdrm
endif

+LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)
+
LOCAL_MODULE := libmesa_loader

include $(MESA_COMMON_MK)
--
1.9.1
Chih-Wei Huang
2015-05-20 03:25:30 UTC
Permalink
To avoid the trick of creating links for all dri drivers.

Signed-off-by: Chih-Wei Huang <***@linux.org.tw>
---
src/egl/drivers/dri2/egl_dri2.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index fe5cbc8..7fc9f78 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -419,6 +419,10 @@ dri2_open_driver(_EGLDisplay *disp)
/* not need continue to loop all paths once the driver is found */
if (dri2_dpy->driver != NULL)
break;
+#ifdef ANDROID
+ snprintf(path, sizeof path, "%.*s/gallium_dri.so", len, p);
+ dri2_dpy->driver = dlopen(path, RTLD_NOW | RTLD_GLOBAL);
+#endif
}

if (dri2_dpy->driver == NULL) {
--
1.9.1
Eric Anholt
2015-06-08 20:39:20 UTC
Permalink
Post by Chih-Wei Huang
To avoid the trick of creating links for all dri drivers.
---
src/egl/drivers/dri2/egl_dri2.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index fe5cbc8..7fc9f78 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -419,6 +419,10 @@ dri2_open_driver(_EGLDisplay *disp)
/* not need continue to loop all paths once the driver is found */
if (dri2_dpy->driver != NULL)
break;
+#ifdef ANDROID
+ snprintf(path, sizeof path, "%.*s/gallium_dri.so", len, p);
+ dri2_dpy->driver = dlopen(path, RTLD_NOW | RTLD_GLOBAL);
+#endif
}
It looks like with your change, things wouldn't work if you had more
than one entry in your drivers path, and gallium_dri.so wasn't in the
last directory.

I want to squish the following changes on to this:

diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 0b8a49b..44a6c96 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -419,9 +419,14 @@ dri2_open_driver(_EGLDisplay *disp)
/* not need continue to loop all paths once the driver is found */
if (dri2_dpy->driver != NULL)
break;
+
#ifdef ANDROID
snprintf(path, sizeof path, "%.*s/gallium_dri.so", len, p);
dri2_dpy->driver = dlopen(path, RTLD_NOW | RTLD_GLOBAL);
+ if (dri2_dpy->driver == NULL)
+ _eglLog(_EGL_DEBUG, "failed to open %s: %s\n", path, dlerror());
+ else
+ break;
#endif
}
Chih-Wei Huang
2015-05-20 03:25:29 UTC
Permalink
The libmesa_dri_common and libmesa_egl_dri2 should not be limited to the
classical drivers only. Allow them to be built with the gallium drivers.

v2: add a clean step to rebuild all dri modules properly.

Signed-off-by: Chih-Wei Huang <***@linux.org.tw>
---
Android.mk | 6 +-----
CleanSpec.mk | 1 +
src/egl/main/Android.mk | 8 ++------
3 files changed, 4 insertions(+), 11 deletions(-)

diff --git a/Android.mk b/Android.mk
index b19419b..6a09a9d 100644
--- a/Android.mk
+++ b/Android.mk
@@ -89,13 +89,9 @@ SUBDIRS := \
src/glsl \
src/mesa \
src/util \
- src/egl/main
-
-ifeq ($(strip $(MESA_BUILD_CLASSIC)),true)
-SUBDIRS += \
+ src/egl/main \
src/egl/drivers/dri2 \
src/mesa/drivers/dri
-endif

ifeq ($(strip $(MESA_BUILD_GALLIUM)),true)
SUBDIRS += src/gallium
diff --git a/CleanSpec.mk b/CleanSpec.mk
index 2068163..d08b0de 100644
--- a/CleanSpec.mk
+++ b/CleanSpec.mk
@@ -13,3 +13,4 @@ $(call add-clean-step, rm -rf $(PRODUCT_OUT)/*/SHARED_LIBRARIES/libGLES_mesa_int
$(call add-clean-step, rm -rf $(HOST_OUT_release)/*/EXECUTABLES/mesa_*_intermediates)
$(call add-clean-step, rm -rf $(HOST_OUT_release)/*/EXECUTABLES/glsl_compiler_intermediates)
$(call add-clean-step, rm -rf $(HOST_OUT_release)/*/STATIC_LIBRARIES/libmesa_*_intermediates)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/*/SHARED_LIBRARIES/*_dri_intermediates)
diff --git a/src/egl/main/Android.mk b/src/egl/main/Android.mk
index 12b66d0..27d0b18 100644
--- a/src/egl/main/Android.mk
+++ b/src/egl/main/Android.mk
@@ -62,10 +62,10 @@ ifneq ($(MESA_GPU_DRIVERS),swrast)
LOCAL_SHARED_LIBRARIES += libdrm
endif

-ifeq ($(strip $(MESA_BUILD_CLASSIC)),true)
LOCAL_CFLAGS += -D_EGL_BUILT_IN_DRIVER_DRI2
LOCAL_STATIC_LIBRARIES += libmesa_egl_dri2

+ifeq ($(strip $(MESA_BUILD_CLASSIC)),true)
# require i915_dri and/or i965_dri
LOCAL_REQUIRED_MODULES += \
$(addsuffix _dri, $(filter i915 i965, $(MESA_GPU_DRIVERS)))
@@ -75,9 +75,6 @@ ifeq ($(strip $(MESA_BUILD_GALLIUM)),true)

gallium_DRIVERS :=

-# swrast
-gallium_DRIVERS += libmesa_pipe_softpipe libmesa_winsys_sw_android
-
# freedreno
ifneq ($(filter freedreno, $(MESA_GPU_DRIVERS)),)
gallium_DRIVERS += libmesa_winsys_freedreno libmesa_pipe_freedreno
@@ -137,8 +134,6 @@ endif
# * libmesa_glsl depends on libmesa_glsl_utils
#
LOCAL_STATIC_LIBRARIES := \
- libmesa_egl_gallium \
- libmesa_st_egl \
$(gallium_DRIVERS) \
libmesa_st_mesa \
libmesa_util \
@@ -147,6 +142,7 @@ LOCAL_STATIC_LIBRARIES := \
libmesa_gallium \
$(LOCAL_STATIC_LIBRARIES)

+LOCAL_REQUIRED_MODULES += gallium_dri
endif # MESA_BUILD_GALLIUM

LOCAL_STATIC_LIBRARIES := \
--
1.9.1
Chih-Wei Huang
2015-05-20 03:25:28 UTC
Permalink
Signed-off-by: Chih-Wei Huang <***@linux.org.tw>
---
src/gallium/Android.mk | 7 +-
src/gallium/targets/dri/Android.mk | 112 +++++++++++++++++++++++++++++++
src/gallium/winsys/sw/dri/Android.mk | 35 ++++++++++
src/gallium/winsys/sw/kms-dri/Android.mk | 37 ++++++++++
4 files changed, 189 insertions(+), 2 deletions(-)
create mode 100644 src/gallium/targets/dri/Android.mk
create mode 100644 src/gallium/winsys/sw/dri/Android.mk
create mode 100644 src/gallium/winsys/sw/kms-dri/Android.mk

diff --git a/src/gallium/Android.mk b/src/gallium/Android.mk
index aaa07bc..a9c34d9 100644
--- a/src/gallium/Android.mk
+++ b/src/gallium/Android.mk
@@ -33,7 +33,9 @@ SUBDIRS := auxiliary
#

# swrast
-SUBDIRS += winsys/sw/android drivers/softpipe
+ifneq ($(filter swrast,$(MESA_GPU_DRIVERS)),)
+SUBDIRS += winsys/sw/dri winsys/sw/kms-dri drivers/softpipe
+endif

# freedreno
ifneq ($(filter freedreno, $(MESA_GPU_DRIVERS)),)
@@ -79,6 +81,7 @@ ifneq ($(filter vmwgfx, $(MESA_GPU_DRIVERS)),)
SUBDIRS += winsys/svga/drm drivers/svga
endif

-SUBDIRS += state_trackers/dri
+# Gallium state trackers and target for dri
+SUBDIRS += state_trackers/dri targets/dri

include $(call all-named-subdir-makefiles,$(SUBDIRS))
diff --git a/src/gallium/targets/dri/Android.mk b/src/gallium/targets/dri/Android.mk
new file mode 100644
index 0000000..ac33a6e
--- /dev/null
+++ b/src/gallium/targets/dri/Android.mk
@@ -0,0 +1,112 @@
+# Mesa 3-D graphics library
+#
+# Copyright (C) 2015 Chih-Wei Huang <***@linux.org.tw>
+# Copyright (C) 2015 Android-x86 Open Source Project
+#
+# 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)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := gallium_dri
+
+ifeq ($(MESA_LOLLIPOP_BUILD),true)
+LOCAL_MODULE_RELATIVE_PATH := $(notdir $(MESA_DRI_MODULE_PATH))
+else
+LOCAL_MODULE_PATH := $(MESA_DRI_MODULE_PATH)
+endif
+
+LOCAL_SRC_FILES := target.c
+
+LOCAL_CFLAGS := -DDRI_TARGET -DHAVE_LIBDRM
+
+LOCAL_SHARED_LIBRARIES := \
+ libdl \
+ libglapi \
+ libexpat \
+
+# swrast only?
+ifeq ($(MESA_GPU_DRIVERS),swrast)
+LOCAL_CFLAGS += -D__NOT_HAVE_DRM_H
+else
+LOCAL_SHARED_LIBRARIES += libdrm
+endif
+
+ifneq ($(filter freedreno,$(MESA_GPU_DRIVERS)),)
+LOCAL_CFLAGS += -DGALLIUM_FREEDRENO
+gallium_DRIVERS += libmesa_winsys_freedreno libmesa_pipe_freedreno
+LOCAL_SHARED_LIBRARIES += libdrm_freedreno
+endif
+ifneq ($(filter i915g,$(MESA_GPU_DRIVERS)),)
+gallium_DRIVERS += libmesa_winsys_i915 libmesa_pipe_i915
+LOCAL_SHARED_LIBRARIES += libdrm_intel
+LOCAL_CFLAGS += -DGALLIUM_I915
+endif
+ifneq ($(filter ilo,$(MESA_GPU_DRIVERS)),)
+gallium_DRIVERS += libmesa_winsys_intel libmesa_pipe_ilo
+LOCAL_SHARED_LIBRARIES += libdrm_intel
+LOCAL_CFLAGS += -DGALLIUM_ILO
+endif
+ifneq ($(filter nouveau,$(MESA_GPU_DRIVERS)),)
+gallium_DRIVERS += libmesa_winsys_nouveau libmesa_pipe_nouveau
+LOCAL_CFLAGS += -DGALLIUM_NOUVEAU
+LOCAL_SHARED_LIBRARIES += libdrm_nouveau
+endif
+ifneq ($(filter r%,$(MESA_GPU_DRIVERS)),)
+ifneq ($(filter r300g,$(MESA_GPU_DRIVERS)),)
+gallium_DRIVERS += libmesa_pipe_r300
+LOCAL_CFLAGS += -DGALLIUM_R300
+endif
+ifneq ($(filter r600g,$(MESA_GPU_DRIVERS)),)
+gallium_DRIVERS += libmesa_pipe_r600
+LOCAL_CFLAGS += -DGALLIUM_R600
+endif
+ifneq ($(filter radeonsi,$(MESA_GPU_DRIVERS)),)
+gallium_DRIVERS += libmesa_pipe_radeonsi
+LOCAL_CFLAGS += -DGALLIUM_RADEONSI
+endif
+gallium_DRIVERS += libmesa_winsys_radeon libmesa_pipe_radeon
+LOCAL_SHARED_LIBRARIES += libdrm_radeon
+endif
+ifneq ($(filter swrast,$(MESA_GPU_DRIVERS)),)
+gallium_DRIVERS += libmesa_pipe_softpipe libmesa_winsys_sw_dri libmesa_winsys_sw_kms_dri
+LOCAL_CFLAGS += -DGALLIUM_SOFTPIPE
+endif
+ifneq ($(filter vmwgfx,$(MESA_GPU_DRIVERS)),)
+gallium_DRIVERS += libmesa_winsys_svga libmesa_pipe_svga
+LOCAL_CFLAGS += -DGALLIUM_VMWGFX
+endif
+ifneq ($(filter nouveau r600g,$(MESA_GPU_DRIVERS)),)
+LOCAL_SHARED_LIBRARIES += libstlport
+endif
+
+LOCAL_STATIC_LIBRARIES := \
+ $(gallium_DRIVERS) \
+ libmesa_st_dri \
+ libmesa_st_mesa \
+ libmesa_glsl \
+ libmesa_dri_common \
+ libmesa_megadriver_stub \
+ libmesa_gallium \
+ libmesa_util \
+ libmesa_loader \
+
+include $(GALLIUM_COMMON_MK)
+include $(BUILD_SHARED_LIBRARY)
diff --git a/src/gallium/winsys/sw/dri/Android.mk b/src/gallium/winsys/sw/dri/Android.mk
new file mode 100644
index 0000000..72fb920
--- /dev/null
+++ b/src/gallium/winsys/sw/dri/Android.mk
@@ -0,0 +1,35 @@
+# Mesa 3-D graphics library
+#
+# Copyright (C) 2015 Chih-Wei Huang <***@linux.org.tw>
+# Copyright (C) 2015 Android-x86 Open Source Project
+#
+# 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)
+
+include $(LOCAL_PATH)/Makefile.sources
+
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := $(C_SOURCES)
+
+LOCAL_MODULE := libmesa_winsys_sw_dri
+
+include $(GALLIUM_COMMON_MK)
+include $(BUILD_STATIC_LIBRARY)
diff --git a/src/gallium/winsys/sw/kms-dri/Android.mk b/src/gallium/winsys/sw/kms-dri/Android.mk
new file mode 100644
index 0000000..b065242
--- /dev/null
+++ b/src/gallium/winsys/sw/kms-dri/Android.mk
@@ -0,0 +1,37 @@
+# Mesa 3-D graphics library
+#
+# Copyright (C) 2015 Chih-Wei Huang <***@linux.org.tw>
+# Copyright (C) 2015 Android-x86 Open Source Project
+#
+# 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)
+
+include $(LOCAL_PATH)/Makefile.sources
+
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := $(C_SOURCES)
+
+LOCAL_MODULE := libmesa_winsys_sw_kms_dri
+
+LOCAL_SHARED_LIBRARIES := libdrm
+
+include $(GALLIUM_COMMON_MK)
+include $(BUILD_STATIC_LIBRARY)
--
1.9.1
Chih-Wei Huang
2015-05-20 03:25:32 UTC
Permalink
Signed-off-by: Chih-Wei Huang <***@linux.org.tw>
---
src/egl/main/eglconfig.h | 2 ++
1 file changed, 2 insertions(+)

diff --git a/src/egl/main/eglconfig.h b/src/egl/main/eglconfig.h
index 84cb227..7121b3d 100644
--- a/src/egl/main/eglconfig.h
+++ b/src/egl/main/eglconfig.h
@@ -86,6 +86,7 @@ struct _egl_config

/* extensions */
EGLint YInvertedNOK;
+ EGLint RecordableAndroid;
};


@@ -133,6 +134,7 @@ _eglOffsetOfConfig(EGLint attr)
ATTRIB_MAP(EGL_CONFORMANT, Conformant);
/* extensions */
ATTRIB_MAP(EGL_Y_INVERTED_NOK, YInvertedNOK);
+ ATTRIB_MAP(EGL_RECORDABLE_ANDROID, RecordableAndroid);
#undef ATTRIB_MAP
default:
return -1;
--
1.9.1
Eric Anholt
2015-06-08 20:17:22 UTC
Permalink
Post by Chih-Wei Huang
---
src/egl/main/eglconfig.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/egl/main/eglconfig.h b/src/egl/main/eglconfig.h
index 84cb227..7121b3d 100644
--- a/src/egl/main/eglconfig.h
+++ b/src/egl/main/eglconfig.h
@@ -86,6 +86,7 @@ struct _egl_config
/* extensions */
EGLint YInvertedNOK;
+ EGLint RecordableAndroid;
};
@@ -133,6 +134,7 @@ _eglOffsetOfConfig(EGLint attr)
ATTRIB_MAP(EGL_CONFORMANT, Conformant);
/* extensions */
ATTRIB_MAP(EGL_Y_INVERTED_NOK, YInvertedNOK);
+ ATTRIB_MAP(EGL_RECORDABLE_ANDROID, RecordableAndroid);
#undef ATTRIB_MAP
return -1;
This should be associated with exposing the EGL_ANDROID_recordable
extension, right?
Chih-Wei Huang
2015-06-19 16:54:24 UTC
Permalink
Post by Eric Anholt
Post by Chih-Wei Huang
---
src/egl/main/eglconfig.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/egl/main/eglconfig.h b/src/egl/main/eglconfig.h
index 84cb227..7121b3d 100644
--- a/src/egl/main/eglconfig.h
+++ b/src/egl/main/eglconfig.h
@@ -86,6 +86,7 @@ struct _egl_config
/* extensions */
EGLint YInvertedNOK;
+ EGLint RecordableAndroid;
};
@@ -133,6 +134,7 @@ _eglOffsetOfConfig(EGLint attr)
ATTRIB_MAP(EGL_CONFORMANT, Conformant);
/* extensions */
ATTRIB_MAP(EGL_Y_INVERTED_NOK, YInvertedNOK);
+ ATTRIB_MAP(EGL_RECORDABLE_ANDROID, RecordableAndroid);
#undef ATTRIB_MAP
return -1;
This should be associated with exposing the EGL_ANDROID_recordable
extension, right?
Sorry for reply late.
I just sent an update patch.
But not sure if it's what you expect.
--
Chih-Wei
Android-x86 project
http://www.android-x86.org
Chih-Wei Huang
2015-05-20 03:25:33 UTC
Permalink
Use the pre-defined macro es-gen to generate new added files
instead of writing new rules manually. The handmade rules
that may generate the files before the directory is created
result in such an error:

/bin/bash: out/target/product/x86/gen/STATIC_LIBRARIES/libmesa_st_mesa_intermediates/main/format_pack.c: No such file or directory
make: *** [out/target/product/x86/gen/STATIC_LIBRARIES/libmesa_st_mesa_intermediates/main/format_pack.c] Error 1

Signed-off-by: Chih-Wei Huang <***@linux.org.tw>
---
src/mesa/Android.gen.mk | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/src/mesa/Android.gen.mk b/src/mesa/Android.gen.mk
index cc97954..145f259 100644
--- a/src/mesa/Android.gen.mk
+++ b/src/mesa/Android.gen.mk
@@ -115,9 +115,11 @@ $(intermediates)/main/api_exec.c: $(dispatch_deps)

GET_HASH_GEN := $(LOCAL_PATH)/main/get_hash_generator.py

+$(intermediates)/main/get_hash.h: PRIVATE_SCRIPT := $(MESA_PYTHON2) $(GET_HASH_GEN)
+$(intermediates)/main/get_hash.h: PRIVATE_XML := -f $(glapi)/gl_and_es_API.xml
$(intermediates)/main/get_hash.h: $(glapi)/gl_and_es_API.xml \
$(LOCAL_PATH)/main/get_hash_params.py $(GET_HASH_GEN)
- @$(MESA_PYTHON2) $(GET_HASH_GEN) -f $< > $@
+ $(call es-gen)

FORMAT_INFO := $(LOCAL_PATH)/main/format_info.py
format_info_deps := \
@@ -125,8 +127,10 @@ format_info_deps := \
$(LOCAL_PATH)/main/format_parser.py \
$(FORMAT_INFO)

+$(intermediates)/main/format_info.h: PRIVATE_SCRIPT := $(MESA_PYTHON2) $(FORMAT_INFO)
+$(intermediates)/main/format_info.h: PRIVATE_XML :=
$(intermediates)/main/format_info.h: $(format_info_deps)
- @$(MESA_PYTHON2) $(FORMAT_INFO) $< > $@
+ $(call es-gen, $<)

FORMAT_PACK := $(LOCAL_PATH)/main/format_pack.py
format_pack_deps := \
@@ -134,8 +138,10 @@ format_pack_deps := \
$(LOCAL_PATH)/main/format_parser.py \
$(FORMAT_PACK)

+$(intermediates)/main/format_pack.c: PRIVATE_SCRIPT := $(MESA_PYTHON2) $(FORMAT_PACK)
+$(intermediates)/main/format_pack.c: PRIVATE_XML :=
$(intermediates)/main/format_pack.c: $(format_pack_deps)
- $(hide) $(MESA_PYTHON2) $(FORMAT_PACK) $< > $@
+ $(call es-gen, $<)

FORMAT_UNPACK := $(LOCAL_PATH)/main/format_unpack.py
format_unpack_deps := \
@@ -143,5 +149,7 @@ format_unpack_deps := \
$(LOCAL_PATH)/main/format_parser.py \
$(FORMAT_UNPACK)

+$(intermediates)/main/format_unpack.c: PRIVATE_SCRIPT := $(MESA_PYTHON2) $(FORMAT_UNPACK)
+$(intermediates)/main/format_unpack.c: PRIVATE_XML :=
$(intermediates)/main/format_unpack.c: $(format_unpack_deps)
- $(hide) $(MESA_PYTHON2) $(FORMAT_UNPACK) $< > $@
+ $(call es-gen, $<)
--
1.9.1
Chih-Wei Huang
2015-05-20 03:25:34 UTC
Permalink
Based on the nice work of Paulo Sergio Travaglia <***@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 <***@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
Chih-Wei Huang
2015-05-20 03:25:35 UTC
Permalink
The gallium debugging helpers have defined the assert macro.
It causes some errors when build with Android stlport.

To workaround it, do not include assert.h if the assert macro
has been defined.

Signed-off-by: Chih-Wei Huang <***@linux.org.tw>
---
src/util/list.h | 2 ++
1 file changed, 2 insertions(+)

diff --git a/src/util/list.h b/src/util/list.h
index 9460347..0ba883a 100644
--- a/src/util/list.h
+++ b/src/util/list.h
@@ -40,7 +40,9 @@

#include <stdbool.h>
#include <stddef.h>
+#ifndef assert
#include <assert.h>
+#endif


struct list_head
--
1.9.1
Chih-Wei Huang
2015-05-20 03:25:38 UTC
Permalink
The stlport uses std::tr1::unordered_set instead of std::unordered_set.
Besides, std::isfinite has to be exported.

Determine whether to build with lollipop libcxx or stlport.

Signed-off-by: Chih-Wei Huang <***@linux.org.tw>
---
src/gallium/drivers/nouveau/codegen/nv50_ir.h | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir.h b/src/gallium/drivers/nouveau/codegen/nv50_ir.h
index f8316f7..2bfc792 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir.h
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir.h
@@ -31,8 +31,13 @@
#include <vector>
#if __cplusplus >= 201103L
#include <unordered_set>
+#ifdef _USING_LIBCXX
typedef std::unordered_set<void *> voidptr_unordered_set;
#else
+typedef std::tr1::unordered_set<void *> voidptr_unordered_set;
+using std::isfinite;
+#endif
+#else
#include <tr1/unordered_set>
typedef std::tr1::unordered_set<void *> voidptr_unordered_set;
#endif
--
1.9.1
Chih-Wei Huang
2015-05-20 03:25:36 UTC
Permalink
Instead of using unordered_set<user-defined-type *> directly, the patch
changes to use unordered_set<void *> and adds a wrapper template class
to convert the iterators to the expected user-defined type.

This avoid instantiating the template multiple times and make the object
code be smaller about 4KB.

Signed-off-by: Chih-Wei Huang <***@linux.org.tw>
---
src/gallium/drivers/nouveau/codegen/nv50_ir.h | 28 +++++++++++++++++++---
.../nouveau/codegen/nv50_ir_lowering_nvc0.cpp | 4 ++--
.../nouveau/codegen/nv50_ir_lowering_nvc0.h | 4 +---
src/gallium/drivers/nouveau/codegen/nv50_ir_ra.cpp | 5 ++--
4 files changed, 30 insertions(+), 11 deletions(-)

diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir.h b/src/gallium/drivers/nouveau/codegen/nv50_ir.h
index 529dcb9..f4d52b7 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir.h
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir.h
@@ -451,6 +451,28 @@ struct Storage
#define NV50_IR_INTERP_OFFSET (2 << 2)
#define NV50_IR_INTERP_SAMPLEID (3 << 2)

+typedef std::tr1::unordered_set<void *> voidptr_unordered_set;
+
+template <typename V>
+class ptr_unordered_set : public voidptr_unordered_set {
+ public:
+ typedef voidptr_unordered_set _base;
+ typedef _base::iterator _biterator;
+
+ class iterator : public _biterator {
+ public:
+ iterator(const _biterator & i) : _biterator(i) {}
+ V *operator*() { return reinterpret_cast<V *>(*_biterator(*this)); }
+ const V *operator*() const { return reinterpret_cast<const V *>(*_biterator(*this)); }
+ };
+ typedef const iterator const_iterator;
+
+ iterator begin() { return _base::begin(); }
+ iterator end() { return _base::end(); }
+ const_iterator begin() const { return _base::begin(); }
+ const_iterator end() const { return _base::end(); }
+};
+
// do we really want this to be a class ?
class Modifier
{
@@ -583,10 +605,10 @@ public:

static inline Value *get(Iterator&);

- std::tr1::unordered_set<ValueRef *> uses;
+ ptr_unordered_set<ValueRef> uses;
std::list<ValueDef *> defs;
- typedef std::tr1::unordered_set<ValueRef *>::iterator UseIterator;
- typedef std::tr1::unordered_set<ValueRef *>::const_iterator UseCIterator;
+ typedef ptr_unordered_set<ValueRef>::iterator UseIterator;
+ typedef ptr_unordered_set<ValueRef>::const_iterator UseCIterator;
typedef std::list<ValueDef *>::iterator DefIterator;
typedef std::list<ValueDef *>::const_iterator DefCIterator;

diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.cpp
index b61f3c4..669d292 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.cpp
@@ -224,7 +224,7 @@ NVC0LegalizePostRA::findFirstUses(
const Instruction *texi,
const Instruction *insn,
std::list<TexUse> &uses,
- std::tr1::unordered_set<const Instruction *>& visited)
+ ptr_unordered_set<const Instruction>& visited)
{
for (int d = 0; insn->defExists(d); ++d) {
Value *v = insn->getDef(d);
@@ -318,7 +318,7 @@ NVC0LegalizePostRA::insertTextureBarriers(Function *fn)
if (!uses)
return false;
for (size_t i = 0; i < texes.size(); ++i) {
- std::tr1::unordered_set<const Instruction *> visited;
+ ptr_unordered_set<const Instruction> visited;
findFirstUses(texes[i], texes[i], uses[i], visited);
}

diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.h b/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.h
index 260e101..17b6f6f 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.h
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.h
@@ -20,8 +20,6 @@
* OTHER DEALINGS IN THE SOFTWARE.
*/

-#include <tr1/unordered_set>
-
#include "codegen/nv50_ir.h"
#include "codegen/nv50_ir_build_util.h"

@@ -73,7 +71,7 @@ private:
inline bool insnDominatedBy(const Instruction *, const Instruction *) const;
void findFirstUses(const Instruction *tex, const Instruction *def,
std::list<TexUse>&,
- std::tr1::unordered_set<const Instruction *>&);
+ ptr_unordered_set<const Instruction>&);
void findOverwritingDefs(const Instruction *tex, Instruction *insn,
const BasicBlock *term,
std::list<TexUse>&);
diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_ra.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_ra.cpp
index 898653c..03acba7 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_ra.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_ra.cpp
@@ -25,7 +25,6 @@

#include <stack>
#include <limits>
-#include <tr1/unordered_set>

namespace nv50_ir {

@@ -1551,7 +1550,7 @@ SpillCodeInserter::run(const std::list<ValuePair>& lst)
// Keep track of which instructions to delete later. Deleting them
// inside the loop is unsafe since a single instruction may have
// multiple destinations that all need to be spilled (like OP_SPLIT).
- std::tr1::unordered_set<Instruction *> to_del;
+ ptr_unordered_set<Instruction> to_del;

for (Value::DefIterator d = lval->defs.begin(); d != lval->defs.end();
++d) {
@@ -1593,7 +1592,7 @@ SpillCodeInserter::run(const std::list<ValuePair>& lst)
}
}

- for (std::tr1::unordered_set<Instruction *>::const_iterator it = to_del.begin();
+ for (ptr_unordered_set<Instruction>::iterator it = to_del.begin();
it != to_del.end(); ++it)
delete_Instruction(func->getProgram(), *it);
}
--
1.9.1
Ilia Mirkin
2015-05-20 03:30:26 UTC
Permalink
Francisco, any opinion on this patch (as the resident C++ expert)? It
seems a little odd. I'd just as soon skip this, and just use "using
std::tr1::unordered_set" or "using std::unordered_set" as necessary in
the next patch. But perhaps this is a common technique?

On Tue, May 19, 2015 at 11:25 PM, Chih-Wei Huang
Post by Chih-Wei Huang
Instead of using unordered_set<user-defined-type *> directly, the patch
changes to use unordered_set<void *> and adds a wrapper template class
to convert the iterators to the expected user-defined type.
This avoid instantiating the template multiple times and make the object
code be smaller about 4KB.
---
src/gallium/drivers/nouveau/codegen/nv50_ir.h | 28 +++++++++++++++++++---
.../nouveau/codegen/nv50_ir_lowering_nvc0.cpp | 4 ++--
.../nouveau/codegen/nv50_ir_lowering_nvc0.h | 4 +---
src/gallium/drivers/nouveau/codegen/nv50_ir_ra.cpp | 5 ++--
4 files changed, 30 insertions(+), 11 deletions(-)
diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir.h b/src/gallium/drivers/nouveau/codegen/nv50_ir.h
index 529dcb9..f4d52b7 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir.h
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir.h
@@ -451,6 +451,28 @@ struct Storage
#define NV50_IR_INTERP_OFFSET (2 << 2)
#define NV50_IR_INTERP_SAMPLEID (3 << 2)
+typedef std::tr1::unordered_set<void *> voidptr_unordered_set;
+
+template <typename V>
+class ptr_unordered_set : public voidptr_unordered_set {
+ typedef voidptr_unordered_set _base;
+ typedef _base::iterator _biterator;
+
+ class iterator : public _biterator {
+ iterator(const _biterator & i) : _biterator(i) {}
+ V *operator*() { return reinterpret_cast<V *>(*_biterator(*this)); }
+ const V *operator*() const { return reinterpret_cast<const V *>(*_biterator(*this)); }
+ };
+ typedef const iterator const_iterator;
+
+ iterator begin() { return _base::begin(); }
+ iterator end() { return _base::end(); }
+ const_iterator begin() const { return _base::begin(); }
+ const_iterator end() const { return _base::end(); }
+};
+
// do we really want this to be a class ?
class Modifier
{
static inline Value *get(Iterator&);
- std::tr1::unordered_set<ValueRef *> uses;
+ ptr_unordered_set<ValueRef> uses;
std::list<ValueDef *> defs;
- typedef std::tr1::unordered_set<ValueRef *>::iterator UseIterator;
- typedef std::tr1::unordered_set<ValueRef *>::const_iterator UseCIterator;
+ typedef ptr_unordered_set<ValueRef>::iterator UseIterator;
+ typedef ptr_unordered_set<ValueRef>::const_iterator UseCIterator;
typedef std::list<ValueDef *>::iterator DefIterator;
typedef std::list<ValueDef *>::const_iterator DefCIterator;
diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.cpp
index b61f3c4..669d292 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.cpp
@@ -224,7 +224,7 @@ NVC0LegalizePostRA::findFirstUses(
const Instruction *texi,
const Instruction *insn,
std::list<TexUse> &uses,
- std::tr1::unordered_set<const Instruction *>& visited)
+ ptr_unordered_set<const Instruction>& visited)
{
for (int d = 0; insn->defExists(d); ++d) {
Value *v = insn->getDef(d);
@@ -318,7 +318,7 @@ NVC0LegalizePostRA::insertTextureBarriers(Function *fn)
if (!uses)
return false;
for (size_t i = 0; i < texes.size(); ++i) {
- std::tr1::unordered_set<const Instruction *> visited;
+ ptr_unordered_set<const Instruction> visited;
findFirstUses(texes[i], texes[i], uses[i], visited);
}
diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.h b/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.h
index 260e101..17b6f6f 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.h
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.h
@@ -20,8 +20,6 @@
* OTHER DEALINGS IN THE SOFTWARE.
*/
-#include <tr1/unordered_set>
-
#include "codegen/nv50_ir.h"
#include "codegen/nv50_ir_build_util.h"
inline bool insnDominatedBy(const Instruction *, const Instruction *) const;
void findFirstUses(const Instruction *tex, const Instruction *def,
std::list<TexUse>&,
- std::tr1::unordered_set<const Instruction *>&);
+ ptr_unordered_set<const Instruction>&);
void findOverwritingDefs(const Instruction *tex, Instruction *insn,
const BasicBlock *term,
std::list<TexUse>&);
diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_ra.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_ra.cpp
index 898653c..03acba7 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_ra.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_ra.cpp
@@ -25,7 +25,6 @@
#include <stack>
#include <limits>
-#include <tr1/unordered_set>
namespace nv50_ir {
@@ -1551,7 +1550,7 @@ SpillCodeInserter::run(const std::list<ValuePair>& lst)
// Keep track of which instructions to delete later. Deleting them
// inside the loop is unsafe since a single instruction may have
// multiple destinations that all need to be spilled (like OP_SPLIT).
- std::tr1::unordered_set<Instruction *> to_del;
+ ptr_unordered_set<Instruction> to_del;
for (Value::DefIterator d = lval->defs.begin(); d != lval->defs.end();
++d) {
@@ -1593,7 +1592,7 @@ SpillCodeInserter::run(const std::list<ValuePair>& lst)
}
}
- for (std::tr1::unordered_set<Instruction *>::const_iterator it = to_del.begin();
+ for (ptr_unordered_set<Instruction>::iterator it = to_del.begin();
it != to_del.end(); ++it)
delete_Instruction(func->getProgram(), *it);
}
--
1.9.1
_______________________________________________
mesa-dev mailing list
http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Petri Latvala
2015-05-20 08:35:57 UTC
Permalink
Post by Chih-Wei Huang
+ typedef const iterator const_iterator;
+
This at least is wrong. A const iterator allows *iter = val, a
const_iterator doesn't. A const_iterator allows ++, a const iterator
doesn't.
--
Petri Latvala
Chih-Wei Huang
2015-05-21 02:18:24 UTC
Permalink
Post by Petri Latvala
Post by Chih-Wei Huang
+ typedef const iterator const_iterator;
+
This at least is wrong. A const iterator allows *iter = val, a
const_iterator doesn't. A const_iterator allows ++, a const iterator
doesn't.
You're right. Thank you!
The const_iterator should be derived from _base::const_iterator.

After review the code again, the unordered_set::const_iterator is not
used except in Value::UseCIterator, but the latter is not used, either.
So I think it's safe to remove it at all.
--
Chih-Wei
Android-x86 project
http://www.android-x86.org
Francisco Jerez
2015-05-20 13:52:15 UTC
Permalink
Post by Ilia Mirkin
Francisco, any opinion on this patch (as the resident C++ expert)? It
seems a little odd. I'd just as soon skip this, and just use "using
std::tr1::unordered_set" or "using std::unordered_set" as necessary in
the next patch. But perhaps this is a common technique?
This seems really ugly to me. I've given the patch a try and the single
instantiation that this patch saves is some 2.7 kB of the binary, some
0.1% of the size of nouveau_compiler alone and 0.03% of the size of the
DRI driver with my configuration. IMHO the tiny saving in disk space
hardly justifies the additional complexity and giving up the type-safe
interface provided by the STL (except for the begin() and end() methods
you have overridden with correct types, which is a tiny fraction of the
unordered_set interface).

If this is required for compatibility reasons with old Android systems I
suggest you wrap it under a preprocessor conditional like:

#if __cplusplus >= 201103L
using std::unordered_set;
#elif building-on-old-android-version-with-broken-stlport
using my-funky-wrapper-for-std-unordered-set;
#else
using std::tr1::unordered_set;
#endif
Post by Ilia Mirkin
On Tue, May 19, 2015 at 11:25 PM, Chih-Wei Huang
Post by Chih-Wei Huang
Instead of using unordered_set<user-defined-type *> directly, the patch
changes to use unordered_set<void *> and adds a wrapper template class
to convert the iterators to the expected user-defined type.
This avoid instantiating the template multiple times and make the object
code be smaller about 4KB.
---
src/gallium/drivers/nouveau/codegen/nv50_ir.h | 28 +++++++++++++++++++---
.../nouveau/codegen/nv50_ir_lowering_nvc0.cpp | 4 ++--
.../nouveau/codegen/nv50_ir_lowering_nvc0.h | 4 +---
src/gallium/drivers/nouveau/codegen/nv50_ir_ra.cpp | 5 ++--
4 files changed, 30 insertions(+), 11 deletions(-)
diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir.h b/src/gallium/drivers/nouveau/codegen/nv50_ir.h
index 529dcb9..f4d52b7 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir.h
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir.h
@@ -451,6 +451,28 @@ struct Storage
#define NV50_IR_INTERP_OFFSET (2 << 2)
#define NV50_IR_INTERP_SAMPLEID (3 << 2)
+typedef std::tr1::unordered_set<void *> voidptr_unordered_set;
+
+template <typename V>
+class ptr_unordered_set : public voidptr_unordered_set {
+ typedef voidptr_unordered_set _base;
+ typedef _base::iterator _biterator;
+
+ class iterator : public _biterator {
+ iterator(const _biterator & i) : _biterator(i) {}
+ V *operator*() { return reinterpret_cast<V *>(*_biterator(*this)); }
+ const V *operator*() const { return reinterpret_cast<const V *>(*_biterator(*this)); }
+ };
+ typedef const iterator const_iterator;
+
+ iterator begin() { return _base::begin(); }
+ iterator end() { return _base::end(); }
+ const_iterator begin() const { return _base::begin(); }
+ const_iterator end() const { return _base::end(); }
+};
+
// do we really want this to be a class ?
class Modifier
{
static inline Value *get(Iterator&);
- std::tr1::unordered_set<ValueRef *> uses;
+ ptr_unordered_set<ValueRef> uses;
std::list<ValueDef *> defs;
- typedef std::tr1::unordered_set<ValueRef *>::iterator UseIterator;
- typedef std::tr1::unordered_set<ValueRef *>::const_iterator UseCIterator;
+ typedef ptr_unordered_set<ValueRef>::iterator UseIterator;
+ typedef ptr_unordered_set<ValueRef>::const_iterator UseCIterator;
typedef std::list<ValueDef *>::iterator DefIterator;
typedef std::list<ValueDef *>::const_iterator DefCIterator;
diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.cpp
index b61f3c4..669d292 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.cpp
@@ -224,7 +224,7 @@ NVC0LegalizePostRA::findFirstUses(
const Instruction *texi,
const Instruction *insn,
std::list<TexUse> &uses,
- std::tr1::unordered_set<const Instruction *>& visited)
+ ptr_unordered_set<const Instruction>& visited)
{
for (int d = 0; insn->defExists(d); ++d) {
Value *v = insn->getDef(d);
@@ -318,7 +318,7 @@ NVC0LegalizePostRA::insertTextureBarriers(Function *fn)
if (!uses)
return false;
for (size_t i = 0; i < texes.size(); ++i) {
- std::tr1::unordered_set<const Instruction *> visited;
+ ptr_unordered_set<const Instruction> visited;
findFirstUses(texes[i], texes[i], uses[i], visited);
}
diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.h b/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.h
index 260e101..17b6f6f 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.h
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.h
@@ -20,8 +20,6 @@
* OTHER DEALINGS IN THE SOFTWARE.
*/
-#include <tr1/unordered_set>
-
#include "codegen/nv50_ir.h"
#include "codegen/nv50_ir_build_util.h"
inline bool insnDominatedBy(const Instruction *, const Instruction *) const;
void findFirstUses(const Instruction *tex, const Instruction *def,
std::list<TexUse>&,
- std::tr1::unordered_set<const Instruction *>&);
+ ptr_unordered_set<const Instruction>&);
void findOverwritingDefs(const Instruction *tex, Instruction *insn,
const BasicBlock *term,
std::list<TexUse>&);
diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_ra.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_ra.cpp
index 898653c..03acba7 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_ra.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_ra.cpp
@@ -25,7 +25,6 @@
#include <stack>
#include <limits>
-#include <tr1/unordered_set>
namespace nv50_ir {
@@ -1551,7 +1550,7 @@ SpillCodeInserter::run(const std::list<ValuePair>& lst)
// Keep track of which instructions to delete later. Deleting them
// inside the loop is unsafe since a single instruction may have
// multiple destinations that all need to be spilled (like OP_SPLIT).
- std::tr1::unordered_set<Instruction *> to_del;
+ ptr_unordered_set<Instruction> to_del;
for (Value::DefIterator d = lval->defs.begin(); d != lval->defs.end();
++d) {
@@ -1593,7 +1592,7 @@ SpillCodeInserter::run(const std::list<ValuePair>& lst)
}
}
- for (std::tr1::unordered_set<Instruction *>::const_iterator it = to_del.begin();
+ for (ptr_unordered_set<Instruction>::iterator it = to_del.begin();
it != to_del.end(); ++it)
delete_Instruction(func->getProgram(), *it);
}
--
1.9.1
_______________________________________________
mesa-dev mailing list
http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Ilia Mirkin
2015-05-20 16:10:58 UTC
Permalink
Post by Francisco Jerez
Post by Ilia Mirkin
Francisco, any opinion on this patch (as the resident C++ expert)? It
seems a little odd. I'd just as soon skip this, and just use "using
std::tr1::unordered_set" or "using std::unordered_set" as necessary in
the next patch. But perhaps this is a common technique?
This seems really ugly to me. I've given the patch a try and the single
instantiation that this patch saves is some 2.7 kB of the binary, some
0.1% of the size of nouveau_compiler alone and 0.03% of the size of the
DRI driver with my configuration. IMHO the tiny saving in disk space
hardly justifies the additional complexity and giving up the type-safe
interface provided by the STL (except for the begin() and end() methods
you have overridden with correct types, which is a tiny fraction of the
unordered_set interface).
Thanks for confirming what I suspected -- this isn't a common way to
do things, and is not hugely beneficial (otherwise it'd be a common
way to do things, and/or the stl impl would do something clever to get
this sort of effect).
Post by Francisco Jerez
If this is required for compatibility reasons with old Android systems I
#if __cplusplus >= 201103L
using std::unordered_set;
#elif building-on-old-android-version-with-broken-stlport
using my-funky-wrapper-for-std-unordered-set;
#else
using std::tr1::unordered_set;
#endif
Chih-Wei, I think this is the right way to go as well. Could you
rework your nv50/ir patches into one that does it this way? Sounds
like the "#elif funky-wrapper" bit isn't actually needed anymore
either, as you're going with a C++11-only approach?

Cheers,

-ilia
Chih-Wei Huang
2015-06-19 16:51:36 UTC
Permalink
Post by Ilia Mirkin
Post by Francisco Jerez
If this is required for compatibility reasons with old Android systems I
#if __cplusplus >= 201103L
using std::unordered_set;
#elif building-on-old-android-version-with-broken-stlport
using my-funky-wrapper-for-std-unordered-set;
#else
using std::tr1::unordered_set;
#endif
Chih-Wei, I think this is the right way to go as well. Could you
rework your nv50/ir patches into one that does it this way? Sounds
like the "#elif funky-wrapper" bit isn't actually needed anymore
either, as you're going with a C++11-only approach?
Sorry for not update in time.
I'm too busy recently.

Just sent the updated patch as Ilia's suggestion.
Thank you for all the comments.
--
Chih-Wei
Android-x86 project
http://www.android-x86.org
Chih-Wei Huang
2015-05-20 03:25:37 UTC
Permalink
If build with C++11 standard, use std::unordered_set
instead of std::tr1::unordered_set.

Signed-off-by: Chih-Wei Huang <***@linux.org.tw>
---
Android.common.mk | 1 +
src/gallium/auxiliary/Android.mk | 2 --
src/gallium/drivers/nouveau/codegen/nv50_ir.h | 8 ++++++--
3 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/Android.common.mk b/Android.common.mk
index 43766bf..45474ee 100644
--- a/Android.common.mk
+++ b/Android.common.mk
@@ -77,6 +77,7 @@ LOCAL_CFLAGS += \
endif

LOCAL_CPPFLAGS += \
+ -std=c++11 \
-Wno-error=non-virtual-dtor \
-Wno-non-virtual-dtor

diff --git a/src/gallium/auxiliary/Android.mk b/src/gallium/auxiliary/Android.mk
index 2d91752..4a914ab 100644
--- a/src/gallium/auxiliary/Android.mk
+++ b/src/gallium/auxiliary/Android.mk
@@ -39,8 +39,6 @@ ifeq ($(MESA_ENABLE_LLVM),true)
LOCAL_SRC_FILES += \
$(GALLIVM_SOURCES) \
$(GALLIVM_CPP_SOURCES)
-
-LOCAL_CPPFLAGS := -std=c++11
endif

LOCAL_MODULE := libmesa_gallium
diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir.h b/src/gallium/drivers/nouveau/codegen/nv50_ir.h
index f4d52b7..f8316f7 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir.h
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir.h
@@ -29,7 +29,13 @@
#include <deque>
#include <list>
#include <vector>
+#if __cplusplus >= 201103L
+#include <unordered_set>
+typedef std::unordered_set<void *> voidptr_unordered_set;
+#else
#include <tr1/unordered_set>
+typedef std::tr1::unordered_set<void *> voidptr_unordered_set;
+#endif

#include "codegen/nv50_ir_util.h"
#include "codegen/nv50_ir_graph.h"
@@ -451,8 +457,6 @@ struct Storage
#define NV50_IR_INTERP_OFFSET (2 << 2)
#define NV50_IR_INTERP_SAMPLEID (3 << 2)

-typedef std::tr1::unordered_set<void *> voidptr_unordered_set;
-
template <typename V>
class ptr_unordered_set : public voidptr_unordered_set {
public:
--
1.9.1
Chih-Wei Huang
2015-05-20 03:25:31 UTC
Permalink
Most of the rules for the gallium drivers has been moved to
src/gallium/targets/dri/Android.mk.

Signed-off-by: Chih-Wei Huang <***@linux.org.tw>
---
src/egl/main/Android.mk | 75 +------------------------------------------------
1 file changed, 1 insertion(+), 74 deletions(-)

diff --git a/src/egl/main/Android.mk b/src/egl/main/Android.mk
index 27d0b18..8f687e9 100644
--- a/src/egl/main/Android.mk
+++ b/src/egl/main/Android.mk
@@ -43,8 +43,6 @@ LOCAL_CFLAGS := \
-D_EGL_DRIVER_SEARCH_DIR=\"/system/lib/egl\" \
-D_EGL_OS_UNIX=1

-LOCAL_STATIC_LIBRARIES :=
-
LOCAL_SHARED_LIBRARIES := \
libglapi \
libdl \
@@ -63,7 +61,6 @@ LOCAL_SHARED_LIBRARIES += libdrm
endif

LOCAL_CFLAGS += -D_EGL_BUILT_IN_DRIVER_DRI2
-LOCAL_STATIC_LIBRARIES += libmesa_egl_dri2

ifeq ($(strip $(MESA_BUILD_CLASSIC)),true)
# require i915_dri and/or i965_dri
@@ -72,81 +69,11 @@ LOCAL_REQUIRED_MODULES += \
endif # MESA_BUILD_CLASSIC

ifeq ($(strip $(MESA_BUILD_GALLIUM)),true)
-
-gallium_DRIVERS :=
-
-# freedreno
-ifneq ($(filter freedreno, $(MESA_GPU_DRIVERS)),)
-gallium_DRIVERS += libmesa_winsys_freedreno libmesa_pipe_freedreno
-LOCAL_SHARED_LIBRARIES += libdrm_freedreno
-endif
-
-# i915g
-ifneq ($(filter i915g, $(MESA_GPU_DRIVERS)),)
-gallium_DRIVERS += libmesa_winsys_i915 libmesa_pipe_i915
-LOCAL_SHARED_LIBRARIES += libdrm_intel
-endif
-
-# ilo
-ifneq ($(filter ilo, $(MESA_GPU_DRIVERS)),)
-gallium_DRIVERS += libmesa_winsys_intel libmesa_pipe_ilo
-LOCAL_SHARED_LIBRARIES += libdrm_intel
-endif
-
-# nouveau
-ifneq ($(filter nouveau, $(MESA_GPU_DRIVERS)),)
-gallium_DRIVERS += libmesa_winsys_nouveau libmesa_pipe_nouveau
-LOCAL_SHARED_LIBRARIES += libdrm_nouveau
-LOCAL_SHARED_LIBRARIES += libstlport
-endif
-
-# r300g/r600g/radeonsi
-ifneq ($(filter r300g r600g radeonsi, $(MESA_GPU_DRIVERS)),)
-gallium_DRIVERS += libmesa_winsys_radeon
-LOCAL_SHARED_LIBRARIES += libdrm_radeon
-ifneq ($(filter r300g, $(MESA_GPU_DRIVERS)),)
-gallium_DRIVERS += libmesa_pipe_r300
-endif # r300g
-ifneq ($(filter r600g radeonsi, $(MESA_GPU_DRIVERS)),)
-ifneq ($(filter r600g, $(MESA_GPU_DRIVERS)),)
-gallium_DRIVERS += libmesa_pipe_r600
-LOCAL_SHARED_LIBRARIES += libstlport
-endif # r600g
-ifneq ($(filter radeonsi, $(MESA_GPU_DRIVERS)),)
-gallium_DRIVERS += libmesa_pipe_radeonsi
-endif # radeonsi
-gallium_DRIVERS += libmesa_pipe_radeon
-endif # r600g || radeonsi
-endif # r300g || r600g || radeonsi
-
-# vmwgfx
-ifneq ($(filter vmwgfx, $(MESA_GPU_DRIVERS)),)
-gallium_DRIVERS += libmesa_winsys_svga libmesa_pipe_svga
-endif
-
-#
-# Notes about the order here:
-#
-# * libmesa_st_egl depends on libmesa_winsys_sw_android in $(gallium_DRIVERS)
-# * libmesa_pipe_r300 in $(gallium_DRIVERS) depends on libmesa_st_mesa and
-# libmesa_glsl
-# * libmesa_st_mesa depends on libmesa_glsl
-# * libmesa_glsl depends on libmesa_glsl_utils
-#
-LOCAL_STATIC_LIBRARIES := \
- $(gallium_DRIVERS) \
- libmesa_st_mesa \
- libmesa_util \
- libmesa_glsl \
- libmesa_glsl_utils \
- libmesa_gallium \
- $(LOCAL_STATIC_LIBRARIES)
-
LOCAL_REQUIRED_MODULES += gallium_dri
endif # MESA_BUILD_GALLIUM

LOCAL_STATIC_LIBRARIES := \
- $(LOCAL_STATIC_LIBRARIES) \
+ libmesa_egl_dri2 \
libmesa_loader

LOCAL_MODULE := libGLES_mesa
--
1.9.1
Chih-Wei Huang
2015-05-20 03:25:39 UTC
Permalink
The libcxx introduced in android lollipop can be used to
replace stlport.

Fallback to use stlport when build with earlier android
releases.

Signed-off-by: Chih-Wei Huang <***@linux.org.tw>
---
Android.common.mk | 1 +
src/gallium/drivers/nouveau/Android.mk | 4 ++++
src/gallium/drivers/r600/Android.mk | 4 ++++
src/gallium/targets/dri/Android.mk | 3 ++-
src/glsl/Android.mk | 1 -
5 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/Android.common.mk b/Android.common.mk
index 45474ee..49a4402 100644
--- a/Android.common.mk
+++ b/Android.common.mk
@@ -78,6 +78,7 @@ endif

LOCAL_CPPFLAGS += \
-std=c++11 \
+ $(if $(filter true,$(MESA_LOLLIPOP_BUILD)),-D_USING_LIBCXX) \
-Wno-error=non-virtual-dtor \
-Wno-non-virtual-dtor

diff --git a/src/gallium/drivers/nouveau/Android.mk b/src/gallium/drivers/nouveau/Android.mk
index 420c8e5..daf3abd 100644
--- a/src/gallium/drivers/nouveau/Android.mk
+++ b/src/gallium/drivers/nouveau/Android.mk
@@ -39,6 +39,10 @@ LOCAL_SRC_FILES := \
LOCAL_SHARED_LIBRARIES := libdrm libdrm_nouveau
LOCAL_MODULE := libmesa_pipe_nouveau

+ifeq ($(MESA_LOLLIPOP_BUILD),true)
+LOCAL_C_INCLUDES := external/libcxx/include
+else
include external/stlport/libstlport.mk
+endif
include $(GALLIUM_COMMON_MK)
include $(BUILD_STATIC_LIBRARY)
diff --git a/src/gallium/drivers/r600/Android.mk b/src/gallium/drivers/r600/Android.mk
index e935759..bfe3987 100644
--- a/src/gallium/drivers/r600/Android.mk
+++ b/src/gallium/drivers/r600/Android.mk
@@ -33,6 +33,10 @@ LOCAL_SRC_FILES := $(C_SOURCES) $(CXX_SOURCES)
LOCAL_SHARED_LIBRARIES := libdrm libdrm_radeon
LOCAL_MODULE := libmesa_pipe_r600

+ifeq ($(MESA_LOLLIPOP_BUILD),true)
+LOCAL_C_INCLUDES := external/libcxx/include
+else
include external/stlport/libstlport.mk
+endif
include $(GALLIUM_COMMON_MK)
include $(BUILD_STATIC_LIBRARY)
diff --git a/src/gallium/targets/dri/Android.mk b/src/gallium/targets/dri/Android.mk
index 78f7b7c..1772d25 100644
--- a/src/gallium/targets/dri/Android.mk
+++ b/src/gallium/targets/dri/Android.mk
@@ -95,7 +95,7 @@ gallium_DRIVERS += libmesa_winsys_svga libmesa_pipe_svga
LOCAL_CFLAGS += -DGALLIUM_VMWGFX
endif
ifneq ($(filter nouveau r600g,$(MESA_GPU_DRIVERS)),)
-LOCAL_SHARED_LIBRARIES += libstlport
+LOCAL_SHARED_LIBRARIES += $(if $(filter true,$(MESA_LOLLIPOP_BUILD)),libc++,libstlport)
endif

LOCAL_STATIC_LIBRARIES := \
@@ -116,6 +116,7 @@ LOCAL_STATIC_LIBRARIES += \
libLLVMR600Info \
libLLVMR600AsmPrinter \
libelf
+LOCAL_LDLIBS += $(if $(filter true,$(MESA_LOLLIPOP_BUILD)),-lgcc)
endif

include $(GALLIUM_COMMON_MK)
diff --git a/src/glsl/Android.mk b/src/glsl/Android.mk
index f20741e..f63b7da 100644
--- a/src/glsl/Android.mk
+++ b/src/glsl/Android.mk
@@ -46,7 +46,6 @@ LOCAL_C_INCLUDES := \

LOCAL_MODULE := libmesa_glsl

-include external/stlport/libstlport.mk
include $(LOCAL_PATH)/Android.gen.mk
include $(MESA_COMMON_MK)
include $(BUILD_STATIC_LIBRARY)
--
1.9.1
Continue reading on narkive:
Loading...