<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On 25 November 2015 at 15:04, Emil Velikov <span dir="ltr"><<a href="mailto:emil.l.velikov@gmail.com" target="_blank">emil.l.velikov@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Julien,<br>
<span class=""><br>
On 25 November 2015 at 09:07, Julien Isorce <<a href="mailto:julien.isorce@gmail.com">julien.isorce@gmail.com</a>> wrote:<br>
> From: Julien Isorce <<a href="mailto:julien.isorce@gmail.com">julien.isorce@gmail.com</a>><br>
><br>
> In general max_references cannot be based on num_render_targets.<br>
><br>
> This patch allow to allocate accurate sizes for buffers.<br>
> For other codecs it is a fixed value to 2.<br>
><br>
> This is similar behaviour as vaapi/vdpau-driver.<br>
><br>
> XXX: do the same for HEVC<br>
><br>
> Signed-off-by: Julien Isorce <<a href="mailto:j.isorce@samsung.com">j.isorce@samsung.com</a>><br>
> ---<br>
> src/gallium/state_trackers/va/context.c | 41 ++++++++++++++--------------<br>
> src/gallium/state_trackers/va/picture.c | 37 ++++++++++++++++++-------<br>
> src/gallium/state_trackers/va/picture_h264.c | 29 +++++++++++++++++++-<br>
> src/gallium/state_trackers/va/va_private.h | 4 +--<br>
> 4 files changed, 78 insertions(+), 33 deletions(-)<br>
><br>
> diff --git a/src/gallium/state_trackers/va/context.c b/src/gallium/state_trackers/va/context.c<br>
> index f0051e5..985007b 100644<br>
> --- a/src/gallium/state_trackers/va/context.c<br>
> +++ b/src/gallium/state_trackers/va/context.c<br>
<br>
</span><span class="">> + /* Can only create decoders for which max_references is known. */<br>
> + if (u_reduce_video_profile(context->templat.profile) !=<br>
> + PIPE_VIDEO_FORMAT_MPEG4_AVC) {<br>
> + context->decoder = drv->pipe->create_video_codec(drv->pipe,<br>
> + &context->templat);<br>
> + if (!context->decoder) {<br>
> + FREE(context);<br>
> + return VA_STATUS_ERROR_ALLOCATION_FAILED;<br>
> + }<br>
> }<br>
</span>What is the benefit of delaying only h264 ? Won't this make things<br>
less obvious and you'll have more subtle checks throughout ?<br></blockquote><div><br></div><div>Good idea, I had a try and indeed it is much easier.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<span class=""><br>
> --- a/src/gallium/state_trackers/va/picture.c<br>
> +++ b/src/gallium/state_trackers/va/picture.c<br>
> @@ -60,6 +60,12 @@ vlVaBeginPicture(VADriverContextP ctx, VAContextID context_id, VASurfaceID rende<br>
><br>
> context->target = surf->buffer;<br>
> if (!context->decoder) {<br>
> + /* Decoder creation is delayed until max_references is set. */<br>
> + if (u_reduce_video_profile(context->templat.profile) ==<br>
> + PIPE_VIDEO_FORMAT_MPEG4_AVC)<br>
> + return context->templat.max_references == 0 ?<br>
> + VA_STATUS_SUCCESS : VA_STATUS_ERROR_INVALID_CONTEXT;<br>
> +<br>
</span>Can we really hit the VA_STATUS_ERROR_INVALID_CONTEXT case here ? The<br>
only way that I can think of is consecutive BeginPicture calls without<br>
a EndPicture - surely that can cause issues even without this patch.<br></blockquote><div><br></div><div>You are right, I'll remove this :) Thx<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<span class="HOEnZb"><font color="#888888"><br>
-Emil<br>
</font></span></blockquote></div><br></div></div>