<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">I'm clearly not deep enough into VA-API
      to judge if that is correct or not, but it sounds sane to me.<br>
      <br>
      So feel free to add an Acked-by: Christian König
      <a class="moz-txt-link-rfc2396E" href="mailto:christian.koenig@amd.com"><christian.koenig@amd.com></a> on the patch.<br>
      <br>
      Cheers,<br>
      Christian.<br>
      <br>
      Am 08.06.2016 um 13:13 schrieb Julien Isorce:<br>
    </div>
    <blockquote
cite="mid:CAHWPjbWN4wKS1RTrDRXY1BvWNafi=xRm9mLL-gAPKUWDhhsYHg@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div>
          <div>
            <div>
              <div>
                <div>
                  <div>Hi Christian,<br>
                    <br>
                  </div>
                  Thx for the review. <br>
                  <br>
                </div>
                pipe_resource_reference(&res, NULL)  will decrement
                reference counting (p_atomic_dec  res->count). But
                the va surface still has the initial reference since it
                created that resource.<br>
              </div>
              So calling vaDestroyImage on a derived image will call
              VaDestroyBuffer but the decrementation wont't reach 0.<br>
              <br>
            </div>
            It is just wrong that vlVaDestroyBuffer relies on the
            export_refcount flag. I also compared with vaapi intel
            driver and they have same flag and it is not present in
            their vaDestroyBuffer.<br>
            <br>
          </div>
          Cheers<br>
        </div>
        Julien<br>
        <div>
          <div>
            <div>
              <div>
                <div>
                  <div><br>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
      <div class="gmail_extra"><br>
        <div class="gmail_quote">On 8 June 2016 at 09:22, Christian
          König <span dir="ltr"><<a moz-do-not-send="true"
              href="mailto:deathsimple@vodafone.de" target="_blank">deathsimple@vodafone.de</a>></span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">Am
            02.06.2016 um 16:03 schrieb Julien Isorce:<br>
            <blockquote class="gmail_quote" style="margin:0 0 0
              .8ex;border-left:1px #ccc solid;padding-left:1ex">
              Signed-off-by: Julien Isorce <<a moz-do-not-send="true"
                href="mailto:j.isorce@samsung.com" target="_blank">j.isorce@samsung.com</a>><br>
            </blockquote>
            <br>
            Actually I'm not sure if that is correct.<br>
            <br>
            If you release the VABuffer of an exported resource you
            won't be able to properly close the handle with
            vlVaReleaseBufferHandle().<br>
            <br>
            On the other hand the semantic VA requires for
            vlVaAcquireBufferHandle() and vlVaReleaseBufferHandle() is
            complete nonsense for DMA-buf handles.<span class="HOEnZb"><font
                color="#888888"><br>
                <br>
                Christian.</font></span><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>
                  src/gallium/state_trackers/va/buffer.c | 8 +-------<br>
                  1 file changed, 1 insertion(+), 7 deletions(-)<br>
                <br>
                diff --git a/src/gallium/state_trackers/va/buffer.c
                b/src/gallium/state_trackers/va/buffer.c<br>
                index 2fd8661..7d3167b 100644<br>
                --- a/src/gallium/state_trackers/va/buffer.c<br>
                +++ b/src/gallium/state_trackers/va/buffer.c<br>
                @@ -192,14 +192,8 @@ vlVaDestroyBuffer(VADriverContextP
                ctx, VABufferID buf_id)<br>
                        return VA_STATUS_ERROR_INVALID_BUFFER;<br>
                     }<br>
                  -   if (buf->derived_surface.resource) {<br>
                -      if (buf->export_refcount > 0) {<br>
                -         pipe_mutex_unlock(drv->mutex);<br>
                -         return VA_STATUS_ERROR_INVALID_BUFFER;<br>
                -      }<br>
                -<br>
                +   if (buf->derived_surface.resource)<br>
                       
                pipe_resource_reference(&buf->derived_surface.resource,
                NULL);<br>
                -   }<br>
                       FREE(buf->data);<br>
                     FREE(buf);<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>
    </blockquote>
    <br>
  </body>
</html>