[Mesa-dev] [PATCH 03/14] intel: Move definition of LOG_TAG from header into Makefiles

Chad Versace chad at kiwitree.net
Thu Sep 28 00:11:49 UTC 2017


This patch prevents compilation failures in upcoming Android Vulkan
patches, failures due to redefinition of LOG_TAG in Android system
headers.

This patch does not change the value of LOG_TAG. It remains
"INTEL-MESA". (I don't like it, though. The all-caps smells like
FORTRAN).

Only one Intel header defined LOG_TAG: gen_debug.h. I believe I defined
it correctly in all the necessary Automake and Android.mk files, but one
can never truly know when touching build systems.

This patch is ugly and too big. If someone knows a better way, please
speak up.
---
 src/intel/Android.blorp.mk            |  2 ++
 src/intel/Android.common.mk           |  2 ++
 src/intel/Android.vulkan.mk           | 21 ++++++++++++++++-----
 src/intel/Makefile.am                 |  3 ++-
 src/intel/common/gen_debug.h          |  1 -
 src/mesa/drivers/dri/i965/Android.mk  | 23 +++++++++++++----------
 src/mesa/drivers/dri/i965/Makefile.am |  1 +
 7 files changed, 36 insertions(+), 17 deletions(-)

diff --git a/src/intel/Android.blorp.mk b/src/intel/Android.blorp.mk
index e1aa908706e..0fc7e1ed090 100644
--- a/src/intel/Android.blorp.mk
+++ b/src/intel/Android.blorp.mk
@@ -31,6 +31,8 @@ LOCAL_MODULE_CLASS := STATIC_LIBRARIES
 
 LOCAL_SRC_FILES := $(BLORP_FILES)
 
+LOCAL_CFLAGS := -DLOG_TAG=\"INTEL-MESA\"
+
 LOCAL_C_INCLUDES := \
 	$(call generated-sources-dir-for,STATIC_LIBRARIES,libmesa_nir,,)/nir \
 	$(MESA_TOP)/src/gallium/auxiliary \
diff --git a/src/intel/Android.common.mk b/src/intel/Android.common.mk
index 12cea6e5472..931800a596f 100644
--- a/src/intel/Android.common.mk
+++ b/src/intel/Android.common.mk
@@ -31,6 +31,8 @@ LOCAL_MODULE_CLASS := STATIC_LIBRARIES
 
 LOCAL_SRC_FILES := $(COMMON_FILES)
 
+LOCAL_CFLAGS := -DLOG_TAG=\"INTEL-MESA\"
+
 LOCAL_C_INCLUDES := \
 	external/zlib \
 	$(MESA_TOP)/src/gallium/include \
diff --git a/src/intel/Android.vulkan.mk b/src/intel/Android.vulkan.mk
index ee98e30c355..e20b32b87c5 100644
--- a/src/intel/Android.vulkan.mk
+++ b/src/intel/Android.vulkan.mk
@@ -51,6 +51,8 @@ LOCAL_MODULE_CLASS := STATIC_LIBRARIES
 
 intermediates := $(call local-generated-sources-dir)
 
+LOCAL_CFLAGS := -DLOG_TAG=\"INTEL-MESA\"
+
 LOCAL_C_INCLUDES := \
 	$(VULKAN_COMMON_INCLUDES)
 
@@ -91,7 +93,8 @@ LOCAL_MODULE := libmesa_anv_gen7
 LOCAL_MODULE_CLASS := STATIC_LIBRARIES
 
 LOCAL_SRC_FILES := $(VULKAN_GEN7_FILES)
-LOCAL_CFLAGS := -DGEN_VERSIONx10=70
+
+LOCAL_CFLAGS := -DLOG_TAG=\"INTEL-MESA\" -DGEN_VERSIONx10=70
 
 LOCAL_C_INCLUDES := $(ANV_INCLUDES)
 
