OSDN Git Service

nouveau: function to return status of bo being referenced in pushbuf
authorBen Skeggs <bskeggs@redhat.com>
Sun, 18 Oct 2009 23:04:37 +0000 (09:04 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Sun, 18 Oct 2009 23:07:45 +0000 (09:07 +1000)
Will be used to implement gallium's is_{texture,buffer}_referenced()
callbacks properly.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
libdrm/nouveau/nouveau_bo.c
libdrm/nouveau/nouveau_bo.h

index 520d5d7..b7e6d86 100644 (file)
@@ -552,6 +552,24 @@ nouveau_bo_busy(struct nouveau_bo *bo, uint32_t access)
        return nouveau_bo_wait(bo, (access & NOUVEAU_BO_WR), 1, 1);
 }
 
+uint32_t
+nouveau_bo_pending(struct nouveau_bo *bo)
+{
+       struct nouveau_bo_priv *nvbo = nouveau_bo(bo);
+       uint32_t flags;
+
+       if (!nvbo->pending)
+               return 0;
+
+       flags = 0;
+       if (nvbo->pending->read_domains)
+               flags |= NOUVEAU_BO_RD;
+       if (nvbo->pending->write_domains)
+               flags |= NOUVEAU_BO_WR;
+
+       return flags;
+}
+
 struct drm_nouveau_gem_pushbuf_bo *
 nouveau_bo_emit_buffer(struct nouveau_channel *chan, struct nouveau_bo *bo)
 {
index 97ad2d7..fdad63e 100644 (file)
@@ -106,4 +106,7 @@ nouveau_bo_unpin(struct nouveau_bo *);
 int
 nouveau_bo_busy(struct nouveau_bo *, uint32_t access);
 
+uint32_t
+nouveau_bo_pending(struct nouveau_bo *);
+
 #endif