[Mesa-dev] [PATCH 04/14] intel: Add simple logging façade for Android
Dylan Baker
dylan at pnwbakers.com
Mon Oct 9 17:47:54 UTC 2017
Quoting Chad Versace (2017-09-27 17:11:50)
> I'm bringing up Vulkan in the Android container of Chrome OS (ARC++).
>
> On Android, stdio goes to /dev/null. On Android, remote gdb is even more
> painful than the usual remote gdb. On Android, nothing works like you
> expect and debugging is hell. I need logging.
>
> This patch introduces a small, simple logging API that can easily wrap
> Android's API. On non-Android platforms, this logger does nothing fancy.
> It follows the time-honored Unix tradition of spewing everything to
> stderr with minimal fuss.
>
> My goal here is not perfection. My goal is to make a minimal, clean API,
> that people hate merely a little instead of a lot, and that's good
> enough to let me bring up Android Vulkan. And it needs to be fast,
> which means it must be small. No one wants to their game to miss frames
> while aiming a flaming bow into the jaws of an angry robot t-rex, and
> thus become t-rex breakfast, because some fool had too much fun desiging
> a bloated, ideal logging API.
>
> If people like it, perhaps we should quickly promote it to src/util.
>
> The API looks like this:
>
> #define INTEL_LOG_TAG "intel-vulkan"
> #define DEBUG
>
> intel_logd("try hard thing with foo=%d", foo);
>
> n = try_foo(...);
> if (n < 0) {
> intel_loge("%s:%d: foo failed bigtime", __FILE__, __LINE__);
> return VK_ERROR_DEVICE_LOST;
> }
>
> And produces this on non-Android:
>
> intel-vulkan: debug: try hard thing with foo=93
> intel-vulkan: error: anv_device.c:182: foo failed bigtime
> ---
> src/intel/Makefile.sources | 4 +-
> src/intel/common/intel_log.c | 87 ++++++++++++++++++++++++++++++++++++++++++++
> src/intel/common/intel_log.h | 82 +++++++++++++++++++++++++++++++++++++++++
> 3 files changed, 172 insertions(+), 1 deletion(-)
> create mode 100644 src/intel/common/intel_log.c
> create mode 100644 src/intel/common/intel_log.h
>
> diff --git a/src/intel/Makefile.sources b/src/intel/Makefile.sources
> index bca7a132b26..64a2dfe10e7 100644
> --- a/src/intel/Makefile.sources
> +++ b/src/intel/Makefile.sources
> @@ -18,7 +18,9 @@ COMMON_FILES = \
> common/gen_l3_config.c \
> common/gen_l3_config.h \
> common/gen_urb_config.c \
> - common/gen_sample_positions.h
> + common/gen_sample_positions.h \
> + common/intel_log.c \
> + common/intel_log.h
I hate to do this, but this is going to break meson. Could you add these two
files to src/intel/common/meson.build? I'm not sure but the previous patch
changes may be needed as well (I haven't gotten around to getting android hooked
up in meson, so it may not be needed. Maybe I can convince krh to do that ;)
Dylan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: signature
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20171009/84c11e85/attachment.sig>
More information about the mesa-dev
mailing list