aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormonk.liu2015-04-27 02:23:54 -0500
committerAlex Deucher2015-08-05 12:47:49 -0500
commit9c3bec246e5f1f7d2fcb2bd7e7cc0deab4d8b20d (patch)
tree95fe294c25cecd0837482a650b2f516a02a71f6b
parent83d9369583d3200510beebe67edd19e9952c17dd (diff)
downloadexternal-libgbm-9c3bec246e5f1f7d2fcb2bd7e7cc0deab4d8b20d.tar.gz
external-libgbm-9c3bec246e5f1f7d2fcb2bd7e7cc0deab4d8b20d.tar.xz
external-libgbm-9c3bec246e5f1f7d2fcb2bd7e7cc0deab4d8b20d.zip
amdgpu: do not call BO_LIST ioctl when no resource referred
Signed-off-by: monk.liu <monk.liu@amd.com> Reviewed-by: Christian K├Ânig <christian.koenig@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r--amdgpu/amdgpu_cs.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/amdgpu/amdgpu_cs.c b/amdgpu/amdgpu_cs.c
index 72a2465c..91e6bcfc 100644
--- a/amdgpu/amdgpu_cs.c
+++ b/amdgpu/amdgpu_cs.c
@@ -635,6 +635,12 @@ static int amdgpu_cs_create_bo_list(amdgpu_device_handle dev,
635 int r; 635 int r;
636 636
637 num_resources = request->number_of_resources; 637 num_resources = request->number_of_resources;
638
639 if (!num_resources) {
640 *handle = 0;
641 return 0;
642 }
643
638 if (fence_ib) 644 if (fence_ib)
639 ++num_resources; 645 ++num_resources;
640 646
@@ -671,6 +677,9 @@ static int amdgpu_cs_free_bo_list(amdgpu_device_handle dev, uint32_t handle)
671 union drm_amdgpu_bo_list args; 677 union drm_amdgpu_bo_list args;
672 int r; 678 int r;
673 679
680 if (!handle)
681 return 0;
682
674 memset(&args, 0, sizeof(args)); 683 memset(&args, 0, sizeof(args));
675 args.in.operation = AMDGPU_BO_LIST_OP_DESTROY; 684 args.in.operation = AMDGPU_BO_LIST_OP_DESTROY;
676 args.in.list_handle = handle; 685 args.in.list_handle = handle;