diff options
Diffstat (limited to 'amdgpu/amdgpu_cs.c')
-rw-r--r-- | amdgpu/amdgpu_cs.c | 88 |
1 files changed, 0 insertions, 88 deletions
diff --git a/amdgpu/amdgpu_cs.c b/amdgpu/amdgpu_cs.c index 1429f26b..2a039d6d 100644 --- a/amdgpu/amdgpu_cs.c +++ b/amdgpu/amdgpu_cs.c @@ -33,94 +33,6 @@ #include "amdgpu_internal.h" /** - * Create an IB buffer. - * - * \param dev - \c [in] Device handle - * \param context - \c [in] GPU Context - * \param ib_size - \c [in] Size of allocation - * \param ib - \c [out] return the pointer to the created IB buffer - * - * \return 0 on success otherwise POSIX Error code -*/ -int amdgpu_cs_alloc_ib(amdgpu_context_handle context, - enum amdgpu_cs_ib_size ib_size, - struct amdgpu_cs_ib_alloc_result *output) -{ - struct amdgpu_bo_alloc_request alloc_buffer = {}; - struct amdgpu_bo_alloc_result info; - int r; - void *cpu; - - if (NULL == context) - return -EINVAL; - if (NULL == output) - return -EINVAL; - if (ib_size >= AMDGPU_CS_IB_SIZE_NUM) - return -EINVAL; - - switch (ib_size) { - case amdgpu_cs_ib_size_4K: - alloc_buffer.alloc_size = 4 * 1024; - break; - case amdgpu_cs_ib_size_16K: - alloc_buffer.alloc_size = 16 * 1024; - break; - case amdgpu_cs_ib_size_32K: - alloc_buffer.alloc_size = 32 * 1024; - break; - case amdgpu_cs_ib_size_64K: - alloc_buffer.alloc_size = 64 * 1024; - break; - case amdgpu_cs_ib_size_128K: - alloc_buffer.alloc_size = 128 * 1024; - break; - default: - return -EINVAL; - } - - alloc_buffer.phys_alignment = 4 * 1024; - alloc_buffer.preferred_heap = AMDGPU_GEM_DOMAIN_GTT; - - r = amdgpu_bo_alloc(context->dev, - &alloc_buffer, - &info); - if (r) - return r; - - r = amdgpu_bo_cpu_map(info.buf_handle, &cpu); - if (r) { - amdgpu_bo_free(info.buf_handle); - return r; - } - - output->handle = info.buf_handle; - output->cpu = cpu; - output->mc_address = info.virtual_mc_base_address; - return 0; -} - -/** - * Destroy an IB buffer. - * - * \param ib - \c [in] IB handle - * - * \return 0 on success otherwise POSIX Error code -*/ -int amdgpu_cs_free_ib(amdgpu_bo_handle bo) -{ - int r; - - if (!bo) - return -EINVAL; - - r = amdgpu_bo_cpu_unmap(bo); - if (r) - return r; - - return amdgpu_bo_free(bo); -} - -/** * Create command submission context * * \param dev - \c [in] amdgpu device handle |