summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/nv30
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/nv30
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/nv30')
-rw-r--r--src/gallium/drivers/nv30/nv30_miptree.c2
-rw-r--r--src/gallium/drivers/nv30/nv30_screen.c6
-rw-r--r--src/gallium/drivers/nv30/nv30_state_fb.c16
3 files changed, 14 insertions, 10 deletions
diff --git a/src/gallium/drivers/nv30/nv30_miptree.c b/src/gallium/drivers/nv30/nv30_miptree.c
index 79baac714ce..c55756971b5 100644
--- a/src/gallium/drivers/nv30/nv30_miptree.c
+++ b/src/gallium/drivers/nv30/nv30_miptree.c
@@ -143,7 +143,6 @@ nv30_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, nv30mt->buffer);
ps->format = pt->format;
ps->width = pt->width[level];
ps->height = pt->height[level];
@@ -181,7 +180,6 @@ nv30_miptree_surface_del(struct pipe_screen *pscreen,
return;
pipe_texture_reference(&ps->texture, NULL);
- pipe_buffer_reference(pscreen, &ps->buffer, NULL);
FREE(ps);
}
diff --git a/src/gallium/drivers/nv30/nv30_screen.c b/src/gallium/drivers/nv30/nv30_screen.c
index 0f10d914ad2..9738436dc47 100644
--- a/src/gallium/drivers/nv30/nv30_screen.c
+++ b/src/gallium/drivers/nv30/nv30_screen.c
@@ -134,6 +134,7 @@ nv30_surface_map(struct pipe_screen *screen, struct pipe_surface *surface,
struct pipe_winsys *ws = screen->winsys;
struct pipe_surface *surface_to_map;
void *map;
+ struct nv30_miptree *nv30mt = (struct nv30_miptree *)surface->texture;
if (!(surface->texture->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR)) {
struct nv30_miptree *mt = (struct nv30_miptree *)surface->texture;
@@ -162,7 +163,7 @@ nv30_surface_map(struct pipe_screen *screen, struct pipe_surface *surface,
assert(surface_to_map);
- map = ws->buffer_map(ws, surface_to_map->buffer, flags);
+ map = ws->buffer_map(ws, nv30mt->buffer, flags);
if (!map)
return NULL;
@@ -174,6 +175,7 @@ nv30_surface_unmap(struct pipe_screen *screen, struct pipe_surface *surface)
{
struct pipe_winsys *ws = screen->winsys;
struct pipe_surface *surface_to_unmap;
+ struct nv30_miptree *nv30mt = (struct nv30_miptree *)surface->texture;
/* TODO: Copy from shadow just before push buffer is flushed instead.
There are probably some programs that map/unmap excessively
@@ -190,7 +192,7 @@ nv30_surface_unmap(struct pipe_screen *screen, struct pipe_surface *surface)
assert(surface_to_unmap);
- ws->buffer_unmap(ws, surface_to_unmap->buffer);
+ ws->buffer_unmap(ws, nv30mt->buffer);
if (surface_to_unmap != surface) {
struct nv30_screen *nvscreen = nv30_screen(screen);
diff --git a/src/gallium/drivers/nv30/nv30_state_fb.c b/src/gallium/drivers/nv30/nv30_state_fb.c
index 8536acc5701..77368cb2055 100644
--- a/src/gallium/drivers/nv30/nv30_state_fb.c
+++ b/src/gallium/drivers/nv30/nv30_state_fb.c
@@ -12,6 +12,7 @@ nv30_state_framebuffer_validate(struct nv30_context *nv30)
unsigned rt_flags = NOUVEAU_BO_RDWR | NOUVEAU_BO_VRAM;
unsigned w = fb->width;
unsigned h = fb->height;
+ struct nv30_miptree *nv30mt;
rt_enable = 0;
for (i = 0; i < fb->nr_cbufs; i++) {
@@ -77,34 +78,37 @@ nv30_state_framebuffer_validate(struct nv30_context *nv30)
pitch |= (pitch << 16);
}
+ nv30mt = (struct nv30_miptree *)rt[0]->texture;
so_method(so, nv30->screen->rankine, NV34TCL_DMA_COLOR0, 1);
- so_reloc (so, rt[0]->buffer, 0, rt_flags | NOUVEAU_BO_OR,
+ so_reloc (so, nv30mt->buffer, 0, rt_flags | NOUVEAU_BO_OR,
nv30->nvws->channel->vram->handle,
nv30->nvws->channel->gart->handle);
so_method(so, nv30->screen->rankine, NV34TCL_COLOR0_PITCH, 2);
so_data (so, pitch);
- so_reloc (so, rt[0]->buffer, rt[0]->offset, rt_flags |
+ so_reloc (so, nv30mt->buffer, rt[0]->offset, rt_flags |
NOUVEAU_BO_LOW, 0, 0);
}
if (rt_enable & NV34TCL_RT_ENABLE_COLOR1) {
+ nv30mt = (struct nv30_miptree *)rt[1]->texture;
so_method(so, nv30->screen->rankine, NV34TCL_DMA_COLOR1, 1);
- so_reloc (so, rt[1]->buffer, 0, rt_flags | NOUVEAU_BO_OR,
+ so_reloc (so, nv30mt->buffer, 0, rt_flags | NOUVEAU_BO_OR,
nv30->nvws->channel->vram->handle,
nv30->nvws->channel->gart->handle);
so_method(so, nv30->screen->rankine, NV34TCL_COLOR1_OFFSET, 2);
- so_reloc (so, rt[1]->buffer, rt[1]->offset, rt_flags |
+ so_reloc (so, nv30mt->buffer, rt[1]->offset, rt_flags |
NOUVEAU_BO_LOW, 0, 0);
so_data (so, rt[1]->stride);
}
if (zeta_format) {
+ nv30mt = (struct nv30_miptree *)zeta->texture;
so_method(so, nv30->screen->rankine, NV34TCL_DMA_ZETA, 1);
- so_reloc (so, zeta->buffer, 0, rt_flags | NOUVEAU_BO_OR,
+ so_reloc (so, nv30mt->buffer, 0, rt_flags | NOUVEAU_BO_OR,
nv30->nvws->channel->vram->handle,
nv30->nvws->channel->gart->handle);
so_method(so, nv30->screen->rankine, NV34TCL_ZETA_OFFSET, 1);
- so_reloc (so, zeta->buffer, zeta->offset, rt_flags |
+ so_reloc (so, nv30mt->buffer, zeta->offset, rt_flags |
NOUVEAU_BO_LOW, 0, 0);
/* TODO: allocate LMA depth buffer */
}