From: Eric Anholt Subject: Re: Fw: [Intel-gfx] [PATCH] intel: add a timed wait function Date: Wed, 30 May 2012 10:41:20 -0700 Message-ID: <87vcjdk1mn.fsf@eliezer.anholt.net> References: <20120527131654.4501e518@bwidawsk.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1160869336==" Return-path: In-Reply-To: <20120527131654.4501e518@bwidawsk.net> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org Errors-To: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org To: Ben Widawsky , dri-devel@lists.freedesktop.org, mesa-dev@lists.freedesktop.org List-Id: dri-devel@lists.freedesktop.org --===============1160869336== Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" --=-=-= Content-Transfer-Encoding: quoted-printable On Sun, 27 May 2012 13:16:54 -0700, Ben Widawsky 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); > } >=20=20 > +int drm_intel_gem_bo_wait(drm_intel_bo *bo, uint64_t *timeout_ns) > +{ > + drm_intel_bufmgr_gem *bufmgr_gem =3D (drm_intel_bufmgr_gem *) > bo->bufmgr; > + drm_intel_bo_gem *bo_gem =3D (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? > + > + wait.bo_handle =3D bo_gem->gem_handle; > + wait.timeout_ns =3D *timeout_ns; > + wait.flags =3D 0; > + ret =3D drmIoctl(bufmgr_gem->fd, DRM_IOCTL_I915_GEM_WAIT, &wait); > + if (ret) > + return ret; > + > + if (wait.timeout_ns =3D=3D 0) { > + DBG("Wait timed out on buffer %d\n", > bo_gem->gem_handle); > + *timeout_ns =3D 0; > + } else > + *timeout_ns =3D 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. I guess GL_ALREADY_SIGNALED handling will be done using a check for bo_busy() before calling this. --=-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iEYEARECAAYFAk/GW8AACgkQHUdvYGzw6veC7gCeOQqhfTFDDnufe7h3lCX/ycia gvgAn0+6UOMFYVe6Zy99Xi4hN63UhmgD =Qp1w -----END PGP SIGNATURE----- --=-=-=-- --===============1160869336== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel --===============1160869336==--