@@ -111,7 +114,8 @@ LOCAL_MODULE := libmesa_anv_gen75
 LOCAL_MODULE_CLASS := STATIC_LIBRARIES
 
 LOCAL_SRC_FILES := $(VULKAN_GEN75_FILES)
-LOCAL_CFLAGS := -DGEN_VERSIONx10=75
+
+LOCAL_CFLAGS := -DLOG_TAG=\"INTEL-MESA\" -DGEN_VERSIONx10=75
 
 LOCAL_C_INCLUDES := $(ANV_INCLUDES)
 
@@ -131,7 +135,8 @@ LOCAL_MODULE := libmesa_anv_gen8
 LOCAL_MODULE_CLASS := STATIC_LIBRARIES
 
 LOCAL_SRC_FILES := $(VULKAN_GEN8_FILES)
-LOCAL_CFLAGS := -DGEN_VERSIONx10=80
+
+LOCAL_CFLAGS := -DLOG_TAG=\"INTEL-MESA\" -DGEN_VERSIONx10=80
 
 LOCAL_C_INCLUDES := $(ANV_INCLUDES)
 
@@ -151,7 +156,8 @@ LOCAL_MODULE := libmesa_anv_gen9
 LOCAL_MODULE_CLASS := STATIC_LIBRARIES
 
 LOCAL_SRC_FILES := $(VULKAN_GEN9_FILES)
-LOCAL_CFLAGS := -DGEN_VERSIONx10=90
+
+LOCAL_CFLAGS := -DLOG_TAG=\"INTEL-MESA\" -DGEN_VERSIONx10=90
 
 LOCAL_C_INCLUDES := $(ANV_INCLUDES)
 
@@ -171,7 +177,8 @@ LOCAL_MODULE := libmesa_anv_gen10
 LOCAL_MODULE_CLASS := STATIC_LIBRARIES
 
 LOCAL_SRC_FILES := $(VULKAN_GEN10_FILES)
-LOCAL_CFLAGS := -DGEN_VERSIONx10=100
+
+LOCAL_CFLAGS := -DLOG_TAG=\"INTEL-MESA\" -DGEN_VERSIONx10=100
 
 LOCAL_C_INCLUDES := $(ANV_INCLUDES)
 
@@ -194,6 +201,8 @@ intermediates := $(call local-generated-sources-dir)
 
 LOCAL_SRC_FILES := $(VULKAN_FILES)
 
+LOCAL_CFLAGS := -DLOG_TAG=\"INTEL-MESA\"
+
 LOCAL_C_INCLUDES := \
 	$(ANV_INCLUDES) \
 	$(MESA_TOP)/src/compiler
@@ -240,6 +249,8 @@ include $(CLEAR_VARS)
 LOCAL_MODULE := libvulkan_intel
 LOCAL_MODULE_CLASS := SHARED_LIBRARIES
 
+LOCAL_CFLAGS := -DLOG_TAG=\"INTEL-MESA\"
+
 LOCAL_LDFLAGS += -Wl,--build-id=sha1
 
 LOCAL_SRC_FILES := \
diff --git a/src/intel/Makefile.am b/src/intel/Makefile.am
index a34e3014497..2872ffc1e89 100644
--- a/src/intel/Makefile.am
+++ b/src/intel/Makefile.am
@@ -40,7 +40,8 @@ AM_CPPFLAGS = \
 	-I$(top_srcdir)/src/gallium/include \
 	$(VALGRIND_CFLAGS) \
 	$(LIBDRM_CFLAGS) \
-	$(DEFINES)
+	$(DEFINES) \
+	-DLOG_TAG=\"INTEL-MESA\"
 
 AM_CFLAGS = \
 	$(VISIBILITY_CFLAGS) \
