[Mesa-dev] [PATCH v3 1/2] intel: print debug either to stdout or `logcat' depending on platform.

Eric Anholt eric at anholt.net
Wed Oct 10 11:15:27 PDT 2012


Kenneth Graunke <kenneth at whitecape.org> writes:

> On 10/09/2012 09:49 PM, Oliver McFadden wrote:
>> Signed-off-by: Oliver McFadden <oliver.mcfadden at linux.intel.com>
>> CC: Chad Versace <chad.versace at linux.intel.com>
>> ---
>> v3: split the unconditional DEBUG_PERF printing for Android into a separate
>> patch.  The second patch doesn't necessarily need to be upstreamed; I'm open to
>> feedback here...
>>
>>   src/mesa/drivers/dri/Android.mk            |    3 ++-
>>   src/mesa/drivers/dri/intel/intel_context.h |   17 ++++++++++++++---
>>   2 files changed, 16 insertions(+), 4 deletions(-)
>>
>> diff --git a/src/mesa/drivers/dri/Android.mk b/src/mesa/drivers/dri/Android.mk
>> index 577f664..d6196bb 100644
>> --- a/src/mesa/drivers/dri/Android.mk
>> +++ b/src/mesa/drivers/dri/Android.mk
>> @@ -34,7 +34,8 @@ MESA_DRI_MODULE_UNSTRIPPED_PATH := $(TARGET_OUT_SHARED_LIBRARIES_UNSTRIPPED)/dri
>>   MESA_DRI_CFLAGS := \
>>   	-DFEATURE_GL=1 \
>>   	-DFEATURE_ES1=1 \
>> -	-DFEATURE_ES2=1
>> +	-DFEATURE_ES2=1 \
>> +	-DHAVE_ANDROID_PLATFORM
>>
>>   MESA_DRI_C_INCLUDES := \
>>   	$(addprefix $(MESA_TOP)/, $(mesa_dri_common_INCLUDES)) \
>> diff --git a/src/mesa/drivers/dri/intel/intel_context.h b/src/mesa/drivers/dri/intel/intel_context.h
>> index d16101d..b732696 100644
>> --- a/src/mesa/drivers/dri/intel/intel_context.h
>> +++ b/src/mesa/drivers/dri/intel/intel_context.h
>> @@ -457,19 +457,30 @@ extern int INTEL_DEBUG;
>>   #define DEBUG_CLIP      0x2000000
>>   #define DEBUG_AUB       0x4000000
>>
>> +#ifdef HAVE_ANDROID_PLATFORM
>> +#define LOG_TAG "INTEL-MESA"
>> +#include <cutils/log.h>
>> +#ifndef ALOGW
>> +#define ALOGW LOGW
>> +#endif
>> +#define dbg_printf(...)	ALOGW(__VA_ARGS__)
>> +#else
>> +#define dbg_printf(...)	printf(__VA_ARGS__)
>> +#endif /* HAVE_ANDROID_PLATFORM */
>> +
>>   #define DBG(...) do {						\
>>   	if (unlikely(INTEL_DEBUG & FILE_DEBUG_FLAG))		\
>> -		printf(__VA_ARGS__);			\
>> +		dbg_printf(__VA_ARGS__);			\
>>   } while(0)
>>
>>   #define fallback_debug(...) do {				\
>>   	if (unlikely(INTEL_DEBUG & DEBUG_PERF))			\
>> -		printf(__VA_ARGS__);				\
>> +		dbg_printf(__VA_ARGS__);			\
>>   } while(0)
>>
>>   #define perf_debug(...) do {					\
>>   	if (unlikely(INTEL_DEBUG & DEBUG_PERF))			\
>> -		printf(__VA_ARGS__);				\
>> +		dbg_printf(__VA_ARGS__);			\
>>   } while(0)
>>
>>   #define PCI_CHIP_845_G			0x2562
>
> Patch 1 is:
> Acked-by: Kenneth Graunke <kenneth at whitecape.org>
>
> (I don't know Android's logging infrastructure, but it all looks 
> reasonable and printing the debug output to logs seems like a really 
> good idea.)

Yeah, it's too bad android didn't just hook up printf to the log since
you apparently can't get your printfs any other way than rewriting your
code.

Patch 1 is:

Reviewed-by: Eric Anholt <eric at anholt.net>

Patch 2 is not OK.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20121010/a38f4145/attachment.pgp>


More information about the mesa-dev mailing list