summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/nv50
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/nv50
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/nv50')
-rw-r--r--src/gallium/drivers/nv50/nv50_context.h7
-rw-r--r--src/gallium/drivers/nv50/nv50_miptree.c6
-rw-r--r--src/gallium/drivers/nv50/nv50_program.c2
-rw-r--r--src/gallium/drivers/nv50/nv50_state_validate.c8
-rw-r--r--src/gallium/drivers/nv50/nv50_surface.c4
5 files changed, 15 insertions, 12 deletions
diff --git a/src/gallium/drivers/nv50/nv50_context.h b/src/gallium/drivers/nv50/nv50_context.h
index 061a4c064b6..6c9e18429ac 100644
--- a/src/gallium/drivers/nv50/nv50_context.h
+++ b/src/gallium/drivers/nv50/nv50_context.h
@@ -99,6 +99,13 @@ nv50_surface(struct pipe_surface *pt)
return (struct nv50_surface *)pt;
}
+static INLINE struct pipe_buffer *
+nv50_surface_buffer(struct pipe_surface *surface)
+{
+ struct nv50_miptree *mt = (struct nv50_miptree *)surface->texture;
+ return mt->buffer;
+}
+
struct nv50_state {
unsigned dirty;
diff --git a/src/gallium/drivers/nv50/nv50_miptree.c b/src/gallium/drivers/nv50/nv50_miptree.c
index 7770fcc3f2a..c6e65c98160 100644
--- a/src/gallium/drivers/nv50/nv50_miptree.c
+++ b/src/gallium/drivers/nv50/nv50_miptree.c
@@ -179,7 +179,7 @@ nv50_miptree_sync(struct pipe_screen *pscreen, struct nv50_miptree *mt,
}
/* The reverse of the above */
-void
+static void
nv50_miptree_sync_cpu(struct pipe_screen *pscreen, struct nv50_miptree *mt,
unsigned level, unsigned image)
{
@@ -232,7 +232,6 @@ nv50_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, mt->buffer);
ps->format = pt->format;
ps->width = pt->width[level];
ps->height = pt->height[level];
@@ -253,7 +252,6 @@ nv50_miptree_surface_new(struct pipe_screen *pscreen, struct pipe_texture *pt,
ps->offset = 0;
pipe_texture_reference(&ps->texture, pt);
- pipe_buffer_reference(pscreen, &ps->buffer, lvl->image[img]);
if (flags & PIPE_BUFFER_USAGE_CPU_WRITE)
mark_dirty(lvl->image_dirty_cpu, img);
@@ -262,7 +260,6 @@ nv50_miptree_surface_new(struct pipe_screen *pscreen, struct pipe_texture *pt,
ps->offset = lvl->image_offset[img];
pipe_texture_reference(&ps->texture, pt);
- pipe_buffer_reference(pscreen, &ps->buffer, mt->buffer);
if (flags & PIPE_BUFFER_USAGE_GPU_WRITE)
mark_dirty(lvl->image_dirty_gpu, img);
@@ -282,7 +279,6 @@ nv50_miptree_surface_del(struct pipe_screen *pscreen,
if (--ps->refcount <= 0) {
pipe_texture_reference(&ps->texture, NULL);
- pipe_buffer_reference(pscreen, &ps->buffer, NULL);
FREE(s);
}
}
diff --git a/src/gallium/drivers/nv50/nv50_program.c b/src/gallium/drivers/nv50/nv50_program.c
index 7686f746eb2..b902c8cf53f 100644
--- a/src/gallium/drivers/nv50/nv50_program.c
+++ b/src/gallium/drivers/nv50/nv50_program.c
@@ -970,7 +970,7 @@ nv50_program_tx_insn(struct nv50_pc *pc, const union tgsi_full_token *tok)
}
for (i = 0; i < inst->Instruction.NumSrcRegs; i++) {
- struct tgsi_full_src_register *fs = &inst->FullSrcRegisters[i];
+ const struct tgsi_full_src_register *fs = &inst->FullSrcRegisters[i];
if (fs->SrcRegister.File == TGSI_FILE_SAMPLER)
unit = fs->SrcRegister.Index;
diff --git a/src/gallium/drivers/nv50/nv50_state_validate.c b/src/gallium/drivers/nv50/nv50_state_validate.c
index 4dc4c04493a..602d76ac743 100644
--- a/src/gallium/drivers/nv50/nv50_state_validate.c
+++ b/src/gallium/drivers/nv50/nv50_state_validate.c
@@ -46,9 +46,9 @@ nv50_state_validate_fb(struct nv50_context *nv50)
so_data (so, fb->cbufs[i]->height);
so_method(so, tesla, NV50TCL_RT_ADDRESS_HIGH(i), 5);
- so_reloc (so, fb->cbufs[i]->buffer, fb->cbufs[i]->offset,
+ so_reloc (so, nv50_surface_buffer(fb->cbufs[i]), fb->cbufs[i]->offset,
NOUVEAU_BO_VRAM | NOUVEAU_BO_HIGH, 0, 0);
- so_reloc (so, fb->cbufs[i]->buffer, fb->cbufs[i]->offset,
+ so_reloc (so, nv50_surface_buffer(fb->cbufs[i]), fb->cbufs[i]->offset,
NOUVEAU_BO_VRAM | NOUVEAU_BO_LOW, 0, 0);
switch (fb->cbufs[i]->format) {
case PIPE_FORMAT_A8R8G8B8_UNORM:
@@ -81,9 +81,9 @@ nv50_state_validate_fb(struct nv50_context *nv50)
}
so_method(so, tesla, NV50TCL_ZETA_ADDRESS_HIGH, 5);
- so_reloc (so, fb->zsbuf->buffer, fb->zsbuf->offset,
+ so_reloc (so, nv50_surface_buffer(fb->zsbuf), fb->zsbuf->offset,
NOUVEAU_BO_VRAM | NOUVEAU_BO_HIGH, 0, 0);
- so_reloc (so, fb->zsbuf->buffer, fb->zsbuf->offset,
+ so_reloc (so, nv50_surface_buffer(fb->zsbuf), fb->zsbuf->offset,
NOUVEAU_BO_VRAM | NOUVEAU_BO_LOW, 0, 0);
switch (fb->zsbuf->format) {
case PIPE_FORMAT_Z24S8_UNORM:
diff --git a/src/gallium/drivers/nv50/nv50_surface.c b/src/gallium/drivers/nv50/nv50_surface.c
index ed6602ba364..8ebbc84817e 100644
--- a/src/gallium/drivers/nv50/nv50_surface.c
+++ b/src/gallium/drivers/nv50/nv50_surface.c
@@ -65,7 +65,7 @@ nv50_surface_map(struct pipe_screen *screen, struct pipe_surface *ps,
{
struct pipe_winsys *ws = screen->winsys;
- return ws->buffer_map(ws, ps->buffer, flags);
+ return ws->buffer_map(ws, nv50_surface_buffer(ps), flags);
}
static void
@@ -73,7 +73,7 @@ nv50_surface_unmap(struct pipe_screen *pscreen, struct pipe_surface *ps)
{
struct pipe_winsys *ws = pscreen->winsys;
- ws->buffer_unmap(ws, ps->buffer);
+ ws->buffer_unmap(ws, nv50_surface_buffer(ps));
}
void