[PATCH 1/2] amdgpu: cleanup public interface

2015-04-28 Thread Christian König
Haven't I CCed the list as well?

If not then sorry that was my fault,
Christian.

On 28.04.2015 15:41, Marek Olšák wrote:
> Hi Alex,
>
> He sent them to me. I've applied them to my tree:
>
> http://cgit.freedesktop.org/~mareko/mesa/log/?h=amdgpu
>
> Marek
>
> On Fri, Apr 24, 2015 at 5:38 PM, Alex Deucher  
> wrote:
>> On Thu, Apr 23, 2015 at 11:53 AM, Christian König
>>  wrote:
>>> From: Christian König 
>>>
>>> Remove the mostly unused device parameter, for the few cases
>>> where we really need it keep a copy in the context structure.
>> Are you going to send out the mesa patches as well?
>>
>> Alex
>>
>>> Signed-off-by: Christian König 
>>> Reviewed-by: Jammy Zhou 
>>> Reviewed-by: Alex Deucher 
>>> ---
>>>   amdgpu/amdgpu.h|  24 +++---
>>>   amdgpu/amdgpu_cs.c | 115 
>>> +++--
>>>   amdgpu/amdgpu_internal.h   |   2 +
>>>   tests/amdgpu/basic_tests.c |  33 +++--
>>>   tests/amdgpu/cs_tests.c|  14 +++---
>>>   5 files changed, 78 insertions(+), 110 deletions(-)
>>>
>>> diff --git a/amdgpu/amdgpu.h b/amdgpu/amdgpu.h
>>> index 90dc33c..7a85982 100644
>>> --- a/amdgpu/amdgpu.h
>>> +++ b/amdgpu/amdgpu.h
>>> @@ -882,7 +882,6 @@ int amdgpu_cs_ctx_create(amdgpu_device_handle dev,
>>>*
>>>* Destroy GPU execution context when not needed any more
>>>*
>>> - * \param   dev- \c [in] Device handle. See 
>>> #amdgpu_device_initialize()
>>>* \param   context - \c [in] GPU Context handle
>>>*
>>>* \return   0 on success\n
>>> @@ -892,13 +891,11 @@ int amdgpu_cs_ctx_create(amdgpu_device_handle dev,
>>>* \sa amdgpu_cs_ctx_create()
>>>*
>>>   */
>>> -int amdgpu_cs_ctx_free(amdgpu_device_handle dev,
>>> -  amdgpu_context_handle context);
>>> +int amdgpu_cs_ctx_free(amdgpu_context_handle context);
>>>
>>>   /**
>>>* Query reset state for the specific GPU Context
>>>*
>>> - * \param   dev- \c [in] Device handle. See 
>>> #amdgpu_device_initialize()
>>>* \param   context - \c [in]  GPU Context handle
>>>* \param   state   - \c [out] Reset state status
>>>*
>>> @@ -909,8 +906,7 @@ int amdgpu_cs_ctx_free(amdgpu_device_handle dev,
>>>* \sa amdgpu_cs_ctx_create()
>>>*
>>>   */
>>> -int amdgpu_cs_query_reset_state(amdgpu_device_handle dev,
>>> -   amdgpu_context_handle context,
>>> +int amdgpu_cs_query_reset_state(amdgpu_context_handle context,
>>>  enum amdgpu_cs_ctx_reset_state *state);
>>>
>>>
>>> @@ -924,7 +920,6 @@ int amdgpu_cs_query_reset_state(amdgpu_device_handle 
>>> dev,
>>>* Allocate memory to be filled with PM4 packets and be served as the 
>>> first
>>>* entry point of execution (a.k.a. Indirect Buffer)
>>>*
>>> - * \param   dev- \c [in] Device handle. See 
>>> #amdgpu_device_initialize()
>>>* \param   context - \c [in]  GPU Context which will use IB
>>>* \param   ib_size - \c [in]  Size of allocation
>>>* \param   output  - \c [out] Pointer to structure to get information 
>>> about
>>> @@ -937,8 +932,7 @@ int amdgpu_cs_query_reset_state(amdgpu_device_handle 
>>> dev,
>>>* \sa amdgpu_cs_free_ib()
>>>*
>>>   */
>>> -int amdgpu_cs_alloc_ib(amdgpu_device_handle dev,
>>> -  amdgpu_context_handle context,
>>> +int amdgpu_cs_alloc_ib(amdgpu_context_handle context,
>>> enum amdgpu_cs_ib_size ib_size,
>>> struct amdgpu_cs_ib_alloc_result *output);
>>>
>>> @@ -946,8 +940,6 @@ int amdgpu_cs_alloc_ib(amdgpu_device_handle dev,
>>>* If UMD has allocates IBs which doesn’t need any more than those IBs 
>>> must
>>>* be explicitly freed
>>>*
>>> - * \param   dev- \c [in] Device handle. See 
>>> #amdgpu_device_initialize()
>>> - * \param   context - \c [in] GPU Context containing IB
>>>* \param   handle  - \c [in] IB handle
>>>*
>>>* \return   0 on success\n
>>> @@ -960,9 +952,7 @@ int amdgpu_cs_alloc_ib(amdgpu_device_handle dev,
>>>* \sa amdgpu_cs_alloc_ib()
>>>*
>>>   */
>>> -int amdgpu_cs_free_ib(amdgpu_device_handle dev,
>>> - amdgpu_context_handle context,
>>> - amdgpu_ib_handle handle);
>>> +int amdgpu_cs_free_ib(amdgpu_ib_handle handle);
>>>
>>>   /**
>>>* Send request to submit command buffers to hardware.
>>> @@ -1011,8 +1001,7 @@ int amdgpu_cs_free_ib(amdgpu_device_handle dev,
>>>* amdgpu_cs_query_fence_status()
>>>*
>>>   */
>>> -int amdgpu_cs_submit(amdgpu_device_handle  dev,
>>> -amdgpu_context_handle context,
>>> +int amdgpu_cs_submit(amdgpu_context_handle context,
>>>   uint64_t flags,
>>>   struct amdgpu_cs_request *ibs_request,
>>>   uint32_t number_of_requests,
>>> @@ -1038,8 +1027,7 @@ int amdgpu_cs_submit(amdgpu_device_handle  dev,
>>>*
>>>* \sa amdgpu_cs_submit()
>>>   */

[PATCH 1/2] amdgpu: cleanup public interface

2015-04-28 Thread Marek Olšák
Hi Alex,

He sent them to me. I've applied them to my tree:

http://cgit.freedesktop.org/~mareko/mesa/log/?h=amdgpu

Marek

On Fri, Apr 24, 2015 at 5:38 PM, Alex Deucher  wrote:
> On Thu, Apr 23, 2015 at 11:53 AM, Christian König
>  wrote:
>> From: Christian König 
>>
>> Remove the mostly unused device parameter, for the few cases
>> where we really need it keep a copy in the context structure.
>
> Are you going to send out the mesa patches as well?
>
> Alex
>
>>
>> Signed-off-by: Christian König 
>> Reviewed-by: Jammy Zhou 
>> Reviewed-by: Alex Deucher 
>> ---
>>  amdgpu/amdgpu.h|  24 +++---
>>  amdgpu/amdgpu_cs.c | 115 
>> +++--
>>  amdgpu/amdgpu_internal.h   |   2 +
>>  tests/amdgpu/basic_tests.c |  33 +++--
>>  tests/amdgpu/cs_tests.c|  14 +++---
>>  5 files changed, 78 insertions(+), 110 deletions(-)
>>
>> diff --git a/amdgpu/amdgpu.h b/amdgpu/amdgpu.h
>> index 90dc33c..7a85982 100644
>> --- a/amdgpu/amdgpu.h
>> +++ b/amdgpu/amdgpu.h
>> @@ -882,7 +882,6 @@ int amdgpu_cs_ctx_create(amdgpu_device_handle dev,
>>   *
>>   * Destroy GPU execution context when not needed any more
>>   *
>> - * \param   dev- \c [in] Device handle. See 
>> #amdgpu_device_initialize()
>>   * \param   context - \c [in] GPU Context handle
>>   *
>>   * \return   0 on success\n
>> @@ -892,13 +891,11 @@ int amdgpu_cs_ctx_create(amdgpu_device_handle dev,
>>   * \sa amdgpu_cs_ctx_create()
>>   *
>>  */
>> -int amdgpu_cs_ctx_free(amdgpu_device_handle dev,
>> -  amdgpu_context_handle context);
>> +int amdgpu_cs_ctx_free(amdgpu_context_handle context);
>>
>>  /**
>>   * Query reset state for the specific GPU Context
>>   *
>> - * \param   dev- \c [in] Device handle. See 
>> #amdgpu_device_initialize()
>>   * \param   context - \c [in]  GPU Context handle
>>   * \param   state   - \c [out] Reset state status
>>   *
>> @@ -909,8 +906,7 @@ int amdgpu_cs_ctx_free(amdgpu_device_handle dev,
>>   * \sa amdgpu_cs_ctx_create()
>>   *
>>  */
>> -int amdgpu_cs_query_reset_state(amdgpu_device_handle dev,
>> -   amdgpu_context_handle context,
>> +int amdgpu_cs_query_reset_state(amdgpu_context_handle context,
>> enum amdgpu_cs_ctx_reset_state *state);
>>
>>
>> @@ -924,7 +920,6 @@ int amdgpu_cs_query_reset_state(amdgpu_device_handle dev,
>>   * Allocate memory to be filled with PM4 packets and be served as the first
>>   * entry point of execution (a.k.a. Indirect Buffer)
>>   *
>> - * \param   dev- \c [in] Device handle. See 
>> #amdgpu_device_initialize()
>>   * \param   context - \c [in]  GPU Context which will use IB
>>   * \param   ib_size - \c [in]  Size of allocation
>>   * \param   output  - \c [out] Pointer to structure to get information about
>> @@ -937,8 +932,7 @@ int amdgpu_cs_query_reset_state(amdgpu_device_handle dev,
>>   * \sa amdgpu_cs_free_ib()
>>   *
>>  */
>> -int amdgpu_cs_alloc_ib(amdgpu_device_handle dev,
>> -  amdgpu_context_handle context,
>> +int amdgpu_cs_alloc_ib(amdgpu_context_handle context,
>>enum amdgpu_cs_ib_size ib_size,
>>struct amdgpu_cs_ib_alloc_result *output);
>>
>> @@ -946,8 +940,6 @@ int amdgpu_cs_alloc_ib(amdgpu_device_handle dev,
>>   * If UMD has allocates IBs which doesn’t need any more than those IBs 
>> must
>>   * be explicitly freed
>>   *
>> - * \param   dev- \c [in] Device handle. See 
>> #amdgpu_device_initialize()
>> - * \param   context - \c [in] GPU Context containing IB
>>   * \param   handle  - \c [in] IB handle
>>   *
>>   * \return   0 on success\n
>> @@ -960,9 +952,7 @@ int amdgpu_cs_alloc_ib(amdgpu_device_handle dev,
>>   * \sa amdgpu_cs_alloc_ib()
>>   *
>>  */
>> -int amdgpu_cs_free_ib(amdgpu_device_handle dev,
>> - amdgpu_context_handle context,
>> - amdgpu_ib_handle handle);
>> +int amdgpu_cs_free_ib(amdgpu_ib_handle handle);
>>
>>  /**
>>   * Send request to submit command buffers to hardware.
>> @@ -1011,8 +1001,7 @@ int amdgpu_cs_free_ib(amdgpu_device_handle dev,
>>   * amdgpu_cs_query_fence_status()
>>   *
>>  */
>> -int amdgpu_cs_submit(amdgpu_device_handle  dev,
>> -amdgpu_context_handle context,
>> +int amdgpu_cs_submit(amdgpu_context_handle context,
>>  uint64_t flags,
>>  struct amdgpu_cs_request *ibs_request,
>>  uint32_t number_of_requests,
>> @@ -1038,8 +1027,7 @@ int amdgpu_cs_submit(amdgpu_device_handle  dev,
>>   *
>>   * \sa amdgpu_cs_submit()
>>  */
>> -int amdgpu_cs_query_fence_status(amdgpu_device_handle dev,
>> -struct amdgpu_cs_query_fence *fence,
>> +int amdgpu_cs_query_fence_status(struct amdgpu_cs_query_fence *fence,
>>  uint32_t *expired);
>>
>>
>> diff --git a/amdgpu/amdgpu_cs.c b/amdgpu/amdgpu_cs.c
>> 

[PATCH 1/2] amdgpu: cleanup public interface

2015-04-28 Thread Alex Deucher
On Tue, Apr 28, 2015 at 9:41 AM, Marek Olšák  wrote:
> Hi Alex,
>
> He sent them to me. I've applied them to my tree:
>
> http://cgit.freedesktop.org/~mareko/mesa/log/?h=amdgpu

I've pushed them to my mesa tree as well.

Alex

>
> Marek
>
> On Fri, Apr 24, 2015 at 5:38 PM, Alex Deucher  
> wrote:
>> On Thu, Apr 23, 2015 at 11:53 AM, Christian König
>>  wrote:
>>> From: Christian König 
>>>
>>> Remove the mostly unused device parameter, for the few cases
>>> where we really need it keep a copy in the context structure.
>>
>> Are you going to send out the mesa patches as well?
>>
>> Alex
>>
>>>
>>> Signed-off-by: Christian König 
>>> Reviewed-by: Jammy Zhou 
>>> Reviewed-by: Alex Deucher 
>>> ---
>>>  amdgpu/amdgpu.h|  24 +++---
>>>  amdgpu/amdgpu_cs.c | 115 
>>> +++--
>>>  amdgpu/amdgpu_internal.h   |   2 +
>>>  tests/amdgpu/basic_tests.c |  33 +++--
>>>  tests/amdgpu/cs_tests.c|  14 +++---
>>>  5 files changed, 78 insertions(+), 110 deletions(-)
>>>
>>> diff --git a/amdgpu/amdgpu.h b/amdgpu/amdgpu.h
>>> index 90dc33c..7a85982 100644
>>> --- a/amdgpu/amdgpu.h
>>> +++ b/amdgpu/amdgpu.h
>>> @@ -882,7 +882,6 @@ int amdgpu_cs_ctx_create(amdgpu_device_handle dev,
>>>   *
>>>   * Destroy GPU execution context when not needed any more
>>>   *
>>> - * \param   dev- \c [in] Device handle. See 
>>> #amdgpu_device_initialize()
>>>   * \param   context - \c [in] GPU Context handle
>>>   *
>>>   * \return   0 on success\n
>>> @@ -892,13 +891,11 @@ int amdgpu_cs_ctx_create(amdgpu_device_handle dev,
>>>   * \sa amdgpu_cs_ctx_create()
>>>   *
>>>  */
>>> -int amdgpu_cs_ctx_free(amdgpu_device_handle dev,
>>> -  amdgpu_context_handle context);
>>> +int amdgpu_cs_ctx_free(amdgpu_context_handle context);
>>>
>>>  /**
>>>   * Query reset state for the specific GPU Context
>>>   *
>>> - * \param   dev- \c [in] Device handle. See 
>>> #amdgpu_device_initialize()
>>>   * \param   context - \c [in]  GPU Context handle
>>>   * \param   state   - \c [out] Reset state status
>>>   *
>>> @@ -909,8 +906,7 @@ int amdgpu_cs_ctx_free(amdgpu_device_handle dev,
>>>   * \sa amdgpu_cs_ctx_create()
>>>   *
>>>  */
>>> -int amdgpu_cs_query_reset_state(amdgpu_device_handle dev,
>>> -   amdgpu_context_handle context,
>>> +int amdgpu_cs_query_reset_state(amdgpu_context_handle context,
>>> enum amdgpu_cs_ctx_reset_state *state);
>>>
>>>
>>> @@ -924,7 +920,6 @@ int amdgpu_cs_query_reset_state(amdgpu_device_handle 
>>> dev,
>>>   * Allocate memory to be filled with PM4 packets and be served as the first
>>>   * entry point of execution (a.k.a. Indirect Buffer)
>>>   *
>>> - * \param   dev- \c [in] Device handle. See 
>>> #amdgpu_device_initialize()
>>>   * \param   context - \c [in]  GPU Context which will use IB
>>>   * \param   ib_size - \c [in]  Size of allocation
>>>   * \param   output  - \c [out] Pointer to structure to get information 
>>> about
>>> @@ -937,8 +932,7 @@ int amdgpu_cs_query_reset_state(amdgpu_device_handle 
>>> dev,
>>>   * \sa amdgpu_cs_free_ib()
>>>   *
>>>  */
>>> -int amdgpu_cs_alloc_ib(amdgpu_device_handle dev,
>>> -  amdgpu_context_handle context,
>>> +int amdgpu_cs_alloc_ib(amdgpu_context_handle context,
>>>enum amdgpu_cs_ib_size ib_size,
>>>struct amdgpu_cs_ib_alloc_result *output);
>>>
>>> @@ -946,8 +940,6 @@ int amdgpu_cs_alloc_ib(amdgpu_device_handle dev,
>>>   * If UMD has allocates IBs which doesn’t need any more than those IBs 
>>> must
>>>   * be explicitly freed
>>>   *
>>> - * \param   dev- \c [in] Device handle. See 
>>> #amdgpu_device_initialize()
>>> - * \param   context - \c [in] GPU Context containing IB
>>>   * \param   handle  - \c [in] IB handle
>>>   *
>>>   * \return   0 on success\n
>>> @@ -960,9 +952,7 @@ int amdgpu_cs_alloc_ib(amdgpu_device_handle dev,
>>>   * \sa amdgpu_cs_alloc_ib()
>>>   *
>>>  */
>>> -int amdgpu_cs_free_ib(amdgpu_device_handle dev,
>>> - amdgpu_context_handle context,
>>> - amdgpu_ib_handle handle);
>>> +int amdgpu_cs_free_ib(amdgpu_ib_handle handle);
>>>
>>>  /**
>>>   * Send request to submit command buffers to hardware.
>>> @@ -1011,8 +1001,7 @@ int amdgpu_cs_free_ib(amdgpu_device_handle dev,
>>>   * amdgpu_cs_query_fence_status()
>>>   *
>>>  */
>>> -int amdgpu_cs_submit(amdgpu_device_handle  dev,
>>> -amdgpu_context_handle context,
>>> +int amdgpu_cs_submit(amdgpu_context_handle context,
>>>  uint64_t flags,
>>>  struct amdgpu_cs_request *ibs_request,
>>>  uint32_t number_of_requests,
>>> @@ -1038,8 +1027,7 @@ int amdgpu_cs_submit(amdgpu_device_handle  dev,
>>>   *
>>>   * \sa amdgpu_cs_submit()
>>>  */
>>> -int amdgpu_cs_query_fence_status(amdgpu_device_handle dev,
>>> -

[PATCH 1/2] amdgpu: cleanup public interface

2015-04-24 Thread Alex Deucher
On Thu, Apr 23, 2015 at 11:53 AM, Christian König
 wrote:
> From: Christian König 
>
> Remove the mostly unused device parameter, for the few cases
> where we really need it keep a copy in the context structure.

Are you going to send out the mesa patches as well?

Alex

>
> Signed-off-by: Christian König 
> Reviewed-by: Jammy Zhou 
> Reviewed-by: Alex Deucher 
> ---
>  amdgpu/amdgpu.h|  24 +++---
>  amdgpu/amdgpu_cs.c | 115 
> +++--
>  amdgpu/amdgpu_internal.h   |   2 +
>  tests/amdgpu/basic_tests.c |  33 +++--
>  tests/amdgpu/cs_tests.c|  14 +++---
>  5 files changed, 78 insertions(+), 110 deletions(-)
>
> diff --git a/amdgpu/amdgpu.h b/amdgpu/amdgpu.h
> index 90dc33c..7a85982 100644
> --- a/amdgpu/amdgpu.h
> +++ b/amdgpu/amdgpu.h
> @@ -882,7 +882,6 @@ int amdgpu_cs_ctx_create(amdgpu_device_handle dev,
>   *
>   * Destroy GPU execution context when not needed any more
>   *
> - * \param   dev- \c [in] Device handle. See 
> #amdgpu_device_initialize()
>   * \param   context - \c [in] GPU Context handle
>   *
>   * \return   0 on success\n
> @@ -892,13 +891,11 @@ int amdgpu_cs_ctx_create(amdgpu_device_handle dev,
>   * \sa amdgpu_cs_ctx_create()
>   *
>  */
> -int amdgpu_cs_ctx_free(amdgpu_device_handle dev,
> -  amdgpu_context_handle context);
> +int amdgpu_cs_ctx_free(amdgpu_context_handle context);
>
>  /**
>   * Query reset state for the specific GPU Context
>   *
> - * \param   dev- \c [in] Device handle. See 
> #amdgpu_device_initialize()
>   * \param   context - \c [in]  GPU Context handle
>   * \param   state   - \c [out] Reset state status
>   *
> @@ -909,8 +906,7 @@ int amdgpu_cs_ctx_free(amdgpu_device_handle dev,
>   * \sa amdgpu_cs_ctx_create()
>   *
>  */
> -int amdgpu_cs_query_reset_state(amdgpu_device_handle dev,
> -   amdgpu_context_handle context,
> +int amdgpu_cs_query_reset_state(amdgpu_context_handle context,
> enum amdgpu_cs_ctx_reset_state *state);
>
>
> @@ -924,7 +920,6 @@ int amdgpu_cs_query_reset_state(amdgpu_device_handle dev,
>   * Allocate memory to be filled with PM4 packets and be served as the first
>   * entry point of execution (a.k.a. Indirect Buffer)
>   *
> - * \param   dev- \c [in] Device handle. See 
> #amdgpu_device_initialize()
>   * \param   context - \c [in]  GPU Context which will use IB
>   * \param   ib_size - \c [in]  Size of allocation
>   * \param   output  - \c [out] Pointer to structure to get information about
> @@ -937,8 +932,7 @@ int amdgpu_cs_query_reset_state(amdgpu_device_handle dev,
>   * \sa amdgpu_cs_free_ib()
>   *
>  */
> -int amdgpu_cs_alloc_ib(amdgpu_device_handle dev,
> -  amdgpu_context_handle context,
> +int amdgpu_cs_alloc_ib(amdgpu_context_handle context,
>enum amdgpu_cs_ib_size ib_size,
>struct amdgpu_cs_ib_alloc_result *output);
>
> @@ -946,8 +940,6 @@ int amdgpu_cs_alloc_ib(amdgpu_device_handle dev,
>   * If UMD has allocates IBs which doesn’t need any more than those IBs must
>   * be explicitly freed
>   *
> - * \param   dev- \c [in] Device handle. See 
> #amdgpu_device_initialize()
> - * \param   context - \c [in] GPU Context containing IB
>   * \param   handle  - \c [in] IB handle
>   *
>   * \return   0 on success\n
> @@ -960,9 +952,7 @@ int amdgpu_cs_alloc_ib(amdgpu_device_handle dev,
>   * \sa amdgpu_cs_alloc_ib()
>   *
>  */
> -int amdgpu_cs_free_ib(amdgpu_device_handle dev,
> - amdgpu_context_handle context,
> - amdgpu_ib_handle handle);
> +int amdgpu_cs_free_ib(amdgpu_ib_handle handle);
>
>  /**
>   * Send request to submit command buffers to hardware.
> @@ -1011,8 +1001,7 @@ int amdgpu_cs_free_ib(amdgpu_device_handle dev,
>   * amdgpu_cs_query_fence_status()
>   *
>  */
> -int amdgpu_cs_submit(amdgpu_device_handle  dev,
> -amdgpu_context_handle context,
> +int amdgpu_cs_submit(amdgpu_context_handle context,
>  uint64_t flags,
>  struct amdgpu_cs_request *ibs_request,
>  uint32_t number_of_requests,
> @@ -1038,8 +1027,7 @@ int amdgpu_cs_submit(amdgpu_device_handle  dev,
>   *
>   * \sa amdgpu_cs_submit()
>  */
> -int amdgpu_cs_query_fence_status(amdgpu_device_handle dev,
> -struct amdgpu_cs_query_fence *fence,
> +int amdgpu_cs_query_fence_status(struct amdgpu_cs_query_fence *fence,
>  uint32_t *expired);
>
>
> diff --git a/amdgpu/amdgpu_cs.c b/amdgpu/amdgpu_cs.c
> index 614904d..d6b4b2d 100644
> --- a/amdgpu/amdgpu_cs.c
> +++ b/amdgpu/amdgpu_cs.c
> @@ -42,8 +42,7 @@
>   *
>   * \return  0 on success otherwise POSIX Error code
>  */
> -static int amdgpu_cs_create_ib(amdgpu_device_handle dev,
> -  amdgpu_context_handle context,
> +static int 

[PATCH 1/2] amdgpu: cleanup public interface

2015-04-23 Thread Christian König
From: Christian König 

Remove the mostly unused device parameter, for the few cases
where we really need it keep a copy in the context structure.

Signed-off-by: Christian König 
Reviewed-by: Jammy Zhou 
Reviewed-by: Alex Deucher 
---
 amdgpu/amdgpu.h|  24 +++---
 amdgpu/amdgpu_cs.c | 115 +++--
 amdgpu/amdgpu_internal.h   |   2 +
 tests/amdgpu/basic_tests.c |  33 +++--
 tests/amdgpu/cs_tests.c|  14 +++---
 5 files changed, 78 insertions(+), 110 deletions(-)

diff --git a/amdgpu/amdgpu.h b/amdgpu/amdgpu.h
index 90dc33c..7a85982 100644
--- a/amdgpu/amdgpu.h
+++ b/amdgpu/amdgpu.h
@@ -882,7 +882,6 @@ int amdgpu_cs_ctx_create(amdgpu_device_handle dev,
  *
  * Destroy GPU execution context when not needed any more
  *
- * \param   dev- \c [in] Device handle. See 
#amdgpu_device_initialize()
  * \param   context - \c [in] GPU Context handle
  *
  * \return   0 on success\n
@@ -892,13 +891,11 @@ int amdgpu_cs_ctx_create(amdgpu_device_handle dev,
  * \sa amdgpu_cs_ctx_create()
  *
 */
-int amdgpu_cs_ctx_free(amdgpu_device_handle dev,
-  amdgpu_context_handle context);
+int amdgpu_cs_ctx_free(amdgpu_context_handle context);

 /**
  * Query reset state for the specific GPU Context
  *
- * \param   dev- \c [in] Device handle. See 
#amdgpu_device_initialize()
  * \param   context - \c [in]  GPU Context handle
  * \param   state   - \c [out] Reset state status
  *
@@ -909,8 +906,7 @@ int amdgpu_cs_ctx_free(amdgpu_device_handle dev,
  * \sa amdgpu_cs_ctx_create()
  *
 */
-int amdgpu_cs_query_reset_state(amdgpu_device_handle dev,
-   amdgpu_context_handle context,
+int amdgpu_cs_query_reset_state(amdgpu_context_handle context,
enum amdgpu_cs_ctx_reset_state *state);


@@ -924,7 +920,6 @@ int amdgpu_cs_query_reset_state(amdgpu_device_handle dev,
  * Allocate memory to be filled with PM4 packets and be served as the first
  * entry point of execution (a.k.a. Indirect Buffer)
  *
- * \param   dev- \c [in] Device handle. See 
#amdgpu_device_initialize()
  * \param   context - \c [in]  GPU Context which will use IB
  * \param   ib_size - \c [in]  Size of allocation
  * \param   output  - \c [out] Pointer to structure to get information about
@@ -937,8 +932,7 @@ int amdgpu_cs_query_reset_state(amdgpu_device_handle dev,
  * \sa amdgpu_cs_free_ib()
  *
 */
-int amdgpu_cs_alloc_ib(amdgpu_device_handle dev,
-  amdgpu_context_handle context,
+int amdgpu_cs_alloc_ib(amdgpu_context_handle context,
   enum amdgpu_cs_ib_size ib_size,
   struct amdgpu_cs_ib_alloc_result *output);

@@ -946,8 +940,6 @@ int amdgpu_cs_alloc_ib(amdgpu_device_handle dev,
  * If UMD has allocates IBs which doesn’t need any more than those IBs must
  * be explicitly freed
  *
- * \param   dev- \c [in] Device handle. See 
#amdgpu_device_initialize()
- * \param   context - \c [in] GPU Context containing IB
  * \param   handle  - \c [in] IB handle
  *
  * \return   0 on success\n
@@ -960,9 +952,7 @@ int amdgpu_cs_alloc_ib(amdgpu_device_handle dev,
  * \sa amdgpu_cs_alloc_ib()
  *
 */
-int amdgpu_cs_free_ib(amdgpu_device_handle dev,
- amdgpu_context_handle context,
- amdgpu_ib_handle handle);
+int amdgpu_cs_free_ib(amdgpu_ib_handle handle);

 /**
  * Send request to submit command buffers to hardware.
@@ -1011,8 +1001,7 @@ int amdgpu_cs_free_ib(amdgpu_device_handle dev,
  * amdgpu_cs_query_fence_status()
  *
 */
-int amdgpu_cs_submit(amdgpu_device_handle  dev,
-amdgpu_context_handle context,
+int amdgpu_cs_submit(amdgpu_context_handle context,
 uint64_t flags,
 struct amdgpu_cs_request *ibs_request,
 uint32_t number_of_requests,
@@ -1038,8 +1027,7 @@ int amdgpu_cs_submit(amdgpu_device_handle  dev,
  *
  * \sa amdgpu_cs_submit()
 */
-int amdgpu_cs_query_fence_status(amdgpu_device_handle dev,
-struct amdgpu_cs_query_fence *fence,
+int amdgpu_cs_query_fence_status(struct amdgpu_cs_query_fence *fence,
 uint32_t *expired);


diff --git a/amdgpu/amdgpu_cs.c b/amdgpu/amdgpu_cs.c
index 614904d..d6b4b2d 100644
--- a/amdgpu/amdgpu_cs.c
+++ b/amdgpu/amdgpu_cs.c
@@ -42,8 +42,7 @@
  *
  * \return  0 on success otherwise POSIX Error code
 */
-static int amdgpu_cs_create_ib(amdgpu_device_handle dev,
-  amdgpu_context_handle context,
+static int amdgpu_cs_create_ib(amdgpu_context_handle context,
   enum amdgpu_cs_ib_size ib_size,
   amdgpu_ib_handle *ib)
 {
@@ -79,7 +78,7 @@ static int amdgpu_cs_create_ib(amdgpu_device_handle dev,

alloc_buffer.preferred_heap = AMDGPU_GEM_DOMAIN_GTT;

-   r = amdgpu_bo_alloc(dev,