From 1cb647a0864c51d896a53b0a7442c7a9154b88bb Mon Sep 17 00:00:00 2001 From: Luca Stefani <luca.stefani.ge1@gmail.com> Date: Thu, 7 Mar 2019 21:58:17 +0100 Subject: [PATCH] Switch to liblog logging on API >= 26 * libcutils log is deprecated * Also fix a typo in a debug format string Test: m hwcomposer.ranchu Change-Id: I0a8e6434c5e1081ccf7663e20279774632e015d7 --- shared/OpenglCodecCommon/ErrorLog.h | 6 +++++- shared/OpenglCodecCommon/FixedBuffer.h | 4 ++++ shared/OpenglCodecCommon/GLClientState.cpp | 5 +++++ shared/OpenglCodecCommon/GLESTextureUtils.cpp | 4 ++++ shared/OpenglCodecCommon/glUtils.h | 4 ++++ shared/OpenglCodecCommon/goldfish_address_space.cpp | 5 +++++ shared/OpenglCodecCommon/goldfish_dma.cpp | 6 +++++- shared/OpenglCodecCommon/qemu_pipe.h | 4 ++++ shared/OpenglCodecCommon/qemu_pipe_host.cpp | 4 ++++ system/GLESv1_enc/GLEncoder.cpp | 6 ++++++ system/OpenglSystemCommon/FormatConversions.cpp | 4 ++++ system/OpenglSystemCommon/HostConnection.cpp | 4 ++++ system/OpenglSystemCommon/ProcessPipe.cpp | 4 ++++ system/OpenglSystemCommon/QemuPipeStream.cpp | 4 ++++ system/egl/egl.cpp | 4 ++++ system/gralloc/gralloc.cpp | 4 ++++ system/vulkan_enc/VulkanStreamGuest.cpp | 2 +- tests/gles_android_wrapper/ServerConnection.cpp | 2 +- tests/gles_android_wrapper/egl.cpp | 2 +- tests/gles_android_wrapper/gles.cpp | 2 +- 20 files changed, 74 insertions(+), 6 deletions(-) diff --git a/shared/OpenglCodecCommon/ErrorLog.h b/shared/OpenglCodecCommon/ErrorLog.h index d2388e6..fa2b0a2 100644 --- a/shared/OpenglCodecCommon/ErrorLog.h +++ b/shared/OpenglCodecCommon/ErrorLog.h @@ -17,7 +17,11 @@ #define _ERROR_LOG_H_ #if defined(__ANDROID__) -# include <cutils/log.h> +# if PLATFORM_SDK_VERSION < 26 +# include <cutils/log.h> +# else +# include <log/log.h> +# endif # define ERR(...) ALOGE(__VA_ARGS__) # ifdef EMUGL_DEBUG # define DBG(...) ALOGD(__VA_ARGS__) diff --git a/shared/OpenglCodecCommon/FixedBuffer.h b/shared/OpenglCodecCommon/FixedBuffer.h index 9a908de..8c34749 100644 --- a/shared/OpenglCodecCommon/FixedBuffer.h +++ b/shared/OpenglCodecCommon/FixedBuffer.h @@ -16,7 +16,11 @@ #ifndef _FIXED_BUFFER_H #define _FIXED_BUFFER_H +#if PLATFORM_SDK_VERSION < 26 #include <cutils/log.h> +#else +#include <log/log.h> +#endif class FixedBuffer { public: diff --git a/shared/OpenglCodecCommon/GLClientState.cpp b/shared/OpenglCodecCommon/GLClientState.cpp index 4375ef0..d2075cf 100644 --- a/shared/OpenglCodecCommon/GLClientState.cpp +++ b/shared/OpenglCodecCommon/GLClientState.cpp @@ -20,7 +20,12 @@ #include <stdlib.h> #include <string.h> #include "glUtils.h" + +#if PLATFORM_SDK_VERSION < 26 #include <cutils/log.h> +#else +#include <log/log.h> +#endif #ifndef MAX #define MAX(a, b) ((a) < (b) ? (b) : (a)) diff --git a/shared/OpenglCodecCommon/GLESTextureUtils.cpp b/shared/OpenglCodecCommon/GLESTextureUtils.cpp index 4572905..297a862 100644 --- a/shared/OpenglCodecCommon/GLESTextureUtils.cpp +++ b/shared/OpenglCodecCommon/GLESTextureUtils.cpp @@ -2,7 +2,11 @@ #include "glUtils.h" +#if PLATFORM_SDK_VERSION < 26 #include <cutils/log.h> +#else +#include <log/log.h> +#endif namespace GLESTextureUtils { diff --git a/shared/OpenglCodecCommon/glUtils.h b/shared/OpenglCodecCommon/glUtils.h index e1f4ff3..2f20b68 100644 --- a/shared/OpenglCodecCommon/glUtils.h +++ b/shared/OpenglCodecCommon/glUtils.h @@ -16,7 +16,11 @@ #ifndef __GL_UTILS_H__ #define __GL_UTILS_H__ +#if PLATFORM_SDK_VERSION < 26 #include <cutils/log.h> +#else +#include <log/log.h> +#endif #include <stdio.h> #include <stdlib.h> diff --git a/shared/OpenglCodecCommon/goldfish_address_space.cpp b/shared/OpenglCodecCommon/goldfish_address_space.cpp index 46420bf..50ea76b 100644 --- a/shared/OpenglCodecCommon/goldfish_address_space.cpp +++ b/shared/OpenglCodecCommon/goldfish_address_space.cpp @@ -1,4 +1,9 @@ +#if PLATFORM_SDK_VERSION < 26 #include <cutils/log.h> +#else +#include <log/log.h> +#endif + #include "goldfish_address_space.h" #ifdef HOST_BUILD diff --git a/shared/OpenglCodecCommon/goldfish_dma.cpp b/shared/OpenglCodecCommon/goldfish_dma.cpp index 0c87329..16bf84e 100644 --- a/shared/OpenglCodecCommon/goldfish_dma.cpp +++ b/shared/OpenglCodecCommon/goldfish_dma.cpp @@ -15,7 +15,11 @@ #include "goldfish_dma.h" #include "qemu_pipe.h" +#if PLATFORM_SDK_VERSION < 26 #include <cutils/log.h> +#else +#include <log/log.h> +#endif #include <errno.h> #ifdef __ANDROID__ #include <linux/ioctl.h> @@ -105,7 +109,7 @@ void* goldfish_dma_map(struct goldfish_dma_context* cxt) { } int goldfish_dma_unmap(struct goldfish_dma_context* cxt) { - ALOGV("%s: cxt=%p mapped=0x" PRIu64, __FUNCTION__, cxt, cxt->mapped_addr); + ALOGV("%s: cxt=%p mapped=0x%" PRIu64, __FUNCTION__, cxt, cxt->mapped_addr); munmap(reinterpret_cast<void *>(cxt->mapped_addr), cxt->size); cxt->mapped_addr = 0; cxt->size = 0; diff --git a/shared/OpenglCodecCommon/qemu_pipe.h b/shared/OpenglCodecCommon/qemu_pipe.h index 75eecb0..429b3fe 100644 --- a/shared/OpenglCodecCommon/qemu_pipe.h +++ b/shared/OpenglCodecCommon/qemu_pipe.h @@ -55,7 +55,11 @@ typedef int QEMU_PIPE_HANDLE; #include <stdint.h> #endif +#if PLATFORM_SDK_VERSION < 26 #include <cutils/log.h> +#else +#include <log/log.h> +#endif #ifdef __ANDROID__ #include <sys/cdefs.h> #endif diff --git a/shared/OpenglCodecCommon/qemu_pipe_host.cpp b/shared/OpenglCodecCommon/qemu_pipe_host.cpp index b4dc2af..e1a3b45 100644 --- a/shared/OpenglCodecCommon/qemu_pipe_host.cpp +++ b/shared/OpenglCodecCommon/qemu_pipe_host.cpp @@ -15,7 +15,11 @@ #include "android/emulation/hostpipe/HostGoldfishPipe.h" +#if PLATFORM_SDK_VERSION < 26 #include <cutils/log.h> +#else +#include <log/log.h> +#endif using android::HostGoldfishPipeDevice; diff --git a/system/GLESv1_enc/GLEncoder.cpp b/system/GLESv1_enc/GLEncoder.cpp index 968dfd6..1fa0dac 100644 --- a/system/GLESv1_enc/GLEncoder.cpp +++ b/system/GLESv1_enc/GLEncoder.cpp @@ -16,7 +16,13 @@ #include "GLEncoder.h" #include "glUtils.h" #include "FixedBuffer.h" + +#if PLATFORM_SDK_VERSION < 26 #include <cutils/log.h> +#else +#include <log/log.h> +#endif + #include <assert.h> #ifndef MIN diff --git a/system/OpenglSystemCommon/FormatConversions.cpp b/system/OpenglSystemCommon/FormatConversions.cpp index 8213602..a14e731 100644 --- a/system/OpenglSystemCommon/FormatConversions.cpp +++ b/system/OpenglSystemCommon/FormatConversions.cpp @@ -14,7 +14,11 @@ #include "FormatConversions.h" +#if PLATFORM_SDK_VERSION < 26 #include <cutils/log.h> +#else +#include <log/log.h> +#endif #include <string.h> #define DEBUG 0 diff --git a/system/OpenglSystemCommon/HostConnection.cpp b/system/OpenglSystemCommon/HostConnection.cpp index 2457ed3..5e05073 100644 --- a/system/OpenglSystemCommon/HostConnection.cpp +++ b/system/OpenglSystemCommon/HostConnection.cpp @@ -62,7 +62,11 @@ using goldfish_vk::VkEncoder; #include "VirtioGpuStream.h" #endif +#if PLATFORM_SDK_VERSION < 26 #include <cutils/log.h> +#else +#include <log/log.h> +#endif #define STREAM_BUFFER_SIZE (4*1024*1024) #define STREAM_PORT_NUM 22468 diff --git a/system/OpenglSystemCommon/ProcessPipe.cpp b/system/OpenglSystemCommon/ProcessPipe.cpp index 08e9571..ad0527a 100644 --- a/system/OpenglSystemCommon/ProcessPipe.cpp +++ b/system/OpenglSystemCommon/ProcessPipe.cpp @@ -17,7 +17,11 @@ #include "renderControl_enc.h" #include "qemu_pipe.h" +#if PLATFORM_SDK_VERSION < 26 #include <cutils/log.h> +#else +#include <log/log.h> +#endif #include <pthread.h> #include <errno.h> diff --git a/system/OpenglSystemCommon/QemuPipeStream.cpp b/system/OpenglSystemCommon/QemuPipeStream.cpp index dbf6f95..fb515c9 100644 --- a/system/OpenglSystemCommon/QemuPipeStream.cpp +++ b/system/OpenglSystemCommon/QemuPipeStream.cpp @@ -15,7 +15,11 @@ */ #include "QemuPipeStream.h" +#if PLATFORM_SDK_VERSION < 26 #include <cutils/log.h> +#else +#include <log/log.h> +#endif #include <errno.h> #include <stdio.h> #include <stdlib.h> diff --git a/system/egl/egl.cpp b/system/egl/egl.cpp index c7794d7..3e4698f 100644 --- a/system/egl/egl.cpp +++ b/system/egl/egl.cpp @@ -20,7 +20,11 @@ #include "eglDisplay.h" #include "eglSync.h" #include "egl_ftable.h" +#if PLATFORM_SDK_VERSION < 26 #include <cutils/log.h> +#else +#include <log/log.h> +#endif #include <cutils/properties.h> #include "goldfish_sync.h" #include "GLClientState.h" diff --git a/system/gralloc/gralloc.cpp b/system/gralloc/gralloc.cpp index 43843b2..2329abd 100644 --- a/system/gralloc/gralloc.cpp +++ b/system/gralloc/gralloc.cpp @@ -36,7 +36,11 @@ #include "glUtils.h" #include "qemu_pipe.h" +#if PLATFORM_SDK_VERSION < 26 #include <cutils/log.h> +#else +#include <log/log.h> +#endif #include <cutils/properties.h> #include <set> diff --git a/system/vulkan_enc/VulkanStreamGuest.cpp b/system/vulkan_enc/VulkanStreamGuest.cpp index c250b5d..bbb5437 100644 --- a/system/vulkan_enc/VulkanStreamGuest.cpp +++ b/system/vulkan_enc/VulkanStreamGuest.cpp @@ -20,7 +20,7 @@ #include <vector> -#include <cutils/log.h> +#include <log/log.h> #include <inttypes.h> namespace goldfish_vk { diff --git a/tests/gles_android_wrapper/ServerConnection.cpp b/tests/gles_android_wrapper/ServerConnection.cpp index ff4e390..ea84aa2 100644 --- a/tests/gles_android_wrapper/ServerConnection.cpp +++ b/tests/gles_android_wrapper/ServerConnection.cpp @@ -18,7 +18,7 @@ #include "ServerConnection.h" #include "TcpStream.h" #include "QemuPipeStream.h" -#include <cutils/log.h> +#include <log/log.h> #include "ThreadInfo.h" gl_client_context_t *ServerConnection::s_getGlContext() diff --git a/tests/gles_android_wrapper/egl.cpp b/tests/gles_android_wrapper/egl.cpp index cc9ab0b..33090d5 100644 --- a/tests/gles_android_wrapper/egl.cpp +++ b/tests/gles_android_wrapper/egl.cpp @@ -27,7 +27,7 @@ #include <dlfcn.h> #include "egl_dispatch.h" #include "egl_ftable.h" -#include <cutils/log.h> +#include <log/log.h> #include "ServerConnection.h" #include "ThreadInfo.h" #include <pthread.h> diff --git a/tests/gles_android_wrapper/gles.cpp b/tests/gles_android_wrapper/gles.cpp index c0949c8..6a0087e 100644 --- a/tests/gles_android_wrapper/gles.cpp +++ b/tests/gles_android_wrapper/gles.cpp @@ -19,7 +19,7 @@ #include "gles_dispatch.h" #include "gles_ftable.h" #include <EGL/egl.h> -#include <cutils/log.h> +#include <log/log.h> static struct gles_dispatch *s_dispatch = NULL; -- GitLab