Merge branch 'master' of ssh://git.freedesktop.org/git/mesa/mesa
[mesa.git] / src / gallium / drivers / nv40 / nv40_context.c
index a40f14895f4ae743b94cc5338adc7e09549ebe4b..4e236712027accfc92f896f380153dea6881a93b 100644 (file)
@@ -1,7 +1,6 @@
 #include "draw/draw_context.h"
 #include "pipe/p_defines.h"
-#include "pipe/p_winsys.h"
-#include "pipe/p_util.h"
+#include "pipe/internal/p_winsys_screen.h"
 
 #include "nv40_context.h"
 #include "nv40_screen.h"
@@ -11,7 +10,7 @@ nv40_flush(struct pipe_context *pipe, unsigned flags,
           struct pipe_fence_handle **fence)
 {
        struct nv40_context *nv40 = nv40_context(pipe);
-       
+
        if (flags & PIPE_FLUSH_TEXTURE_CACHE) {
                BEGIN_RING(curie, 0x1fd8, 1);
                OUT_RING  (2);
@@ -32,6 +31,37 @@ nv40_destroy(struct pipe_context *pipe)
        FREE(nv40);
 }
 
+static unsigned int
+nv40_is_texture_referenced( struct pipe_context *pipe,
+                           struct pipe_texture *texture,
+                           unsigned face, unsigned level)
+{
+   /**
+    * FIXME: Return the correct result. We can't always return referenced
+    *        since it causes a double flush within the vbo module.
+    */
+#if 0
+   return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE;
+#else
+   return 0;
+#endif
+}
+
+static unsigned int
+nv40_is_buffer_referenced( struct pipe_context *pipe,
+                          struct pipe_buffer *buf)
+{
+   /**
+    * FIXME: Return the correct result. We can't always return referenced
+    *        since it causes a double flush within the vbo module.
+    */
+#if 0
+   return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE;
+#else
+   return 0;
+#endif
+}
+
 struct pipe_context *
 nv40_create(struct pipe_screen *pscreen, unsigned pctx_id)
 {
@@ -56,6 +86,9 @@ nv40_create(struct pipe_screen *pscreen, unsigned pctx_id)
        nv40->pipe.clear = nv40_clear;
        nv40->pipe.flush = nv40_flush;
 
+       nv40->pipe.is_texture_referenced = nv40_is_texture_referenced;
+       nv40->pipe.is_buffer_referenced = nv40_is_buffer_referenced;
+
        nv40_init_query_functions(nv40);
        nv40_init_surface_functions(nv40);
        nv40_init_state_functions(nv40);
@@ -70,4 +103,3 @@ nv40_create(struct pipe_screen *pscreen, unsigned pctx_id)
 
        return &nv40->pipe;
 }
-