summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/nv10
diff options
context:
space:
mode:
authorBen Skeggs <skeggsb@gmail.com>2008-05-27 01:22:22 +1000
committerBen Skeggs <skeggsb@gmail.com>2008-05-27 01:23:31 +1000
commitfa4b2439d4f240a5e573d4ea198b829791d614f4 (patch)
tree702abbb5a9cbe97ab902252720df9d6916ac7af7 /src/gallium/drivers/nv10
parent0f9635d9d522ea712724415599ceb44d53e67819 (diff)
nouveau: very quick port to tex-surface changes.
probably the last match-gallium-upstream merge for a bit, some cleanup+nv50 work coming RSN...
Diffstat (limited to 'src/gallium/drivers/nv10')
-rw-r--r--src/gallium/drivers/nv10/nv10_context.c1
-rw-r--r--src/gallium/drivers/nv10/nv10_context.h1
-rw-r--r--src/gallium/drivers/nv10/nv10_miptree.c11
-rw-r--r--src/gallium/drivers/nv10/nv10_screen.c25
4 files changed, 32 insertions, 6 deletions
diff --git a/src/gallium/drivers/nv10/nv10_context.c b/src/gallium/drivers/nv10/nv10_context.c
index 79253f8a2b..9fcd0b0fc3 100644
--- a/src/gallium/drivers/nv10/nv10_context.c
+++ b/src/gallium/drivers/nv10/nv10_context.c
@@ -285,7 +285,6 @@ nv10_create(struct pipe_screen *pscreen, unsigned pctx_id)
nv10_init_surface_functions(nv10);
nv10_init_state_functions(nv10);
- nv10_init_miptree_functions(nv10);
nv10->draw = draw_create();
assert(nv10->draw);
diff --git a/src/gallium/drivers/nv10/nv10_context.h b/src/gallium/drivers/nv10/nv10_context.h
index 433d04dc2a..5636dfc9d2 100644
--- a/src/gallium/drivers/nv10/nv10_context.h
+++ b/src/gallium/drivers/nv10/nv10_context.h
@@ -109,7 +109,6 @@ nv10_context(struct pipe_context *pipe)
extern void nv10_init_state_functions(struct nv10_context *nv10);
extern void nv10_init_surface_functions(struct nv10_context *nv10);
-extern void nv10_init_miptree_functions(struct nv10_context *nv10);
extern void nv10_screen_init_miptree_functions(struct pipe_screen *pscreen);
diff --git a/src/gallium/drivers/nv10/nv10_miptree.c b/src/gallium/drivers/nv10/nv10_miptree.c
index 4dfc675a6b..1b9947354d 100644
--- a/src/gallium/drivers/nv10/nv10_miptree.c
+++ b/src/gallium/drivers/nv10/nv10_miptree.c
@@ -52,7 +52,7 @@ nv10_miptree_layout(struct nv10_miptree *nv10mt)
}
static struct pipe_texture *
-nv10_miptree_create(struct pipe_screen *screen, struct pipe_texture *pt)
+nv10_miptree_create(struct pipe_screen *screen, const struct pipe_texture *pt)
{
struct pipe_winsys *ws = screen->winsys;
struct nv10_miptree *mt;
@@ -105,7 +105,8 @@ nv10_miptree_update(struct pipe_context *pipe, struct pipe_texture *mt,
static struct pipe_surface *
nv10_miptree_surface_get(struct pipe_screen *screen, struct pipe_texture *pt,
- unsigned face, unsigned level, unsigned zslice)
+ unsigned face, unsigned level, unsigned zslice,
+ unsigned flags)
{
struct pipe_winsys *ws = screen->winsys;
struct nv10_miptree *nv10mt = (struct nv10_miptree *)pt;
@@ -130,9 +131,10 @@ nv10_miptree_surface_get(struct pipe_screen *screen, struct pipe_texture *pt,
return ps;
}
-void nv10_init_miptree_functions(struct nv10_context *nv10)
+static void
+nv10_miptree_surface_release(struct pipe_screen *screen,
+ struct pipe_surface **surface)
{
- nv10->pipe.texture_update = nv10_miptree_update;
}
void nv10_screen_init_miptree_functions(struct pipe_screen *pscreen)
@@ -140,5 +142,6 @@ void nv10_screen_init_miptree_functions(struct pipe_screen *pscreen)
pscreen->texture_create = nv10_miptree_create;
pscreen->texture_release = nv10_miptree_release;
pscreen->get_tex_surface = nv10_miptree_surface_get;
+ pscreen->tex_surface_release = nv10_miptree_surface_release;
}
diff --git a/src/gallium/drivers/nv10/nv10_screen.c b/src/gallium/drivers/nv10/nv10_screen.c
index 5fe3a03081..67787d8e9c 100644
--- a/src/gallium/drivers/nv10/nv10_screen.c
+++ b/src/gallium/drivers/nv10/nv10_screen.c
@@ -117,6 +117,28 @@ nv10_screen_is_format_supported(struct pipe_screen *screen,
return FALSE;
}
+static void *
+nv10_surface_map(struct pipe_screen *screen, struct pipe_surface *surface,
+ unsigned flags )
+{
+ struct pipe_winsys *ws = screen->winsys;
+ void *map;
+
+ map = ws->buffer_map(ws, surface->buffer, flags);
+ if (!map)
+ return NULL;
+
+ return map + surface->offset;
+}
+
+static void
+nv10_surface_unmap(struct pipe_screen *screen, struct pipe_surface *surface)
+{
+ struct pipe_winsys *ws = screen->winsys;
+
+ ws->buffer_unmap(ws, surface->buffer);
+}
+
static void
nv10_screen_destroy(struct pipe_screen *pscreen)
{
@@ -180,6 +202,9 @@ nv10_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws)
screen->pipe.is_format_supported = nv10_screen_is_format_supported;
+ screen->pipe.surface_map = nv10_surface_map;
+ screen->pipe.surface_unmap = nv10_surface_unmap;
+
nv10_screen_init_miptree_functions(&screen->pipe);
return &screen->pipe;