<div dir="ltr"><div><div><div><div>Hi,<br></div>Thx for looking at it but are you sure your diff compiles ?<br><br></div>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 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, &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></div>Cheers<br></div>Julien<br><br><div class="gmail_extra"><br><div class="gmail_quote">On 31 May 2016 at 08:43, Christian König <span dir="ltr"><<a href="mailto:christian.koenig@amd.com" target="_blank">christian.koenig@amd.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="">Am 31.05.2016 um 03:24 schrieb Eric Engestrom:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
CoverityID: 1337953<br>
<br>
Signed-off-by: Eric Engestrom <<a href="mailto:eric@engestrom.ch" target="_blank">eric@engestrom.ch</a>><br>
---<br>
<br>
Note that I do not know this code at all; I'm blindly following Coverity's advice on this one :]<br>
</blockquote>
<br></span>
Well and that is completely nonsense. The buffer was already reallocated when this error happens and so resetting the template 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 fix this?<br>
<br>
Regards,<br>
Christian.<span class="im HOEnZb"><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<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 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, VASurfaceID surface, VAImageID image,<br>
       views = 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>
</blockquote>
<br></span><div class="HOEnZb"><div class="h5">
_______________________________________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org" target="_blank">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></div></blockquote></div><br></div></div>