mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 04:58:05 +02:00
winsys/amdgpu: use mesa_loge instead of fprintf
It's helpful on platforms with custom loggers like Android. Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35733>
This commit is contained in:
parent
c1bfbabca3
commit
bb22697437
2 changed files with 22 additions and 20 deletions
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
#include "util/os_drm.h"
|
||||
#include "util/hash_table.h"
|
||||
#include "util/log.h"
|
||||
#include "util/os_time.h"
|
||||
#include "util/u_hash_table.h"
|
||||
#include "util/u_process.h"
|
||||
|
|
@ -112,7 +113,7 @@ static bool amdgpu_bo_wait(struct radeon_winsys *rws,
|
|||
|
||||
r = ac_drm_bo_wait_for_idle(aws->dev, get_real_bo(bo)->bo, timeout, &buffer_busy);
|
||||
if (r)
|
||||
fprintf(stderr, "%s: amdgpu_bo_wait_for_idle failed %i\n", __func__, r);
|
||||
mesa_loge("%s: amdgpu_bo_wait_for_idle failed %i\n", __func__, r);
|
||||
|
||||
if (!buffer_busy)
|
||||
get_real_bo(bo)->slab_has_busy_alt_fences = false;
|
||||
|
|
@ -660,11 +661,11 @@ static struct amdgpu_winsys_bo *amdgpu_create_bo(struct amdgpu_winsys *aws,
|
|||
|
||||
r = ac_drm_bo_alloc(aws->dev, &request, &buf_handle);
|
||||
if (r) {
|
||||
fprintf(stderr, "amdgpu: Failed to allocate a buffer:\n");
|
||||
fprintf(stderr, "amdgpu: size : %"PRIu64" bytes\n", size);
|
||||
fprintf(stderr, "amdgpu: alignment : %u bytes\n", alignment);
|
||||
fprintf(stderr, "amdgpu: domains : %u\n", initial_domain);
|
||||
fprintf(stderr, "amdgpu: flags : %" PRIx64 "\n", request.flags);
|
||||
mesa_loge("amdgpu: Failed to allocate a buffer:\n");
|
||||
mesa_loge("amdgpu: size : %"PRIu64" bytes\n", size);
|
||||
mesa_loge("amdgpu: alignment : %u bytes\n", alignment);
|
||||
mesa_loge("amdgpu: domains : %u\n", initial_domain);
|
||||
mesa_loge("amdgpu: flags : %" PRIx64 "\n", request.flags);
|
||||
goto error_bo_alloc;
|
||||
}
|
||||
|
||||
|
|
@ -680,8 +681,8 @@ static struct amdgpu_winsys_bo *amdgpu_create_bo(struct amdgpu_winsys *aws,
|
|||
(flags & RADEON_FLAG_32BIT ? AMDGPU_VA_RANGE_32_BIT : 0) |
|
||||
AMDGPU_VA_RANGE_HIGH);
|
||||
if (r) {
|
||||
fprintf(stderr, "amdgpu: failed to allocate %"PRIu64" bytes from the %u-bit address space\n",
|
||||
size + va_gap_size, flags & RADEON_FLAG_32BIT ? 32 : 64);
|
||||
mesa_loge("amdgpu: failed to allocate %"PRIu64" bytes from the %u-bit address space\n",
|
||||
size + va_gap_size, flags & RADEON_FLAG_32BIT ? 32 : 64);
|
||||
goto error_va_alloc;
|
||||
}
|
||||
|
||||
|
|
@ -1138,7 +1139,7 @@ static void amdgpu_bo_sparse_destroy(struct radeon_winsys *rws, struct pb_buffer
|
|||
(uint64_t)bo->num_va_pages * RADEON_SPARSE_PAGE_SIZE,
|
||||
amdgpu_va_get_start_addr(bo->va_handle), 0, AMDGPU_VA_OP_CLEAR);
|
||||
if (r) {
|
||||
fprintf(stderr, "amdgpu: clearing PRT VA region on destroy failed (%d)\n", r);
|
||||
mesa_loge("amdgpu: clearing PRT VA region on destroy failed (%d)\n", r);
|
||||
}
|
||||
|
||||
while (!list_is_empty(&bo->backing)) {
|
||||
|
|
@ -1336,7 +1337,7 @@ amdgpu_bo_sparse_commit(struct radeon_winsys *rws, struct pb_buffer_lean *buf,
|
|||
|
||||
if (!sparse_backing_free(aws, bo, backing, backing_start, span_pages)) {
|
||||
/* Couldn't allocate tracking data structures, so we have to leak */
|
||||
fprintf(stderr, "amdgpu: leaking PRT backing memory\n");
|
||||
mesa_loge("amdgpu: leaking PRT backing memory\n");
|
||||
ok = false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
#include "amdgpu_cs.h"
|
||||
#include "util/detect_os.h"
|
||||
#include "util/log.h"
|
||||
#include "amdgpu_winsys.h"
|
||||
#include "util/os_time.h"
|
||||
#include <inttypes.h>
|
||||
|
|
@ -278,7 +279,7 @@ static struct radeon_winsys_ctx *amdgpu_ctx_create(struct radeon_winsys *rws, un
|
|||
break;
|
||||
}
|
||||
if (r) {
|
||||
fprintf(stderr, "amdgpu: amdgpu_cs_ctx_create2 failed. (%i)\n", r);
|
||||
mesa_loge("amdgpu: amdgpu_cs_ctx_create2 failed. (%i)\n", r);
|
||||
goto error_create;
|
||||
}
|
||||
|
||||
|
|
@ -288,14 +289,14 @@ static struct radeon_winsys_ctx *amdgpu_ctx_create(struct radeon_winsys *rws, un
|
|||
|
||||
r = ac_drm_bo_alloc(dev, &alloc_buffer, &buf_handle);
|
||||
if (r) {
|
||||
fprintf(stderr, "amdgpu: amdgpu_bo_alloc failed. (%i)\n", r);
|
||||
mesa_loge("amdgpu: amdgpu_bo_alloc failed. (%i)\n", r);
|
||||
goto error_user_fence_alloc;
|
||||
}
|
||||
|
||||
ctx->user_fence_cpu_address_base = NULL;
|
||||
r = ac_drm_bo_cpu_map(dev, buf_handle, (void**)&ctx->user_fence_cpu_address_base);
|
||||
if (r) {
|
||||
fprintf(stderr, "amdgpu: amdgpu_bo_cpu_map failed. (%i)\n", r);
|
||||
mesa_loge("amdgpu: amdgpu_bo_cpu_map failed. (%i)\n", r);
|
||||
goto error_user_fence_map;
|
||||
}
|
||||
|
||||
|
|
@ -514,7 +515,7 @@ amdgpu_ctx_query_reset_status(struct radeon_winsys_ctx *rwctx, bool full_reset_o
|
|||
}
|
||||
}
|
||||
} else {
|
||||
fprintf(stderr, "amdgpu: amdgpu_cs_query_reset_state2 failed. (%i)\n", r);
|
||||
mesa_loge("amdgpu: amdgpu_cs_query_reset_state2 failed. (%i)\n", r);
|
||||
}
|
||||
|
||||
/* Return a failure due to SW issues. */
|
||||
|
|
@ -600,7 +601,7 @@ amdgpu_do_add_buffer(struct amdgpu_cs_context *csc, struct amdgpu_winsys_bo *bo,
|
|||
REALLOC(list->buffers, list->max_buffers * sizeof(*new_buffers),
|
||||
new_max * sizeof(*new_buffers));
|
||||
if (!new_buffers) {
|
||||
fprintf(stderr, "amdgpu_do_add_buffer: allocation failed\n");
|
||||
mesa_loge("amdgpu_do_add_buffer: allocation failed\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
@ -699,7 +700,7 @@ static bool amdgpu_ib_new_buffer(struct amdgpu_winsys *aws,
|
|||
aws->info.gart_page_size,
|
||||
domain, (radeon_bo_flag)flags);
|
||||
if (!pb) {
|
||||
fprintf(stderr, "amdgpu: failed to create IB buffer: size=%u\n", buffer_size);
|
||||
mesa_loge("amdgpu: failed to create IB buffer: size=%u\n", buffer_size);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -1434,7 +1435,7 @@ static void amdgpu_cs_add_userq_packets(struct amdgpu_userq *userq,
|
|||
amdgpu_pkt_add_dw(PKT3(PKT3_PROTECTED_FENCE_SIGNAL, 0, 0));
|
||||
amdgpu_pkt_add_dw(0);
|
||||
} else {
|
||||
fprintf(stderr, "amdgpu: unsupported userq ip submission = %d\n", userq->ip_type);
|
||||
mesa_loge("amdgpu: unsupported userq ip submission = %d\n", userq->ip_type);
|
||||
}
|
||||
|
||||
amdgpu_pkt_end();
|
||||
|
|
@ -1513,7 +1514,7 @@ static int amdgpu_cs_submit_ib_userq(struct amdgpu_userq *userq,
|
|||
*/
|
||||
r = ac_drm_userq_wait(aws->dev, &userq_wait_data);
|
||||
if (r)
|
||||
fprintf(stderr, "amdgpu: getting wait num_fences failed\n");
|
||||
mesa_loge("amdgpu: getting wait num_fences failed\n");
|
||||
|
||||
fence_info = (struct drm_amdgpu_userq_fence_info*)
|
||||
alloca(userq_wait_data.num_fences * sizeof(struct drm_amdgpu_userq_fence_info));
|
||||
|
|
@ -1521,7 +1522,7 @@ static int amdgpu_cs_submit_ib_userq(struct amdgpu_userq *userq,
|
|||
|
||||
r = ac_drm_userq_wait(aws->dev, &userq_wait_data);
|
||||
if (r)
|
||||
fprintf(stderr, "amdgpu: getting wait fences failed\n");
|
||||
mesa_loge("amdgpu: getting wait fences failed\n");
|
||||
|
||||
simple_mtx_lock(&userq->lock);
|
||||
amdgpu_cs_add_userq_packets(userq, csc, userq_wait_data.num_fences, fence_info);
|
||||
|
|
@ -1722,7 +1723,7 @@ static void amdgpu_cs_submit_ib(void *job, void *gdata, int thread_index)
|
|||
struct amdgpu_cs_buffer *real_buffer =
|
||||
amdgpu_do_add_buffer(csc, &backing->bo->b, &csc->buffer_lists[AMDGPU_BO_REAL], true);
|
||||
if (!real_buffer) {
|
||||
fprintf(stderr, "%s: failed to add sparse backing buffer\n", __func__);
|
||||
mesa_loge("%s: failed to add sparse backing buffer\n", __func__);
|
||||
simple_mtx_unlock(&sparse_bo->commit_lock);
|
||||
r = -ENOMEM;
|
||||
out_of_memory = true;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue