turnip: Replace tu_log*() with mesa_log*()

This gets us logging on Android.

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6806>
This commit is contained in:
Eric Anholt 2020-09-21 13:02:14 -07:00
parent 13ea7db760
commit a55dc276a3
5 changed files with 14 additions and 56 deletions

View File

@ -255,7 +255,7 @@ tu_CreateInstance(const VkInstanceCreateInfo *pCreateInfo,
parse_debug_string(getenv("TU_DEBUG"), tu_debug_options);
if (instance->debug_flags & TU_DEBUG_STARTUP)
tu_logi("Created an instance");
mesa_logi("Created an instance");
for (uint32_t i = 0; i < pCreateInfo->enabledExtensionCount; i++) {
const char *ext_name = pCreateInfo->ppEnabledExtensionNames[i];

View File

@ -347,7 +347,7 @@ tu_drm_device_init(struct tu_physical_device *device,
drmFreeVersion(version);
if (instance->debug_flags & TU_DEBUG_STARTUP)
tu_logi("Found compatible device '%s'.", path);
mesa_logi("Found compatible device '%s'.", path);
vk_object_base_init(NULL, &device->base, VK_OBJECT_TYPE_PHYSICAL_DEVICE);
device->instance = instance;
@ -365,7 +365,7 @@ tu_drm_device_init(struct tu_physical_device *device,
if (tu_drm_get_gpu_id(device, &device->gpu_id)) {
if (instance->debug_flags & TU_DEBUG_STARTUP)
tu_logi("Could not query the GPU ID");
mesa_logi("Could not query the GPU ID");
result = vk_errorf(instance, VK_ERROR_INITIALIZATION_FAILED,
"could not get GPU ID");
goto fail;
@ -373,7 +373,7 @@ tu_drm_device_init(struct tu_physical_device *device,
if (tu_drm_get_gmem_size(device, &device->gmem_size)) {
if (instance->debug_flags & TU_DEBUG_STARTUP)
tu_logi("Could not query the GMEM size");
mesa_logi("Could not query the GMEM size");
result = vk_errorf(instance, VK_ERROR_INITIALIZATION_FAILED,
"could not get GMEM size");
goto fail;
@ -381,7 +381,7 @@ tu_drm_device_init(struct tu_physical_device *device,
if (tu_drm_get_gmem_base(device, &device->gmem_base)) {
if (instance->debug_flags & TU_DEBUG_STARTUP)
tu_logi("Could not query the GMEM size");
mesa_logi("Could not query the GMEM size");
result = vk_errorf(instance, VK_ERROR_INITIALIZATION_FAILED,
"could not get GMEM size");
goto fail;
@ -410,9 +410,9 @@ tu_enumerate_devices(struct tu_instance *instance)
if (instance->debug_flags & TU_DEBUG_STARTUP) {
if (max_devices < 0)
tu_logi("drmGetDevices2 returned error: %s\n", strerror(max_devices));
mesa_logi("drmGetDevices2 returned error: %s\n", strerror(max_devices));
else
tu_logi("Found %d drm nodes", max_devices);
mesa_logi("Found %d drm nodes", max_devices);
}
if (max_devices < 1)

View File

@ -188,7 +188,7 @@ tu_enumerate_devices(struct tu_instance *instance)
/* kgsl version check? */
if (instance->debug_flags & TU_DEBUG_STARTUP)
tu_logi("Found compatible device '%s'.", path);
mesa_logi("Found compatible device '%s'.", path);
vk_object_base_init(NULL, &device->base, VK_OBJECT_TYPE_PHYSICAL_DEVICE);
device->instance = instance;

View File

@ -43,9 +43,12 @@
#define VG(x) ((void)0)
#endif
#define MESA_LOG_TAG "TU"
#include "c11/threads.h"
#include "main/macros.h"
#include "util/list.h"
#include "util/log.h"
#include "util/macros.h"
#include "util/u_atomic.h"
#include "vk_alloc.h"
@ -141,10 +144,6 @@ __vk_errorf(struct tu_instance *instance,
void
__tu_finishme(const char *file, int line, const char *format, ...)
tu_printflike(3, 4);
void
tu_loge(const char *format, ...) tu_printflike(1, 2);
void
tu_logi(const char *format, ...) tu_printflike(1, 2);
/**
* Print a FINISHME message, including its source location.

View File

@ -33,47 +33,6 @@
#include "util/u_math.h"
#include "vk_enum_to_str.h"
/* TODO: Add Android support to tu_log funcs */
/** \see tu_loge() */
static void
tu_loge_v(const char *format, va_list va)
{
fprintf(stderr, "vk: error: ");
vfprintf(stderr, format, va);
fprintf(stderr, "\n");
}
/** Log an error message. */
void tu_printflike(1, 2) tu_loge(const char *format, ...)
{
va_list va;
va_start(va, format);
tu_loge_v(format, va);
va_end(va);
}
/** \see tu_logi() */
static void
tu_logi_v(const char *format, va_list va)
{
fprintf(stderr, "tu: info: ");
vfprintf(stderr, format, va);
fprintf(stderr, "\n");
}
/** Log an error message. */
void tu_printflike(1, 2) tu_logi(const char *format, ...)
{
va_list va;
va_start(va, format);
tu_logi_v(format, va);
va_end(va);
}
void tu_printflike(3, 4)
__tu_finishme(const char *file, int line, const char *format, ...)
{
@ -84,7 +43,7 @@ void tu_printflike(3, 4)
vsnprintf(buffer, sizeof(buffer), format, ap);
va_end(ap);
fprintf(stderr, "%s:%d: FINISHME: %s\n", file, line, buffer);
mesa_loge("%s:%d: FINISHME: %s\n", file, line, buffer);
}
VkResult
@ -109,9 +68,9 @@ __vk_errorf(struct tu_instance *instance,
vsnprintf(buffer, sizeof(buffer), format, ap);
va_end(ap);
fprintf(stderr, "%s:%d: %s (%s)\n", file, line, buffer, error_str);
mesa_loge("%s:%d: %s (%s)\n", file, line, buffer, error_str);
} else {
fprintf(stderr, "%s:%d: %s\n", file, line, error_str);
mesa_loge("%s:%d: %s\n", file, line, error_str);
}
return error;