X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fgallium%2Fdrivers%2Fnv30%2Fnv30_context.c;h=8bfd7b2c9095bf9c8dfcee533c164007da9ecdb3;hb=9381a2777c1a36c1b88de9edf04141c485569259;hp=f827bdc78b1f3ae9bee54ee45f1afa368f2cb738;hpb=eb0d46490332091b2ee247f32a1f08a04e1fe00f;p=mesa.git diff --git a/src/gallium/drivers/nv30/nv30_context.c b/src/gallium/drivers/nv30/nv30_context.c index f827bdc78b1..8bfd7b2c909 100644 --- a/src/gallium/drivers/nv30/nv30_context.c +++ b/src/gallium/drivers/nv30/nv30_context.c @@ -1,6 +1,6 @@ #include "draw/draw_context.h" #include "pipe/p_defines.h" -#include "pipe/internal/p_winsys_screen.h" +#include "util/u_simple_screen.h" #include "nv30_context.h" #include "nv30_screen.h" @@ -10,52 +10,40 @@ nv30_flush(struct pipe_context *pipe, unsigned flags, struct pipe_fence_handle **fence) { struct nv30_context *nv30 = nv30_context(pipe); - + struct nv30_screen *screen = nv30->screen; + struct nouveau_channel *chan = screen->base.channel; + struct nouveau_grobj *rankine = screen->rankine; + if (flags & PIPE_FLUSH_TEXTURE_CACHE) { - BEGIN_RING(rankine, 0x1fd8, 1); - OUT_RING (2); - BEGIN_RING(rankine, 0x1fd8, 1); - OUT_RING (1); + BEGIN_RING(chan, rankine, 0x1fd8, 1); + OUT_RING (chan, 2); + BEGIN_RING(chan, rankine, 0x1fd8, 1); + OUT_RING (chan, 1); } - FIRE_RING(fence); + FIRE_RING(chan); + if (fence) + *fence = NULL; } static void nv30_destroy(struct pipe_context *pipe) { struct nv30_context *nv30 = nv30_context(pipe); + unsigned i; + + for (i = 0; i < NV30_STATE_MAX; i++) { + if (nv30->state.hw[i]) + so_ref(NULL, &nv30->state.hw[i]); + } if (nv30->draw) draw_destroy(nv30->draw); FREE(nv30); } -static unsigned int -nv30_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 -nv30_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 * -nv30_create(struct pipe_screen *pscreen, unsigned pctx_id) +nv30_create(struct pipe_screen *pscreen, void *priv) { struct nv30_screen *screen = nv30_screen(pscreen); struct pipe_winsys *ws = pscreen->winsys; @@ -66,20 +54,23 @@ nv30_create(struct pipe_screen *pscreen, unsigned pctx_id) if (!nv30) return NULL; nv30->screen = screen; - nv30->pctx_id = pctx_id; nv30->nvws = nvws; nv30->pipe.winsys = ws; nv30->pipe.screen = pscreen; + nv30->pipe.priv = priv; nv30->pipe.destroy = nv30_destroy; nv30->pipe.draw_arrays = nv30_draw_arrays; nv30->pipe.draw_elements = nv30_draw_elements; nv30->pipe.clear = nv30_clear; nv30->pipe.flush = nv30_flush; - nv30->pipe.is_texture_referenced = nv30_is_texture_referenced; - nv30->pipe.is_buffer_referenced = nv30_is_buffer_referenced; + nv30->pipe.is_texture_referenced = nouveau_is_texture_referenced; + nv30->pipe.is_buffer_referenced = nouveau_is_buffer_referenced; + + screen->base.channel->user_private = nv30; + screen->base.channel->flush_notify = nv30_state_flush_notify; nv30_init_query_functions(nv30); nv30_init_surface_functions(nv30); @@ -95,4 +86,3 @@ nv30_create(struct pipe_screen *pscreen, unsigned pctx_id) return &nv30->pipe; } -