v3dv: use Mesa log infrastructure instead of using stderr

The Mesa log infrastructure is really useful as it allows us to get
debug and error information in Android systems. Apart from that, it also
allows us to forward diagnostics into the right logs and files.

Therefore, instead of using stderr for all messages, use Mesa log and
separate the messages into debugging and error messages.

Signed-off-by: Maíra Canal <mcanal@igalia.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32304>
This commit is contained in:
Maíra Canal 2024-11-22 11:16:31 -03:00 committed by Marge Bot
parent 2c45a999a6
commit 3594a35610
13 changed files with 119 additions and 133 deletions

View file

@ -48,10 +48,10 @@ bo_dump_stats(struct v3dv_device *device)
{
struct v3dv_bo_cache *cache = &device->bo_cache;
fprintf(stderr, " BOs allocated: %d\n", device->bo_count);
fprintf(stderr, " BOs size: %dkb\n", device->bo_size / 1024);
fprintf(stderr, " BOs cached: %d\n", cache->cache_count);
fprintf(stderr, " BOs cached size: %dkb\n", cache->cache_size / 1024);
mesa_logi(" BOs allocated: %d\n", device->bo_count);
mesa_logi(" BOs size: %dkb\n", device->bo_size / 1024);
mesa_logi(" BOs cached: %d\n", cache->cache_count);
mesa_logi(" BOs cached size: %dkb\n", cache->cache_size / 1024);
if (!list_is_empty(&cache->time_list)) {
struct v3dv_bo *first = list_first_entry(&cache->time_list,
@ -61,15 +61,12 @@ bo_dump_stats(struct v3dv_device *device)
struct v3dv_bo,
time_list);
fprintf(stderr, " oldest cache time: %ld\n",
(long)first->free_time);
fprintf(stderr, " newest cache time: %ld\n",
(long)last->free_time);
mesa_logi(" oldest cache time: %ld\n", (long)first->free_time);
mesa_logi(" newest cache time: %ld\n", (long)last->free_time);
struct timespec time;
clock_gettime(CLOCK_MONOTONIC, &time);
fprintf(stderr, " now: %lld\n",
(long long)time.tv_sec);
mesa_logi(" now: %lld\n", (long long)time.tv_sec);
}
if (cache->size_list_size) {
@ -78,7 +75,7 @@ bo_dump_stats(struct v3dv_device *device)
if (list_is_empty(&cache->size_list[i]))
empty_size_list++;
}
fprintf(stderr, " Empty size_list lists: %d\n", empty_size_list);
mesa_logi(" Empty size_list lists: %d\n", empty_size_list);
}
}
@ -140,10 +137,8 @@ bo_free(struct v3dv_device *device,
device->bo_size -= bo->size;
if (dump_stats) {
fprintf(stderr, "Freed %s%s%dkb:\n",
bo->name ? bo->name : "",
bo->name ? " " : "",
bo->size / 1024);
mesa_logi("Freed %s%s%dkb:\n", bo->name ? bo->name : "",
bo->name ? " " : "", bo->size / 1024);
bo_dump_stats(device);
}
}
@ -164,7 +159,7 @@ bo_free(struct v3dv_device *device,
c.handle = handle;
int ret = v3dv_ioctl(device->pdevice->render_fd, DRM_IOCTL_GEM_CLOSE, &c);
if (ret != 0)
fprintf(stderr, "close object %d: %s\n", handle, strerror(errno));
mesa_loge("close object %d: %s\n", handle, strerror(errno));
return ret == 0;
}
@ -236,8 +231,7 @@ v3dv_bo_alloc(struct v3dv_device *device,
bo = bo_from_cache(device, size, name);
if (bo) {
if (dump_stats) {
fprintf(stderr, "Allocated %s %dkb from cache:\n",
name, size / 1024);
mesa_logi("Allocated %s %dkb from cache:\n", name, size / 1024);
bo_dump_stats(device);
}
return bo;
@ -262,7 +256,7 @@ v3dv_bo_alloc(struct v3dv_device *device,
goto retry;
}
fprintf(stderr, "Failed to allocate device memory for BO\n");
mesa_loge("Failed to allocate device memory for BO\n");
return NULL;
}
@ -277,7 +271,7 @@ v3dv_bo_alloc(struct v3dv_device *device,
device->bo_count++;
device->bo_size += bo->size;
if (dump_stats) {
fprintf(stderr, "Allocated %s %dkb:\n", name, size / 1024);
mesa_logi("Allocated %s %dkb:\n", name, size / 1024);
bo_dump_stats(device);
}
@ -300,15 +294,15 @@ v3dv_bo_map_unsynchronized(struct v3dv_device *device,
int ret = v3dv_ioctl(device->pdevice->render_fd,
DRM_IOCTL_V3D_MMAP_BO, &map);
if (ret != 0) {
fprintf(stderr, "map ioctl failure\n");
mesa_loge("map ioctl failure\n");
return false;
}
bo->map = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED,
device->pdevice->render_fd, map.offset);
if (bo->map == MAP_FAILED) {
fprintf(stderr, "mmap of bo %d (offset 0x%016llx, size %d) failed\n",
bo->handle, (long long)map.offset, (uint32_t)bo->size);
mesa_loge("mmap of bo %d (offset 0x%016llx, size %d) failed\n",
bo->handle, (long long)map.offset, (uint32_t)bo->size);
return false;
}
VG(VALGRIND_MALLOCLIKE_BLOCK(bo->map, bo->size, 0, false));
@ -342,7 +336,7 @@ v3dv_bo_map(struct v3dv_device *device, struct v3dv_bo *bo, uint32_t size)
ok = v3dv_bo_wait(device, bo, OS_TIMEOUT_INFINITE);
if (!ok) {
fprintf(stderr, "memory wait for map failed\n");
mesa_loge("memory wait for map failed\n");
return false;
}
@ -370,7 +364,7 @@ reallocate_size_list(struct v3dv_bo_cache *cache,
VK_SYSTEM_ALLOCATION_SCOPE_DEVICE);
if (!new_list) {
fprintf(stderr, "Failed to allocate host memory for cache bo list\n");
mesa_loge("Failed to allocate host memory for cache bo list\n");
return false;
}
struct list_head *old_list = cache->size_list;
@ -417,7 +411,7 @@ v3dv_bo_cache_init(struct v3dv_device *device)
device->bo_cache.max_cache_size = atoll(max_cache_size_str);
if (dump_stats) {
fprintf(stderr, "MAX BO CACHE SIZE: %iMB\n", device->bo_cache.max_cache_size);
mesa_logi("MAX BO CACHE SIZE: %iMB\n", device->bo_cache.max_cache_size);
}
mtx_lock(&device->bo_cache.lock);
@ -434,7 +428,7 @@ v3dv_bo_cache_destroy(struct v3dv_device *device)
vk_free(&device->vk.alloc, device->bo_cache.size_list);
if (dump_stats) {
fprintf(stderr, "BO stats after screen destroy:\n");
mesa_loge("BO stats after screen destroy:\n");
bo_dump_stats(device);
}
}
@ -452,7 +446,7 @@ free_stale_bos(struct v3dv_device *device,
/* If it's more than a second old, free it. */
if (time - bo->free_time > 2) {
if (dump_stats && !freed_any) {
fprintf(stderr, "Freeing stale BOs:\n");
mesa_logi("Freeing stale BOs:\n");
bo_dump_stats(device);
freed_any = true;
}
@ -465,7 +459,7 @@ free_stale_bos(struct v3dv_device *device,
}
if (dump_stats && freed_any) {
fprintf(stderr, "Freed stale BOs:\n");
mesa_logi("Freed stale BOs:\n");
bo_dump_stats(device);
}
}
@ -524,8 +518,7 @@ v3dv_bo_free(struct v3dv_device *device,
cache->cache_size += bo->size;
if (dump_stats) {
fprintf(stderr, "Freed %s %dkb to cache:\n",
bo->name, bo->size / 1024);
mesa_logi("Freed %s %dkb to cache:\n", bo->name, bo->size / 1024);
bo_dump_stats(device);
}
bo->name = NULL;

View file

@ -97,7 +97,7 @@ cl_alloc_bo(struct v3dv_cl *cl, uint32_t space, enum
struct v3dv_bo *bo = v3dv_bo_alloc(cl->job->device, space, "CL", true);
if (!bo) {
fprintf(stderr, "failed to allocate memory for command list\n");
mesa_loge("failed to allocate memory for command list\n");
v3dv_flag_oom(NULL, cl->job);
return false;
}
@ -106,7 +106,7 @@ cl_alloc_bo(struct v3dv_cl *cl, uint32_t space, enum
bool ok = v3dv_bo_map(cl->job->device, bo, bo->size);
if (!ok) {
fprintf(stderr, "failed to map command list buffer\n");
mesa_loge("failed to map command list buffer\n");
v3dv_flag_oom(NULL, cl->job);
return false;
}

View file

@ -873,7 +873,7 @@ v3dv_cmd_buffer_start_job(struct v3dv_cmd_buffer *cmd_buffer,
VK_SYSTEM_ALLOCATION_SCOPE_COMMAND);
if (!job) {
fprintf(stderr, "Error: failed to allocate CPU memory for job\n");
mesa_loge("Error: failed to allocate CPU memory for job\n");
v3dv_flag_oom(cmd_buffer, NULL);
return NULL;
}
@ -3557,8 +3557,8 @@ handle_sample_from_linear_image(struct v3dv_cmd_buffer *cmd_buffer,
if (view->vk.view_type != VK_IMAGE_VIEW_TYPE_2D ||
view->vk.level_count != 1 || view->vk.layer_count != 1 ||
blayout->array_size != 1) {
fprintf(stderr, "Sampling from linear image is not supported. "
"Expect corruption.\n");
mesa_loge("Sampling from linear image is not supported. "
"Expect corruption.\n");
continue;
}
@ -3605,8 +3605,8 @@ handle_sample_from_linear_image(struct v3dv_cmd_buffer *cmd_buffer,
result = v3dv_CreateImage(vk_device, &image_info,
&device->vk.alloc, &tiled_image);
if (result != VK_SUCCESS) {
fprintf(stderr, "Failed to copy linear 2D image for sampling."
"Expect corruption.\n");
mesa_loge("Failed to copy linear 2D image for sampling."
"Expect corruption.\n");
mtx_unlock(&device->meta.mtx);
continue;
}
@ -3641,8 +3641,8 @@ handle_sample_from_linear_image(struct v3dv_cmd_buffer *cmd_buffer,
result = v3dv_AllocateMemory(vk_device, &alloc_info,
&device->vk.alloc, &mem);
if (result != VK_SUCCESS) {
fprintf(stderr, "Failed to copy linear 2D image for sampling."
"Expect corruption.\n");
mesa_loge("Failed to copy linear 2D image for sampling."
"Expect corruption.\n");
v3dv_DestroyImage(vk_device, tiled_image, &device->vk.alloc);
mtx_unlock(&device->meta.mtx);
continue;
@ -3662,8 +3662,8 @@ handle_sample_from_linear_image(struct v3dv_cmd_buffer *cmd_buffer,
bind_info.pNext = &plane_bind_info;
result = v3dv_BindImageMemory2(vk_device, 1, &bind_info);
if (result != VK_SUCCESS) {
fprintf(stderr, "Failed to copy linear 2D image for sampling."
"Expect corruption.\n");
mesa_loge("Failed to copy linear 2D image for sampling."
"Expect corruption.\n");
v3dv_DestroyImage(vk_device, tiled_image, &device->vk.alloc);
v3dv_FreeMemory(vk_device, mem, &device->vk.alloc);
mtx_unlock(&device->meta.mtx);
@ -3696,8 +3696,8 @@ handle_sample_from_linear_image(struct v3dv_cmd_buffer *cmd_buffer,
};
result = v3dv_create_image_view(device, &view_info, &tiled_view);
if (result != VK_SUCCESS) {
fprintf(stderr, "Failed to copy linear 2D image for sampling."
"Expect corruption.\n");
mesa_loge("Failed to copy linear 2D image for sampling."
"Expect corruption.\n");
mtx_unlock(&device->meta.mtx);
continue;
}
@ -3806,8 +3806,8 @@ handle_sample_from_linear_image(struct v3dv_cmd_buffer *cmd_buffer,
}
}
} else {
fprintf(stderr, "Failed to copy linear 2D image for sampling."
"TFU doesn't support copy. Expect corruption.\n");
mesa_loge("Failed to copy linear 2D image for sampling."
"TFU doesn't support copy. Expect corruption.\n");
}
}
}
@ -3920,7 +3920,7 @@ v3dv_cmd_buffer_ensure_array_state(struct v3dv_cmd_buffer *cmd_buffer,
*ptr = vk_alloc(&cmd_buffer->device->vk.alloc, bytes, 8,
VK_SYSTEM_ALLOCATION_SCOPE_COMMAND);
if (*ptr == NULL) {
fprintf(stderr, "Error: failed to allocate CPU buffer for query.\n");
mesa_loge("Error: failed to allocate CPU buffer for query.\n");
v3dv_flag_oom(cmd_buffer, NULL);
return;
}

View file

@ -591,22 +591,22 @@ v3dv_CreateInstance(const VkInstanceCreateInfo *pCreateInfo,
instance->default_pipeline_cache_enabled = false;
instance->meta_cache_enabled = false;
} else {
fprintf(stderr, "Wrong value for envvar V3DV_ENABLE_PIPELINE_CACHE. "
"Allowed values are: full, no-default-cache, no-meta-cache, off\n");
mesa_loge("Wrong value for envvar V3DV_ENABLE_PIPELINE_CACHE. "
"Allowed values are: full, no-default-cache, no-meta-cache, off\n");
}
}
if (instance->pipeline_cache_enabled == false) {
fprintf(stderr, "WARNING: v3dv pipeline cache is disabled. Performance "
"can be affected negatively\n");
mesa_logw("v3dv pipeline cache is disabled. Performance "
"can be affected negatively\n");
}
if (instance->default_pipeline_cache_enabled == false) {
fprintf(stderr, "WARNING: default v3dv pipeline cache is disabled. "
"Performance can be affected negatively\n");
mesa_logw("default v3dv pipeline cache is disabled. "
"Performance can be affected negatively\n");
}
if (instance->meta_cache_enabled == false) {
fprintf(stderr, "WARNING: custom pipeline cache for meta operations are disabled. "
"Performance can be affected negatively\n");
mesa_logw("custom pipeline cache for meta operations are disabled. "
"Performance can be affected negatively\n");
}
@ -1438,7 +1438,7 @@ try_device(const char *path, int *fd, const char *target)
*fd = open(path, O_RDWR | O_CLOEXEC);
if (*fd < 0) {
fprintf(stderr, "Opening %s failed: %s\n", path, strerror(errno));
mesa_loge("Opening %s failed: %s\n", path, strerror(errno));
return false;
}
@ -1447,7 +1447,7 @@ try_device(const char *path, int *fd, const char *target)
version = drmGetVersion(*fd);
if (!version) {
fprintf(stderr, "Retrieving device version failed: %s\n", strerror(errno));
mesa_loge("Retrieving device version failed: %s\n", strerror(errno));
goto fail;
}
@ -1472,7 +1472,7 @@ try_display_device(struct v3dv_instance *instance, const char *path,
instance->vk.enabled_extensions.EXT_acquire_drm_display;
*fd = open(path, O_RDWR | O_CLOEXEC);
if (*fd < 0) {
fprintf(stderr, "Opening %s failed: %s\n", path, strerror(errno));
mesa_loge("Opening %s failed: %s\n", path, strerror(errno));
return;
}
@ -1501,7 +1501,7 @@ try_display_device(struct v3dv_instance *instance, const char *path,
drmModeResPtr mode_res = drmModeGetResources(*fd);
if (!mode_res) {
fprintf(stderr, "Failed to get DRM mode resources: %s\n", strerror(errno));
mesa_loge("Failed to get DRM mode resources: %s\n", strerror(errno));
goto fail;
}
@ -1980,7 +1980,7 @@ device_free_wsi_dumb(int32_t display_fd, int32_t dumb_handle)
.handle = dumb_handle,
};
if (v3dv_ioctl(display_fd, DRM_IOCTL_MODE_DESTROY_DUMB, &destroy_dumb)) {
fprintf(stderr, "destroy dumb object %d: %s\n", dumb_handle, strerror(errno));
mesa_loge("destroy dumb object %d: %s\n", dumb_handle, strerror(errno));
}
}

View file

@ -1787,13 +1787,13 @@ v3dv_CmdUpdateBuffer(VkCommandBuffer commandBuffer,
struct v3dv_bo *src_bo =
v3dv_bo_alloc(cmd_buffer->device, dataSize, "vkCmdUpdateBuffer", true);
if (!src_bo) {
fprintf(stderr, "Failed to allocate BO for vkCmdUpdateBuffer.\n");
mesa_loge("Failed to allocate BO for vkCmdUpdateBuffer.\n");
return;
}
bool ok = v3dv_bo_map(cmd_buffer->device, src_bo, src_bo->size);
if (!ok) {
fprintf(stderr, "Failed to map BO for vkCmdUpdateBuffer.\n");
mesa_loge("Failed to map BO for vkCmdUpdateBuffer.\n");
return;
}

View file

@ -1435,13 +1435,13 @@ upload_assembly(struct v3dv_pipeline *pipeline)
struct v3dv_bo *bo = v3dv_bo_alloc(pipeline->device, total_size,
"pipeline shader assembly", true);
if (!bo) {
fprintf(stderr, "failed to allocate memory for shader\n");
mesa_loge("failed to allocate memory for shader\n");
return false;
}
bool ok = v3dv_bo_map(pipeline->device, bo, total_size);
if (!ok) {
fprintf(stderr, "failed to map source shader buffer\n");
mesa_loge("failed to map source shader buffer\n");
return false;
}
@ -1659,9 +1659,9 @@ pipeline_compile_shader_variant(struct v3dv_pipeline_stage *p_stage,
struct v3dv_shader_variant *variant = NULL;
if (!qpu_insts) {
fprintf(stderr, "Failed to compile %s prog %d NIR to VIR\n",
broadcom_shader_stage_name(p_stage->stage),
p_stage->program_id);
mesa_loge("Failed to compile %s prog %d NIR to VIR\n",
broadcom_shader_stage_name(p_stage->stage),
p_stage->program_id);
*out_vk_result = VK_ERROR_UNKNOWN;
} else {
variant =

View file

@ -54,15 +54,15 @@ struct serialized_nir {
static void
cache_dump_stats(struct v3dv_pipeline_cache *cache)
{
fprintf(stderr, " NIR cache entries: %d\n", cache->nir_stats.count);
fprintf(stderr, " NIR cache miss count: %d\n", cache->nir_stats.miss);
fprintf(stderr, " NIR cache hit count: %d\n", cache->nir_stats.hit);
mesa_logi(" NIR cache entries: %d\n", cache->nir_stats.count);
mesa_logi(" NIR cache miss count: %d\n", cache->nir_stats.miss);
mesa_logi(" NIR cache hit count: %d\n", cache->nir_stats.hit);
fprintf(stderr, " cache entries: %d\n", cache->stats.count);
fprintf(stderr, " cache miss count: %d\n", cache->stats.miss);
fprintf(stderr, " cache hit count: %d\n", cache->stats.hit);
mesa_logi(" cache entries: %d\n", cache->stats.count);
mesa_logi(" cache miss count: %d\n", cache->stats.miss);
mesa_logi(" cache hit count: %d\n", cache->stats.hit);
fprintf(stderr, " on-disk cache hit count: %d\n", cache->stats.on_disk_hit);
mesa_logi(" on-disk cache hit count: %d\n", cache->stats.on_disk_hit);
}
static void
@ -131,7 +131,7 @@ v3dv_pipeline_cache_upload_nir(struct v3dv_pipeline *pipeline,
if (debug_cache) {
char sha1buf[41];
_mesa_sha1_format(sha1buf, snir->sha1_key);
fprintf(stderr, "pipeline cache %p, new nir entry %s\n", cache, sha1buf);
mesa_logi("pipeline cache %p, new nir entry %s\n", cache, sha1buf);
if (dump_stats)
cache_dump_stats(cache);
}
@ -154,7 +154,7 @@ v3dv_pipeline_cache_search_for_nir(struct v3dv_pipeline *pipeline,
char sha1buf[41];
_mesa_sha1_format(sha1buf, sha1_key);
fprintf(stderr, "pipeline cache %p, search for nir %s\n", cache, sha1buf);
mesa_logi("pipeline cache %p, search for nir %s\n", cache, sha1buf);
}
const struct serialized_nir *snir = NULL;
@ -180,7 +180,7 @@ v3dv_pipeline_cache_search_for_nir(struct v3dv_pipeline *pipeline,
} else {
cache->nir_stats.hit++;
if (debug_cache) {
fprintf(stderr, "[v3dv nir cache] hit: %p\n", nir);
mesa_logi("[v3dv nir cache] hit: %p\n", nir);
if (dump_stats)
cache_dump_stats(cache);
}
@ -190,7 +190,7 @@ v3dv_pipeline_cache_search_for_nir(struct v3dv_pipeline *pipeline,
cache->nir_stats.miss++;
if (debug_cache) {
fprintf(stderr, "[v3dv nir cache] miss\n");
mesa_logi("[v3dv nir cache] miss\n");
if (dump_stats)
cache_dump_stats(cache);
}
@ -259,7 +259,7 @@ v3dv_pipeline_cache_search_for_pipeline(struct v3dv_pipeline_cache *cache,
char sha1buf[41];
_mesa_sha1_format(sha1buf, sha1_key);
fprintf(stderr, "pipeline cache %p, search pipeline with key %s\n", cache, sha1buf);
mesa_logi("pipeline cache %p, search pipeline with key %s\n", cache, sha1buf);
}
pipeline_cache_lock(cache);
@ -275,7 +275,7 @@ v3dv_pipeline_cache_search_for_pipeline(struct v3dv_pipeline_cache *cache,
cache->stats.hit++;
*cache_hit = true;
if (debug_cache) {
fprintf(stderr, "[v3dv cache] hit: %p\n", cache_entry);
mesa_logi("[v3dv cache] hit: %p\n", cache_entry);
if (dump_stats)
cache_dump_stats(cache);
}
@ -290,7 +290,7 @@ v3dv_pipeline_cache_search_for_pipeline(struct v3dv_pipeline_cache *cache,
cache->stats.miss++;
if (debug_cache) {
fprintf(stderr, "[v3dv cache] miss\n");
mesa_logi("[v3dv cache] miss\n");
if (dump_stats)
cache_dump_stats(cache);
}
@ -314,9 +314,8 @@ v3dv_pipeline_cache_search_for_pipeline(struct v3dv_pipeline_cache *cache,
if (V3D_DBG(CACHE)) {
char sha1buf[41];
_mesa_sha1_format(sha1buf, cache_key);
fprintf(stderr, "[v3dv on-disk cache] %s %s\n",
buffer ? "hit" : "miss",
sha1buf);
mesa_logi("[v3dv on-disk cache] %s %s\n",
buffer ? "hit" : "miss", sha1buf);
}
if (buffer) {
@ -401,13 +400,13 @@ v3dv_pipeline_shared_data_new(struct v3dv_pipeline_cache *cache,
struct v3dv_bo *bo = v3dv_bo_alloc(cache->device, total_assembly_size,
"pipeline shader assembly", true);
if (!bo) {
fprintf(stderr, "failed to allocate memory for shaders assembly\n");
mesa_loge("failed to allocate memory for shaders assembly\n");
goto fail;
}
bool ok = v3dv_bo_map(cache->device, bo, total_assembly_size);
if (!ok) {
fprintf(stderr, "failed to map source shader buffer\n");
mesa_loge("failed to map source shader buffer\n");
goto fail;
}
@ -456,8 +455,8 @@ pipeline_cache_upload_shared_data(struct v3dv_pipeline_cache *cache,
char sha1buf[41];
_mesa_sha1_format(sha1buf, shared_data->sha1_key);
fprintf(stderr, "pipeline cache %p, new cache entry with sha1 key %s:%p\n\n",
cache, sha1buf, shared_data);
mesa_logi("pipeline cache %p, new cache entry with sha1 key %s:%p\n\n",
cache, sha1buf, shared_data);
if (dump_stats)
cache_dump_stats(cache);
}
@ -483,7 +482,7 @@ pipeline_cache_upload_shared_data(struct v3dv_pipeline_cache *cache,
if (V3D_DBG(CACHE)) {
char sha1buf[41];
_mesa_sha1_format(sha1buf, shared_data->sha1_key);
fprintf(stderr, "[v3dv on-disk cache] storing %s\n", sha1buf);
mesa_logi("[v3dv on-disk cache] storing %s\n", sha1buf);
}
disk_cache_put(disk_cache, cache_key, binary.data, binary.size, NULL);
}
@ -700,8 +699,8 @@ pipeline_cache_load(struct v3dv_pipeline_cache *cache,
}
if (debug_cache) {
fprintf(stderr, "pipeline cache %p, loaded %i nir shaders and "
"%i entries\n", cache, nir_count, count);
mesa_logi("pipeline cache %p, loaded %i nir shaders and "
"%i entries\n", cache, nir_count, count);
if (dump_stats)
cache_dump_stats(cache);
}
@ -822,8 +821,8 @@ v3dv_MergePipelineCaches(VkDevice device,
char sha1buf[41];
_mesa_sha1_format(sha1buf, snir_dst->sha1_key);
fprintf(stderr, "pipeline cache %p, added nir entry %s "
"from pipeline cache %p\n",
mesa_logi("pipeline cache %p, added nir entry %s "
"from pipeline cache %p\n",
dst, sha1buf, src);
if (dump_stats)
cache_dump_stats(dst);
@ -845,8 +844,8 @@ v3dv_MergePipelineCaches(VkDevice device,
char sha1buf[41];
_mesa_sha1_format(sha1buf, cache_entry->sha1_key);
fprintf(stderr, "pipeline cache %p, added entry %s "
"from pipeline cache %p\n",
mesa_logi("pipeline cache %p, added entry %s "
"from pipeline cache %p\n",
dst, sha1buf, src);
if (dump_stats)
cache_dump_stats(dst);
@ -1033,10 +1032,10 @@ v3dv_GetPipelineCacheData(VkDevice _device,
if (debug_cache) {
assert(count <= cache->stats.count);
fprintf(stderr, "GetPipelineCacheData: serializing cache %p, "
"%i nir shader entries "
"%i entries, %u DataSize\n",
cache, nir_count, count, (uint32_t) *pDataSize);
mesa_logi("GetPipelineCacheData: serializing cache %p, "
"%i nir shader entries "
"%i entries, %u DataSize\n",
cache, nir_count, count, (uint32_t) *pDataSize);
}
done:

View file

@ -102,7 +102,7 @@
#if MESA_DEBUG
#define v3dv_assert(x) ({ \
if (unlikely(!(x))) \
fprintf(stderr, "%s:%d ASSERT: %s", __FILE__, __LINE__, #x); \
mesa_loge("%s:%d ASSERT: %s", __FILE__, __LINE__, #x); \
})
#else
#define v3dv_assert(x)
@ -110,7 +110,7 @@
#define perf_debug(...) do { \
if (V3D_DBG(PERF)) \
fprintf(stderr, __VA_ARGS__); \
mesa_logi(__VA_ARGS__); \
} while (0)
struct v3dv_instance;

View file

@ -47,8 +47,8 @@ kperfmon_create(struct v3dv_device *device,
DRM_IOCTL_V3D_PERFMON_CREATE,
&req);
if (ret)
fprintf(stderr, "Failed to create perfmon for query %d: %s\n", query,
strerror(errno));
mesa_loge("Failed to create perfmon for query %d: %s\n", query,
strerror(errno));
pool->queries[query].perf.kperfmon_ids[i] = req.id;
}
@ -73,8 +73,8 @@ kperfmon_destroy(struct v3dv_device *device,
&req);
if (ret) {
fprintf(stderr, "Failed to destroy perfmon %u: %s\n",
req.id, strerror(errno));
mesa_loge("Failed to destroy perfmon %u: %s\n",
req.id, strerror(errno));
}
}
}
@ -655,7 +655,7 @@ write_performance_query_result(struct v3dv_device *device,
&req);
if (ret) {
fprintf(stderr, "failed to get perfmon values: %s\n", strerror(errno));
mesa_loge("failed to get perfmon values: %s\n", strerror(errno));
return vk_error(device, VK_ERROR_DEVICE_LOST);
}
}
@ -1107,7 +1107,7 @@ cmd_buffer_emit_copy_query_pool_results(struct v3dv_cmd_buffer *cmd_buffer,
&device->queries.copy_pipeline[pipeline_idx]);
ralloc_free(copy_query_results_cs_nir);
if (result != VK_SUCCESS) {
fprintf(stderr, "Failed to create copy query results pipeline\n");
mesa_loge("Failed to create copy query results pipeline\n");
return;
}
}
@ -1136,8 +1136,8 @@ cmd_buffer_emit_copy_query_pool_results(struct v3dv_cmd_buffer *cmd_buffer,
allocate_storage_buffer_descriptor_set(cmd_buffer,
&out_buf_descriptor_set);
if (result != VK_SUCCESS) {
fprintf(stderr, "vkCmdCopyQueryPoolResults failed: "
"could not allocate descriptor.\n");
mesa_loge("vkCmdCopyQueryPoolResults failed: "
"could not allocate descriptor.\n");
return;
}
@ -1296,7 +1296,7 @@ v3dv_reset_query_pool_cpu(struct v3dv_device *device,
for (uint32_t i = first; i < first + count; i++) {
if (vk_sync_reset(&device->vk, pool->queries[i].timestamp.sync) != VK_SUCCESS)
fprintf(stderr, "Failed to reset sync");
mesa_loge("Failed to reset sync");
}
mtx_unlock(&device->query_mutex);
@ -1325,7 +1325,7 @@ v3dv_reset_query_pool_cpu(struct v3dv_device *device,
kperfmon_destroy(device, pool, i);
kperfmon_create(device, pool, i);
if (vk_sync_reset(&device->vk, q->perf.last_job_sync) != VK_SUCCESS)
fprintf(stderr, "Failed to reset sync");
mesa_loge("Failed to reset sync");
break;
default:
unreachable("Unsupported query type");

View file

@ -55,7 +55,7 @@ v3dv_clif_dump(struct v3dv_device *device,
bool ok = v3dv_bo_map(device, bo, bo->size);
if (!ok) {
fprintf(stderr, "failed to map BO for clif_dump.\n");
mesa_loge("failed to map BO for clif_dump.\n");
ralloc_free(name);
goto free_clif;
}
@ -1015,8 +1015,8 @@ handle_cl_job(struct v3dv_queue *queue,
static bool warned = false;
if (ret && !warned) {
fprintf(stderr, "Draw call returned %s. Expect corruption.\n",
strerror(errno));
mesa_loge("Draw call returned %s. Expect corruption.\n",
strerror(errno));
warned = true;
}
@ -1127,8 +1127,8 @@ handle_csd_job(struct v3dv_queue *queue,
static bool warned = false;
if (ret && !warned) {
fprintf(stderr, "Compute dispatch returned %s. Expect corruption.\n",
strerror(errno));
mesa_loge("Compute dispatch returned %s. Expect corruption.\n",
strerror(errno));
warned = true;
}

View file

@ -97,7 +97,7 @@ check_push_constants_ubo(struct v3dv_cmd_buffer *cmd_buffer,
cmd_buffer->push_constants_resource.bo);
if (!cmd_buffer->push_constants_resource.bo) {
fprintf(stderr, "Failed to allocate memory for push constants\n");
mesa_loge("Failed to allocate memory for push constants\n");
abort();
}
@ -105,7 +105,7 @@ check_push_constants_ubo(struct v3dv_cmd_buffer *cmd_buffer,
cmd_buffer->push_constants_resource.bo,
cmd_buffer->push_constants_resource.bo->size);
if (!ok) {
fprintf(stderr, "failed to map push constants buffer\n");
mesa_loge("failed to map push constants buffer\n");
abort();
}
} else {
@ -616,10 +616,8 @@ v3dv_write_uniforms_wg_offsets(struct v3dv_cmd_buffer *cmd_buffer,
} else {
assert(cmd_buffer->vk.level == VK_COMMAND_BUFFER_LEVEL_SECONDARY);
num_layers = 2048;
#if MESA_DEBUG
fprintf(stderr, "Skipping gl_LayerID shader sanity check for "
"secondary command buffer\n");
#endif
mesa_logd("Skipping gl_LayerID shader sanity check for "
"secondary command buffer\n");
}
cl_aligned_u32(&uniforms, num_layers);
break;

View file

@ -625,18 +625,14 @@ get_attr_type(const struct util_format_description *desc)
attr_type = ATTRIBUTE_BYTE;
break;
default:
fprintf(stderr,
"format %s unsupported\n",
desc->name);
mesa_loge("format %s unsupported\n", desc->name);
attr_type = ATTRIBUTE_BYTE;
abort();
}
break;
default:
fprintf(stderr,
"format %s unsupported\n",
desc->name);
mesa_loge("format %s unsupported\n", desc->name);
abort();
}
@ -769,14 +765,14 @@ v3dX(create_default_attribute_values)(struct v3dv_device *device,
bo = v3dv_bo_alloc(device, size, "default_vi_attributes", true);
if (!bo) {
fprintf(stderr, "failed to allocate memory for the default "
"attribute values\n");
mesa_loge("failed to allocate memory for the default "
"attribute values\n");
return NULL;
}
bool ok = v3dv_bo_map(device, bo, size);
if (!ok) {
fprintf(stderr, "failed to map default attribute values buffer\n");
mesa_loge("failed to map default attribute values buffer\n");
return NULL;
}

View file

@ -51,8 +51,8 @@ v3dX(enumerate_performance_query_counters)(struct v3dv_physical_device *pDevice,
int ret = v3dv_ioctl(pDevice->render_fd, DRM_IOCTL_V3D_PERFMON_GET_COUNTER,
&counter);
if (ret) {
fprintf(stderr, "Failed to get counter description for counter %d: %s\n",
i, strerror(errno));
mesa_loge("Failed to get counter description for counter %d: %s\n",
i, strerror(errno));
}
name = (char *) counter.name;