diff --git a/src/intel/common/gen_debug.h b/src/intel/common/gen_debug.h
index e418e3fb166..053c41c0fb2 100644
--- a/src/intel/common/gen_debug.h
+++ b/src/intel/common/gen_debug.h
@@ -85,7 +85,6 @@ extern uint64_t INTEL_DEBUG;
 #define DEBUG_REEMIT              (1ull << 41)
 
 #ifdef HAVE_ANDROID_PLATFORM
-#define LOG_TAG "INTEL-MESA"
 #include <cutils/log.h>
 #ifndef ALOGW
 #define ALOGW LOGW
diff --git a/src/mesa/drivers/dri/i965/Android.mk b/src/mesa/drivers/dri/i965/Android.mk
index d75ffb13813..c155b3f9cca 100644
--- a/src/mesa/drivers/dri/i965/Android.mk
+++ b/src/mesa/drivers/dri/i965/Android.mk
@@ -27,6 +27,8 @@ LOCAL_PATH := $(call my-dir)
 # Import variables i965_FILES.
 include $(LOCAL_PATH)/Makefile.sources
 
+I965_PERGEN_COMMON_CFLAGS := -DLOG_TAG=\"INTEL-MESA\"
+
 I965_PERGEN_COMMON_INCLUDES := \
 	$(MESA_DRI_C_INCLUDES) \
 	$(MESA_TOP)/src/intel \
@@ -66,7 +68,7 @@ LOCAL_SHARED_LIBRARIES := $(I965_PERGEN_SHARED_LIBRARIES)
 
 LOCAL_STATIC_LIBRARIES := $(I965_PERGEN_STATIC_LIBRARIES)
 
-LOCAL_CFLAGS := -DGEN_VERSIONx10=40
+LOCAL_CFLAGS := $(I965_PERGEN_COMMON_CFLAGS) -DGEN_VERSIONx10=40
 
 include $(MESA_COMMON_MK)
 include $(BUILD_STATIC_LIBRARY)
@@ -87,7 +89,7 @@ LOCAL_SHARED_LIBRARIES := $(I965_PERGEN_SHARED_LIBRARIES)
 
 LOCAL_STATIC_LIBRARIES := $(I965_PERGEN_STATIC_LIBRARIES)
 
-LOCAL_CFLAGS := -DGEN_VERSIONx10=45
+LOCAL_CFLAGS := $(I965_PERGEN_COMMON_CFLAGS) -DGEN_VERSIONx10=45
 
 include $(MESA_COMMON_MK)
 include $(BUILD_STATIC_LIBRARY)
@@ -108,7 +110,7 @@ LOCAL_SHARED_LIBRARIES := $(I965_PERGEN_SHARED_LIBRARIES)
 
 LOCAL_STATIC_LIBRARIES := $(I965_PERGEN_STATIC_LIBRARIES)
 
-LOCAL_CFLAGS := -DGEN_VERSIONx10=50
+LOCAL_CFLAGS := $(I965_PERGEN_COMMON_CFLAGS) -DGEN_VERSIONx10=50
 
 include $(MESA_COMMON_MK)
 include $(BUILD_STATIC_LIBRARY)
@@ -129,7 +131,7 @@ LOCAL_SHARED_LIBRARIES := $(I965_PERGEN_SHARED_LIBRARIES)
 
 LOCAL_STATIC_LIBRARIES := $(I965_PERGEN_STATIC_LIBRARIES)
 
-LOCAL_CFLAGS := -DGEN_VERSIONx10=60
+LOCAL_CFLAGS := $(I965_PERGEN_COMMON_CFLAGS) -DGEN_VERSIONx10=60
 
 include $(MESA_COMMON_MK)
 include $(BUILD_STATIC_LIBRARY)
@@ -150,7 +152,7 @@ LOCAL_SHARED_LIBRARIES := $(I965_PERGEN_SHARED_LIBRARIES)
 
 LOCAL_STATIC_LIBRARIES := $(I965_PERGEN_STATIC_LIBRARIES)
 
