[03/14] intel: Move definition of LOG_TAG from header into Makefiles

Submitted by Chad Versace on Sept. 28, 2017, 12:11 a.m.

Details

Message ID 20170928001200.15180-4-chadversary@chromium.org
State New
Headers show
Series "anv: Implement VK_ANDROID_native_buffer" ( rev: 13 12 11 10 ) in Mesa

Not browsing as part of any series.

Commit Message

Chad Versace Sept. 28, 2017, 12:11 a.m.
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(-)

Patch hide | download patch | download mbox

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) \

Comments

On 09/28/2017 03:11 AM, Chad Versace wrote:
> 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.

Currently we have INTEL-MESA, EGL-DRI2 and EGL_MAIN. IMO we could 
simplify and have just 'MESA' or 'mesa'? Debug messages from EGL could 
indicate 'EGL' in the message if that is not clear from the context already.

After such change we could just have it defined once in 
Android.common.mk for Android build.


> ---
>   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) \
>
On Mon 09 Oct 2017, Tapani Pälli wrote:
> 
> 
> On 09/28/2017 03:11 AM, Chad Versace wrote:
> > 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.
> 
> Currently we have INTEL-MESA, EGL-DRI2 and EGL_MAIN. IMO we could simplify
> and have just 'MESA' or 'mesa'? Debug messages from EGL could indicate 'EGL'
> in the message if that is not clear from the context already.
> 
> After such change we could just have it defined once in Android.common.mk
> for Android build.

(Rob, opinions?)

I'm in favor of unifying all LOG_TAGs to a single tag. That would
simplify debugging.

Currently, sometimes I misremember the LOG_TAG, type the wrong one in
`logcat -s "$TAG1,$TAG2,$TAG3"`, and then waste time because I get
a false negative when searching through the logs. "Hmm... that ALOGD
message never appeared... we must never hit that path!". If there was
a single log, the likelihood of bad logcat searches greatly diminishes.

Let's choose a LOG_TAG that follows the conventions of other tags in the
system.  I just scanned the logcat on a running system for examples, and
I found a single ALL-CAPS tag. I find these three classes of tags:

  - CamelCase. I suspect these mirror the names of Java classes or
    C++ classes.

    Examples:
      BackupManagerService
      PlayCommon
      NetworkStats
      ArcAppTaskTracker

  - snake_case and hyphen-case. This case seems to be used for low-level
    system components.

    Examples:
      libc
      art
      wayland-service

  - ALLCAPS. I found one case of this: 'DEBUG'.

Based on that evidence, 'mesa' is probably the best choice, with 'Mesa'
as second best.
On Mon, Oct 9, 2017 at 11:17 AM, Chad Versace <chadversary@chromium.org> wrote:
> On Mon 09 Oct 2017, Tapani Pälli wrote:
>>
>>
>> On 09/28/2017 03:11 AM, Chad Versace wrote:
>> > 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.
>>
>> Currently we have INTEL-MESA, EGL-DRI2 and EGL_MAIN. IMO we could simplify
>> and have just 'MESA' or 'mesa'? Debug messages from EGL could indicate 'EGL'
>> in the message if that is not clear from the context already.
>>
>> After such change we could just have it defined once in Android.common.mk
>> for Android build.
>
> (Rob, opinions?)
>
> I'm in favor of unifying all LOG_TAGs to a single tag. That would
> simplify debugging.

That's fine with me.

> Currently, sometimes I misremember the LOG_TAG, type the wrong one in
> `logcat -s "$TAG1,$TAG2,$TAG3"`, and then waste time because I get
> a false negative when searching through the logs. "Hmm... that ALOGD
> message never appeared... we must never hit that path!". If there was
> a single log, the likelihood of bad logcat searches greatly diminishes.

I worry more about the ones we just drop on the floor (i.e. stderr).
logwrapper used to work at least for anything in SF process, but
thanks to SELinux that's a pain to get working.

> Let's choose a LOG_TAG that follows the conventions of other tags in the
> system.  I just scanned the logcat on a running system for examples, and
> I found a single ALL-CAPS tag. I find these three classes of tags:
>
>   - CamelCase. I suspect these mirror the names of Java classes or
>     C++ classes.
>
>     Examples:
>       BackupManagerService
>       PlayCommon
>       NetworkStats
>       ArcAppTaskTracker
>
>   - snake_case and hyphen-case. This case seems to be used for low-level
>     system components.
>
>     Examples:
>       libc
>       art
>       wayland-service
>
>   - ALLCAPS. I found one case of this: 'DEBUG'.
>
> Based on that evidence, 'mesa' is probably the best choice, with 'Mesa'
> as second best.

Either color of shed is okay with me.

Rob