Merge branch 'mesa_7_7_branch'
[mesa.git] / src / gallium / drivers / nv50 / nv50_context.c
index e02afc4be9901c48b36ab5aaab9f7877174624d2..219e7a7862321f2ede5eeabbcbce52785b3d4b30 100644 (file)
@@ -31,15 +31,17 @@ static void
 nv50_flush(struct pipe_context *pipe, unsigned flags,
           struct pipe_fence_handle **fence)
 {
-       struct nv50_context *nv50 = (struct nv50_context *)pipe;
-       
-       FIRE_RING(nv50->screen->base.channel);
+       struct nv50_context *nv50 = nv50_context(pipe);
+       struct nouveau_channel *chan = nv50->screen->base.channel;
+
+       if (flags & PIPE_FLUSH_FRAME)
+               FIRE_RING(chan);
 }
 
 static void
 nv50_destroy(struct pipe_context *pipe)
 {
-       struct nv50_context *nv50 = (struct nv50_context *)pipe;
+       struct nv50_context *nv50 = nv50_context(pipe);
 
        draw_destroy(nv50->draw);
        FREE(nv50);
@@ -51,29 +53,6 @@ nv50_set_edgeflags(struct pipe_context *pipe, const unsigned *bitfield)
 {
 }
 
-static unsigned int
-nv50_is_texture_referenced( struct pipe_context *pipe,
-                           struct pipe_texture *texture,
-                           unsigned face, unsigned level)
-{
-   /**
-    * FIXME: Optimize.
-    */
-
-   return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE;
-}
-
-static unsigned int
-nv50_is_buffer_referenced( struct pipe_context *pipe,
-                          struct pipe_buffer *buf)
-{
-   /**
-    * FIXME: Optimize.
-    */
-
-   return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE;
-}
-
 struct pipe_context *
 nv50_create(struct pipe_screen *pscreen, unsigned pctx_id)
 {
@@ -99,8 +78,11 @@ nv50_create(struct pipe_screen *pscreen, unsigned pctx_id)
 
        nv50->pipe.flush = nv50_flush;
 
-       nv50->pipe.is_texture_referenced = nv50_is_texture_referenced;
-       nv50->pipe.is_buffer_referenced = nv50_is_buffer_referenced;
+       nv50->pipe.is_texture_referenced = nouveau_is_texture_referenced;
+       nv50->pipe.is_buffer_referenced = nouveau_is_buffer_referenced;
+
+       screen->base.channel->user_private = nv50;
+       screen->base.channel->flush_notify = nv50_state_flush_notify;
 
        nv50_init_surface_functions(nv50);
        nv50_init_state_functions(nv50);
@@ -112,5 +94,3 @@ nv50_create(struct pipe_screen *pscreen, unsigned pctx_id)
 
        return &nv50->pipe;
 }
-
-