<div dir="ltr">And the attachment :)<br></div><div class="gmail_extra"><br><div class="gmail_quote">On 15 December 2015 at 09:06, Julien Isorce <span dir="ltr"><<a href="mailto:julien.isorce@gmail.com" target="_blank">julien.isorce@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div>Hi Christian,<br><br></div><div>I tried your v2.<br></div><div><br></div>I had to apply attached change on top of your patch. (the one in buffer.c to avoid crashing, the one postproc.c otherwise same behavior as the v1 of this patch). Note that I export the RGB-like surface (the one that vpp output), not the NV12 one that come from the decoder directly.<br><br></div>Cheers<span class="HOEnZb"><font color="#888888"><br></font></span></div><span class="HOEnZb"><font color="#888888">Julien<br></font></span></div><div class="gmail_extra"><br><div class="gmail_quote"><span class="">On 14 December 2015 at 10:11, Christian König <span dir="ltr"><<a href="mailto:deathsimple@vodafone.de" target="_blank">deathsimple@vodafone.de</a>></span> wrote:<br></span><div><div class="h5"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div bgcolor="#FFFFFF" text="#000000">
    <div><span>
      <blockquote type="cite">Also note that in this pipeline, HW
        decoding is done with nouveau driver and rendering is done with
        intel. dmabuf in between.<br>
      </blockquote></span>
      Yeah, I already thought that somebody is using it like this. I'm
      not sure if this is actually supposed to work because we don't
      have proper synchronization between kernel drivers with DMA-buf
      jet.<span><br>
      <br>
      <blockquote type="cite">Maybe the idea of the patch is good but
        something is still wrong.</blockquote></span>
      While it is not the proper solution I would say let's keep the
      pipeline draining during exporting the handle for now if that's
      really necessary for your use case. Please test the attached
      patch.<br>
      <br>
      Coding the patch I've just noticed that there wasn't a
      pipe->flush() before exporting the handle. Does it work as well
      if you just flush the pipeline without waiting for the commands to
      be finished?<br>
      <br>
      Regards,<br>
      Christian.<div><div><br>
      <br>
      On 14.12.2015 10:14, Julien Isorce wrote:<br>
    </div></div></div><div><div>
    <blockquote type="cite">
      <div dir="ltr">
        <div>
          <div>
            <div>
              <div>Hi Christian,<br>
                <br>
              </div>
              I have tested this patch but then the displayed video is
              garbage (mostly white and sometimes just garbage). It also
              stall the nouveau driver which requires to reboot but I
              guess this is another issue.<br>
              I tested with:<br>
              GST_GL_WINDOW=x11 GST_GL_PLATFORM=egl GST_GL_API=gles2
              GST_DEBUG=2 LIBVA_DRIVER_NAME=gallium gst-launch-1.0
              filesrc location=simpson.mp4 ! qtdemux ! vaapidecodebin !
              glimagesink<br>
              <br>
            </div>
            (to test that you need my gstreamer-vaapi and gstgl branches
            on my github but I would not waste time to try them since
            they should be merged upstream at some point)<br>
            <br>
          </div>
          Also note that in this pipeline, HW decoding is done with
          nouveau driver and rendering is done with intel. dmabuf in
          between.<br>
          <br>
        </div>
        Maybe the idea of the patch is good but something is still
        wrong.<br>
        <div>
          <div>
            <div>
              <div>
                <div>I can test any update if it helps.<br>
                  <br>
                </div>
                <div>Cheers<br>
                </div>
                <div>Julien<br>
                </div>
                <div><br>
                  <br>
                  <br>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
      <div class="gmail_extra"><br>
        <div class="gmail_quote">On 11 December 2015 at 12:33, Christian
          König <span dir="ltr"><<a 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">From:
            Christian König <<a href="mailto:christian.koenig@amd.com" target="_blank">christian.koenig@amd.com</a>><br>
            <br>
            It's nonsense to drain the pipeline like this.<br>
            <br>
            Signed-off-by: Christian König <<a href="mailto:christian.koenig@amd.com" target="_blank">christian.koenig@amd.com</a>><br>
            ---<br>
             src/gallium/state_trackers/va/buffer.c     |  5 -----<br>
             src/gallium/state_trackers/va/image.c      |  1 -<br>
             src/gallium/state_trackers/va/postproc.c   |  6 ------<br>
             src/gallium/state_trackers/va/surface.c    | 10 +---------<br>
             src/gallium/state_trackers/va/va_private.h |  2 --<br>
             5 files changed, 1 insertion(+), 23 deletions(-)<br>
            <br>
            diff --git a/src/gallium/state_trackers/va/buffer.c
            b/src/gallium/state_trackers/va/buffer.c<br>
            index 769305e..2ec187c 100644<br>
            --- a/src/gallium/state_trackers/va/buffer.c<br>
            +++ b/src/gallium/state_trackers/va/buffer.c<br>
            @@ -257,11 +257,6 @@
            vlVaAcquireBufferHandle(VADriverContextP ctx, VABufferID
            buf_id,<br>
            <br>
                screen = VL_VA_PSCREEN(ctx);<br>
            <br>
            -   if (buf->derived_surface.fence) {<br>
            -      screen->fence_finish(screen,
            buf->derived_surface.fence, PIPE_TIMEOUT_INFINITE);<br>
            -      screen->fence_reference(screen,
            &buf->derived_surface.fence, NULL);<br>
            -   }<br>
            -<br>
                if (buf->export_refcount > 0) {<br>
                   if (buf->export_state.mem_type != mem_type)<br>
                      return VA_STATUS_ERROR_INVALID_PARAMETER;<br>
            diff --git a/src/gallium/state_trackers/va/image.c
            b/src/gallium/state_trackers/va/image.c<br>
            index ae07da8..58c9ff7 100644<br>
            --- a/src/gallium/state_trackers/va/image.c<br>
            +++ b/src/gallium/state_trackers/va/image.c<br>
            @@ -266,7 +266,6 @@ vlVaDeriveImage(VADriverContextP ctx,
            VASurfaceID surface, VAImage *image)<br>
                img_buf->type = VAImageBufferType;<br>
                img_buf->size = image->data_size;<br>
                img_buf->num_elements = 1;<br>
            -   img_buf->derived_surface.fence = surf->fence;<br>
            <br>
               
            pipe_resource_reference(&img_buf->derived_surface.resource,
            surfaces[0]->texture);<br>
            <br>
            diff --git a/src/gallium/state_trackers/va/postproc.c
            b/src/gallium/state_trackers/va/postproc.c<br>
            index 105f251..1ee3587 100644<br>
            --- a/src/gallium/state_trackers/va/postproc.c<br>
            +++ b/src/gallium/state_trackers/va/postproc.c<br>
            @@ -54,7 +54,6 @@
            vlVaHandleVAProcPipelineParameterBufferType(vlVaDriver *drv,
            vlVaContext *contex<br>
                vlVaSurface *src_surface;<br>
                VAProcPipelineParameterBuffer *pipeline_param;<br>
                struct pipe_surface **surfaces;<br>
            -   struct pipe_screen *screen;<br>
                struct pipe_surface *psurf;<br>
            <br>
                if (!drv || !context)<br>
            @@ -77,8 +76,6 @@
            vlVaHandleVAProcPipelineParameterBufferType(vlVaDriver *drv,
            vlVaContext *contex<br>
                if (!surfaces || !surfaces[0])<br>
                   return VA_STATUS_ERROR_INVALID_SURFACE;<br>
            <br>
            -   screen = drv->pipe->screen;<br>
            -<br>
                psurf = surfaces[0];<br>
            <br>
                src_region =
            vlVaRegionDefault(pipeline_param->surface_region,
            src_surface->buffer, &def_src_region);<br>
            @@ -99,9 +96,6 @@
            vlVaHandleVAProcPipelineParameterBufferType(vlVaDriver *drv,
            vlVaContext *contex<br>
                vl_compositor_set_layer_dst_area(&drv->cstate, 0,
            &dst_rect);<br>
                vl_compositor_render(&drv->cstate,
            &drv->compositor, psurf, NULL, false);<br>
            <br>
            -   screen->fence_reference(screen,
            &src_surface->fence, NULL);<br>
            -   drv->pipe->flush(drv->pipe,
            &src_surface->fence, 0);<br>
            -<br>
                return VA_STATUS_SUCCESS;<br>
             }<br>
            <br>
            diff --git a/src/gallium/state_trackers/va/surface.c
            b/src/gallium/state_trackers/va/surface.c<br>
            index 4a18a6f..5ddaf04 100644<br>
            --- a/src/gallium/state_trackers/va/surface.c<br>
            +++ b/src/gallium/state_trackers/va/surface.c<br>
            @@ -72,8 +72,6 @@ vlVaDestroySurfaces(VADriverContextP ctx,
            VASurfaceID *surface_list, int num_sur<br>
                   vlVaSurface *surf = handle_table_get(drv->htab,
            surface_list[i]);<br>
                   if (surf->buffer)<br>
                      surf->buffer->destroy(surf->buffer);<br>
            -      if(surf->fence)<br>
            -       
             drv->pipe->screen->fence_reference(drv->pipe->screen,
            &surf->fence, NULL);<br>
                   util_dynarray_fini(&surf->subpics);<br>
                   FREE(surf);<br>
                   handle_table_remove(drv->htab, surface_list[i]);<br>
            @@ -245,11 +243,6 @@ vlVaPutSurface(VADriverContextP ctx,
            VASurfaceID surface_id, void* draw, short s<br>
                screen = drv->pipe->screen;<br>
                vscreen = drv->vscreen;<br>
            <br>
            -   if(surf->fence) {<br>
            -      screen->fence_finish(screen, surf->fence,
            PIPE_TIMEOUT_INFINITE);<br>
            -      screen->fence_reference(screen,
            &surf->fence, NULL);<br>
            -   }<br>
            -<br>
                tex = vscreen->texture_from_drawable(vscreen, draw);<br>
                if (!tex)<br>
                   return VA_STATUS_ERROR_INVALID_DISPLAY;<br>
            @@ -281,8 +274,7 @@ vlVaPutSurface(VADriverContextP ctx,
            VASurfaceID surface_id, void* draw, short s<br>
                screen->flush_frontbuffer(screen, tex, 0, 0,<br>
                                         
            vscreen->get_private(vscreen), NULL);<br>
            <br>
            -   screen->fence_reference(screen, &surf->fence,
            NULL);<br>
            -   drv->pipe->flush(drv->pipe,
            &surf->fence, 0);<br>
            +   drv->pipe->flush(drv->pipe, NULL, 0);<br>
            <br>
                pipe_resource_reference(&tex, NULL);<br>
                pipe_surface_reference(&surf_draw, NULL);<br>
            diff --git a/src/gallium/state_trackers/va/va_private.h
            b/src/gallium/state_trackers/va/va_private.h<br>
            index 6739efc..fa6e0fb 100644<br>
            --- a/src/gallium/state_trackers/va/va_private.h<br>
            +++ b/src/gallium/state_trackers/va/va_private.h<br>
            @@ -244,7 +244,6 @@ typedef struct {<br>
                struct {<br>
                   struct pipe_resource *resource;<br>
                   struct pipe_transfer *transfer;<br>
            -      struct pipe_fence_handle *fence;<br>
                } derived_surface;<br>
                unsigned int export_refcount;<br>
                VABufferInfo export_state;<br>
            @@ -252,7 +251,6 @@ typedef struct {<br>
            <br>
             typedef struct {<br>
                struct pipe_video_buffer templat, *buffer;<br>
            -   struct pipe_fence_handle *fence;<br>
                struct util_dynarray subpics; /* vlVaSubpicture */<br>
             } vlVaSurface;<br>
            <span><font color="#888888"><br>
                --<br>
                2.5.0<br>
                <br>
                _______________________________________________<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="http://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">http://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
              </font></span></blockquote>
        </div>
        <br>
      </div>
    </blockquote>
    <br>
  </div></div></div>

</blockquote></div></div></div><br></div>
</blockquote></div><br></div>