summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/nv50/nv50_surface.c
diff options
context:
space:
mode:
authorBen Skeggs <skeggsb@gmail.com>2008-07-11 22:45:11 +1000
committerBen Skeggs <skeggsb@gmail.com>2008-07-11 22:46:07 +1000
commit9b0add0be4a3ba7fc72779daf8361d8cd98d9f64 (patch)
treede5ce8244c8ead44b6f1ef3c5a8eaf8643ba0f6c /src/gallium/drivers/nv50/nv50_surface.c
parent5180a668a7da627a40e024a2ed765458d5bac43e (diff)
nv50: quick hack to get textures untiled on map, and tiled on unmap
progs/fp/tri-tex is all good now rather than all scrambled :)
Diffstat (limited to 'src/gallium/drivers/nv50/nv50_surface.c')
-rw-r--r--src/gallium/drivers/nv50/nv50_surface.c36
1 files changed, 31 insertions, 5 deletions
diff --git a/src/gallium/drivers/nv50/nv50_surface.c b/src/gallium/drivers/nv50/nv50_surface.c
index 6229b63626..8d3f1edcfe 100644
--- a/src/gallium/drivers/nv50/nv50_surface.c
+++ b/src/gallium/drivers/nv50/nv50_surface.c
@@ -52,25 +52,51 @@ nv50_surface_fill(struct pipe_context *pipe, struct pipe_surface *dest,
}
static void *
-nv50_surface_map(struct pipe_screen *screen, struct pipe_surface *surface,
+nv50_surface_map(struct pipe_screen *screen, struct pipe_surface *ps,
unsigned flags )
{
+ struct nouveau_winsys *nvws = nv50_screen(screen)->nvws;
struct pipe_winsys *ws = screen->winsys;
+ struct nv50_surface *s = nv50_surface(ps);
+ struct nv50_surface m = *s;
void *map;
- map = ws->buffer_map(ws, surface->buffer, flags);
+ if (!s->untiled) {
+ s->untiled = ws->buffer_create(ws, 0, 0, ps->buffer->size);
+
+ m.base.buffer = s->untiled;
+ nvws->surface_copy(nvws, &m.base, 0, 0, &s->base, 0, 0,
+ ps->width, ps->height);
+ }
+
+ /* Map original tiled surface to disallow it being validated while
+ * untiled mirror is mapped.
+ */
+ ws->buffer_map(ws, ps->buffer, flags);
+
+ map = ws->buffer_map(ws, s->untiled, flags);
if (!map)
return NULL;
- return map + surface->offset;
+ return map;
}
static void
-nv50_surface_unmap(struct pipe_screen *screen, struct pipe_surface *surface)
+nv50_surface_unmap(struct pipe_screen *screen, struct pipe_surface *ps)
{
+ struct nouveau_winsys *nvws = nv50_screen(screen)->nvws;
struct pipe_winsys *ws = screen->winsys;
+ struct nv50_surface *s = nv50_surface(ps);
+ struct nv50_surface m = *s;
+
+ ws->buffer_unmap(ws, s->untiled);
+ ws->buffer_unmap(ws, ps->buffer);
+
+ m.base.buffer = s->untiled;
+ nvws->surface_copy(nvws, &s->base, 0, 0, &m.base, 0, 0,
+ ps->width, ps->height);
- ws->buffer_unmap(ws, surface->buffer);
+ pipe_buffer_reference(ws, &s->untiled, NULL);
}
void