On 13/09/2019 12:17, Boris Brezillon wrote: > So we can choose to wait for all BO users, or just for writers. > > Signed-off-by: Boris Brezillon <boris.brezillon@xxxxxxxxxxxxx> Looks good to me: Reviewed-by: Steven Price <steven.price@xxxxxxx> Although I don't know if the term "writers" should be in the API or if "exclusive" is the preferred term? Steve > --- > drivers/gpu/drm/panfrost/panfrost_drv.c | 8 ++++++-- > include/uapi/drm/panfrost_drm.h | 4 ++++ > 2 files changed, 10 insertions(+), 2 deletions(-) > > diff --git a/drivers/gpu/drm/panfrost/panfrost_drv.c b/drivers/gpu/drm/panfrost/panfrost_drv.c > index 08082fd557c3..6a94aea2147f 100644 > --- a/drivers/gpu/drm/panfrost/panfrost_drv.c > +++ b/drivers/gpu/drm/panfrost/panfrost_drv.c > @@ -322,16 +322,20 @@ panfrost_ioctl_wait_bo(struct drm_device *dev, void *data, > struct drm_panfrost_wait_bo *args = data; > struct drm_gem_object *gem_obj; > unsigned long timeout = drm_timeout_abs_to_jiffies(args->timeout_ns); > + bool wait_all = !(args->flags & PANFROST_WAIT_BO_WRITERS); > > if (args->pad) > return -EINVAL; > > + if (args->flags & ~PANFROST_WAIT_BO_WRITERS) > + return -EINVAL; > + > gem_obj = drm_gem_object_lookup(file_priv, args->handle); > if (!gem_obj) > return -ENOENT; > > - ret = dma_resv_wait_timeout_rcu(gem_obj->resv, true, > - true, timeout); > + ret = dma_resv_wait_timeout_rcu(gem_obj->resv, wait_all, > + true, timeout); > if (!ret) > ret = timeout ? -ETIMEDOUT : -EBUSY; > > diff --git a/include/uapi/drm/panfrost_drm.h b/include/uapi/drm/panfrost_drm.h > index 029c6ae1b1f0..ac4facbcee47 100644 > --- a/include/uapi/drm/panfrost_drm.h > +++ b/include/uapi/drm/panfrost_drm.h > @@ -111,6 +111,9 @@ struct drm_panfrost_submit { > __u32 pad; > }; > > +#define PANFROST_WAIT_ALL_BO_USERS (0 << 0) > +#define PANFROST_WAIT_BO_WRITERS (1 << 0) > + > /** > * struct drm_panfrost_wait_bo - ioctl argument for waiting for > * completion of the last DRM_PANFROST_SUBMIT on a BO. > @@ -123,6 +126,7 @@ struct drm_panfrost_wait_bo { > __u32 handle; > __u32 pad; > __s64 timeout_ns; /* absolute */ > + __u64 flags; > }; > > #define PANFROST_BO_NOEXEC 1 > _______________________________________________ dri-devel mailing list dri-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/dri-devel