<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">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 from a local variable which doesn't exists any more where
      you wanted to add the line.<br>
      <br>
      So Coverity creates code which won't compile and needs to be fixed
      instead.<br>
      <br>
      Christian.<br>
      <br>
      Am 31.05.2016 um 14:51 schrieb Christian König:<br>
    </div>
    <blockquote cite="mid:574D88E9.5090909@amd.com" type="cite">
      <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
      <div class="moz-cite-prefix">Yeah, that solution looks more
        correct to me.<br>
        <br>
        Christian.<br>
        <br>
        Am 31.05.2016 um 14:44 schrieb Julien Isorce:<br>
      </div>
      <blockquote
cite="mid:CAHWPjbWihnt5k38R5VPuWgYGT0mS57W7cAA4ZcADD8XxiS+Upw@mail.gmail.com"
        type="cite">
        <meta http-equiv="Content-Type" content="text/html;
          charset=utf-8">
        <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 moz-do-not-send="true"
                  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
                      moz-do-not-send="true"
                      class="moz-txt-link-abbreviated"
                      href="mailto:eric@engestrom.ch"><a class="moz-txt-link-abbreviated" href="mailto:eric@engestrom.ch">eric@engestrom.ch</a></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 moz-do-not-send="true"
                      href="mailto:mesa-dev@lists.freedesktop.org"
                      target="_blank">mesa-dev@lists.freedesktop.org</a><br>
                    <a moz-do-not-send="true"
                      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>
      </blockquote>
      <br>
    </blockquote>
    <br>
  </body>
</html>