[7/8] drivers/radeonsi:create uvd hevc enc entry

Submitted by Zhu, James on Feb. 5, 2018, 9:14 p.m.

Details

Message ID 1517865240-944-1-git-send-email-James.Zhu@amd.com
State New
Headers show
Series "Series without cover letter" ( rev: 1 ) in Mesa

Not browsing as part of any series.

Commit Message

Zhu, James Feb. 5, 2018, 9:14 p.m.
Add UVD hevc encode pipe video codec creation entry

Signed-off-by: James Zhu <James.Zhu@amd.com>
---
 src/gallium/drivers/radeonsi/si_uvd.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

Patch hide | download patch | download mbox

diff --git a/src/gallium/drivers/radeonsi/si_uvd.c b/src/gallium/drivers/radeonsi/si_uvd.c
index 64f2f8e..0dea60d 100644
--- a/src/gallium/drivers/radeonsi/si_uvd.c
+++ b/src/gallium/drivers/radeonsi/si_uvd.c
@@ -31,6 +31,8 @@ 
 #include "radeon/radeon_vce.h"
 #include "radeon/radeon_vcn_dec.h"
 #include "radeon/radeon_vcn_enc.h"
+#include "radeon/radeon_uvd_enc.h"
+#include "util/u_video.h"
 
 /**
  * creates an video buffer with an UVD compatible memory layout
@@ -146,9 +148,16 @@  struct pipe_video_codec *si_uvd_create_decoder(struct pipe_context *context,
 	struct si_context *ctx = (struct si_context *)context;
 	bool vcn = (ctx->b.family == CHIP_RAVEN) ? true : false;
 
-	if (templ->entrypoint == PIPE_VIDEO_ENTRYPOINT_ENCODE)
-		return (vcn) ? radeon_create_encoder(context, templ, ctx->b.ws, si_vce_get_buffer) :
-               si_vce_create_encoder(context, templ, ctx->b.ws, si_vce_get_buffer);
+	if (templ->entrypoint == PIPE_VIDEO_ENTRYPOINT_ENCODE) {
+		if (vcn) {
+			radeon_create_encoder(context, templ, ctx->b.ws, si_vce_get_buffer);
+		} else {
+			if (u_reduce_video_profile(templ->profile) == PIPE_VIDEO_FORMAT_HEVC)
+				radeon_uvd_create_encoder(context, templ, ctx->b.ws, si_vce_get_buffer);
+			else
+				si_vce_create_encoder(context, templ, ctx->b.ws, si_vce_get_buffer);
+		}
+	}
 
 	return (vcn) ? 	radeon_create_decoder(context, templ) :
 		si_common_uvd_create_decoder(context, templ, si_uvd_set_dtb);

Comments

General comments:

1. The patch title: please refer to previous commits under the directory,

https://cgit.freedesktop.org/mesa/mesa/log/src/gallium/drivers/radeon

Normally either "radeon/uvd" or "radeonsi"

Applies to changes on other directory.

2. Code style and indentation refer to:

https://cgit.freedesktop.org/mesa/mesa/tree/docs/codingstyle.html

3. If you have changes on the initial version, you'd better to add v2, 
v3. It's good practice in that way.
please refer to lots of commits in Mesa.

4. Once you resend your v2 version, you'd better to add 
"--in-reply-to="message-id", so that the newer patch will be in the same 
thread with your initial patch.


Leo

On 02/05/2018 04:14 PM, James Zhu wrote:
> Add UVD hevc encode pipe video codec creation entry
>
> Signed-off-by: James Zhu <James.Zhu@amd.com>
> ---
>   src/gallium/drivers/radeonsi/si_uvd.c | 15 ++++++++++++---
>   1 file changed, 12 insertions(+), 3 deletions(-)
>
> diff --git a/src/gallium/drivers/radeonsi/si_uvd.c b/src/gallium/drivers/radeonsi/si_uvd.c
> index 64f2f8e..0dea60d 100644
> --- a/src/gallium/drivers/radeonsi/si_uvd.c
> +++ b/src/gallium/drivers/radeonsi/si_uvd.c
> @@ -31,6 +31,8 @@
>   #include "radeon/radeon_vce.h"
>   #include "radeon/radeon_vcn_dec.h"
>   #include "radeon/radeon_vcn_enc.h"
> +#include "radeon/radeon_uvd_enc.h"
> +#include "util/u_video.h"
>   
>   /**
>    * creates an video buffer with an UVD compatible memory layout
> @@ -146,9 +148,16 @@ struct pipe_video_codec *si_uvd_create_decoder(struct pipe_context *context,
>   	struct si_context *ctx = (struct si_context *)context;
>   	bool vcn = (ctx->b.family == CHIP_RAVEN) ? true : false;
>   
> -	if (templ->entrypoint == PIPE_VIDEO_ENTRYPOINT_ENCODE)
> -		return (vcn) ? radeon_create_encoder(context, templ, ctx->b.ws, si_vce_get_buffer) :
> -               si_vce_create_encoder(context, templ, ctx->b.ws, si_vce_get_buffer);
> +	if (templ->entrypoint == PIPE_VIDEO_ENTRYPOINT_ENCODE) {
> +		if (vcn) {
> +			radeon_create_encoder(context, templ, ctx->b.ws, si_vce_get_buffer);
> +		} else {
> +			if (u_reduce_video_profile(templ->profile) == PIPE_VIDEO_FORMAT_HEVC)
> +				radeon_uvd_create_encoder(context, templ, ctx->b.ws, si_vce_get_buffer);
> +			else
> +				si_vce_create_encoder(context, templ, ctx->b.ws, si_vce_get_buffer);
> +		}
> +	}
>   
>   	return (vcn) ? 	radeon_create_decoder(context, templ) :
>   		si_common_uvd_create_decoder(context, templ, si_uvd_set_dtb);
Updated in [Mesa-dev] [PATCH v2 0/8] The 2nd version for UVD HEVC encode


On 2018-02-06 08:56 AM, Leo Liu wrote:
> General comments:
>
> 1. The patch title: please refer to previous commits under the directory,
>
> https://cgit.freedesktop.org/mesa/mesa/log/src/gallium/drivers/radeon
>
> Normally either "radeon/uvd" or "radeonsi"
>
> Applies to changes on other directory.
>
> 2. Code style and indentation refer to:
>
> https://cgit.freedesktop.org/mesa/mesa/tree/docs/codingstyle.html
>
> 3. If you have changes on the initial version, you'd better to add v2, 
> v3. It's good practice in that way.
> please refer to lots of commits in Mesa.
>
> 4. Once you resend your v2 version, you'd better to add 
> "--in-reply-to="message-id", so that the newer patch will be in the 
> same thread with your initial patch.
>
>
> Leo
>
> On 02/05/2018 04:14 PM, James Zhu wrote:
>> Add UVD hevc encode pipe video codec creation entry
>>
>> Signed-off-by: James Zhu <James.Zhu@amd.com>
>> ---
>>   src/gallium/drivers/radeonsi/si_uvd.c | 15 ++++++++++++---
>>   1 file changed, 12 insertions(+), 3 deletions(-)
>>
>> diff --git a/src/gallium/drivers/radeonsi/si_uvd.c 
>> b/src/gallium/drivers/radeonsi/si_uvd.c
>> index 64f2f8e..0dea60d 100644
>> --- a/src/gallium/drivers/radeonsi/si_uvd.c
>> +++ b/src/gallium/drivers/radeonsi/si_uvd.c
>> @@ -31,6 +31,8 @@
>>   #include "radeon/radeon_vce.h"
>>   #include "radeon/radeon_vcn_dec.h"
>>   #include "radeon/radeon_vcn_enc.h"
>> +#include "radeon/radeon_uvd_enc.h"
>> +#include "util/u_video.h"
>>     /**
>>    * creates an video buffer with an UVD compatible memory layout
>> @@ -146,9 +148,16 @@ struct pipe_video_codec 
>> *si_uvd_create_decoder(struct pipe_context *context,
>>       struct si_context *ctx = (struct si_context *)context;
>>       bool vcn = (ctx->b.family == CHIP_RAVEN) ? true : false;
>>   -    if (templ->entrypoint == PIPE_VIDEO_ENTRYPOINT_ENCODE)
>> -        return (vcn) ? radeon_create_encoder(context, templ, 
>> ctx->b.ws, si_vce_get_buffer) :
>> -               si_vce_create_encoder(context, templ, ctx->b.ws, 
>> si_vce_get_buffer);
>> +    if (templ->entrypoint == PIPE_VIDEO_ENTRYPOINT_ENCODE) {
>> +        if (vcn) {
>> +            radeon_create_encoder(context, templ, ctx->b.ws, 
>> si_vce_get_buffer);
>> +        } else {
>> +            if (u_reduce_video_profile(templ->profile) == 
>> PIPE_VIDEO_FORMAT_HEVC)
>> +                radeon_uvd_create_encoder(context, templ, ctx->b.ws, 
>> si_vce_get_buffer);
>> +            else
>> +                si_vce_create_encoder(context, templ, ctx->b.ws, 
>> si_vce_get_buffer);
>> +        }
>> +    }
>>         return (vcn) ?     radeon_create_decoder(context, templ) :
>>           si_common_uvd_create_decoder(context, templ, si_uvd_set_dtb);
>