All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ben Widawsky <ben@bwidawsk.net>
To: Eric Anholt <eric@anholt.net>
Cc: mesa-dev@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Subject: Re: [Intel-gfx] [PATCH] intel: add a timed wait function
Date: Wed, 30 May 2012 11:13:25 -0700	[thread overview]
Message-ID: <20120530111325.321dc654@bwidawsk.net> (raw)
In-Reply-To: <87vcjdk1mn.fsf@eliezer.anholt.net>

On Wed, 30 May 2012 10:41:20 -0700
Eric Anholt <eric@anholt.net> wrote:

> On Sun, 27 May 2012 13:16:54 -0700, Ben Widawsky <ben@bwidawsk.net> wrote:
> > diff --git a/intel/intel_bufmgr_gem.c b/intel/intel_bufmgr_gem.c
> > index b776d2f..695a449 100644
> > --- a/intel/intel_bufmgr_gem.c
> > +++ b/intel/intel_bufmgr_gem.c
> > @@ -1478,6 +1478,32 @@ drm_intel_gem_bo_wait_rendering(drm_intel_bo *bo)
> >  	drm_intel_gem_bo_start_gtt_access(bo, 1);
> >  }
> >  
> > +int drm_intel_gem_bo_wait(drm_intel_bo *bo, uint64_t *timeout_ns)
> > +{
> > +	drm_intel_bufmgr_gem *bufmgr_gem = (drm_intel_bufmgr_gem *)
> > bo->bufmgr;
> > +	drm_intel_bo_gem *bo_gem = (drm_intel_bo_gem *) bo;
> > +	struct drm_i915_gem_wait wait;
> > +	int ret;
> > +
> > +	if (!timeout_ns)
> > +		return -EINVAL;
> 
> At least for the GL case, timeout of 0 ns wants to turn into
> GL_TIMEOUT_EXPIRED or GL_ALREADY_SIGNALED.  -EINVAL doesn't sound like
> translating into either of those -- are you thinking that GL will
> special case 0 ns to not call this function?

Well, it's timeout of NULL, not 0. 0 should do what you want. I can turn
NULL into 0 just as easily, if you want?

> 
> > +
> > +	wait.bo_handle = bo_gem->gem_handle;
> > +	wait.timeout_ns = *timeout_ns;
> > +	wait.flags = 0;
> > +	ret = drmIoctl(bufmgr_gem->fd, DRM_IOCTL_I915_GEM_WAIT, &wait);
> > +	if (ret)
> > +		return ret;
> > +
> > +	if (wait.timeout_ns == 0) {
> > +		DBG("Wait timed out on buffer %d\n",
> > bo_gem->gem_handle);
> > +		*timeout_ns = 0;
> > +	} else
> > +		*timeout_ns = wait.timeout_ns;
> > +
> > +	return ret;
> > +}
> 
> Do we see any consumers wanting the unslept time?  GL doesn't care, and
> not passing a pointer would be more convenient for the caller.

That is how I originally had it, but Daniel Vetter requested otherwise.
I don't care either way. This interacts with your earlier comment as
well.

> 
> I guess GL_ALREADY_SIGNALED handling will be done using a check for
> bo_busy() before calling this.

It shouldn't have to.

I think the outcome is either, drop the return time, or convert NULLs to
0, and everything should be fine, right?


-- 
Ben Widawsky, Intel Open Source Technology Center

  reply	other threads:[~2012-05-30 18:13 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-27 20:16 Fw: [Intel-gfx] [PATCH] intel: add a timed wait function Ben Widawsky
2012-05-30 17:41 ` Eric Anholt
2012-05-30 18:13   ` Ben Widawsky [this message]
2012-05-30 19:07   ` Daniel Vetter
2012-05-30 20:32     ` Ben Widawsky
2012-05-30 22:35     ` Fw: " Eric Anholt
2012-05-31  7:05       ` Daniel Vetter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120530111325.321dc654@bwidawsk.net \
    --to=ben@bwidawsk.net \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=eric@anholt.net \
    --cc=mesa-dev@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.