-LOCAL_CFLAGS := -DGEN_VERSIONx10=70
+LOCAL_CFLAGS := $(I965_PERGEN_COMMON_CFLAGS) -DGEN_VERSIONx10=70
 
 include $(MESA_COMMON_MK)
 include $(BUILD_STATIC_LIBRARY)
@@ -171,7 +173,7 @@ LOCAL_SHARED_LIBRARIES := $(I965_PERGEN_SHARED_LIBRARIES)
 
 LOCAL_STATIC_LIBRARIES := $(I965_PERGEN_STATIC_LIBRARIES)
 
-LOCAL_CFLAGS := -DGEN_VERSIONx10=75
+LOCAL_CFLAGS := $(I965_PERGEN_COMMON_CFLAGS) -DGEN_VERSIONx10=75
 
 include $(MESA_COMMON_MK)
 include $(BUILD_STATIC_LIBRARY)
@@ -192,7 +194,7 @@ LOCAL_SHARED_LIBRARIES := $(I965_PERGEN_SHARED_LIBRARIES)
 
 LOCAL_STATIC_LIBRARIES := $(I965_PERGEN_STATIC_LIBRARIES)
 
-LOCAL_CFLAGS := -DGEN_VERSIONx10=80
+LOCAL_CFLAGS := $(I965_PERGEN_COMMON_CFLAGS) -DGEN_VERSIONx10=80
 
 include $(MESA_COMMON_MK)
 include $(BUILD_STATIC_LIBRARY)
@@ -213,7 +215,7 @@ LOCAL_SHARED_LIBRARIES := $(I965_PERGEN_SHARED_LIBRARIES)
 
 LOCAL_STATIC_LIBRARIES := $(I965_PERGEN_STATIC_LIBRARIES)
 
-LOCAL_CFLAGS := -DGEN_VERSIONx10=90
+LOCAL_CFLAGS := $(I965_PERGEN_COMMON_CFLAGS) -DGEN_VERSIONx10=90
 
 include $(MESA_COMMON_MK)
 include $(BUILD_STATIC_LIBRARY)
@@ -234,7 +236,7 @@ LOCAL_SHARED_LIBRARIES := $(I965_PERGEN_SHARED_LIBRARIES)
 
 LOCAL_STATIC_LIBRARIES := $(I965_PERGEN_STATIC_LIBRARIES)
 
-LOCAL_CFLAGS := -DGEN_VERSIONx10=100
+LOCAL_CFLAGS := $(I965_PERGEN_COMMON_CFLAGS) -DGEN_VERSIONx10=100
 
 include $(MESA_COMMON_MK)
 include $(BUILD_STATIC_LIBRARY)
@@ -249,7 +251,8 @@ LOCAL_MODULE := i965_dri
 LOCAL_MODULE_RELATIVE_PATH := $(MESA_DRI_MODULE_REL_PATH)
 
 LOCAL_CFLAGS := \
-	$(MESA_DRI_CFLAGS)
+	$(MESA_DRI_CFLAGS) \
+	-DLOG_TAG=\"INTEL-MESA\"
 
 ifeq ($(ARCH_X86_HAVE_SSE4_1),true)
 LOCAL_CFLAGS += \
diff --git a/src/mesa/drivers/dri/i965/Makefile.am b/src/mesa/drivers/dri/i965/Makefile.am
index eccca643c3c..11bf2399ba3 100644
--- a/src/mesa/drivers/dri/i965/Makefile.am
+++ b/src/mesa/drivers/dri/i965/Makefile.am
@@ -39,6 +39,7 @@ AM_CFLAGS = \
 	-I$(top_builddir)/src/intel \
 	-I$(top_srcdir)/src/intel \
 	-I$(top_srcdir)/include/drm-uapi \
+	-DLOG_TAG=\"INTEL-MESA\" \
 	$(DEFINES) \
 	$(VISIBILITY_CFLAGS) \
 	$(WNO_OVERRIDE_INIT) \
-- 
2.13.5



More information about the mesa-dev mailing list