浏览代码

drm/nouveau: move fence sequence check to start of loop

I want to be able to use REF_CNT from other places in the kernel without
pushing a fence object onto the list of emitted fences.

The current code makes an assumption that every time the acked sequence is
bumped that there's at least one fence on the list that'll be signalled.

This will no longer be true in the near future.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Ben Skeggs 13 年之前
父节点
当前提交
b08abd4e9a
共有 1 个文件被更改,包括 5 次插入6 次删除
  1. 5 6
      drivers/gpu/drm/nouveau/nouveau_fence.c

+ 5 - 6
drivers/gpu/drm/nouveau/nouveau_fence.c

@@ -93,18 +93,17 @@ nouveau_fence_update(struct nouveau_channel *chan)
 	}
 	}
 
 
 	list_for_each_entry_safe(fence, tmp, &chan->fence.pending, entry) {
 	list_for_each_entry_safe(fence, tmp, &chan->fence.pending, entry) {
-		sequence = fence->sequence;
+		if (fence->sequence > chan->fence.sequence_ack)
+			break;
+
 		fence->signalled = true;
 		fence->signalled = true;
 		list_del(&fence->entry);
 		list_del(&fence->entry);
-
-		if (unlikely(fence->work))
+		if (fence->work)
 			fence->work(fence->priv, true);
 			fence->work(fence->priv, true);
 
 
 		kref_put(&fence->refcount, nouveau_fence_del);
 		kref_put(&fence->refcount, nouveau_fence_del);
-
-		if (sequence == chan->fence.sequence_ack)
-			break;
 	}
 	}
+
 out:
 out:
 	spin_unlock(&chan->fence.lock);
 	spin_unlock(&chan->fence.lock);
 }
 }