On Wed, Sep 07, 2016 at 09:21:05PM +0100, Chris Wilson wrote: > If the fence context has notifies enabled, each of the fences' > FENCE_FLAG_SIGNALED_BIT will be updated from the interrupt. We can rely > on this status for reporting the current fence_is_signaled() and so > avoid an expensive uncached read. > > Signed-off-by: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx> > Cc: Ben Skeggs <bskeggs@xxxxxxxxxx> > Cc: dri-devel@xxxxxxxxxxxxxxxxxxxxx > Cc: nouveau@xxxxxxxxxxxxxxxxxxxxx > --- > drivers/gpu/drm/nouveau/nouveau_fence.c | 10 ++++++++++ > 1 file changed, 10 insertions(+) > > diff --git a/drivers/gpu/drm/nouveau/nouveau_fence.c b/drivers/gpu/drm/nouveau/nouveau_fence.c > index 4bb9ab892ae1..7daed5c33043 100644 > --- a/drivers/gpu/drm/nouveau/nouveau_fence.c > +++ b/drivers/gpu/drm/nouveau/nouveau_fence.c > @@ -510,6 +510,16 @@ static bool nouveau_fence_is_signaled(struct fence *f) > struct nouveau_channel *chan; > bool ret = false; > > + /* If the notify is already active, we can rely on > + * FENCE_FLAG_SIGNALED_BIT being accurate and skip checking the > + * current seqno as fctx->read() requires an expensive uncached read. > + */ > + if (test_bit(FENCE_FLAG_USER_BITS, &fence->base.flags)) > + return false; > + > + if (READ_ONCE(fctx->notify_ref)) > + return false; Missed that nouveau_fence_is_signaled() is called after first enabling the interrupt - and there the uncached read is required in case the seqno passed before the interrupts were enabled. In that case we just want the test_bit and not the fctx->notify_ref check. -Chris -- Chris Wilson, Intel Open Source Technology Centre _______________________________________________ dri-devel mailing list dri-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/dri-devel