<div dir="ltr">no problem, it was actually good, I think that even if current code is correct, I'll still submit <br>the new diff for review because it looks better.<br><div><div class="gmail_extra"><br><div class="gmail_quote">On 2 June 2016 at 10:34, Eric Engestrom <span dir="ltr"><<a href="mailto:eric.engestrom@imgtec.com" target="_blank">eric.engestrom@imgtec.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Tue, May 31, 2016 at 02:54:06PM +0200, Christian König wrote:<br>
> On the other hand the original code was correct in the first place.<br>
><br>
> And as Julien noted Coverity tries to restore the template buffer format<br>
> from a local variable which doesn't exists any more where you wanted to add<br>
> the line.<br>
><br>
> So Coverity creates code which won't compile and needs to be fixed instead.<br>
<br>
</span>I guess the lesson for me is to not try and fix stuff in code I don't<br>
understand at all :]<br>
<br>
Sorry for wasting your time with this.<br>
<br>
Cheers,<br>
Eric<br>
<div><div class="h5"><br>
><br>
> Christian.<br>
><br>
> Am 31.05.2016 um 14:51 schrieb Christian König:<br>
> > Yeah, that solution looks more correct to me.<br>
> ><br>
> > Christian.<br>
> ><br>
> > Am 31.05.2016 um 14:44 schrieb Julien Isorce:<br>
> > > Hi,<br>
> > > Thx for looking at it but are you sure your diff compiles ?<br>
> > ><br>
> > > Can you try this instead:<br>
> > ><br>
> > > --- a/src/gallium/state_trackers/va/image.c<br>
> > > +++ b/src/gallium/state_trackers/va/image.c<br>
> > > @@ -471,19 +471,19 @@ vlVaPutImage(VADriverContextP ctx, VASurfaceID<br>
> > > surface, VAImageID image,<br>
> > ><br>
> > > if (format != surf->buffer->buffer_format) {<br>
> > > struct pipe_video_buffer *tmp_buf;<br>
> > > - enum pipe_format old_surf_format = surf->templat.buffer_format;<br>
> > > + struct pipe_video_buffer templat = surf->templat;<br>
> > ><br>
> > > - surf->templat.buffer_format = format;<br>
> > > - tmp_buf = drv->pipe->create_video_buffer(drv->pipe,<br>
> > > &surf->templat);<br>
> > > + templat.buffer_format = format;<br>
> > > + tmp_buf = drv->pipe->create_video_buffer(drv->pipe, &templat);<br>
> > ><br>
> > > if (!tmp_buf) {<br>
> > > - surf->templat.buffer_format = old_surf_format;<br>
> > > pipe_mutex_unlock(drv->mutex);<br>
> > > return VA_STATUS_ERROR_ALLOCATION_FAILED;<br>
> > > }<br>
> > ><br>
> > > surf->buffer->destroy(surf->buffer);<br>
> > > surf->buffer = tmp_buf;<br>
> > > + surf->templat.buffer_format = format;<br>
> > > }<br>
> > ><br>
> > > Cheers<br>
> > > Julien<br>
> > ><br>
> > ><br>
> > > On 31 May 2016 at 08:43, Christian König <<a href="mailto:christian.koenig@amd.com">christian.koenig@amd.com</a><br>
</div></div><div><div class="h5">> > > <mailto:<a href="mailto:christian.koenig@amd.com">christian.koenig@amd.com</a>>> wrote:<br>
> > ><br>
> > > Am 31.05.2016 um 03:24 schrieb Eric Engestrom:<br>
> > ><br>
> > > CoverityID: 1337953<br>
> > ><br>
> > > Signed-off-by: Eric Engestrom <<a href="mailto:eric@engestrom.ch">eric@engestrom.ch</a>><br>
> > > ---<br>
> > ><br>
> > > Note that I do not know this code at all; I'm blindly<br>
> > > following Coverity's advice on this one :]<br>
> > ><br>
> > ><br>
> > > Well and that is completely nonsense. The buffer was already<br>
> > > reallocated when this error happens and so resetting the template<br>
> > > to the original value is incorrect and actually rather dangerous.<br>
> > ><br>
> > > Why does Coverity things that we should add this? And how can we<br>
> > > fix this?<br>
> > ><br>
> > > Regards,<br>
> > > Christian.<br>
> > ><br>
> > ><br>
> > > ---<br>
> > > src/gallium/state_trackers/va/image.c | 1 +<br>
> > > 1 file changed, 1 insertion(+)<br>
> > ><br>
> > > diff --git a/src/gallium/state_trackers/va/image.c<br>
> > > b/src/gallium/state_trackers/va/image.c<br>
> > > index 92d014c..8cfe17a 100644<br>
> > > --- a/src/gallium/state_trackers/va/image.c<br>
> > > +++ b/src/gallium/state_trackers/va/image.c<br>
> > > @@ -490,6 +490,7 @@ vlVaPutImage(VADriverContextP ctx,<br>
> > > VASurfaceID surface, VAImageID image,<br>
> > > views =<br>
> > > surf->buffer->get_sampler_view_planes(surf->buffer);<br>
> > > if (!views) {<br>
> > > + surf->templat.buffer_format = old_surf_format;<br>
> > > pipe_mutex_unlock(drv->mutex);<br>
> > > return VA_STATUS_ERROR_OPERATION_FAILED;<br>
> > > }<br>
> > ><br>
> > ><br>
> > > _______________________________________________<br>
> > > mesa-dev mailing list<br>
> > > <a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
</div></div>> > > <mailto:<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a>><br>
> > > <a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
<div class="HOEnZb"><div class="h5">> > ><br>
> > ><br>
> ><br>
><br>
<br>
> _______________________________________________<br>
> mesa-dev mailing list<br>
> <a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
> <a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
<br>
</div></div></blockquote></div><br></div></div></div>