summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/nv04
diff options
context:
space:
mode:
authorZack Rusin <[email protected]>2009-02-02 23:47:16 -0500
committerZack Rusin <[email protected]>2009-02-02 23:47:16 -0500
commit5069bfed29bcee2c89c36c74c6d65d388eb7792e (patch)
tree2aef5035140ca24eef97b5d328e0c29d0460f3a8 /src/gallium/drivers/nv04
parentdf73c964d85d2f44d8c62558b5752b2f4443763f (diff)
gallium: remove pipe_buffer from surfaces
this change disassociates, at least from the driver perspective, the surface from buffer. surfaces are technically now views on the textures so make it so by hiding the buffer in the internals of textures.
Diffstat (limited to 'src/gallium/drivers/nv04')
-rw-r--r--src/gallium/drivers/nv04/nv04_miptree.c2
-rw-r--r--src/gallium/drivers/nv04/nv04_screen.c9
-rw-r--r--src/gallium/drivers/nv04/nv04_state_emit.c9
3 files changed, 11 insertions, 9 deletions
diff --git a/src/gallium/drivers/nv04/nv04_miptree.c b/src/gallium/drivers/nv04/nv04_miptree.c
index 01cb8ecbf31..0575dc0afc2 100644
--- a/src/gallium/drivers/nv04/nv04_miptree.c
+++ b/src/gallium/drivers/nv04/nv04_miptree.c
@@ -107,7 +107,6 @@ nv04_miptree_surface_new(struct pipe_screen *pscreen, struct pipe_texture *pt,
if (!ps)
return NULL;
pipe_texture_reference(&ps->texture, pt);
- pipe_buffer_reference(pscreen, &ps->buffer, nv04mt->buffer);
ps->format = pt->format;
ps->width = pt->width[level];
ps->height = pt->height[level];
@@ -138,7 +137,6 @@ nv04_miptree_surface_del(struct pipe_screen *pscreen,
return;
pipe_texture_reference(&ps->texture, NULL);
- pipe_buffer_reference(pscreen->winsys, &ps->buffer, NULL);
FREE(ps);
}
diff --git a/src/gallium/drivers/nv04/nv04_screen.c b/src/gallium/drivers/nv04/nv04_screen.c
index 2ae67840770..e5e3d4772aa 100644
--- a/src/gallium/drivers/nv04/nv04_screen.c
+++ b/src/gallium/drivers/nv04/nv04_screen.c
@@ -1,4 +1,5 @@
#include "pipe/p_screen.h"
+#include "pipe/p_inlines.h"
#include "util/u_simple_screen.h"
#include "nv04_context.h"
@@ -122,10 +123,10 @@ static void *
nv04_surface_map(struct pipe_screen *screen, struct pipe_surface *surface,
unsigned flags )
{
- struct pipe_winsys *ws = screen->winsys;
void *map;
+ struct nv04_miptree *nv04mt = (struct nv04_miptree *)surface->texture;
- map = ws->buffer_map(ws, surface->buffer, flags);
+ map = pipe_buffer_map(screen, nv04mt->buffer, flags);
if (!map)
return NULL;
@@ -135,9 +136,9 @@ nv04_surface_map(struct pipe_screen *screen, struct pipe_surface *surface,
static void
nv04_surface_unmap(struct pipe_screen *screen, struct pipe_surface *surface)
{
- struct pipe_winsys *ws = screen->winsys;
+ struct nv04_miptree *nv04mt = (struct nv04_miptree *)surface->texture;
- ws->buffer_unmap(ws, surface->buffer);
+ pipe_buffer_unmap(screen, nv04mt->buffer);
}
static void
diff --git a/src/gallium/drivers/nv04/nv04_state_emit.c b/src/gallium/drivers/nv04/nv04_state_emit.c
index 26491758a01..bd8ef1adbff 100644
--- a/src/gallium/drivers/nv04/nv04_state_emit.c
+++ b/src/gallium/drivers/nv04/nv04_state_emit.c
@@ -96,6 +96,7 @@ static void nv04_state_emit_framebuffer(struct nv04_context* nv04)
struct pipe_surface *rt, *zeta;
uint32_t rt_format, w, h;
int colour_format = 0, zeta_format = 0;
+ struct nv04_miptree *nv04mt = 0;
w = fb->cbufs[0]->width;
h = fb->cbufs[0]->height;
@@ -129,14 +130,16 @@ static void nv04_state_emit_framebuffer(struct nv04_context* nv04)
BEGIN_RING(context_surfaces_3d, NV04_CONTEXT_SURFACES_3D_FORMAT, 1);
OUT_RING(rt_format);
-
+
+ nv04mt = (struct nv04_miptree *)rt->texture;
/* FIXME pitches have to be aligned ! */
BEGIN_RING(context_surfaces_3d, NV04_CONTEXT_SURFACES_3D_PITCH, 2);
OUT_RING(rt->stride|(zeta->stride<<16));
- OUT_RELOCl(rt->buffer, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
+ OUT_RELOCl(nv04mt->buffer, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
if (fb->zsbuf) {
+ nv04mt = (struct nv04_miptree *)zeta->texture;
BEGIN_RING(context_surfaces_3d, NV04_CONTEXT_SURFACES_3D_OFFSET_ZETA, 1);
- OUT_RELOCl(zeta->buffer, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
+ OUT_RELOCl(nv04mt->buffer, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
}
}