summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/nouveau/nouveau_context.c
diff options
context:
space:
mode:
authorIan Romanick <ian.d.romanick@intel.com>2009-10-22 19:27:34 -0700
committerIan Romanick <ian.d.romanick@intel.com>2009-10-22 19:27:34 -0700
commit21c795b64d14dbd3496903ba5aaab196de2e7a2a (patch)
tree6ab54c3279819342757dae4c3b7fd28d968dd819 /src/gallium/drivers/nouveau/nouveau_context.c
parentea92bef2898bc3391407702b0843ebb9d5e083fc (diff)
parent286611d99060c38c4cc12f18fde5448213e2a44b (diff)
Merge branch 'master' into asm-shader-rework-3asm-shader-rework-3
Conflicts: src/mesa/shader/lex.yy.c
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 0000000000..23443869e6
--- /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);
+}
+