<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">Am 20.07.2016 um 20:00 schrieb Zhang,
Boyuan:<br>
</div>
<blockquote
cite="mid:CY4PR12MB1127DBA7EB3A95E05937F35787080@CY4PR12MB1127.namprd12.prod.outlook.com"
type="cite">
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
<meta name="Generator" content="Microsoft Word 14 (filtered
medium)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]-->
<style><!--
/* Font Definitions */
@font-face
{font-family:SimSun;
panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
{font-family:SimSun;
panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
{font-family:"\@SimSun";
panose-1:2 1 6 0 3 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman","serif";
color:black;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
p
{mso-style-priority:99;
margin:0cm;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman","serif";
color:black;}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
{mso-style-priority:99;
mso-style-link:"Balloon Text Char";
margin:0cm;
margin-bottom:.0001pt;
font-size:8.0pt;
font-family:"Tahoma","sans-serif";
color:black;}
span.EmailStyle18
{mso-style-type:personal-reply;
font-family:"Calibri","sans-serif";
color:#1F497D;}
span.BalloonTextChar
{mso-style-name:"Balloon Text Char";
mso-style-priority:99;
mso-style-link:"Balloon Text";
font-family:"Tahoma","sans-serif";
color:black;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
<div class="WordSection1">
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">>Makes
sense, but I suggest that in this case we should add at
least a comment why this is still disabled.<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">>And
it would look better if we have an "#if 0" or something like
this in the code which gets explicitly removed with the last
patch.<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Sure,
I agree. I will submit a new patch set to add this and other
minor changes.<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">>The
problem with slice level encoding is that we haven't fully
implemented it. E.g. the last time I checked the h264encode
test it would try to add an SPS and PPS in front of the
slice data returned from our VA-API driver.<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">>Since
our VA-API driver doesn't return slice data, but rather a
full blown elementary stream you end up with a complete mess
which looks something like this:<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">>SPS
(added by the application), PPS (added by the application),
Slice Header, SPS (added by the driver), PPS(added by the
driver), Slice Header/Slice Data.<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">>That
might work in some if not most cases, but is certainly not
complaint to the VA-API specification.<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">><o:p> </o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">>Christian.<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">I
just tried to disable slice encoding support, and even
Gstreamer is not working. It will give error message saying
“unsupported HW profile”.
<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">On
the other hand, by exposing slice encoding, Gstreamer will
still work as “Frame-in, Frame-out” mode. I didn’t see that
Gstreamer will add extra headers. And by dumping the output
264 output, it seems gstreamer is using picture encoding.
However, as my test shown, gstreamer will not work at all if
we don’t expose slice encoding. Do you have any suggestions
how we should do for this situation?</span></p>
</div>
</blockquote>
<br>
Good question. From the GStreamer source it looks like VA-API was
switched from returning only slice data to a full blown elementary
stream at some point.<br>
<br>
Picture encoding seems to be only used for JPEG as far as I can see.<br>
<br>
Anyway let's keep it like this for now and fix all the fallout we
will run into later on.<br>
<br>
Regards,<br>
Christian.<br>
<br>
<blockquote
cite="mid:CY4PR12MB1127DBA7EB3A95E05937F35787080@CY4PR12MB1127.namprd12.prod.outlook.com"
type="cite">
<div class="WordSection1">
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Regards,<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Boyuan
<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #B5C4DF
1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext"
lang="EN-US">From:</span></b><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext"
lang="EN-US"> Christian König
[<a class="moz-txt-link-freetext" href="mailto:deathsimple@vodafone.de">mailto:deathsimple@vodafone.de</a>]
<br>
<b>Sent:</b> July-20-16 4:48 AM<br>
<b>To:</b> Zhang, Boyuan; <a class="moz-txt-link-abbreviated" href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
<b>Cc:</b> <a class="moz-txt-link-abbreviated" href="mailto:adf.lists@gmail.com">adf.lists@gmail.com</a><br>
<b>Subject:</b> Re: [PATCH 05/12] st/va: add encode
entrypoint<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">Am 20.07.2016 um 06:12 schrieb Zhang,
Boyuan:<o:p></o:p></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div id="divtagdefaultwrapper">
<p style="background:white"><span
style="font-size:10.0pt;font-family:"Calibri","sans-serif";color:#212121">>>
@@ -150,7 +167,16 @@ vlVaCreateConfig(VADriverContextP
ctx, VAProfile profile, VAEntrypoint entrypoin<br>
>> if (entrypoint != VAEntrypointVLD)<br>
>> return
VA_STATUS_ERROR_UNSUPPORTED_ENTRYPOINT;<br>
>> <br>
>> - *config_id = p;<br>
>> + if (entrypoint == VAEntrypointEncSlice ||
entrypoint == VAEntrypointEncPicture)</span><span
style="font-size:10.0pt;font-family:"Calibri","sans-serif""><br>
</span><span
style="font-size:10.0pt;font-family:"Calibri","sans-serif";color:#212121">>>
+ config->entrypoint =
PIPE_VIDEO_ENTRYPOINT_ENCODE;<br>
>> + else<br>
>> + config->entrypoint =
PIPE_VIDEO_ENTRYPOINT_BITSTREAM;<br>
<br>
>Well that doesn't make much sense here.<br>
<br>
>First we return and error if the entrypoint isn't
VAEntrypointVLD and <br>
>then check if it's an encoding entry point.<br>
<br>
>Additional to that I already wondered if we are
really going to support <br>
>slice level as well as picture level encoding.<br>
<br>
>I think that it should only be one of the two.<br>
<br>
>Regards,<br>
>Christian.</span><span
style="font-family:"Calibri","sans-serif""><o:p></o:p></span></p>
<p style="background:white"><span
style="font-family:"Calibri","sans-serif""><o:p> </o:p></span></p>
<p style="background:white"><span
style="font-size:10.0pt;font-family:"Calibri","sans-serif";color:#212121">Hi
Christian,</span><span
style="font-family:"Calibri","sans-serif""><o:p></o:p></span></p>
<p style="background:white"><span
style="font-family:"Calibri","sans-serif""><o:p> </o:p></span></p>
<p style="background:white"><span
style="font-size:10.0pt;font-family:"Calibri","sans-serif";color:#212121">Sorry
for the confusion, The first 2 lines of codes</span><span
style="font-family:"Calibri","sans-serif""><o:p></o:p></span></p>
<p style="background:white"><span
style="font-size:10.0pt;font-family:"Calibri","sans-serif";color:#212121">>>
if (entrypoint != VAEntrypointVLD)<br>
>> return
VA_STATUS_ERROR_UNSUPPORTED_ENTRYPOINT;</span><span
style="font-family:"Calibri","sans-serif""><o:p></o:p></span></p>
<p style="background:white"><span
style="font-size:10.0pt;font-family:"Calibri","sans-serif";color:#212121">will
actually be removed in the last patch where we enable
the VAAPI Encode (Patch 12/12). In other word, we don't
accept VAEncode entrypoint until the time we enable
VAAPI Encode. Therefore, we still only accept
VAEntrypointVLD at this patch.</span><span
style="font-family:"Calibri","sans-serif""><o:p></o:p></span></p>
</div>
</blockquote>
<p class="MsoNormal"><br>
Makes sense, but I suggest that in this case we should add at
least a comment why this is still disabled.<br>
<br>
And it would look better if we have an "#if 0" or something
like this in the code which gets explicitly removed with the
last patch.<br>
<br>
<br>
<o:p></o:p></p>
<div id="divtagdefaultwrapper">
<p style="background:white"><span
style="font-family:"Calibri","sans-serif""><o:p> </o:p></span></p>
<p style="background:white"><span
style="font-size:10.0pt;font-family:"Calibri","sans-serif";color:#212121">And
we need to accept both picture level and slice level
entrypoint. For some application, e.g. libva h264encode
test, if we don't enable slice level encode, it will fail
the call and report h264 encode is not supported. If we
enable both, it will still use picture level encode.
That's why I put both here.</span><span
style="font-family:"Calibri","sans-serif""><o:p></o:p></span></p>
</div>
<p class="MsoNormal"><br>
The problem with slice level encoding is that we haven't fully
implemented it. E.g. the last time I checked the h264encode
test it would try to add an SPS and PPS in front of the slice
data returned from our VA-API driver.<br>
<br>
Since our VA-API driver doesn't return slice data, but rather
a full blown elementary stream you end up with a complete mess
which looks something like this:<br>
<br>
SPS (added by the application), PPS (added by the
application), Slice Header, SPS (added by the driver),
PPS(added by the driver), Slice Header/Slice Data.<br>
<br>
That might work in some if not most cases, but is certainly
not complaint to the VA-API specification.<br>
<br>
Christian.<br>
<br>
<br>
<o:p></o:p></p>
<div id="divtagdefaultwrapper">
<p style="background:white"><span
style="font-family:"Calibri","sans-serif""><o:p> </o:p></span></p>
<p style="background:white"><span
style="font-size:10.0pt;font-family:"Calibri","sans-serif";color:#212121">Regards,</span><span
style="font-family:"Calibri","sans-serif""><o:p></o:p></span></p>
<p style="background:white"><span
style="font-size:10.0pt;font-family:"Calibri","sans-serif";color:#212121">Boyuan </span><span
style="font-family:"Calibri","sans-serif""><o:p></o:p></span></p>
<div>
<div>
<div class="MsoNormal"
style="text-align:center;background:white"
align="center">
<span
style="font-family:"Calibri","sans-serif"">
<hr width="98%" align="center" size="2">
</span></div>
<div id="x_divRplyFwdMsg">
<p class="MsoNormal" style="background:white"><b><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif"">From:</span></b><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif"">
Christian König
<a moz-do-not-send="true"
href="mailto:deathsimple@vodafone.de"><deathsimple@vodafone.de></a><br>
<b>Sent:</b> July 19, 2016 4:52 AM<br>
<b>To:</b> Zhang, Boyuan; <a moz-do-not-send="true"
href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
<b>Cc:</b> <a moz-do-not-send="true"
href="mailto:adf.lists@gmail.com">adf.lists@gmail.com</a><br>
<b>Subject:</b> Re: [PATCH 05/12] st/va: add encode
entrypoint</span><span
style="font-family:"Calibri","sans-serif"">
<o:p></o:p></span></p>
<div>
<p class="MsoNormal" style="background:white"><span
style="font-family:"Calibri","sans-serif""> <o:p></o:p></span></p>
</div>
</div>
</div>
<div>
<p class="MsoNormal"
style="margin-bottom:12.0pt;background:white"><span
style="font-size:10.0pt;font-family:"Calibri","sans-serif"">Am
19.07.2016 um 00:43 schrieb Boyuan Zhang:<br>
> VAAPI passes PIPE_VIDEO_ENTRYPOINT_ENCODE as
entry point for encoding case. We will save this
encode entry point in config. config_id was used as
profile previously. Now, config has both profile and
entrypoint field, and config_id is used to get the
config object. Later on, we pass this entrypoint to
context->templat.entrypoint instead of always
hardcoded to PIPE_VIDEO_ENTRYPOINT_BITSTREAM for
decoding case previously.<br>
><br>
> Signed-off-by: Boyuan Zhang <a
moz-do-not-send="true"
href="mailto:boyuan.zhang@amd.com"><boyuan.zhang@amd.com></a><br>
> ---<br>
> src/gallium/state_trackers/va/config.c | 69
+++++++++++++++++++++++++++---<br>
> src/gallium/state_trackers/va/context.c | 59
++++++++++++++-----------<br>
> src/gallium/state_trackers/va/surface.c | 14
++++--<br>
> src/gallium/state_trackers/va/va_private.h | 5
+++<br>
> 4 files changed, 115 insertions(+), 32
deletions(-)<br>
><br>
> diff --git
a/src/gallium/state_trackers/va/config.c
b/src/gallium/state_trackers/va/config.c<br>
> index 9ca0aa8..7ea7e24 100644<br>
> --- a/src/gallium/state_trackers/va/config.c<br>
> +++ b/src/gallium/state_trackers/va/config.c<br>
> @@ -34,6 +34,8 @@<br>
> <br>
> #include "va_private.h"<br>
> <br>
> +#include "util/u_handle_table.h"<br>
> +<br>
> DEBUG_GET_ONCE_BOOL_OPTION(mpeg4,
"VAAPI_MPEG4_ENABLED", false)<br>
> <br>
> VAStatus<br>
> @@ -128,14 +130,29 @@ VAStatus<br>
> vlVaCreateConfig(VADriverContextP ctx,
VAProfile profile, VAEntrypoint entrypoint,<br>
> VAConfigAttrib *attrib_list,
int num_attribs, VAConfigID *config_id)<br>
> {<br>
> + vlVaDriver *drv;<br>
> + vlVaConfig *config;<br>
> struct pipe_screen *pscreen;<br>
> enum pipe_video_profile p;<br>
> <br>
> if (!ctx)<br>
> return VA_STATUS_ERROR_INVALID_CONTEXT;<br>
> <br>
> + drv = VL_VA_DRIVER(ctx);<br>
> +<br>
> + if (!drv)<br>
> + return VA_STATUS_ERROR_INVALID_CONTEXT;<br>
> +<br>
> + config = CALLOC(1, sizeof(vlVaConfig));<br>
> + if (!config)<br>
> + return VA_STATUS_ERROR_ALLOCATION_FAILED;<br>
> +<br>
> if (profile == VAProfileNone &&
entrypoint == VAEntrypointVideoProc) {<br>
> - *config_id = PIPE_VIDEO_PROFILE_UNKNOWN;<br>
> + config->entrypoint =
VAEntrypointVideoProc;<br>
> + config->profile =
PIPE_VIDEO_PROFILE_UNKNOWN;<br>
> + pipe_mutex_lock(drv->mutex);<br>
> + *config_id =
handle_table_add(drv->htab, config);<br>
> + pipe_mutex_unlock(drv->mutex);<br>
> return VA_STATUS_SUCCESS;<br>
> }<br>
> <br>
> @@ -150,7 +167,16 @@
vlVaCreateConfig(VADriverContextP ctx, VAProfile
profile, VAEntrypoint entrypoin<br>
> if (entrypoint != VAEntrypointVLD)<br>
> return
VA_STATUS_ERROR_UNSUPPORTED_ENTRYPOINT;<br>
> <br>
> - *config_id = p;<br>
> + if (entrypoint == VAEntrypointEncSlice ||
entrypoint == VAEntrypointEncPicture)<br>
> + config->entrypoint =
PIPE_VIDEO_ENTRYPOINT_ENCODE;<br>
> + else<br>
> + config->entrypoint =
PIPE_VIDEO_ENTRYPOINT_BITSTREAM;<br>
<br>
Well that doesn't make much sense here.<br>
<br>
First we return and error if the entrypoint isn't
VAEntrypointVLD and <br>
then check if it's an encoding entry point.<br>
<br>
Additional to that I already wondered if we are really
going to support <br>
slice level as well as picture level encoding.<br>
<br>
I think that it should only be one of the two.<br>
<br>
Regards,<br>
Christian.<br>
<br>
> +<br>
> + config->profile = p;<br>
> +<br>
> + pipe_mutex_lock(drv->mutex);<br>
> + *config_id = handle_table_add(drv->htab,
config);<br>
> + pipe_mutex_unlock(drv->mutex);<br>
> <br>
> return VA_STATUS_SUCCESS;<br>
> }<br>
> @@ -158,9 +184,27 @@
vlVaCreateConfig(VADriverContextP ctx, VAProfile
profile, VAEntrypoint entrypoin<br>
> VAStatus<br>
> vlVaDestroyConfig(VADriverContextP ctx,
VAConfigID config_id)<br>
> {<br>
> + vlVaDriver *drv;<br>
> + vlVaConfig *config;<br>
> +<br>
> if (!ctx)<br>
> return VA_STATUS_ERROR_INVALID_CONTEXT;<br>
> <br>
> + drv = VL_VA_DRIVER(ctx);<br>
> +<br>
> + if (!drv)<br>
> + return VA_STATUS_ERROR_INVALID_CONTEXT;<br>
> +<br>
> + pipe_mutex_lock(drv->mutex);<br>
> + config = handle_table_get(drv->htab,
config_id);<br>
> +<br>
> + if (!config)<br>
> + return VA_STATUS_ERROR_INVALID_CONFIG;<br>
> +<br>
> + FREE(config);<br>
> + handle_table_remove(drv->htab, config_id);<br>
> + pipe_mutex_unlock(drv->mutex);<br>
> +<br>
> return VA_STATUS_SUCCESS;<br>
> }<br>
> <br>
> @@ -168,18 +212,33 @@ VAStatus<br>
> vlVaQueryConfigAttributes(VADriverContextP ctx,
VAConfigID config_id, VAProfile *profile,<br>
> VAEntrypoint
*entrypoint, VAConfigAttrib *attrib_list, int
*num_attribs)<br>
> {<br>
> + vlVaDriver *drv;<br>
> + vlVaConfig *config;<br>
> +<br>
> if (!ctx)<br>
> return VA_STATUS_ERROR_INVALID_CONTEXT;<br>
> <br>
> - *profile = PipeToProfile(config_id);<br>
> + drv = VL_VA_DRIVER(ctx);<br>
> +<br>
> + if (!drv)<br>
> + return VA_STATUS_ERROR_INVALID_CONTEXT;<br>
> +<br>
> + pipe_mutex_lock(drv->mutex);<br>
> + config = handle_table_get(drv->htab,
config_id);<br>
> + pipe_mutex_unlock(drv->mutex);<br>
> +<br>
> + if (!config)<br>
> + return VA_STATUS_ERROR_INVALID_CONFIG;<br>
> +<br>
> + *profile = PipeToProfile(config->profile);<br>
> <br>
> - if (config_id == PIPE_VIDEO_PROFILE_UNKNOWN)
{<br>
> + if (config->profile ==
PIPE_VIDEO_PROFILE_UNKNOWN) {<br>
> *entrypoint = VAEntrypointVideoProc;<br>
> *num_attribs = 0;<br>
> return VA_STATUS_SUCCESS;<br>
> }<br>
> <br>
> - *entrypoint = VAEntrypointVLD;<br>
> + *entrypoint = config->entrypoint;<br>
> <br>
> *num_attribs = 1;<br>
> attrib_list[0].type =
VAConfigAttribRTFormat;<br>
> diff --git
a/src/gallium/state_trackers/va/context.c
b/src/gallium/state_trackers/va/context.c<br>
> index 402fbb2..8882cba 100644<br>
> --- a/src/gallium/state_trackers/va/context.c<br>
> +++ b/src/gallium/state_trackers/va/context.c<br>
> @@ -195,18 +195,23 @@
vlVaCreateContext(VADriverContextP ctx, VAConfigID
config_id, int picture_width,<br>
> {<br>
> vlVaDriver *drv;<br>
> vlVaContext *context;<br>
> + vlVaConfig *config;<br>
> int is_vpp;<br>
> <br>
> if (!ctx)<br>
> return VA_STATUS_ERROR_INVALID_CONTEXT;<br>
> <br>
> - is_vpp = config_id ==
PIPE_VIDEO_PROFILE_UNKNOWN && !picture_width
&&<br>
> + drv = VL_VA_DRIVER(ctx);<br>
> + pipe_mutex_lock(drv->mutex);<br>
> + config = handle_table_get(drv->htab,
config_id);<br>
> + pipe_mutex_unlock(drv->mutex);<br>
> +<br>
> + is_vpp = config->profile ==
PIPE_VIDEO_PROFILE_UNKNOWN && !picture_width
&&<br>
> !picture_height && !flag
&& !render_targets &&
!num_render_targets;<br>
> <br>
> if (!(picture_width &&
picture_height) && !is_vpp)<br>
> return
VA_STATUS_ERROR_INVALID_IMAGE_FORMAT;<br>
> <br>
> - drv = VL_VA_DRIVER(ctx);<br>
> context = CALLOC(1, sizeof(vlVaContext));<br>
> if (!context)<br>
> return VA_STATUS_ERROR_ALLOCATION_FAILED;<br>
> @@ -218,8 +223,8 @@
vlVaCreateContext(VADriverContextP ctx, VAConfigID
config_id, int picture_width,<br>
> return
VA_STATUS_ERROR_INVALID_CONTEXT;<br>
> }<br>
> } else {<br>
> - context->templat.profile = config_id;<br>
> - context->templat.entrypoint =
PIPE_VIDEO_ENTRYPOINT_BITSTREAM;<br>
> + context->templat.profile =
config->profile;<br>
> + context->templat.entrypoint =
config->entrypoint;<br>
> context->templat.chroma_format =
PIPE_VIDEO_CHROMA_FORMAT_420;<br>
> context->templat.width =
picture_width;<br>
> context->templat.height =
picture_height;<br>
> @@ -234,16 +239,18 @@
vlVaCreateContext(VADriverContextP ctx, VAConfigID
config_id, int picture_width,<br>
> <br>
> case PIPE_VIDEO_FORMAT_MPEG4_AVC:<br>
> context->templat.max_references =
0;<br>
> - context->desc.h264.pps =
CALLOC_STRUCT(pipe_h264_pps);<br>
> - if (!context->desc.h264.pps) {<br>
> - FREE(context);<br>
> - return
VA_STATUS_ERROR_ALLOCATION_FAILED;<br>
> - }<br>
> - context->desc.h264.pps->sps =
CALLOC_STRUCT(pipe_h264_sps);<br>
> - if (!context->desc.h264.pps->sps)
{<br>
> - FREE(context->desc.h264.pps);<br>
> - FREE(context);<br>
> - return
VA_STATUS_ERROR_ALLOCATION_FAILED;<br>
> + if (config->entrypoint !=
PIPE_VIDEO_ENTRYPOINT_ENCODE) {<br>
> + context->desc.h264.pps =
CALLOC_STRUCT(pipe_h264_pps);<br>
> + if (!context->desc.h264.pps) {<br>
> + FREE(context);<br>
> + return
VA_STATUS_ERROR_ALLOCATION_FAILED;<br>
> + }<br>
> + context->desc.h264.pps->sps =
CALLOC_STRUCT(pipe_h264_sps);<br>
> + if
(!context->desc.h264.pps->sps) {<br>
> + FREE(context->desc.h264.pps);<br>
> + FREE(context);<br>
> + return
VA_STATUS_ERROR_ALLOCATION_FAILED;<br>
> + }<br>
> }<br>
> break;<br>
> <br>
> @@ -267,7 +274,9 @@
vlVaCreateContext(VADriverContextP ctx, VAConfigID
config_id, int picture_width,<br>
> }<br>
> }<br>
> <br>
> - context->desc.base.profile = config_id;<br>
> + context->desc.base.profile =
config->profile;<br>
> + context->desc.base.entry_point =
config->entrypoint;<br>
> +<br>
> pipe_mutex_lock(drv->mutex);<br>
> *context_id = handle_table_add(drv->htab,
context);<br>
> pipe_mutex_unlock(drv->mutex);<br>
> @@ -293,15 +302,17 @@
vlVaDestroyContext(VADriverContextP ctx, VAContextID
context_id)<br>
> }<br>
> <br>
> if (context->decoder) {<br>
> - if
(u_reduce_video_profile(context->decoder->profile)
==<br>
> - PIPE_VIDEO_FORMAT_MPEG4_AVC) {<br>
> -
FREE(context->desc.h264.pps->sps);<br>
> - FREE(context->desc.h264.pps);<br>
> - }<br>
> - if
(u_reduce_video_profile(context->decoder->profile)
==<br>
> - PIPE_VIDEO_FORMAT_HEVC) {<br>
> -
FREE(context->desc.h265.pps->sps);<br>
> - FREE(context->desc.h265.pps);<br>
> + if (context->desc.base.entry_point !=
PIPE_VIDEO_ENTRYPOINT_ENCODE) {<br>
> + if
(u_reduce_video_profile(context->decoder->profile)
==<br>
> + PIPE_VIDEO_FORMAT_MPEG4_AVC) {<br>
> +
FREE(context->desc.h264.pps->sps);<br>
> + FREE(context->desc.h264.pps);<br>
> + }<br>
> + if
(u_reduce_video_profile(context->decoder->profile)
==<br>
> + PIPE_VIDEO_FORMAT_HEVC) {<br>
> +
FREE(context->desc.h265.pps->sps);<br>
> + FREE(context->desc.h265.pps);<br>
> + }<br>
> }<br>
>
context->decoder->destroy(context->decoder);<br>
> }<br>
> diff --git
a/src/gallium/state_trackers/va/surface.c
b/src/gallium/state_trackers/va/surface.c<br>
> index 3e74353..8ce4143 100644<br>
> --- a/src/gallium/state_trackers/va/surface.c<br>
> +++ b/src/gallium/state_trackers/va/surface.c<br>
> @@ -319,17 +319,18 @@
vlVaUnlockSurface(VADriverContextP ctx, VASurfaceID
surface)<br>
> }<br>
> <br>
> VAStatus<br>
> -vlVaQuerySurfaceAttributes(VADriverContextP ctx,
VAConfigID config,<br>
> +vlVaQuerySurfaceAttributes(VADriverContextP ctx,
VAConfigID config_id,<br>
> VASurfaceAttrib
*attrib_list, unsigned int *num_attribs)<br>
> {<br>
> vlVaDriver *drv;<br>
> + vlVaConfig *config;<br>
> VASurfaceAttrib *attribs;<br>
> struct pipe_screen *pscreen;<br>
> int i, j;<br>
> <br>
>
STATIC_ASSERT(ARRAY_SIZE(vpp_surface_formats) <=
VL_VA_MAX_IMAGE_FORMATS);<br>
> <br>
> - if (config == VA_INVALID_ID)<br>
> + if (config_id == VA_INVALID_ID)<br>
> return VA_STATUS_ERROR_INVALID_CONFIG;<br>
> <br>
> if (!attrib_list && !num_attribs)<br>
> @@ -348,6 +349,13 @@
vlVaQuerySurfaceAttributes(VADriverContextP ctx,
VAConfigID config,<br>
> if (!drv)<br>
> return VA_STATUS_ERROR_INVALID_CONTEXT;<br>
> <br>
> + pipe_mutex_lock(drv->mutex);<br>
> + config = handle_table_get(drv->htab,
config_id);<br>
> + pipe_mutex_unlock(drv->mutex);<br>
> +<br>
> + if (!config)<br>
> + return VA_STATUS_ERROR_INVALID_CONFIG;<br>
> +<br>
> pscreen = VL_VA_PSCREEN(ctx);<br>
> <br>
> if (!pscreen)<br>
> @@ -363,7 +371,7 @@
vlVaQuerySurfaceAttributes(VADriverContextP ctx,
VAConfigID config,<br>
> <br>
> /* vlVaCreateConfig returns
PIPE_VIDEO_PROFILE_UNKNOWN<br>
> * only for VAEntrypointVideoProc. */<br>
> - if (config == PIPE_VIDEO_PROFILE_UNKNOWN) {<br>
> + if (config->profile ==
PIPE_VIDEO_PROFILE_UNKNOWN) {<br>
> for (j = 0; j <
ARRAY_SIZE(vpp_surface_formats); ++j) {<br>
> attribs[i].type =
VASurfaceAttribPixelFormat;<br>
> attribs[i].value.type =
VAGenericValueTypeInteger;<br>
> diff --git
a/src/gallium/state_trackers/va/va_private.h
b/src/gallium/state_trackers/va/va_private.h<br>
> index d91de44..723983d 100644<br>
> --- a/src/gallium/state_trackers/va/va_private.h<br>
> +++ b/src/gallium/state_trackers/va/va_private.h<br>
> @@ -244,6 +244,11 @@ typedef struct {<br>
> } vlVaContext;<br>
> <br>
> typedef struct {<br>
> + VAEntrypoint entrypoint;<br>
> + enum pipe_video_profile profile;<br>
> +} vlVaConfig;<br>
> +<br>
> +typedef struct {<br>
> VABufferType type;<br>
> unsigned int size;<br>
> unsigned int num_elements;<o:p></o:p></span></p>
</div>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</blockquote>
<p><br>
</p>
</body>
</html>