コード例 #1
0
ファイル: cm_event.cpp プロジェクト: lsun30/cmrt
CM_RT_API INT CmEvent::WaitForTaskFinished(DWORD dwTimeOutMs)
{
	INT result = CM_SUCCESS;
	m_pQueue->AcquireQueueLock();

	while (m_Status == CM_STATUS_QUEUED) {
		m_pQueue->FlushTaskWithoutSync();
	}

	Query();

	while (m_Status != CM_STATUS_FINISHED) {
		if (m_OsData) {
			result = drm_intel_gem_bo_wait((drm_intel_bo*)m_OsData, 1000000LL*dwTimeOutMs);
			drm_intel_gem_bo_clear_relocs((drm_intel_bo*)m_OsData, 0);
			if (result) {
				//translate the drm ecode (-ETIME).
				result = CM_EXCEED_MAX_TIMEOUT;
				break;
			}
		}

		Query();
	}

	m_pQueue->ReleaseQueueLock();
	return result;
}
コード例 #2
0
ファイル: intel_syncobj.c プロジェクト: airlied/mesa
/**
 * Return true if the function successfully signals or has already signalled.
 * (This matches the behavior expected from __DRI2fence::client_wait_sync).
 */
static bool
brw_fence_client_wait(struct brw_context *brw, struct brw_fence *fence,
                      uint64_t timeout)
{
   if (fence->signalled)
      return true;

   assert(fence->batch_bo);

   /* DRM_IOCTL_I915_GEM_WAIT uses a signed 64 bit timeout and returns
    * immediately for timeouts <= 0.  The best we can do is to clamp the
    * timeout to INT64_MAX.  This limits the maximum timeout from 584 years to
    * 292 years - likely not a big deal.
    */
   if (timeout > INT64_MAX)
      timeout = INT64_MAX;

   if (drm_intel_gem_bo_wait(fence->batch_bo, timeout) != 0)
      return false;

   fence->signalled = true;
   drm_intel_bo_unreference(fence->batch_bo);
   fence->batch_bo = NULL;

   return true;
}
コード例 #3
0
ファイル: intel_syncobj.c プロジェクト: CSRedRat/mesa-1
static void intel_client_wait_sync(struct gl_context *ctx, struct gl_sync_object *s,
				 GLbitfield flags, GLuint64 timeout)
{
   struct intel_sync_object *sync = (struct intel_sync_object *)s;

   if (sync->bo && drm_intel_gem_bo_wait(sync->bo, timeout) == 0) {
      s->StatusFlag = 1;
      drm_intel_bo_unreference(sync->bo);
      sync->bo = NULL;
   }
}
コード例 #4
0
ファイル: intel_drm_winsys.c プロジェクト: pwnz7777/Mesa-3D
int
intel_bo_wait(struct intel_bo *bo, int64_t timeout)
{
   int err;

   err = drm_intel_gem_bo_wait(gem_bo(bo), timeout);
   /* consider the bo idle on errors */
   if (err && err != -ETIME)
      err = 0;

   return err;
}
コード例 #5
0
ファイル: intel_drm_winsys.c プロジェクト: Distrotech/Mesa
int
intel_bo_wait(struct intel_bo *bo, int64_t timeout)
{
   int err;

   if (timeout >= 0) {
      err = drm_intel_gem_bo_wait(gem_bo(bo), timeout);
   } else {
      drm_intel_bo_wait_rendering(gem_bo(bo));
      err = 0;
   }

   /* consider the bo idle on errors */
   if (err && err != -ETIME)
      err = 0;

   return err;
}