gfxstream: convert some Vulkan to mesa_log(..)

There are still some places left in the libgfxstream_vulkan.so
dependencies. For example, guest/platform &
guest/OpenglSystemCommon.

BUG=323384796
TEST=compile

Change-Id: I9953b945ae682b9b6c10f7fa001bb9ba071d6a1c
diff --git a/guest/vulkan_enc/ResourceTracker.cpp b/guest/vulkan_enc/ResourceTracker.cpp
index 8c70b17..fb8c7ba 100644
--- a/guest/vulkan_enc/ResourceTracker.cpp
+++ b/guest/vulkan_enc/ResourceTracker.cpp
@@ -32,7 +32,6 @@
 #ifdef VK_USE_PLATFORM_ANDROID_KHR
 #include "vk_format_info.h"
 #endif
-#include <log/log.h>
 #include <stdlib.h>
 #include <vndk/hardware_buffer.h>
 
@@ -497,7 +496,7 @@
     fidl::WireSyncClient<fuchsia_sysmem::BufferCollection>* collection,
     const VkImageCreateInfo* pImageInfo) {
     if (pImageInfo == nullptr) {
-        ALOGE("setBufferCollectionConstraints: pImageInfo cannot be null.");
+        mesa_loge("setBufferCollectionConstraints: pImageInfo cannot be null.");
         return VK_ERROR_OUT_OF_DEVICE_MEMORY;
     }
 
@@ -567,7 +566,7 @@
         physicalDevice, createInfo->format, createInfo->imageType, tiling, createInfo->usage,
         createInfo->flags, &imageFormatProperties, true /* do lock */);
     if (result != VK_SUCCESS) {
-        ALOGD(
+        mesa_logd(
             "%s: Image format (%u) type (%u) tiling (%u) "
             "usage (%u) flags (%u) not supported by physical "
             "device",
@@ -588,7 +587,7 @@
                                      : formatProperties.optimalTilingFeatures;
         auto requiredFeatures = formatConstraints->requiredFormatFeatures;
         if ((~supportedFeatures) & requiredFeatures) {
-            ALOGD(
+            mesa_logd(
                 "%s: Host device support features for %s tiling: %08x, "
                 "required features: %08x, feature bits %08x missing",
                 __func__, tiling == VK_IMAGE_TILING_LINEAR ? "LINEAR" : "OPTIMAL",
@@ -604,7 +603,7 @@
             formatConstraints->sysmemPixelFormat);
         if (createInfo->format != VK_FORMAT_UNDEFINED &&
             !vkFormatMatchesSysmemFormat(createInfo->format, pixelFormat)) {
-            ALOGD("%s: VkFormat %u doesn't match sysmem pixelFormat %lu", __func__,
+            mesa_logd("%s: VkFormat %u doesn't match sysmem pixelFormat %lu", __func__,
                   static_cast<uint32_t>(createInfo->format), formatConstraints->sysmemPixelFormat);
             return VK_ERROR_FORMAT_NOT_SUPPORTED;
         }
@@ -612,7 +611,7 @@
     } else {
         auto pixel_format = vkFormatTypeToSysmem(createInfo->format);
         if (pixel_format == fuchsia_sysmem::wire::PixelFormatType::kInvalid) {
-            ALOGD("%s: Unsupported VkFormat %u", __func__,
+            mesa_logd("%s: Unsupported VkFormat %u", __func__,
                   static_cast<uint32_t>(createInfo->format));
             return VK_ERROR_FORMAT_NOT_SUPPORTED;
         }
@@ -634,7 +633,7 @@
         createInfoDup.pNext = nullptr;
         enc->vkGetLinearImageLayout2GOOGLE(device, &createInfoDup, &offset, &rowPitchAlignment,
                                            true /* do lock */);
-        ALOGD(
+        mesa_logd(
             "vkGetLinearImageLayout2GOOGLE: format %d offset %lu "
             "rowPitchAlignment = %lu",
             (int)createInfo->format, offset, rowPitchAlignment);
@@ -673,7 +672,7 @@
     const VkBufferConstraintsInfoFUCHSIA* pBufferConstraintsInfo) {
     const auto& collection = *pCollection;
     if (pBufferConstraintsInfo == nullptr) {
-        ALOGE(
+        mesa_loge(
             "setBufferCollectionBufferConstraints: "
             "pBufferConstraintsInfo cannot be null.");
         return {VK_ERROR_OUT_OF_DEVICE_MEMORY};
@@ -692,7 +691,7 @@
 
     auto result = collection->SetConstraints(true, constraints);
     if (!result.ok()) {
-        ALOGE("setBufferCollectionConstraints: SetConstraints failed: %d", result.status());
+        mesa_loge("setBufferCollectionConstraints: SetConstraints failed: %d", result.status());
         return {VK_ERROR_OUT_OF_DEVICE_MEMORY};
     }
 
@@ -885,7 +884,7 @@
                     case DescriptorWriteType::InlineUniformBlock:
                     case DescriptorWriteType::AccelerationStructure:
                         // TODO
-                        ALOGE(
+                        mesa_loge(
                             "Encountered pending inline uniform block or acceleration structure "
                             "desc write, abort (NYI)\n");
                         abort();
@@ -1000,9 +999,9 @@
     if (mSyncDeviceFd >= 0) return;
     mSyncDeviceFd = goldfish_sync_open();
     if (mSyncDeviceFd >= 0) {
-        ALOGD("%s: created sync device for current Vulkan process: %d\n", __func__, mSyncDeviceFd);
+        mesa_logd("%s: created sync device for current Vulkan process: %d\n", __func__, mSyncDeviceFd);
     } else {
-        ALOGD("%s: failed to create sync device for current Vulkan process\n", __func__);
+        mesa_logd("%s: failed to create sync device for current Vulkan process\n", __func__);
     }
 #endif
 }
@@ -1456,7 +1455,7 @@
         fidl::ClientEnd<fuchsia_hardware_goldfish::ControlDevice> channel{zx::channel(
             GetConnectToServiceFunction()("/loader-gpu-devices/class/goldfish-control/000"))};
         if (!channel) {
-            ALOGE("failed to open control device");
+            mesa_loge("failed to open control device");
             abort();
         }
         mControlDevice =
@@ -1465,7 +1464,7 @@
         fidl::ClientEnd<fuchsia_sysmem::Allocator> sysmem_channel{
             zx::channel(GetConnectToServiceFunction()("/svc/fuchsia.sysmem.Allocator"))};
         if (!sysmem_channel) {
-            ALOGE("failed to open sysmem connection");
+            mesa_loge("failed to open sysmem connection");
         }
         mSysmemAllocator =
             fidl::WireSyncClient<fuchsia_sysmem::Allocator>(std::move(sysmem_channel));
@@ -1983,7 +1982,7 @@
         lock.lock();
 
         if (countRes != VK_SUCCESS) {
-            ALOGE(
+            mesa_loge(
                 "%s: failed: could not count host physical devices. "
                 "Error %d\n",
                 __func__, countRes);
@@ -1998,7 +1997,7 @@
         lock.lock();
 
         if (enumRes != VK_SUCCESS) {
-            ALOGE(
+            mesa_loge(
                 "%s: failed: could not retrieve host physical devices. "
                 "Error %d\n",
                 __func__, enumRes);
@@ -2253,7 +2252,7 @@
     auto& info = memoryIt->second;
 
     if (info.vmoHandle == ZX_HANDLE_INVALID) {
-        ALOGE("%s: memory cannot be exported", __func__);
+        mesa_loge("%s: memory cannot be exported", __func__);
         return VK_ERROR_INITIALIZATION_FAILED;
     }
 
@@ -2292,7 +2291,7 @@
     zx::vmo vmo_dup;
     status = zx::unowned_vmo(handle)->duplicate(ZX_RIGHT_SAME_RIGHTS, &vmo_dup);
     if (status != ZX_OK) {
-        ALOGE("zx_handle_duplicate() error: %d", status);
+        mesa_loge("zx_handle_duplicate() error: %d", status);
         return VK_ERROR_INITIALIZATION_FAILED;
     }
 
@@ -2300,7 +2299,7 @@
 
     auto result = mControlDevice->GetBufferHandleInfo(std::move(vmo_dup));
     if (!result.ok()) {
-        ALOGE("mControlDevice->GetBufferHandleInfo fatal error: epitaph: %d", result.status());
+        mesa_loge("mControlDevice->GetBufferHandleInfo fatal error: epitaph: %d", result.status());
         return VK_ERROR_INITIALIZATION_FAILED;
     }
     if (result.value().is_ok()) {
@@ -2316,7 +2315,7 @@
         // VkMemoryZirconHandlePropertiesFUCHSIA with no available
         // memoryType bits should be enough for clients. See fxbug.dev/42098398
         // for other issues this this flow.
-        ALOGW("GetBufferHandleInfo failed: %d", result.value().error_value());
+        mesa_logw("GetBufferHandleInfo failed: %d", result.value().error_value());
         pProperties->memoryTypeBits = 0;
         return VK_SUCCESS;
     }
@@ -2342,7 +2341,7 @@
     zx_status_t status = zx_object_get_info(eventHandle, ZX_INFO_HANDLE_BASIC, &info, sizeof(info),
                                             nullptr, nullptr);
     if (status != ZX_OK) {
-        ALOGE("Cannot get object info of handle %u: %d", eventHandle, status);
+        mesa_loge("Cannot get object info of handle %u: %d", eventHandle, status);
         return ZX_KOID_INVALID;
     }
     return info.koid;
@@ -2426,13 +2425,13 @@
     } else {
         auto endpoints = fidl::CreateEndpoints<::fuchsia_sysmem::BufferCollectionToken>();
         if (!endpoints.is_ok()) {
-            ALOGE("zx_channel_create failed: %d", endpoints.status_value());
+            mesa_loge("zx_channel_create failed: %d", endpoints.status_value());
             return VK_ERROR_INITIALIZATION_FAILED;
         }
 
         auto result = mSysmemAllocator->AllocateSharedCollection(std::move(endpoints->server));
         if (!result.ok()) {
-            ALOGE("AllocateSharedCollection failed: %d", result.status());
+            mesa_loge("AllocateSharedCollection failed: %d", result.status());
             return VK_ERROR_INITIALIZATION_FAILED;
         }
         token_client = std::move(endpoints->client);
@@ -2440,7 +2439,7 @@
 
     auto endpoints = fidl::CreateEndpoints<::fuchsia_sysmem::BufferCollection>();
     if (!endpoints.is_ok()) {
-        ALOGE("zx_channel_create failed: %d", endpoints.status_value());
+        mesa_loge("zx_channel_create failed: %d", endpoints.status_value());
         return VK_ERROR_INITIALIZATION_FAILED;
     }
     auto [collection_client, collection_server] = std::move(endpoints.value());
@@ -2448,7 +2447,7 @@
     auto result = mSysmemAllocator->BindSharedCollection(std::move(token_client),
                                                          std::move(collection_server));
     if (!result.ok()) {
-        ALOGE("BindSharedCollection failed: %d", result.status());
+        mesa_loge("BindSharedCollection failed: %d", result.status());
         return VK_ERROR_INITIALIZATION_FAILED;
     }
 
@@ -2480,12 +2479,12 @@
     const auto& collection = *pCollection;
     if (!pImageConstraintsInfo ||
         pImageConstraintsInfo->sType != VK_STRUCTURE_TYPE_IMAGE_CONSTRAINTS_INFO_FUCHSIA) {
-        ALOGE("%s: invalid pImageConstraintsInfo", __func__);
+        mesa_loge("%s: invalid pImageConstraintsInfo", __func__);
         return {VK_ERROR_INITIALIZATION_FAILED};
     }
 
     if (pImageConstraintsInfo->formatConstraintsCount == 0) {
-        ALOGE("%s: formatConstraintsCount must be greater than 0", __func__);
+        mesa_loge("%s: formatConstraintsCount must be greater than 0", __func__);
         abort();
     }
 
@@ -2543,7 +2542,7 @@
             constraints.usage.vulkan |= getBufferCollectionConstraintsVulkanImageUsage(createInfo);
 
             if (formatConstraints && formatConstraints->flags) {
-                ALOGW(
+                mesa_logw(
                     "%s: Non-zero flags (%08x) in image format "
                     "constraints; this is currently not supported, see "
                     "fxbug.dev/42147900.",
@@ -2584,7 +2583,7 @@
     }
 
     if (constraints.image_format_constraints_count == 0) {
-        ALOGE("%s: none of the specified formats is supported by device", __func__);
+        mesa_loge("%s: none of the specified formats is supported by device", __func__);
         return {VK_ERROR_FORMAT_NOT_SUPPORTED};
     }
 
@@ -2594,7 +2593,7 @@
 
     auto result = collection->SetConstraints(true, constraints);
     if (!result.ok()) {
-        ALOGE("setBufferCollectionConstraints: SetConstraints failed: %d", result.status());
+        mesa_loge("setBufferCollectionConstraints: SetConstraints failed: %d", result.status());
         return {VK_ERROR_INITIALIZATION_FAILED};
     }
 
@@ -2674,7 +2673,7 @@
     VkBufferCollectionFUCHSIA collection, fuchsia_sysmem::wire::BufferCollectionInfo2& info,
     uint32_t* outCreateInfoIndex) {
     if (!info_VkBufferCollectionFUCHSIA[collection].constraints.hasValue()) {
-        ALOGE("%s: constraints not set", __func__);
+        mesa_loge("%s: constraints not set", __func__);
         return VK_ERROR_OUT_OF_DEVICE_MEMORY;
     }
 
@@ -2729,7 +2728,7 @@
         return VK_SUCCESS;
     }
 
-    ALOGE("%s: cannot find a valid image format in constraints", __func__);
+    mesa_loge("%s: cannot find a valid image format in constraints", __func__);
     return VK_ERROR_OUT_OF_DEVICE_MEMORY;
 }
 
@@ -2742,8 +2741,8 @@
 
     auto result = sysmem_collection->WaitForBuffersAllocated();
     if (!result.ok() || result->status != ZX_OK) {
-        ALOGE("Failed wait for allocation: %d %d", result.status(),
-              GET_STATUS_SAFE(result, status));
+        mesa_loge("Failed wait for allocation: %d %d", result.status(),
+                  GET_STATUS_SAFE(result, status));
         return VK_ERROR_INITIALIZATION_FAILED;
     }
     fuchsia_sysmem::wire::BufferCollectionInfo2 info = std::move(result->buffer_collection_info);
@@ -2753,8 +2752,8 @@
     bool is_device_local =
         info.settings.buffer_settings.heap == fuchsia_sysmem::wire::HeapType::kGoldfishDeviceLocal;
     if (!is_host_visible && !is_device_local) {
-        ALOGE("buffer collection uses a non-goldfish heap (type 0x%lu)",
-              static_cast<uint64_t>(info.settings.buffer_settings.heap));
+        mesa_loge("buffer collection uses a non-goldfish heap (type 0x%lu)",
+                  static_cast<uint64_t>(info.settings.buffer_settings.heap));
         return VK_ERROR_INITIALIZATION_FAILED;
     }
 
@@ -2804,7 +2803,7 @@
 
     // The fields below only apply to buffer collections with image formats.
     if (!info.settings.has_image_format_constraints) {
-        ALOGD("%s: buffer collection doesn't have image format constraints", __func__);
+        mesa_logd("%s: buffer collection doesn't have image format constraints", __func__);
         return storeProperties();
     }
 
@@ -2817,7 +2816,7 @@
     // colorSpace
     // ====================================================================
     if (info.settings.image_format_constraints.color_spaces_count == 0) {
-        ALOGE(
+        mesa_loge(
             "%s: color space missing from allocated buffer collection "
             "constraints",
             __func__);
@@ -2935,7 +2934,7 @@
         GoldfishAddressSpaceBlockPtr block = nullptr;
         res = enc->vkMapMemoryIntoAddressSpaceGOOGLE(device, mem, &gpuAddr, true);
         if (res != VK_SUCCESS) {
-            ALOGE(
+            mesa_loge(
                 "Failed to create coherent memory: vkMapMemoryIntoAddressSpaceGOOGLE "
                 "returned:%d.",
                 res);
@@ -2945,7 +2944,7 @@
             AutoLock<RecursiveLock> lock(mLock);
             auto it = info_VkDeviceMemory.find(mem);
             if (it == info_VkDeviceMemory.end()) {
-                ALOGE("Failed to create coherent memory: failed to find device memory.");
+                mesa_loge("Failed to create coherent memory: failed to find device memory.");
                 res = VK_ERROR_OUT_OF_HOST_MEMORY;
                 return coherentMemory;
             }
@@ -2964,7 +2963,7 @@
             res = enc->vkGetMemoryHostAddressInfoGOOGLE(device, mem, &hvaSizeId[0], &hvaSizeId[1],
                                                         &hvaSizeId[2], true /* do lock */);
             if (res != VK_SUCCESS) {
-                ALOGE(
+                mesa_loge(
                     "Failed to create coherent memory: vkMapMemoryIntoAddressSpaceGOOGLE "
                     "returned:%d.",
                     res);
@@ -2980,14 +2979,14 @@
 
                 auto blob = instance->createBlob(createBlob);
                 if (!blob) {
-                    ALOGE("Failed to create coherent memory: failed to create blob.");
+                    mesa_loge("Failed to create coherent memory: failed to create blob.");
                     res = VK_ERROR_OUT_OF_DEVICE_MEMORY;
                     return coherentMemory;
                 }
 
                 VirtGpuResourceMappingPtr mapping = blob->createMapping();
                 if (!mapping) {
-                    ALOGE("Failed to create coherent memory: failed to create blob mapping.");
+                    mesa_loge("Failed to create coherent memory: failed to create blob mapping.");
                     res = VK_ERROR_OUT_OF_DEVICE_MEMORY;
                     return coherentMemory;
                 }
@@ -2996,7 +2995,7 @@
                     std::make_shared<CoherentMemory>(mapping, createBlob.size, device, mem);
             }
         } else {
-            ALOGE("FATAL: Unsupported virtual memory feature");
+            mesa_loge("FATAL: Unsupported virtual memory feature");
             abort();
         }
     return coherentMemory;
@@ -3049,13 +3048,13 @@
     // Support device address capture/replay allocations
     if (deviceAddressMemoryAllocation) {
         if (allocFlagsInfoPtr) {
-            ALOGV("%s: has alloc flags\n", __func__);
+            mesa_logi("%s: has alloc flags\n", __func__);
             allocFlagsInfo = *allocFlagsInfoPtr;
             vk_append_struct(&structChainIter, &allocFlagsInfo);
         }
 
         if (opaqueCaptureAddressAllocInfoPtr) {
-            ALOGV("%s: has opaque capture address\n", __func__);
+            mesa_logi("%s: has opaque capture address\n", __func__);
             opaqueCaptureAddressAllocInfo = *opaqueCaptureAddressAllocInfoPtr;
             vk_append_struct(&structChainIter, &opaqueCaptureAddressAllocInfo);
         }
@@ -3079,7 +3078,7 @@
 
         guestBlob = instance->createBlob(createBlob);
         if (!guestBlob) {
-            ALOGE("Failed to allocate coherent memory: failed to create blob.");
+            mesa_loge("Failed to allocate coherent memory: failed to create blob.");
             return VK_ERROR_OUT_OF_DEVICE_MEMORY;
         }
 
@@ -3089,7 +3088,7 @@
         exec.flags = kRingIdx;
         exec.ring_idx = 1;
         if (instance->execBuffer(exec, guestBlob.get())) {
-            ALOGE("Failed to allocate coherent memory: failed to execbuffer for wait.");
+            mesa_loge("Failed to allocate coherent memory: failed to execbuffer for wait.");
             return VK_ERROR_OUT_OF_HOST_MEMORY;
         }
 
@@ -3104,7 +3103,8 @@
     VkResult host_res =
         enc->vkAllocateMemory(device, &hostAllocationInfo, nullptr, &mem, true /* do lock */);
     if (host_res != VK_SUCCESS) {
-        ALOGE("Failed to allocate coherent memory: failed to allocate on the host: %d.", host_res);
+        mesa_loge("Failed to allocate coherent memory: failed to allocate on the host: %d.",
+                  host_res);
         return host_res;
     }
 
@@ -3117,7 +3117,7 @@
     if (guestBlob) {
         auto mapping = guestBlob->createMapping();
         if (!mapping) {
-            ALOGE("Failed to allocate coherent memory: failed to create blob mapping.");
+            mesa_loge("Failed to allocate coherent memory: failed to create blob mapping.");
             return VK_ERROR_OUT_OF_DEVICE_MEMORY;
         }
 
@@ -3270,13 +3270,13 @@
         vk_find_struct<VkMemoryOpaqueCaptureAddressAllocateInfo>(pAllocateInfo);
 
     if (allocFlagsInfoPtr) {
-        ALOGV("%s: has alloc flags\n", __func__);
+        mesa_logi("%s: has alloc flags\n", __func__);
         allocFlagsInfo = *allocFlagsInfoPtr;
         vk_append_struct(&structChainIter, &allocFlagsInfo);
     }
 
     if (opaqueCaptureAddressAllocInfoPtr) {
-        ALOGV("%s: has opaque capture address\n", __func__);
+        mesa_logi("%s: has opaque capture address\n", __func__);
         opaqueCaptureAddressAllocInfo = *opaqueCaptureAddressAllocInfoPtr;
         vk_append_struct(&structChainIter, &opaqueCaptureAddressAllocInfo);
     }
@@ -3485,14 +3485,14 @@
                 importBufferCollectionInfoPtr->collection);
         auto result = collection->WaitForBuffersAllocated();
         if (!result.ok() || result->status != ZX_OK) {
-            ALOGE("WaitForBuffersAllocated failed: %d %d", result.status(),
-                  GET_STATUS_SAFE(result, status));
+            mesa_loge("WaitForBuffersAllocated failed: %d %d", result.status(),
+                      GET_STATUS_SAFE(result, status));
             _RETURN_FAILURE_WITH_DEVICE_MEMORY_REPORT(VK_ERROR_INITIALIZATION_FAILED);
         }
         fuchsia_sysmem::wire::BufferCollectionInfo2& info = result->buffer_collection_info;
         uint32_t index = importBufferCollectionInfoPtr->index;
         if (info.buffer_count < index) {
-            ALOGE("Invalid buffer index: %d %d", index);
+            mesa_loge("Invalid buffer index: %d %d", index);
             _RETURN_FAILURE_WITH_DEVICE_MEMORY_REPORT(VK_ERROR_INITIALIZATION_FAILED);
         }
         vmo_handle = info.buffers[index].vmo.release();
@@ -3509,7 +3509,7 @@
             dedicatedAllocInfoPtr && (dedicatedAllocInfoPtr->buffer != VK_NULL_HANDLE);
 
         if (hasDedicatedImage && hasDedicatedBuffer) {
-            ALOGE(
+            mesa_loge(
                 "Invalid VkMemoryDedicatedAllocationInfo: At least one "
                 "of image and buffer must be VK_NULL_HANDLE.");
             return VK_ERROR_OUT_OF_DEVICE_MEMORY;
@@ -3564,7 +3564,7 @@
         if (hasDedicatedImage || hasDedicatedBuffer) {
             auto token_ends = fidl::CreateEndpoints<::fuchsia_sysmem::BufferCollectionToken>();
             if (!token_ends.is_ok()) {
-                ALOGE("zx_channel_create failed: %d", token_ends.status_value());
+                mesa_loge("zx_channel_create failed: %d", token_ends.status_value());
                 abort();
             }
 
@@ -3572,14 +3572,14 @@
                 auto result =
                     mSysmemAllocator->AllocateSharedCollection(std::move(token_ends->server));
                 if (!result.ok()) {
-                    ALOGE("AllocateSharedCollection failed: %d", result.status());
+                    mesa_loge("AllocateSharedCollection failed: %d", result.status());
                     abort();
                 }
             }
 
             auto collection_ends = fidl::CreateEndpoints<::fuchsia_sysmem::BufferCollection>();
             if (!collection_ends.is_ok()) {
-                ALOGE("zx_channel_create failed: %d", collection_ends.status_value());
+                mesa_loge("zx_channel_create failed: %d", collection_ends.status_value());
                 abort();
             }
 
@@ -3587,7 +3587,7 @@
                 auto result = mSysmemAllocator->BindSharedCollection(
                     std::move(token_ends->client), std::move(collection_ends->server));
                 if (!result.ok()) {
-                    ALOGE("BindSharedCollection failed: %d", result.status());
+                    mesa_loge("BindSharedCollection failed: %d", result.status());
                     abort();
                 }
             }
@@ -3599,12 +3599,12 @@
                 VkResult res = setBufferCollectionConstraintsFUCHSIA(enc, device, &collection,
                                                                      pImageCreateInfo);
                 if (res == VK_ERROR_FORMAT_NOT_SUPPORTED) {
-                    ALOGE("setBufferCollectionConstraints failed: format %u is not supported",
-                          pImageCreateInfo->format);
+                    mesa_loge("setBufferCollectionConstraints failed: format %u is not supported",
+                              pImageCreateInfo->format);
                     return VK_ERROR_OUT_OF_DEVICE_MEMORY;
                 }
                 if (res != VK_SUCCESS) {
-                    ALOGE("setBufferCollectionConstraints failed: %d", res);
+                    mesa_loge("setBufferCollectionConstraints failed: %d", res);
                     abort();
                 }
             }
@@ -3613,7 +3613,7 @@
                 VkResult res = setBufferCollectionBufferConstraintsFUCHSIA(&collection,
                                                                            pBufferConstraintsInfo);
                 if (res != VK_SUCCESS) {
-                    ALOGE("setBufferCollectionBufferConstraints failed: %d", res);
+                    mesa_loge("setBufferCollectionBufferConstraints failed: %d", res);
                     abort();
                 }
             }
@@ -3624,7 +3624,7 @@
                     fuchsia_sysmem::wire::BufferCollectionInfo2& info =
                         result->buffer_collection_info;
                     if (!info.buffer_count) {
-                        ALOGE(
+                        mesa_loge(
                             "WaitForBuffersAllocated returned "
                             "invalid count: %d",
                             info.buffer_count);
@@ -3632,8 +3632,8 @@
                     }
                     vmo_handle = info.buffers[0].vmo.release();
                 } else {
-                    ALOGE("WaitForBuffersAllocated failed: %d %d", result.status(),
-                          GET_STATUS_SAFE(result, status));
+                    mesa_loge("WaitForBuffersAllocated failed: %d %d", result.status(),
+                              GET_STATUS_SAFE(result, status));
                     abort();
                 }
             }
@@ -3644,7 +3644,7 @@
             zx_status_t status = zx_handle_duplicate(vmo_handle, ZX_RIGHT_SAME_RIGHTS,
                                                      vmo_copy.reset_and_get_address());
             if (status != ZX_OK) {
-                ALOGE("Failed to duplicate VMO: %d", status);
+                mesa_loge("Failed to duplicate VMO: %d", status);
                 abort();
             }
 
@@ -3694,7 +3694,7 @@
                             format = fuchsia_hardware_goldfish::wire::ColorBufferFormatType::kRg;
                             break;
                         default:
-                            ALOGE("Unsupported format: %d", pImageCreateInfo->format);
+                            mesa_loge("Unsupported format: %d", pImageCreateInfo->format);
                             abort();
                     }
 
@@ -3710,12 +3710,12 @@
                                                                      std::move(createParams));
                     if (!result.ok() || result->res != ZX_OK) {
                         if (result.ok() && result->res == ZX_ERR_ALREADY_EXISTS) {
-                            ALOGD(
+                            mesa_logd(
                                 "CreateColorBuffer: color buffer already "
                                 "exists\n");
                         } else {
-                            ALOGE("CreateColorBuffer failed: %d:%d", result.status(),
-                                  GET_STATUS_SAFE(result, res));
+                            mesa_loge("CreateColorBuffer failed: %d:%d", result.status(),
+                                      GET_STATUS_SAFE(result, res));
                             abort();
                         }
                     }
@@ -3732,13 +3732,13 @@
                 auto result =
                     mControlDevice->CreateBuffer2(std::move(vmo_copy), std::move(createParams));
                 if (!result.ok() || result->is_error()) {
-                    ALOGE("CreateBuffer2 failed: %d:%d", result.status(),
-                          GET_STATUS_SAFE(result, error_value()));
+                    mesa_loge("CreateBuffer2 failed: %d:%d", result.status(),
+                              GET_STATUS_SAFE(result, error_value()));
                     abort();
                 }
             }
         } else {
-            ALOGW(
+            mesa_logw(
                 "Dedicated image / buffer not available. Cannot create "
                 "BufferCollection to export VMOs.");
             return VK_ERROR_OUT_OF_DEVICE_MEMORY;
@@ -3750,14 +3750,15 @@
         zx_status_t status =
             zx_handle_duplicate(vmo_handle, ZX_RIGHT_SAME_RIGHTS, vmo_copy.reset_and_get_address());
         if (status != ZX_OK) {
-            ALOGE("Failed to duplicate VMO: %d", status);
+            mesa_loge("Failed to duplicate VMO: %d", status);
             abort();
         }
         zx_status_t status2 = ZX_OK;
 
         auto result = mControlDevice->GetBufferHandle(std::move(vmo_copy));
         if (!result.ok() || result->res != ZX_OK) {
-            ALOGE("GetBufferHandle failed: %d:%d", result.status(), GET_STATUS_SAFE(result, res));
+            mesa_loge("GetBufferHandle failed: %d:%d", result.status(),
+                      GET_STATUS_SAFE(result, res));
         } else {
             fuchsia_hardware_goldfish::wire::BufferHandleType handle_type = result->type;
             uint32_t buffer_handle = result->id;
@@ -3786,8 +3787,8 @@
         bool hasDedicatedBuffer =
             dedicatedAllocInfoPtr && (dedicatedAllocInfoPtr->buffer != VK_NULL_HANDLE);
         if (!hasDedicatedImage && !hasDedicatedBuffer) {
-            ALOGE(
-                "%s: dma-buf exportable memory requires dedicated Image or Buffer information.\n");
+            mesa_loge(
+                "dma-buf exportable memory requires dedicated Image or Buffer information.\n");
             return VK_ERROR_OUT_OF_DEVICE_MEMORY;
         }
 
@@ -3809,19 +3810,20 @@
             uint32_t bpp = 0;
             if (!gfxstream::vk::getVirtGpuFormatParams(imageCreateInfo.format, &virglFormat,
                                                        &target, &bind, &bpp)) {
-                ALOGE("%s: Unsupported VK format for VirtGpu resource, vkFormat: 0x%x", __func__,
-                      imageCreateInfo.format);
+                mesa_loge("%s: Unsupported VK format for VirtGpu resource, vkFormat: 0x%x",
+                          __func__, imageCreateInfo.format);
                 return VK_ERROR_FORMAT_NOT_SUPPORTED;
             }
             colorBufferBlob = instance->createResource(imageCreateInfo.extent.width,
                                                        imageCreateInfo.extent.height, virglFormat,
                                                        target, bind, bpp);
             if (!colorBufferBlob) {
-                ALOGE("%s: Failed to create colorBuffer resource for Image memory\n", __func__);
+                mesa_loge("%s: Failed to create colorBuffer resource for Image memory\n", __func__);
                 return VK_ERROR_OUT_OF_DEVICE_MEMORY;
             }
             if (0 != colorBufferBlob->wait()) {
-                ALOGE("%s: Failed to wait for colorBuffer resource for Image memory\n", __func__);
+                mesa_loge("%s: Failed to wait for colorBuffer resource for Image memory\n",
+                          __func__);
                 return VK_ERROR_OUT_OF_DEVICE_MEMORY;
             }
         }
@@ -3843,19 +3845,21 @@
             uint32_t bpp = 0;
             if (!gfxstream::vk::getVirtGpuFormatParams(vkFormat, &virglFormat, &target, &bind,
                                                        &bpp)) {
-                ALOGE("%s: Unexpected error getting VirtGpu format params for vkFormat: 0x%x",
-                      __func__, vkFormat);
+                mesa_loge("%s: Unexpected error getting VirtGpu format params for vkFormat: 0x%x",
+                          __func__, vkFormat);
                 return VK_ERROR_FORMAT_NOT_SUPPORTED;
             }
 
             colorBufferBlob = instance->createResource(bufferCreateInfo.size / bpp, 1, virglFormat,
                                                        target, bind, bpp);
             if (!colorBufferBlob) {
-                ALOGE("%s: Failed to create colorBuffer resource for Buffer memory\n", __func__);
+                mesa_loge("%s: Failed to create colorBuffer resource for Buffer memory\n",
+                          __func__);
                 return VK_ERROR_OUT_OF_DEVICE_MEMORY;
             }
             if (0 != colorBufferBlob->wait()) {
-                ALOGE("%s: Failed to wait for colorBuffer resource for Buffer memory\n", __func__);
+                mesa_loge("%s: Failed to wait for colorBuffer resource for Buffer memory\n",
+                          __func__);
                 return VK_ERROR_OUT_OF_DEVICE_MEMORY;
             }
         }
@@ -3869,7 +3873,7 @@
         auto instance = VirtGpuDevice::getInstance();
         colorBufferBlob = instance->importBlob(importHandle);
         if (!colorBufferBlob) {
-            ALOGE("%s: Failed to import colorBuffer resource\n", __func__);
+            mesa_loge("%s: Failed to import colorBuffer resource\n", __func__);
             return VK_ERROR_OUT_OF_DEVICE_MEMORY;
         }
     }
@@ -3904,8 +3908,8 @@
         zx_status_t status = zx_object_get_info(vmo_handle, ZX_INFO_HANDLE_BASIC, &handle_info,
                                                 sizeof(handle_info), nullptr, nullptr);
         if (status != ZX_OK) {
-            ALOGE("%s: cannot get vmo object info: vmo = %u status: %d.", __func__, vmo_handle,
-                  status);
+            mesa_loge("%s: cannot get vmo object info: vmo = %u status: %d.", __func__, vmo_handle,
+                      status);
             return VK_ERROR_OUT_OF_HOST_MEMORY;
         }
 
@@ -3917,7 +3921,7 @@
         status = zx_vmar_map(zx_vmar_root_self(), vm_permission, 0, vmo_handle, 0,
                              finalAllocInfo.allocationSize, &addr);
         if (status != ZX_OK) {
-            ALOGE("%s: cannot map vmar: status %d.", __func__, status);
+            mesa_loge("%s: cannot map vmar: status %d.", __func__, status);
             return VK_ERROR_OUT_OF_HOST_MEMORY;
         }
 
@@ -3960,7 +3964,7 @@
         zx_status_t status = zx_vmar_unmap(
             zx_vmar_root_self(), reinterpret_cast<zx_paddr_t>(info.ptr), info.allocationSize);
         if (status != ZX_OK) {
-            ALOGE("%s: Cannot unmap ptr: status %d", status);
+            mesa_loge("%s: Cannot unmap ptr: status %d", status);
         }
         info.ptr = nullptr;
     }
@@ -3986,7 +3990,7 @@
                                          VkDeviceMemory memory, VkDeviceSize offset,
                                          VkDeviceSize size, VkMemoryMapFlags, void** ppData) {
     if (host_result != VK_SUCCESS) {
-        ALOGE("%s: Host failed to map", __func__);
+        mesa_loge("%s: Host failed to map", __func__);
         return host_result;
     }
 
@@ -3994,7 +3998,7 @@
 
     auto deviceMemoryInfoIt = info_VkDeviceMemory.find(memory);
     if (deviceMemoryInfoIt == info_VkDeviceMemory.end()) {
-        ALOGE("%s: Failed to find VkDeviceMemory.", __func__);
+        mesa_loge("%s: Failed to find VkDeviceMemory.", __func__);
         return VK_ERROR_MEMORY_MAP_FAILED;
     }
     auto& deviceMemoryInfo = deviceMemoryInfoIt->second;
@@ -4006,7 +4010,7 @@
         VkEncoder* enc = (VkEncoder*)context;
         VkResult vkResult = enc->vkGetBlobGOOGLE(device, memory, /*doLock*/ false);
         if (vkResult != VK_SUCCESS) {
-            ALOGE("%s: Failed to vkGetBlobGOOGLE().", __func__);
+            mesa_loge("%s: Failed to vkGetBlobGOOGLE().", __func__);
             return vkResult;
         }
         lock.lock();
@@ -4038,13 +4042,13 @@
     }
 
     if (!deviceMemoryInfo.ptr) {
-        ALOGE("%s: VkDeviceMemory has nullptr.", __func__);
+        mesa_loge("%s: VkDeviceMemory has nullptr.", __func__);
         return VK_ERROR_MEMORY_MAP_FAILED;
     }
 
     if (size != VK_WHOLE_SIZE && (deviceMemoryInfo.ptr + offset + size >
                                   deviceMemoryInfo.ptr + deviceMemoryInfo.allocationSize)) {
-        ALOGE(
+        mesa_loge(
             "%s: size is too big. alloc size 0x%llx while we wanted offset 0x%llx size 0x%llx "
             "total 0x%llx",
             __func__, (unsigned long long)deviceMemoryInfo.allocationSize,
@@ -4198,22 +4202,22 @@
                 vmo = std::move(info.buffers[index].vmo);
             }
         } else {
-            ALOGE("WaitForBuffersAllocated failed: %d %d", result.status(),
-                  GET_STATUS_SAFE(result, status));
+            mesa_loge("WaitForBuffersAllocated failed: %d %d", result.status(),
+                      GET_STATUS_SAFE(result, status));
         }
 
         if (vmo.is_valid()) {
             zx::vmo vmo_dup;
             if (zx_status_t status = vmo.duplicate(ZX_RIGHT_SAME_RIGHTS, &vmo_dup);
                 status != ZX_OK) {
-                ALOGE("%s: zx_vmo_duplicate failed: %d", __func__, status);
+                mesa_loge("%s: zx_vmo_duplicate failed: %d", __func__, status);
                 abort();
             }
 
             auto buffer_handle_result = mControlDevice->GetBufferHandle(std::move(vmo_dup));
             if (!buffer_handle_result.ok()) {
-                ALOGE("%s: GetBufferHandle FIDL error: %d", __func__,
-                      buffer_handle_result.status());
+                mesa_loge("%s: GetBufferHandle FIDL error: %d", __func__,
+                          buffer_handle_result.status());
                 abort();
             }
             if (buffer_handle_result.value().res == ZX_OK) {
@@ -4221,8 +4225,8 @@
                 // If it is a ColorBuffer, no-op; Otherwise return error.
                 if (buffer_handle_result.value().type !=
                     fuchsia_hardware_goldfish::wire::BufferHandleType::kColorBuffer) {
-                    ALOGE("%s: BufferHandle %u is not a ColorBuffer", __func__,
-                          buffer_handle_result.value().id);
+                    mesa_loge("%s: BufferHandle %u is not a ColorBuffer", __func__,
+                              buffer_handle_result.value().id);
                     return VK_ERROR_OUT_OF_HOST_MEMORY;
                 }
             } else if (buffer_handle_result.value().res == ZX_ERR_NOT_FOUND) {
@@ -4248,16 +4252,16 @@
                 auto result =
                     mControlDevice->CreateColorBuffer2(std::move(vmo), std::move(createParams));
                 if (result.ok() && result->res == ZX_ERR_ALREADY_EXISTS) {
-                    ALOGD("CreateColorBuffer: color buffer already exists\n");
+                    mesa_logd("CreateColorBuffer: color buffer already exists\n");
                 } else if (!result.ok() || result->res != ZX_OK) {
-                    ALOGE("CreateColorBuffer failed: %d:%d", result.status(),
-                          GET_STATUS_SAFE(result, res));
+                    mesa_loge("CreateColorBuffer failed: %d:%d", result.status(),
+                              GET_STATUS_SAFE(result, res));
                 }
             }
 
             if (info.settings.buffer_settings.heap ==
                 fuchsia_sysmem::wire::HeapType::kGoldfishHostVisible) {
-                ALOGD(
+                mesa_logd(
                     "%s: Image uses host visible memory heap; set tiling "
                     "to linear to match host ImageCreateInfo",
                     __func__);
@@ -4366,7 +4370,7 @@
                                                        pYcbcrConversion, true /* do lock */);
 
     if (*pYcbcrConversion == VK_YCBCR_CONVERSION_DO_NOTHING) {
-        ALOGE(
+        mesa_loge(
             "FATAL: vkCreateSamplerYcbcrConversion returned a reserved value "
             "(VK_YCBCR_CONVERSION_DO_NOTHING)");
         abort();
@@ -4412,7 +4416,7 @@
                                                           pYcbcrConversion, true /* do lock */);
 
     if (*pYcbcrConversion == VK_YCBCR_CONVERSION_DO_NOTHING) {
-        ALOGE(
+        mesa_loge(
             "FATAL: vkCreateSamplerYcbcrConversionKHR returned a reserved value "
             "(VK_YCBCR_CONVERSION_DO_NOTHING)");
         abort();
@@ -4519,11 +4523,11 @@
 #if defined(VK_USE_PLATFORM_ANDROID_KHR) || defined(__linux__)
     if (exportSyncFd) {
         if (!mFeatureInfo->hasVirtioGpuNativeSync) {
-            ALOGV("%s: ensure sync device\n", __func__);
+            mesa_logi("%s: ensure sync device\n", __func__);
             ensureSyncDeviceFd();
         }
 
-        ALOGV("%s: getting fence info\n", __func__);
+        mesa_logi("%s: getting fence info\n", __func__);
         AutoLock<RecursiveLock> lock(mLock);
         auto it = info_VkFence.find(*pFence);
 
@@ -4533,7 +4537,7 @@
 
         info.external = true;
         info.exportFenceCreateInfo = *exportFenceInfoPtr;
-        ALOGV("%s: info set (fence still -1). fence: %p\n", __func__, (void*)(*pFence));
+        mesa_logi("%s: info set (fence still -1). fence: %p\n", __func__, (void*)(*pFence));
         // syncFd is still -1 because we expect user to explicitly
         // export it via vkGetFenceFdKHR
     }
@@ -4569,7 +4573,7 @@
 
 #if GFXSTREAM_ENABLE_GUEST_GOLDFISH
         if (info.syncFd >= 0) {
-            ALOGV("%s: resetting fence. make fd -1\n", __func__);
+            mesa_logi("%s: resetting fence. make fd -1\n", __func__);
             goldfish_sync_signal(info.syncFd);
             auto* syncHelper =
                 ResourceTracker::threadingCallbacks.hostConnectionGetFunc()->syncHelper();
@@ -4602,14 +4606,14 @@
     bool syncFdImport = pImportFenceFdInfo->handleType & VK_EXTERNAL_FENCE_HANDLE_TYPE_SYNC_FD_BIT;
 
     if (!syncFdImport) {
-        ALOGV("%s: VK_ERROR_OUT_OF_HOST_MEMORY: no sync fd import\n", __func__);
+        mesa_logi("%s: VK_ERROR_OUT_OF_HOST_MEMORY: no sync fd import\n", __func__);
         return VK_ERROR_OUT_OF_HOST_MEMORY;
     }
 
     AutoLock<RecursiveLock> lock(mLock);
     auto it = info_VkFence.find(pImportFenceFdInfo->fence);
     if (it == info_VkFence.end()) {
-        ALOGV("%s: VK_ERROR_OUT_OF_HOST_MEMORY: no fence info\n", __func__);
+        mesa_logi("%s: VK_ERROR_OUT_OF_HOST_MEMORY: no fence info\n", __func__);
         return VK_ERROR_OUT_OF_HOST_MEMORY;
     }
 
@@ -4618,17 +4622,17 @@
     auto* syncHelper = ResourceTracker::threadingCallbacks.hostConnectionGetFunc()->syncHelper();
 #if GFXSTREAM_ENABLE_GUEST_GOLDFISH
     if (info.syncFd >= 0) {
-        ALOGV("%s: previous sync fd exists, close it\n", __func__);
+        mesa_logi("%s: previous sync fd exists, close it\n", __func__);
         goldfish_sync_signal(info.syncFd);
         syncHelper->close(info.syncFd);
     }
 #endif
 
     if (pImportFenceFdInfo->fd < 0) {
-        ALOGV("%s: import -1, set to -1 and exit\n", __func__);
+        mesa_logi("%s: import -1, set to -1 and exit\n", __func__);
         info.syncFd = -1;
     } else {
-        ALOGV("%s: import actual fd, dup and close()\n", __func__);
+        mesa_logi("%s: import actual fd, dup and close()\n", __func__);
         info.syncFd = syncHelper->dup(pImportFenceFdInfo->fd);
         syncHelper->close(pImportFenceFdInfo->fd);
     }
@@ -4650,7 +4654,7 @@
     bool hasFence = pGetFdInfo->fence != VK_NULL_HANDLE;
 
     if (!hasFence) {
-        ALOGV("%s: VK_ERROR_OUT_OF_HOST_MEMORY: no fence\n", __func__);
+        mesa_logi("%s: VK_ERROR_OUT_OF_HOST_MEMORY: no fence\n", __func__);
         return VK_ERROR_OUT_OF_HOST_MEMORY;
     }
 
@@ -4658,7 +4662,7 @@
     bool syncFdExport = pGetFdInfo->handleType & VK_EXTERNAL_FENCE_HANDLE_TYPE_SYNC_FD_BIT;
 
     if (!syncFdExport) {
-        ALOGV("%s: VK_ERROR_OUT_OF_HOST_MEMORY: no sync fd fence\n", __func__);
+        mesa_logi("%s: VK_ERROR_OUT_OF_HOST_MEMORY: no sync fd fence\n", __func__);
         return VK_ERROR_OUT_OF_HOST_MEMORY;
     }
 
@@ -4666,7 +4670,7 @@
         enc->vkGetFenceStatus(device, pGetFdInfo->fence, true /* do lock */);
 
     if (VK_ERROR_DEVICE_LOST == currentFenceStatus) {  // Other error
-        ALOGV("%s: VK_ERROR_DEVICE_LOST: Other error\n", __func__);
+        mesa_logi("%s: VK_ERROR_DEVICE_LOST: Other error\n", __func__);
         *pFd = -1;
         return VK_ERROR_DEVICE_LOST;
     }
@@ -4680,7 +4684,7 @@
 
         auto it = info_VkFence.find(pGetFdInfo->fence);
         if (it == info_VkFence.end()) {
-            ALOGV("%s: VK_ERROR_OUT_OF_HOST_MEMORY: no fence info\n", __func__);
+            mesa_logi("%s: VK_ERROR_OUT_OF_HOST_MEMORY: no fence info\n", __func__);
             return VK_ERROR_OUT_OF_HOST_MEMORY;
         }
 
@@ -4690,7 +4694,7 @@
                                                VK_EXTERNAL_FENCE_HANDLE_TYPE_SYNC_FD_BIT);
 
         if (!syncFdCreated) {
-            ALOGV("%s: VK_ERROR_OUT_OF_HOST_MEMORY: no sync fd created\n", __func__);
+            mesa_logi("%s: VK_ERROR_OUT_OF_HOST_MEMORY: no sync fd created\n", __func__);
             return VK_ERROR_OUT_OF_HOST_MEMORY;
         }
 
@@ -4714,7 +4718,7 @@
 
         // relinquish ownership
         info.syncFd = -1;
-        ALOGV("%s: got fd: %d\n", __func__, *pFd);
+        mesa_logi("%s: got fd: %d\n", __func__, *pFd);
         return VK_SUCCESS;
     }
     return VK_ERROR_DEVICE_LOST;
@@ -4758,15 +4762,15 @@
         // schedule a wait group with waitAny/waitAll
         std::vector<WorkPool::Task> tasks;
 
-        ALOGV("%s: scheduling ext waits\n", __func__);
+        mesa_logi("%s: scheduling ext waits\n", __func__);
 
         for (auto fd : fencesExternalWaitFds) {
-            ALOGV("%s: wait on %d\n", __func__, fd);
+            mesa_logi("%s: wait on %d\n", __func__, fd);
             tasks.push_back([fd] {
                 auto* syncHelper =
                     ResourceTracker::threadingCallbacks.hostConnectionGetFunc()->syncHelper();
                 syncHelper->wait(fd, 3000);
-                ALOGV("done waiting on fd %d\n", fd);
+                mesa_logi("done waiting on fd %d\n", fd);
             });
         }
 
@@ -4775,7 +4779,7 @@
                 [this, fencesNonExternal /* copy of vector */, device, waitAll, timeout] {
                     auto hostConn = ResourceTracker::threadingCallbacks.hostConnectionGetFunc();
                     auto vkEncoder = ResourceTracker::threadingCallbacks.vkEncoderGetFunc(hostConn);
-                    ALOGV("%s: vkWaitForFences to host\n", __func__);
+                    mesa_logi("%s: vkWaitForFences to host\n", __func__);
                     vkEncoder->vkWaitForFences(device, fencesNonExternal.size(),
                                                fencesNonExternal.data(), waitAll, timeout,
                                                true /* do lock */);
@@ -4793,10 +4797,10 @@
         }
 
         if (waitRes) {
-            ALOGV("%s: VK_SUCCESS\n", __func__);
+            mesa_logi("%s: VK_SUCCESS\n", __func__);
             return VK_SUCCESS;
         } else {
-            ALOGV("%s: VK_TIMEOUT\n", __func__);
+            mesa_logi("%s: VK_TIMEOUT\n", __func__);
             return VK_TIMEOUT;
         }
     }
@@ -4941,7 +4945,7 @@
 
             for (uint32_t i = 0; i < descriptorSetCount; ++i) {
                 if (allocedSets.end() == allocedSets.find(pDescriptorSets[i])) {
-                    ALOGV(
+                    mesa_logi(
                         "%s: Warning: descriptor set %p not found in pool. Was this "
                         "double-freed?\n",
                         __func__, (void*)pDescriptorSets[i]);
@@ -5100,8 +5104,8 @@
             for (int syncFd : imageInfo.pendingQsriSyncFds) {
                 int syncWaitRet = syncHelper->wait(syncFd, 3000);
                 if (syncWaitRet < 0) {
-                    ALOGE("%s: Failed to wait for pending QSRI sync: sterror: %s errno: %d",
-                          __func__, strerror(errno), errno);
+                    mesa_loge("%s: Failed to wait for pending QSRI sync: sterror: %s errno: %d",
+                              __func__, strerror(errno), errno);
                 }
                 syncHelper->close(syncFd);
             }
@@ -5261,8 +5265,8 @@
                 vmo = gfxstream::guest::makeOptional(std::move(info.buffers[index].vmo));
             }
         } else {
-            ALOGE("WaitForBuffersAllocated failed: %d %d", result.status(),
-                  GET_STATUS_SAFE(result, status));
+            mesa_loge("WaitForBuffersAllocated failed: %d %d", result.status(),
+                      GET_STATUS_SAFE(result, status));
         }
 
         if (vmo && vmo->is_valid()) {
@@ -5274,8 +5278,8 @@
             auto result = mControlDevice->CreateBuffer2(std::move(*vmo), createParams);
             if (!result.ok() ||
                 (result->is_error() != ZX_OK && result->error_value() != ZX_ERR_ALREADY_EXISTS)) {
-                ALOGE("CreateBuffer2 failed: %d:%d", result.status(),
-                      GET_STATUS_SAFE(result, error_value()));
+                mesa_loge("CreateBuffer2 failed: %d:%d", result.status(),
+                          GET_STATUS_SAFE(result, error_value()));
             }
             isSysmemBackedMemory = true;
         }
@@ -5577,7 +5581,7 @@
         int fd = pImportSemaphoreFdInfo->fd;
         int err = lseek(fd, 0, SEEK_SET);
         if (err == -1) {
-            ALOGE("lseek fail on import semaphore");
+            mesa_loge("lseek fail on import semaphore");
         }
         int hostFd = 0;
         read(fd, &hostFd, sizeof(hostFd));
@@ -5601,8 +5605,8 @@
     VkMemoryFdPropertiesKHR* pMemoryFdProperties) {
 #if defined(__linux__) && !defined(VK_USE_PLATFORM_ANDROID_KHR)
     if (!(handleType & VK_EXTERNAL_MEMORY_HANDLE_TYPE_DMA_BUF_BIT_EXT)) {
-        ALOGE("%s: VK_KHR_external_memory_fd behavior not defined for handleType: 0x%x\n", __func__,
-              handleType);
+        mesa_loge("%s: VK_KHR_external_memory_fd behavior not defined for handleType: 0x%x\n",
+                  __func__, handleType);
         return VK_ERROR_INVALID_EXTERNAL_HANDLE;
     }
     // Sanity-check device
@@ -5640,8 +5644,8 @@
 
     if (!(pGetFdInfo->handleType & (VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT |
                                     VK_EXTERNAL_MEMORY_HANDLE_TYPE_DMA_BUF_BIT_EXT))) {
-        ALOGE("%s: Export operation not defined for handleType: 0x%x\n", __func__,
-              pGetFdInfo->handleType);
+        mesa_loge("%s: Export operation not defined for handleType: 0x%x\n", __func__,
+                  pGetFdInfo->handleType);
         return VK_ERROR_OUT_OF_HOST_MEMORY;
     }
     // Sanity-check device
@@ -5658,14 +5662,14 @@
     auto& info = deviceMemIt->second;
 
     if (!info.blobPtr) {
-        ALOGE("%s: VkDeviceMemory does not have a resource available for export.\n", __func__);
+        mesa_loge("%s: VkDeviceMemory does not have a resource available for export.\n", __func__);
         return VK_ERROR_OUT_OF_HOST_MEMORY;
     }
 
     VirtGpuExternalHandle handle{};
     int ret = info.blobPtr->exportBlob(handle);
     if (ret != 0 || handle.osHandle < 0) {
-        ALOGE("%s: Failed to export host resource to FD.\n", __func__);
+        mesa_loge("%s: Failed to export host resource to FD.\n", __func__);
         return VK_ERROR_OUT_OF_HOST_MEMORY;
     }
     *pFd = handle.osHandle;
@@ -5982,7 +5986,7 @@
             }
 
             if (externalFenceFdToSignal >= 0) {
-                ALOGV("%s: external fence real signal: %d\n", __func__, externalFenceFdToSignal);
+                mesa_logi("%s: external fence real signal: %d\n", __func__, externalFenceFdToSignal);
                 goldfish_sync_signal(externalFenceFdToSignal);
             }
 #endif
@@ -6003,12 +6007,12 @@
     lock.unlock();
 
     if (toWait.empty()) {
-        ALOGV("%s: No queue-specific work pool items\n", __func__);
+        mesa_logi("%s: No queue-specific work pool items\n", __func__);
         return enc->vkQueueWaitIdle(queue, true /* do lock */);
     }
 
     for (auto handle : toWait) {
-        ALOGV("%s: waiting on work group item: %llu\n", __func__, (unsigned long long)handle);
+        mesa_logi("%s: waiting on work group item: %llu\n", __func__, (unsigned long long)handle);
         mWorkPool.waitAll(handle);
     }
 
@@ -6024,7 +6028,7 @@
     }
 
     if (!outputNativeInfo || !outputNativeInfo) {
-        ALOGE("FATAL: Local native buffer info not properly allocated!");
+        mesa_loge("FATAL: Local native buffer info not properly allocated!");
         abort();
     }
 
@@ -6199,7 +6203,7 @@
                 } else if (isDescriptorTypeBufferView(descType)) {
                     ++info.bufferViewCount;
                 } else {
-                    ALOGE("%s: FATAL: Unknown descriptor type %d\n", __func__, descType);
+                    mesa_loge("%s: FATAL: Unknown descriptor type %d\n", __func__, descType);
                     // abort();
                 }
             }
@@ -6256,7 +6260,7 @@
                     info.bufferViewIndices[bufferViewIndex] = i;
                     ++bufferViewIndex;
                 } else {
-                    ALOGE("%s: FATAL: Unknown descriptor type %d\n", __func__, descType);
+                    mesa_loge("%s: FATAL: Unknown descriptor type %d\n", __func__, descType);
                     // abort();
                 }
             }
@@ -6431,7 +6435,7 @@
                     currInlineUniformBlockBufferBegin, reified);
             }
         } else {
-            ALOGE("%s: FATAL: Unknown descriptor type %d\n", __func__, descType);
+            mesa_loge("%s: FATAL: Unknown descriptor type %d\n", __func__, descType);
             abort();
         }
     }
@@ -6716,7 +6720,7 @@
             VkDeviceMemory vkDeviceMem = VK_NULL_HANDLE;
             VkResult result = getCoherentMemory(&info, enc, device, &vkDeviceMem);
             if (result != VK_SUCCESS) {
-                ALOGE("Failed to get coherent memory %u", result);
+                mesa_loge("Failed to get coherent memory %u", result);
                 return {.deviceMemory = VK_NULL_HANDLE, .ptr = nullptr};
             }
 
@@ -6728,7 +6732,7 @@
                 AutoLock<RecursiveLock> lock(mLock);
                 const auto it = info_VkDeviceMemory.find(vkDeviceMem);
                 if (it == info_VkDeviceMemory.end()) {
-                    ALOGE("Coherent memory allocated %u not found", result);
+                    mesa_loge("Coherent memory allocated %u not found", result);
                     return {.deviceMemory = VK_NULL_HANDLE, .ptr = nullptr};
                 };
 
@@ -6750,7 +6754,7 @@
             AutoLock<RecursiveLock> lock(mLock);
             auto it = info_VkDeviceMemory.find(deviceMemory);
             if (it == info_VkDeviceMemory.end()) {
-                ALOGE("Device memory to free not found");
+                mesa_loge("Device memory to free not found");
                 return;
             }
             auto coherentMemory = freeCoherentMemoryLocked(deviceMemory, it->second);
@@ -6973,7 +6977,7 @@
 
 #if defined(VK_USE_PLATFORM_ANDROID_KHR)
 VkResult ResourceTracker::exportSyncFdForQSRILocked(VkImage image, int* fd) {
-    ALOGV("%s: call for image %p hos timage handle 0x%llx\n", __func__, (void*)image,
+    mesa_logi("%s: call for image %p hos timage handle 0x%llx\n", __func__, (void*)image,
           (unsigned long long)get_host_u64_VkImage(image));
 
     if (mFeatureInfo->hasVirtioGpuNativeSync) {
@@ -7002,7 +7006,7 @@
 #endif
     }
 
-    ALOGV("%s: got fd: %d\n", __func__, *fd);
+    mesa_logi("%s: got fd: %d\n", __func__, *fd);
     auto imageInfoIt = info_VkImage.find(image);
     if (imageInfoIt != info_VkImage.end()) {
         auto& imageInfo = imageInfoIt->second;
@@ -7021,8 +7025,8 @@
                 syncHelper->close(syncFd);
             } else {
                 if (errno != ETIME) {
-                    ALOGE("%s: Failed to wait for pending QSRI sync: sterror: %s errno: %d",
-                          __func__, strerror(errno), errno);
+                    mesa_loge("%s: Failed to wait for pending QSRI sync: sterror: %s errno: %d",
+                              __func__, strerror(errno), errno);
                 }
                 break;
             }
@@ -7030,8 +7034,8 @@
 
         int syncFdDup = syncHelper->dup(*fd);
         if (syncFdDup < 0) {
-            ALOGE("%s: Failed to dup() QSRI sync fd : sterror: %s errno: %d", __func__,
-                  strerror(errno), errno);
+            mesa_loge("%s: Failed to dup() QSRI sync fd : sterror: %s errno: %d", __func__,
+                      strerror(errno), errno);
         } else {
             imageInfo.pendingQsriSyncFds.push_back(syncFdDup);
         }
@@ -7312,7 +7316,7 @@
 
             auto deviceInfoIt = info_VkDevice.find(device);
             if (deviceInfoIt == info_VkDevice.end()) {
-                ALOGE("Failed to pass device or physical device.");
+                mesa_loge("Failed to pass device or physical device.");
                 abort();
             }
             const auto& deviceInfo = deviceInfoIt->second;