summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQiang Yu <Qiang.Yu@amd.com>2016-08-30 17:22:05 -0400
committerQiang Yu <Qiang.Yu@amd.com>2017-05-17 11:10:47 +0800
commit3a4fa98167b8add4ebbe1bb2a3f29ca7ab344449 (patch)
tree96c6004a9da6f1b650cb3532eb22ca22bea4576b
parent9385ab7f9da82a8f82e62941c29285a9b2c58082 (diff)
amdgpu: add amdgpu_bo_inc_ref() function.
Change-Id: Icdc00d3e22e48120ca6f4d73ffd05ba43551ad2c Signed-off-by: Qiang Yu <Qiang.Yu@amd.com> Reviewed-by: Christian K├Ânig <christian.koenig@amd.com>
-rw-r--r--amdgpu/amdgpu.h15
-rw-r--r--amdgpu/amdgpu_bo.c6
2 files changed, 20 insertions, 1 deletions
diff --git a/amdgpu/amdgpu.h b/amdgpu/amdgpu.h
index 94e0f11f..3f98e1de 100644
--- a/amdgpu/amdgpu.h
+++ b/amdgpu/amdgpu.h
@@ -721,7 +721,20 @@ int amdgpu_find_bo_by_cpu_mapping(amdgpu_device_handle dev,
int amdgpu_bo_free(amdgpu_bo_handle buf_handle);
/**
- * Request CPU access to GPU accessible memory
+ * Increase the reference count of a buffer object
+ *
+ * \param bo - \c [in] Buffer object handle to increase the reference count
+ *
+ * \return 0 on success\n
+ * <0 - Negative POSIX Error code
+ *
+ * \sa amdgpu_bo_alloc(), amdgpu_bo_free()
+ *
+*/
+int amdgpu_bo_inc_ref(amdgpu_bo_handle bo);
+
+/**
+ * Request CPU access to GPU accessable memory
*
* \param buf_handle - \c [in] Buffer handle
* \param cpu - \c [out] CPU address to be used for access
diff --git a/amdgpu/amdgpu_bo.c b/amdgpu/amdgpu_bo.c
index 10652688..0760be9a 100644
--- a/amdgpu/amdgpu_bo.c
+++ b/amdgpu/amdgpu_bo.c
@@ -424,6 +424,12 @@ int amdgpu_bo_free(amdgpu_bo_handle buf_handle)
return 0;
}
+int amdgpu_bo_inc_ref(amdgpu_bo_handle bo)
+{
+ atomic_inc(&bo->refcount);
+ return 0;
+}
+
int amdgpu_bo_cpu_map(amdgpu_bo_handle bo, void **cpu)
{
union drm_amdgpu_gem_mmap args;