summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/nv40
diff options
context:
space:
mode:
authorBen Skeggs <[email protected]>2008-06-29 13:26:04 +1000
committerBen Skeggs <[email protected]>2008-06-29 15:00:28 +1000
commitb6478021d572d9ec30212d6e6992496ee4cf347d (patch)
tree99fd64089ed7dff15f5a6a7c60c17f4bad3a3e45 /src/gallium/drivers/nv40
parentcc8e628563a1cfb26752bc014a75f3087cd8986d (diff)
nouveau: adapt to cpp->pf_block changes
Diffstat (limited to 'src/gallium/drivers/nv40')
-rw-r--r--src/gallium/drivers/nv40/nv40_miptree.c29
-rw-r--r--src/gallium/drivers/nv40/nv40_state_fb.c10
-rw-r--r--src/gallium/drivers/nv40/nv40_surface.c2
3 files changed, 28 insertions, 13 deletions
diff --git a/src/gallium/drivers/nv40/nv40_miptree.c b/src/gallium/drivers/nv40/nv40_miptree.c
index 23da6e36a3e..38e1a5f04ca 100644
--- a/src/gallium/drivers/nv40/nv40_miptree.c
+++ b/src/gallium/drivers/nv40/nv40_miptree.c
@@ -28,19 +28,20 @@ nv40_miptree_layout(struct nv40_miptree *nv40mt)
pt->width[l] = width;
pt->height[l] = height;
pt->depth[l] = depth;
+ pt->nblocksx[l] = pf_get_nblocksx(&pt->block, width);
+ pt->nblocksy[l] = pf_get_nblocksy(&pt->block, height);
if (swizzled)
- pitch = pt->width[l];
- pitch = (pitch + 63) & ~63;
+ pitch = pt->nblocksx[l];
+ pitch = align_int(pitch, 64);
- nv40mt->level[l].pitch = pitch * pt->cpp;
+ nv40mt->level[l].pitch = pitch * pt->block.size;
nv40mt->level[l].image_offset =
CALLOC(nr_faces, sizeof(unsigned));
width = MAX2(1, width >> 1);
height = MAX2(1, height >> 1);
depth = MAX2(1, depth >> 1);
-
}
for (f = 0; f < nr_faces; f++) {
@@ -109,15 +110,20 @@ nv40_miptree_surface_new(struct pipe_screen *pscreen, struct pipe_texture *pt,
struct nv40_miptree *nv40mt = (struct nv40_miptree *)pt;
struct pipe_surface *ps;
- ps = ws->surface_alloc(ws);
+ ps = CALLOC_STRUCT(pipe_surface);
if (!ps)
return NULL;
+ pipe_texture_reference(&ps->texture, pt);
pipe_buffer_reference(ws, &ps->buffer, nv40mt->buffer);
ps->format = pt->format;
- ps->cpp = pt->cpp;
ps->width = pt->width[level];
ps->height = pt->height[level];
- ps->pitch = nv40mt->level[level].pitch / ps->cpp;
+ ps->block = pt->block;
+ ps->nblocksx = pt->nblocksx[level];
+ ps->nblocksy = pt->nblocksy[level];
+ ps->stride = nv40mt->level[level].pitch;
+ ps->usage = flags;
+ ps->status = PIPE_SURFACE_STATUS_DEFINED;
if (pt->target == PIPE_TEXTURE_CUBE) {
ps->offset = nv40mt->level[level].image_offset[face];
@@ -135,6 +141,15 @@ static void
nv40_miptree_surface_del(struct pipe_screen *pscreen,
struct pipe_surface **psurface)
{
+ struct pipe_surface *ps = *psurface;
+
+ *psurface = NULL;
+ if (--ps->refcount > 0)
+ return;
+
+ pipe_texture_reference(&ps->texture, NULL);
+ pipe_buffer_reference(pscreen->winsys, &ps->buffer, NULL);
+ FREE(ps);
}
void
diff --git a/src/gallium/drivers/nv40/nv40_state_fb.c b/src/gallium/drivers/nv40/nv40_state_fb.c
index 88baf61ffb3..0e4e60eaa75 100644
--- a/src/gallium/drivers/nv40/nv40_state_fb.c
+++ b/src/gallium/drivers/nv40/nv40_state_fb.c
@@ -64,7 +64,7 @@ nv40_state_framebuffer_validate(struct nv40_context *nv40)
nv40->nvws->channel->vram->handle,
nv40->nvws->channel->gart->handle);
so_method(so, nv40->screen->curie, NV40TCL_COLOR0_PITCH, 2);
- so_data (so, rt[0]->pitch * rt[0]->cpp);
+ so_data (so, rt[0]->stride);
so_reloc (so, rt[0]->buffer, rt[0]->offset, rt_flags |
NOUVEAU_BO_LOW, 0, 0);
}
@@ -77,7 +77,7 @@ nv40_state_framebuffer_validate(struct nv40_context *nv40)
so_method(so, nv40->screen->curie, NV40TCL_COLOR1_OFFSET, 2);
so_reloc (so, rt[1]->buffer, rt[1]->offset, rt_flags |
NOUVEAU_BO_LOW, 0, 0);
- so_data (so, rt[1]->pitch * rt[1]->cpp);
+ so_data (so, rt[1]->stride);
}
if (rt_enable & NV40TCL_RT_ENABLE_COLOR2) {
@@ -89,7 +89,7 @@ nv40_state_framebuffer_validate(struct nv40_context *nv40)
so_reloc (so, rt[2]->buffer, rt[2]->offset, rt_flags |
NOUVEAU_BO_LOW, 0, 0);
so_method(so, nv40->screen->curie, NV40TCL_COLOR2_PITCH, 1);
- so_data (so, rt[2]->pitch * rt[2]->cpp);
+ so_data (so, rt[2]->stride);
}
if (rt_enable & NV40TCL_RT_ENABLE_COLOR3) {
@@ -101,7 +101,7 @@ nv40_state_framebuffer_validate(struct nv40_context *nv40)
so_reloc (so, rt[3]->buffer, rt[3]->offset, rt_flags |
NOUVEAU_BO_LOW, 0, 0);
so_method(so, nv40->screen->curie, NV40TCL_COLOR3_PITCH, 1);
- so_data (so, rt[3]->pitch * rt[3]->cpp);
+ so_data (so, rt[3]->stride);
}
if (zeta_format) {
@@ -113,7 +113,7 @@ nv40_state_framebuffer_validate(struct nv40_context *nv40)
so_reloc (so, zeta->buffer, zeta->offset, rt_flags |
NOUVEAU_BO_LOW, 0, 0);
so_method(so, nv40->screen->curie, NV40TCL_ZETA_PITCH, 1);
- so_data (so, zeta->pitch * zeta->cpp);
+ so_data (so, zeta->stride);
}
so_method(so, nv40->screen->curie, NV40TCL_RT_ENABLE, 1);
diff --git a/src/gallium/drivers/nv40/nv40_surface.c b/src/gallium/drivers/nv40/nv40_surface.c
index c0d135eb36d..0916555d564 100644
--- a/src/gallium/drivers/nv40/nv40_surface.c
+++ b/src/gallium/drivers/nv40/nv40_surface.c
@@ -34,7 +34,7 @@
#include "util/p_tile.h"
static void
-nv40_surface_copy(struct pipe_context *pipe, unsigned do_flip,
+nv40_surface_copy(struct pipe_context *pipe, boolean do_flip,
struct pipe_surface *dest, unsigned destx, unsigned desty,
struct pipe_surface *src, unsigned srcx, unsigned srcy,
unsigned width, unsigned height)