aboutsummaryrefslogtreecommitdiffstats
path: root/amdgpu
diff options
context:
space:
mode:
authorMarek Olšák2017-09-04 14:05:26 -0500
committerMarek Olšák2017-09-28 15:48:26 -0500
commit1dd84e01a972b1759839a7326009be24ab3e6de2 (patch)
tree960d71ae90bb494128d910126216fe0d6e13f89a /amdgpu
parent7c71188610b4ceba0339c2bc884320bcb749adee (diff)
downloadexternal-libdrm-1dd84e01a972b1759839a7326009be24ab3e6de2.tar.gz
external-libdrm-1dd84e01a972b1759839a7326009be24ab3e6de2.tar.xz
external-libdrm-1dd84e01a972b1759839a7326009be24ab3e6de2.zip
amdgpu: print error messages when amdgpu_device_initialize is failing
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'amdgpu')
-rw-r--r--amdgpu/amdgpu_device.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/amdgpu/amdgpu_device.c b/amdgpu/amdgpu_device.c
index 9a238d97..2b31c45b 100644
--- a/amdgpu/amdgpu_device.c
+++ b/amdgpu/amdgpu_device.c
@@ -191,6 +191,8 @@ int amdgpu_device_initialize(int fd,
191 fd_tab = util_hash_table_create(fd_hash, fd_compare); 191 fd_tab = util_hash_table_create(fd_hash, fd_compare);
192 r = amdgpu_get_auth(fd, &flag_auth); 192 r = amdgpu_get_auth(fd, &flag_auth);
193 if (r) { 193 if (r) {
194 fprintf(stderr, "%s: amdgpu_get_auth (1) failed (%i)\n",
195 __func__, r);
194 pthread_mutex_unlock(&fd_mutex); 196 pthread_mutex_unlock(&fd_mutex);
195 return r; 197 return r;
196 } 198 }
@@ -198,6 +200,8 @@ int amdgpu_device_initialize(int fd,
198 if (dev) { 200 if (dev) {
199 r = amdgpu_get_auth(dev->fd, &flag_authexist); 201 r = amdgpu_get_auth(dev->fd, &flag_authexist);
200 if (r) { 202 if (r) {
203 fprintf(stderr, "%s: amdgpu_get_auth (2) failed (%i)\n",
204 __func__, r);
201 pthread_mutex_unlock(&fd_mutex); 205 pthread_mutex_unlock(&fd_mutex);
202 return r; 206 return r;
203 } 207 }
@@ -213,6 +217,7 @@ int amdgpu_device_initialize(int fd,
213 217
214 dev = calloc(1, sizeof(struct amdgpu_device)); 218 dev = calloc(1, sizeof(struct amdgpu_device));
215 if (!dev) { 219 if (!dev) {
220 fprintf(stderr, "%s: calloc failed\n", __func__);
216 pthread_mutex_unlock(&fd_mutex); 221 pthread_mutex_unlock(&fd_mutex);
217 return -ENOMEM; 222 return -ENOMEM;
218 } 223 }
@@ -248,16 +253,22 @@ int amdgpu_device_initialize(int fd,
248 253
249 /* Check if acceleration is working. */ 254 /* Check if acceleration is working. */
250 r = amdgpu_query_info(dev, AMDGPU_INFO_ACCEL_WORKING, 4, &accel_working); 255 r = amdgpu_query_info(dev, AMDGPU_INFO_ACCEL_WORKING, 4, &accel_working);
251 if (r) 256 if (r) {
257 fprintf(stderr, "%s: amdgpu_query_info(ACCEL_WORKING) failed (%i)\n",
258 __func__, r);
252 goto cleanup; 259 goto cleanup;
260 }
253 if (!accel_working) { 261 if (!accel_working) {
262 fprintf(stderr, "%s: AMDGPU_INFO_ACCEL_WORKING = 0\n", __func__);
254 r = -EBADF; 263 r = -EBADF;
255 goto cleanup; 264 goto cleanup;
256 } 265 }
257 266
258 r = amdgpu_query_gpu_info_init(dev); 267 r = amdgpu_query_gpu_info_init(dev);
259 if (r) 268 if (r) {
269 fprintf(stderr, "%s: amdgpu_query_gpu_info_init failed\n", __func__);
260 goto cleanup; 270 goto cleanup;
271 }
261 272
262 amdgpu_vamgr_init(&dev->vamgr, dev->dev_info.virtual_address_offset, 273 amdgpu_vamgr_init(&dev->vamgr, dev->dev_info.virtual_address_offset,
263 dev->dev_info.virtual_address_max, 274 dev->dev_info.virtual_address_max,
@@ -267,8 +278,10 @@ int amdgpu_device_initialize(int fd,
267 start = amdgpu_vamgr_find_va(&dev->vamgr, 278 start = amdgpu_vamgr_find_va(&dev->vamgr,
268 max - dev->dev_info.virtual_address_offset, 279 max - dev->dev_info.virtual_address_offset,
269 dev->dev_info.virtual_address_alignment, 0); 280 dev->dev_info.virtual_address_alignment, 0);
270 if (start > 0xffffffff) 281 if (start > 0xffffffff) {
282 fprintf(stderr, "%s: amdgpu_vamgr_find_va failed\n", __func__);
271 goto free_va; /* shouldn't get here */ 283 goto free_va; /* shouldn't get here */
284 }
272 285
273 amdgpu_vamgr_init(&dev->vamgr_32, start, max, 286 amdgpu_vamgr_init(&dev->vamgr_32, start, max,
274 dev->dev_info.virtual_address_alignment); 287 dev->dev_info.virtual_address_alignment);