[Intel-gfx] [PATCH] drm/i915: Android sync points for i915

Jesse Barnes jbarnes at virtuousgeek.org
Fri Aug 1 18:02:24 CEST 2014


On Fri, 01 Aug 2014 10:04:55 +0100
Tvrtko Ursulin <tvrtko.ursulin at linux.intel.com> wrote:

> Hi Jesse,
> 
> On 07/31/2014 07:58 PM, Jesse Barnes wrote:
> > Expose an ioctl to create Android fences based on the Android sync point
> > infrastructure (which in turn is based on DMA-buf fences).  Just a
> > sketch at this point, no testing has been done.
> >
> > There are a couple of goals here:
> >    1) allow applications and libraries to create fences without an
> >       associated buffer
> >    2) re-use a common API so userspace doesn't have to impedance mismatch
> >       between different driver implementations too much
> >    3) allow applications and libraries to use explicit synchronization if
> >       they choose by exposing fences directly
> >
> > Signed-off-by: Jesse Barnes <jbarnes at virtuousgeek.org>
> 
> [snip]
> 
> > +
> > +/*
> > + * i915 fences on sync timelines
> > + *
> > + * We implement sync points in terms of i915 seqnos.  They're exposed
> > + * through the new DRM_I915_GEM_FENCE ioctl, and can be mixed and matched
> > + * with other Android timelines and aggregated into sync_fences, etc.
> > + *
> > + * TODO:
> > + *   rebase on top of Chris's seqno/request stuff and use requests
> > + *   allow non-RCS fences (need ring/context association)
> > + */
> > +
> > +struct i915_sync_timeline {
> > +	struct sync_timeline obj;
> > +	struct intel_engine_cs *ring;
> > +	struct drm_i915_private *dev_priv;
> > +};
> > +
> > +struct i915_sync_pt {
> > +	struct sync_pt pt;
> > +	u32 seqno;
> > +};
> 
> In case one day more than seqno needs to be exported to userspace, 
> perhaps it would be handy to version the driver data somehow to allow 
> for some forward/backward compatibility? Unless kernel/libdrm are 
> supposed to be updated in lock-step already.

This is the structure we expose to userspace:

struct drm_i915_gem_fence {
	__s32 fd;
	__u32 ctx_id;
	__u32 flags;
	__u32 pad;
	char name[32];
};

It might be good to version it, but fundamentally we're talking about
fences on a given context's command stream, with an opaque fd, so this
seems sufficient, even if we did want to add additional seqnos in the
internals later on.

-- 
Jesse Barnes, Intel Open Source Technology Center



More information about the Intel-gfx mailing list