On Tue, Jun 14, 2016 at 04:03:57PM +0100, Chris Wilson wrote:
> obj->base.dma_buf represents a dma-buf exported from this object (for
> use by others). On the contrary, ob->base.import_attach represents the
> source dma-buf that was used to create this object (if any). When
> serialising with third parties, we want to wait on their rendering via
> the import attachment (and not our own via the dma_buf export).
> 
> Note that for an object exported from i915 and passed to another i915
> client, we do not create the import attachment and so serialisation will
> use our native paths.

But that would break it, if the foreign object attaches a some fence to
the reservation. We need things to work both ways, and that is done by
having a reservation pointer, where we either store our own per-bo lock +
list of reservations, or the imported one from the other driver.

A bit much, but interim we'd need at least both base.dma_buf and
base.import_attach.

Also, we should just extract the fence, and wait on that later on in the
atomic path.
-Daniel

> 
> Signed-off-by: Chris Wilson <ch...@chris-wilson.co.uk>
> Cc: Alex Goins <ago...@nvidia.com>
> Cc: Maarten Lankhorst <maarten.lankho...@linux.intel.com>


> ---
>  drivers/gpu/drm/i915/intel_display.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_display.c 
> b/drivers/gpu/drm/i915/intel_display.c
> index 801e4c17dd8d..cbaa2e6f7679 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -11425,8 +11425,8 @@ static bool use_mmio_flip(struct intel_engine_cs 
> *engine,
>               return true;
>       else if (i915.enable_execlists)
>               return true;
> -     else if (obj->base.dma_buf &&
> -              !reservation_object_test_signaled_rcu(obj->base.dma_buf->resv,
> +     else if (obj->base.import_attach &&
> +              
> !reservation_object_test_signaled_rcu(obj->base.import_attach->dmabuf->resv,
>                                                      false))
>               return true;
>       else
> @@ -11526,8 +11526,8 @@ static void intel_mmio_flip_work_func(struct 
> work_struct *w)
>                                           &dev_priv->rps.mmioflips));
>  
>       /* For framebuffer backed by dmabuf, wait for fence */
> -     if (obj->base.dma_buf)
> -             
> WARN_ON(reservation_object_wait_timeout_rcu(obj->base.dma_buf->resv,
> +     if (obj->base.import_attach)
> +             
> WARN_ON(reservation_object_wait_timeout_rcu(obj->base.import_attach->dmabuf->resv,
>                                                           false, false,
>                                                           
> MAX_SCHEDULE_TIMEOUT) < 0);
>  
> @@ -13952,10 +13952,10 @@ intel_prepare_plane_fb(struct drm_plane *plane,
>       }
>  
>       /* For framebuffer backed by dmabuf, wait for fence */
> -     if (obj && obj->base.dma_buf) {
> +     if (obj && obj->base.import_attach) {
>               long lret;
>  
> -             lret = 
> reservation_object_wait_timeout_rcu(obj->base.dma_buf->resv,
> +             lret = 
> reservation_object_wait_timeout_rcu(obj->base.import_attach->dmabuf->resv,
>                                                          false, true,
>                                                          
> MAX_SCHEDULE_TIMEOUT);
>               if (lret == -ERESTARTSYS)
> -- 
> 2.8.1
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to