summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/nouveau/nouveau_context.c
diff options
context:
space:
mode:
authorBen Skeggs <[email protected]>2009-10-19 09:28:59 +1000
committerBen Skeggs <[email protected]>2009-10-19 09:49:02 +1000
commit35b98e2884bd7c76c43fa08d5bb0a8f1396d3298 (patch)
tree94bb8d699cb282bb31d268be6dbf8d0c0b7121b3 /src/gallium/drivers/nouveau/nouveau_context.c
parent869d3eea37ee060d62cd5b7f6031ef5a93e328a1 (diff)
nouveau: implement is_{texture,buffer}_referenced properly
Diffstat (limited to 'src/gallium/drivers/nouveau/nouveau_context.c')
-rw-r--r--src/gallium/drivers/nouveau/nouveau_context.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/gallium/drivers/nouveau/nouveau_context.c b/src/gallium/drivers/nouveau/nouveau_context.c
new file mode 100644
index 00000000000..23443869e68
--- /dev/null
+++ b/src/gallium/drivers/nouveau/nouveau_context.c
@@ -0,0 +1,41 @@
+#include <pipe/p_defines.h>
+#include <pipe/p_context.h>
+
+#include "nouveau/nouveau_screen.h"
+#include "nouveau/nouveau_context.h"
+
+#include "nouveau/nouveau_bo.h"
+
+static unsigned int
+nouveau_reference_flags(struct nouveau_bo *bo)
+{
+ uint32_t bo_flags;
+ int flags = 0;
+
+ bo_flags = nouveau_bo_pending(bo);
+ if (bo_flags & NOUVEAU_BO_RD)
+ flags |= PIPE_REFERENCED_FOR_READ;
+ if (bo_flags & NOUVEAU_BO_WR)
+ flags |= PIPE_REFERENCED_FOR_WRITE;
+
+ return flags;
+}
+
+unsigned int
+nouveau_is_texture_referenced(struct pipe_context *pipe,
+ struct pipe_texture *pt,
+ unsigned face, unsigned level)
+{
+ struct nouveau_miptree *mt = nouveau_miptree(pt);
+
+ return nouveau_reference_flags(mt->bo);
+}
+
+unsigned int
+nouveau_is_buffer_referenced(struct pipe_context *pipe, struct pipe_buffer *pb)
+{
+ struct nouveau_bo *bo = nouveau_bo(pb);
+
+ return nouveau_reference_flags(bo);
+}
+