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>
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];
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;
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;
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;
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;
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)
/* 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;
#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"
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.
#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, ...)
{
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
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;