* [PATCH libdrm] amdgpu: print error messages when amdgpu_device_initialize is failing
@ 2017-09-12 17:39 Marek Olšák
[not found] ` <1505237954-842-1-git-send-email-maraeo-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
0 siblings, 1 reply; 2+ messages in thread
From: Marek Olšák @ 2017-09-12 17:39 UTC (permalink / raw)
To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
From: Marek Olšák <marek.olsak@amd.com>
---
amdgpu/amdgpu_device.c | 19 ++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)
diff --git a/amdgpu/amdgpu_device.c b/amdgpu/amdgpu_device.c
index 9a238d9..2b31c45 100644
--- a/amdgpu/amdgpu_device.c
+++ b/amdgpu/amdgpu_device.c
@@ -184,42 +184,47 @@ int amdgpu_device_initialize(int fd,
uint32_t accel_working = 0;
uint64_t start, max;
*device_handle = NULL;
pthread_mutex_lock(&fd_mutex);
if (!fd_tab)
fd_tab = util_hash_table_create(fd_hash, fd_compare);
r = amdgpu_get_auth(fd, &flag_auth);
if (r) {
+ fprintf(stderr, "%s: amdgpu_get_auth (1) failed (%i)\n",
+ __func__, r);
pthread_mutex_unlock(&fd_mutex);
return r;
}
dev = util_hash_table_get(fd_tab, UINT_TO_PTR(fd));
if (dev) {
r = amdgpu_get_auth(dev->fd, &flag_authexist);
if (r) {
+ fprintf(stderr, "%s: amdgpu_get_auth (2) failed (%i)\n",
+ __func__, r);
pthread_mutex_unlock(&fd_mutex);
return r;
}
if ((flag_auth) && (!flag_authexist)) {
dev->flink_fd = dup(fd);
}
*major_version = dev->major_version;
*minor_version = dev->minor_version;
amdgpu_device_reference(device_handle, dev);
pthread_mutex_unlock(&fd_mutex);
return 0;
}
dev = calloc(1, sizeof(struct amdgpu_device));
if (!dev) {
+ fprintf(stderr, "%s: calloc failed\n", __func__);
pthread_mutex_unlock(&fd_mutex);
return -ENOMEM;
}
dev->fd = -1;
dev->flink_fd = -1;
atomic_set(&dev->refcount, 1);
version = drmGetVersion(fd);
@@ -241,41 +246,49 @@ int amdgpu_device_initialize(int fd,
dev->minor_version = version->version_minor;
drmFreeVersion(version);
dev->bo_flink_names = util_hash_table_create(handle_hash,
handle_compare);
dev->bo_handles = util_hash_table_create(handle_hash, handle_compare);
pthread_mutex_init(&dev->bo_table_mutex, NULL);
/* Check if acceleration is working. */
r = amdgpu_query_info(dev, AMDGPU_INFO_ACCEL_WORKING, 4, &accel_working);
- if (r)
+ if (r) {
+ fprintf(stderr, "%s: amdgpu_query_info(ACCEL_WORKING) failed (%i)\n",
+ __func__, r);
goto cleanup;
+ }
if (!accel_working) {
+ fprintf(stderr, "%s: AMDGPU_INFO_ACCEL_WORKING = 0\n", __func__);
r = -EBADF;
goto cleanup;
}
r = amdgpu_query_gpu_info_init(dev);
- if (r)
+ if (r) {
+ fprintf(stderr, "%s: amdgpu_query_gpu_info_init failed\n", __func__);
goto cleanup;
+ }
amdgpu_vamgr_init(&dev->vamgr, dev->dev_info.virtual_address_offset,
dev->dev_info.virtual_address_max,
dev->dev_info.virtual_address_alignment);
max = MIN2(dev->dev_info.virtual_address_max, 0xffffffff);
start = amdgpu_vamgr_find_va(&dev->vamgr,
max - dev->dev_info.virtual_address_offset,
dev->dev_info.virtual_address_alignment, 0);
- if (start > 0xffffffff)
+ if (start > 0xffffffff) {
+ fprintf(stderr, "%s: amdgpu_vamgr_find_va failed\n", __func__);
goto free_va; /* shouldn't get here */
+ }
amdgpu_vamgr_init(&dev->vamgr_32, start, max,
dev->dev_info.virtual_address_alignment);
r = amdgpu_parse_asic_ids(&dev->asic_ids);
if (r) {
fprintf(stderr, "%s: Cannot parse ASIC IDs, 0x%x.",
__func__, r);
}
--
2.7.4
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH libdrm] amdgpu: print error messages when amdgpu_device_initialize is failing
[not found] ` <1505237954-842-1-git-send-email-maraeo-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2017-09-12 17:52 ` Alex Deucher
0 siblings, 0 replies; 2+ messages in thread
From: Alex Deucher @ 2017-09-12 17:52 UTC (permalink / raw)
To: Marek Olšák; +Cc: amd-gfx list
On Tue, Sep 12, 2017 at 1:39 PM, Marek Olšák <maraeo@gmail.com> wrote:
> From: Marek Olšák <marek.olsak@amd.com>
>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
> ---
> amdgpu/amdgpu_device.c | 19 ++++++++++++++++---
> 1 file changed, 16 insertions(+), 3 deletions(-)
>
> diff --git a/amdgpu/amdgpu_device.c b/amdgpu/amdgpu_device.c
> index 9a238d9..2b31c45 100644
> --- a/amdgpu/amdgpu_device.c
> +++ b/amdgpu/amdgpu_device.c
> @@ -184,42 +184,47 @@ int amdgpu_device_initialize(int fd,
> uint32_t accel_working = 0;
> uint64_t start, max;
>
> *device_handle = NULL;
>
> pthread_mutex_lock(&fd_mutex);
> if (!fd_tab)
> fd_tab = util_hash_table_create(fd_hash, fd_compare);
> r = amdgpu_get_auth(fd, &flag_auth);
> if (r) {
> + fprintf(stderr, "%s: amdgpu_get_auth (1) failed (%i)\n",
> + __func__, r);
> pthread_mutex_unlock(&fd_mutex);
> return r;
> }
> dev = util_hash_table_get(fd_tab, UINT_TO_PTR(fd));
> if (dev) {
> r = amdgpu_get_auth(dev->fd, &flag_authexist);
> if (r) {
> + fprintf(stderr, "%s: amdgpu_get_auth (2) failed (%i)\n",
> + __func__, r);
> pthread_mutex_unlock(&fd_mutex);
> return r;
> }
> if ((flag_auth) && (!flag_authexist)) {
> dev->flink_fd = dup(fd);
> }
> *major_version = dev->major_version;
> *minor_version = dev->minor_version;
> amdgpu_device_reference(device_handle, dev);
> pthread_mutex_unlock(&fd_mutex);
> return 0;
> }
>
> dev = calloc(1, sizeof(struct amdgpu_device));
> if (!dev) {
> + fprintf(stderr, "%s: calloc failed\n", __func__);
> pthread_mutex_unlock(&fd_mutex);
> return -ENOMEM;
> }
>
> dev->fd = -1;
> dev->flink_fd = -1;
>
> atomic_set(&dev->refcount, 1);
>
> version = drmGetVersion(fd);
> @@ -241,41 +246,49 @@ int amdgpu_device_initialize(int fd,
> dev->minor_version = version->version_minor;
> drmFreeVersion(version);
>
> dev->bo_flink_names = util_hash_table_create(handle_hash,
> handle_compare);
> dev->bo_handles = util_hash_table_create(handle_hash, handle_compare);
> pthread_mutex_init(&dev->bo_table_mutex, NULL);
>
> /* Check if acceleration is working. */
> r = amdgpu_query_info(dev, AMDGPU_INFO_ACCEL_WORKING, 4, &accel_working);
> - if (r)
> + if (r) {
> + fprintf(stderr, "%s: amdgpu_query_info(ACCEL_WORKING) failed (%i)\n",
> + __func__, r);
> goto cleanup;
> + }
> if (!accel_working) {
> + fprintf(stderr, "%s: AMDGPU_INFO_ACCEL_WORKING = 0\n", __func__);
> r = -EBADF;
> goto cleanup;
> }
>
> r = amdgpu_query_gpu_info_init(dev);
> - if (r)
> + if (r) {
> + fprintf(stderr, "%s: amdgpu_query_gpu_info_init failed\n", __func__);
> goto cleanup;
> + }
>
> amdgpu_vamgr_init(&dev->vamgr, dev->dev_info.virtual_address_offset,
> dev->dev_info.virtual_address_max,
> dev->dev_info.virtual_address_alignment);
>
> max = MIN2(dev->dev_info.virtual_address_max, 0xffffffff);
> start = amdgpu_vamgr_find_va(&dev->vamgr,
> max - dev->dev_info.virtual_address_offset,
> dev->dev_info.virtual_address_alignment, 0);
> - if (start > 0xffffffff)
> + if (start > 0xffffffff) {
> + fprintf(stderr, "%s: amdgpu_vamgr_find_va failed\n", __func__);
> goto free_va; /* shouldn't get here */
> + }
>
> amdgpu_vamgr_init(&dev->vamgr_32, start, max,
> dev->dev_info.virtual_address_alignment);
>
> r = amdgpu_parse_asic_ids(&dev->asic_ids);
> if (r) {
> fprintf(stderr, "%s: Cannot parse ASIC IDs, 0x%x.",
> __func__, r);
> }
>
> --
> 2.7.4
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-09-12 17:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-12 17:39 [PATCH libdrm] amdgpu: print error messages when amdgpu_device_initialize is failing Marek Olšák
[not found] ` <1505237954-842-1-git-send-email-maraeo-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-09-12 17:52 ` Alex Deucher
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.