summaryrefslogtreecommitdiff
path: root/src/mesa/pipe
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/pipe')
-rw-r--r--src/mesa/pipe/nouveau/nouveau_winsys.h17
-rw-r--r--src/mesa/pipe/nv40/Makefile1
-rw-r--r--src/mesa/pipe/nv40/nv40_clear.c3
-rw-r--r--src/mesa/pipe/nv40/nv40_context.c15
-rw-r--r--src/mesa/pipe/nv40/nv40_context.h16
-rw-r--r--src/mesa/pipe/nv40/nv40_miptree.c116
-rw-r--r--src/mesa/pipe/nv40/nv40_query.c39
-rw-r--r--src/mesa/pipe/nv40/nv40_region.c85
-rw-r--r--src/mesa/pipe/nv40/nv40_state.c59
-rw-r--r--src/mesa/pipe/nv40/nv40_state.h12
-rw-r--r--src/mesa/pipe/nv40/nv40_state_tex.c50
-rw-r--r--src/mesa/pipe/nv40/nv40_surface.c114
-rw-r--r--src/mesa/pipe/nv50/Makefile1
-rw-r--r--src/mesa/pipe/nv50/nv50_clear.c3
-rw-r--r--src/mesa/pipe/nv50/nv50_context.c13
-rw-r--r--src/mesa/pipe/nv50/nv50_context.h12
-rw-r--r--src/mesa/pipe/nv50/nv50_miptree.c17
-rw-r--r--src/mesa/pipe/nv50/nv50_query.c13
-rw-r--r--src/mesa/pipe/nv50/nv50_region.c85
-rw-r--r--src/mesa/pipe/nv50/nv50_state.c2
-rw-r--r--src/mesa/pipe/nv50/nv50_surface.c93
21 files changed, 342 insertions, 424 deletions
diff --git a/src/mesa/pipe/nouveau/nouveau_winsys.h b/src/mesa/pipe/nouveau/nouveau_winsys.h
index 40e4bfae54..a274e23af5 100644
--- a/src/mesa/pipe/nouveau/nouveau_winsys.h
+++ b/src/mesa/pipe/nouveau/nouveau_winsys.h
@@ -53,15 +53,14 @@ struct nouveau_winsys {
int (*notifier_wait)(struct nouveau_notifier *, int id,
int status, int timeout);
- int (*region_copy)(struct nouveau_winsys *, struct pipe_region *,
- unsigned, unsigned, unsigned, struct pipe_region *,
- unsigned, unsigned, unsigned, unsigned, unsigned);
- int (*region_fill)(struct nouveau_winsys *, struct pipe_region *,
- unsigned, unsigned, unsigned, unsigned, unsigned,
- unsigned);
- int (*region_data)(struct nouveau_winsys *, struct pipe_region *,
- unsigned, unsigned, unsigned, const void *,
- unsigned, unsigned, unsigned, unsigned, unsigned);
+ int (*surface_copy)(struct nouveau_winsys *, struct pipe_surface *,
+ unsigned, unsigned, struct pipe_surface *,
+ unsigned, unsigned, unsigned, unsigned);
+ int (*surface_fill)(struct nouveau_winsys *, struct pipe_surface *,
+ unsigned, unsigned, unsigned, unsigned, unsigned);
+ int (*surface_data)(struct nouveau_winsys *, struct pipe_surface *,
+ unsigned, unsigned, const void *, unsigned,
+ unsigned, unsigned, unsigned, unsigned);
};
extern struct pipe_context *
diff --git a/src/mesa/pipe/nv40/Makefile b/src/mesa/pipe/nv40/Makefile
index 90c8542da4..9818889ee3 100644
--- a/src/mesa/pipe/nv40/Makefile
+++ b/src/mesa/pipe/nv40/Makefile
@@ -10,7 +10,6 @@ DRIVER_SOURCES = \
nv40_fragprog.c \
nv40_miptree.c \
nv40_query.c \
- nv40_region.c \
nv40_state.c \
nv40_state_emit.c \
nv40_state_tex.c \
diff --git a/src/mesa/pipe/nv40/nv40_clear.c b/src/mesa/pipe/nv40/nv40_clear.c
index 7890107c95..380a2a642f 100644
--- a/src/mesa/pipe/nv40/nv40_clear.c
+++ b/src/mesa/pipe/nv40/nv40_clear.c
@@ -10,6 +10,5 @@ void
nv40_clear(struct pipe_context *pipe, struct pipe_surface *ps,
unsigned clearValue)
{
- pipe->region_fill(pipe, ps->region, 0, 0, 0, ps->width, ps->height,
- clearValue);
+ pipe->surface_fill(pipe, ps, 0, 0, ps->width, ps->height, clearValue);
}
diff --git a/src/mesa/pipe/nv40/nv40_context.c b/src/mesa/pipe/nv40/nv40_context.c
index 8706ed1c07..7b77c70e81 100644
--- a/src/mesa/pipe/nv40/nv40_context.c
+++ b/src/mesa/pipe/nv40/nv40_context.c
@@ -10,9 +10,9 @@ static boolean
nv40_is_format_supported(struct pipe_context *pipe, uint format)
{
switch (format) {
- case PIPE_FORMAT_U_A8_R8_G8_B8:
- case PIPE_FORMAT_U_R5_G6_B5:
- case PIPE_FORMAT_Z24_S8:
+ case PIPE_FORMAT_A8R8G8B8_UNORM:
+ case PIPE_FORMAT_R5G6B5_UNORM:
+ case PIPE_FORMAT_Z24S8_UNORM:
return TRUE;
default:
break;
@@ -267,17 +267,12 @@ nv40_create(struct pipe_winsys *pipe_winsys, struct nouveau_winsys *nvws,
nv40->pipe.draw_elements = nv40_draw_elements;
nv40->pipe.clear = nv40_clear;
- nv40->pipe.begin_query = nv40_query_begin;
- nv40->pipe.end_query = nv40_query_end;
- nv40->pipe.wait_query = nv40_query_wait;
-
- nv40->pipe.mipmap_tree_layout = nv40_miptree_layout;
-
nv40->pipe.flush = nv40_flush;
- nv40_init_region_functions(nv40);
+ nv40_init_query_functions(nv40);
nv40_init_surface_functions(nv40);
nv40_init_state_functions(nv40);
+ nv40_init_miptree_functions(nv40);
nv40->draw = draw_create();
assert(nv40->draw);
diff --git a/src/mesa/pipe/nv40/nv40_context.h b/src/mesa/pipe/nv40/nv40_context.h
index 65a197ae2f..3a1d3f076c 100644
--- a/src/mesa/pipe/nv40/nv40_context.h
+++ b/src/mesa/pipe/nv40/nv40_context.h
@@ -41,7 +41,7 @@ struct nv40_context {
uint32_t dirty;
struct nv40_sampler_state *tex_sampler[PIPE_MAX_SAMPLERS];
- struct pipe_mipmap_tree *tex_miptree[PIPE_MAX_SAMPLERS];
+ struct pipe_texture *tex_miptree[PIPE_MAX_SAMPLERS];
uint32_t tex_dirty;
struct {
@@ -66,17 +66,14 @@ struct nv40_context {
};
-extern void nv40_init_region_functions(struct nv40_context *nv40);
-extern void nv40_init_surface_functions(struct nv40_context *nv40);
extern void nv40_init_state_functions(struct nv40_context *nv40);
+extern void nv40_init_surface_functions(struct nv40_context *nv40);
+extern void nv40_init_miptree_functions(struct nv40_context *nv40);
+extern void nv40_init_query_functions(struct nv40_context *nv40);
/* nv40_draw.c */
extern struct draw_stage *nv40_draw_render_stage(struct nv40_context *nv40);
-/* nv40_miptree.c */
-extern boolean nv40_miptree_layout(struct pipe_context *,
- struct pipe_mipmap_tree *);
-
/* nv40_vertprog.c */
extern void nv40_vertprog_translate(struct nv40_context *,
struct nv40_vertex_program *);
@@ -107,9 +104,4 @@ extern void nv40_vbo_arrays_update(struct nv40_context *nv40);
extern void nv40_clear(struct pipe_context *pipe, struct pipe_surface *ps,
unsigned clearValue);
-/* nv40_query.c */
-extern void nv40_query_begin(struct pipe_context *, struct pipe_query_object *);
-extern void nv40_query_end(struct pipe_context *, struct pipe_query_object *);
-extern void nv40_query_wait(struct pipe_context *, struct pipe_query_object *);
-
#endif
diff --git a/src/mesa/pipe/nv40/nv40_miptree.c b/src/mesa/pipe/nv40/nv40_miptree.c
index f5c4206f40..45711f064d 100644
--- a/src/mesa/pipe/nv40/nv40_miptree.c
+++ b/src/mesa/pipe/nv40/nv40_miptree.c
@@ -4,63 +4,105 @@
#include "nv40_context.h"
-boolean
-nv40_miptree_layout(struct pipe_context *pipe, struct pipe_mipmap_tree *mt)
+static void
+nv40_miptree_layout(struct nv40_miptree *nv40mt)
{
+ struct pipe_texture *pt = &nv40mt->base;
boolean swizzled = FALSE;
- uint width = mt->width0, height = mt->height0, depth = mt->depth0;
- uint offset;
+ uint width = pt->width[0], height = pt->height[0], depth = pt->depth[0];
+ uint offset = 0;
int nr_faces, l, f;
- mt->pitch = mt->width0;
- mt->total_height = 0;
-
- if (mt->target == PIPE_TEXTURE_CUBE) {
+ if (pt->target == PIPE_TEXTURE_CUBE) {
nr_faces = 6;
} else
- if (mt->target == PIPE_TEXTURE_3D) {
- nr_faces = mt->depth0;
+ if (pt->target == PIPE_TEXTURE_3D) {
+ nr_faces = pt->depth[0];
} else {
nr_faces = 1;
}
+
+ for (l = pt->first_level; l <= pt->last_level; l++) {
+ pt->width[l] = width;
+ pt->height[l] = height;
+ pt->depth[l] = depth;
- for (l = mt->first_level; l <= mt->last_level; l++) {
- mt->level[l].width = width;
- mt->level[l].height = height;
- mt->level[l].depth = depth;
- mt->level[l].level_offset = 0;
+ if (swizzled)
+ nv40mt->level[l].pitch = pt->width[l] * pt->cpp;
+ else
+ nv40mt->level[l].pitch = pt->width[0] * pt->cpp;
+ nv40mt->level[l].pitch = (nv40mt->level[l].pitch + 63) & ~63;
- mt->level[l].nr_images = nr_faces;
- mt->level[l].image_offset = malloc(nr_faces * sizeof(unsigned));
- for (f = 0; f < nr_faces; f++)
- mt->total_height += height;
+ 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);
+
}
- offset = 0;
for (f = 0; f < nr_faces; f++) {
- for (l = mt->first_level; l <= mt->last_level; l++) {
- if (f == 0) {
- mt->level[l].level_offset = offset;
- }
-
- uint pitch;
-
- if (swizzled)
- pitch = mt->level[l].width * mt->cpp;
- else
- pitch = mt->width0 * mt->cpp;
- pitch = (pitch + 63) & ~63;
-
- mt->level[l].image_offset[f] =
- (offset - mt->level[l].level_offset) / mt->cpp;
- offset += pitch * mt->level[l].height;
+ for (l = pt->first_level; l <= pt->last_level; l++) {
+ nv40mt->level[l].image_offset[f] = offset;
+ offset += nv40mt->level[l].pitch * pt->height[l];
+ }
+ }
+
+ nv40mt->total_size = offset;
+}
+
+static void
+nv40_miptree_create(struct pipe_context *pipe, struct pipe_texture **pt)
+{
+ struct pipe_texture *mt = *pt;
+ struct pipe_winsys *ws = pipe->winsys;
+ struct nv40_miptree *nv40mt;
+
+ *pt = NULL;
+
+ nv40mt = calloc(1, sizeof(struct nv40_miptree));
+ if (!nv40mt)
+ return;
+
+ memcpy(&nv40mt->base, mt, sizeof(struct pipe_texture));
+ nv40_miptree_layout(nv40mt);
+
+ nv40mt->buffer = ws->buffer_create(ws, PIPE_SURFACE_FLAG_TEXTURE);
+ if (!nv40mt->buffer) {
+ free(nv40mt);
+ return;
+ }
+
+ ws->buffer_data(ws, nv40mt->buffer, nv40mt->total_size, NULL,
+ PIPE_BUFFER_USAGE_PIXEL);
+ *pt = &nv40mt->base;
+}
+
+static void
+nv40_miptree_release(struct pipe_context *pipe, struct pipe_texture **pt)
+{
+ struct pipe_winsys *ws = pipe->winsys;
+ struct pipe_texture *mt = *pt;
+
+ *pt = NULL;
+ if (--mt->refcount <= 0) {
+ struct nv40_miptree *nv40mt = (struct nv40_miptree *)mt;
+ int l;
+
+ ws->buffer_reference(ws, &nv40mt->buffer, NULL);
+ for (l = 0; l < PIPE_MAX_TEXTURE_LEVELS; l++) {
+ if (nv40mt->level[l].image_offset)
+ free(nv40mt->level[l].image_offset);
}
+ free(nv40mt);
}
+}
- return TRUE;
+void
+nv40_init_miptree_functions(struct nv40_context *nv40)
+{
+ nv40->pipe.texture_create = nv40_miptree_create;
+ nv40->pipe.texture_release = nv40_miptree_release;
}
diff --git a/src/mesa/pipe/nv40/nv40_query.c b/src/mesa/pipe/nv40/nv40_query.c
index efd81e6640..bcd6fe0cf4 100644
--- a/src/mesa/pipe/nv40/nv40_query.c
+++ b/src/mesa/pipe/nv40/nv40_query.c
@@ -16,7 +16,7 @@ nv40_query_object_find(struct nv40_context *nv40, struct pipe_query_object *q)
return -1;
}
-void
+static void
nv40_query_begin(struct pipe_context *pipe, struct pipe_query_object *q)
{
struct nv40_context *nv40 = (struct nv40_context *)pipe;
@@ -53,7 +53,24 @@ nv40_query_update(struct pipe_context *pipe, struct pipe_query_object *q)
}
}
-void
+static void
+nv40_query_wait(struct pipe_context *pipe, struct pipe_query_object *q)
+{
+ nv40_query_update(pipe, q);
+ if (!q->ready) {
+ struct nv40_context *nv40 = (struct nv40_context *)pipe;
+ int id;
+
+ id = nv40_query_object_find(nv40, q);
+ assert(id >= 0);
+
+ nv40->nvws->notifier_wait(nv40->query, id, 0, 0);
+ nv40_query_update(pipe, q);
+ assert(q->ready);
+ }
+}
+
+static void
nv40_query_end(struct pipe_context *pipe, struct pipe_query_object *q)
{
struct nv40_context *nv40 = (struct nv40_context *)pipe;
@@ -80,19 +97,9 @@ nv40_query_end(struct pipe_context *pipe, struct pipe_query_object *q)
}
void
-nv40_query_wait(struct pipe_context *pipe, struct pipe_query_object *q)
+nv40_init_query_functions(struct nv40_context *nv40)
{
- nv40_query_update(pipe, q);
- if (!q->ready) {
- struct nv40_context *nv40 = (struct nv40_context *)pipe;
- int id;
-
- id = nv40_query_object_find(nv40, q);
- assert(id >= 0);
-
- nv40->nvws->notifier_wait(nv40->query, id, 0, 0);
- nv40_query_update(pipe, q);
- assert(q->ready);
- }
+ nv40->pipe.begin_query = nv40_query_begin;
+ nv40->pipe.end_query = nv40_query_end;
+ nv40->pipe.wait_query = nv40_query_wait;
}
-
diff --git a/src/mesa/pipe/nv40/nv40_region.c b/src/mesa/pipe/nv40/nv40_region.c
deleted file mode 100644
index 572b82bca3..0000000000
--- a/src/mesa/pipe/nv40/nv40_region.c
+++ /dev/null
@@ -1,85 +0,0 @@
-#include "pipe/p_defines.h"
-#include "pipe/p_winsys.h"
-
-#include "nv40_context.h"
-#include "nv40_dma.h"
-
-static ubyte *
-nv40_region_map(struct pipe_context *pipe, struct pipe_region *region)
-{
- struct nv40_context *nv40 = (struct nv40_context *)pipe;
- struct pipe_winsys *ws = nv40->pipe.winsys;
-
- if (!region->map_refcount++) {
- region->map = ws->buffer_map(ws, region->buffer,
- PIPE_BUFFER_FLAG_WRITE |
- PIPE_BUFFER_FLAG_READ);
- }
-
- return region->map;
-}
-
-static void
-nv40_region_unmap(struct pipe_context *pipe, struct pipe_region *region)
-{
- struct nv40_context *nv40 = (struct nv40_context *)pipe;
- struct pipe_winsys *ws = nv40->pipe.winsys;
-
- if (!--region->map_refcount) {
- ws->buffer_unmap(ws, region->buffer);
- region->map = NULL;
- }
-}
-
-static void
-nv40_region_data(struct pipe_context *pipe,
- struct pipe_region *dst,
- unsigned dst_offset,
- unsigned dstx, unsigned dsty,
- const void *src, unsigned src_pitch,
- unsigned srcx, unsigned srcy, unsigned width, unsigned height)
-{
- struct nv40_context *nv40 = (struct nv40_context *)pipe;
- struct nouveau_winsys *nvws = nv40->nvws;
-
- nvws->region_data(nvws, dst, dst_offset, dstx, dsty,
- src, src_pitch, srcx, srcy, width, height);
-}
-
-
-static void
-nv40_region_copy(struct pipe_context *pipe, struct pipe_region *dst,
- unsigned dst_offset, unsigned dstx, unsigned dsty,
- struct pipe_region *src, unsigned src_offset,
- unsigned srcx, unsigned srcy, unsigned width, unsigned height)
-{
- struct nv40_context *nv40 = (struct nv40_context *)pipe;
- struct nouveau_winsys *nvws = nv40->nvws;
-
- nvws->region_copy(nvws, dst, dst_offset, dstx, dsty,
- src, src_offset, srcx, srcy, width, height);
-}
-
-static void
-nv40_region_fill(struct pipe_context *pipe,
- struct pipe_region *dst, unsigned dst_offset,
- unsigned dstx, unsigned dsty,
- unsigned width, unsigned height, unsigned value)
-{
- struct nv40_context *nv40 = (struct nv40_context *)pipe;
- struct nouveau_winsys *nvws = nv40->nvws;
-
- nvws->region_fill(nvws, dst, dst_offset, dstx, dsty,
- width, height, value);
-}
-
-void
-nv40_init_region_functions(struct nv40_context *nv40)
-{
- nv40->pipe.region_map = nv40_region_map;
- nv40->pipe.region_unmap = nv40_region_unmap;
- nv40->pipe.region_data = nv40_region_data;
- nv40->pipe.region_copy = nv40_region_copy;
- nv40->pipe.region_fill = nv40_region_fill;
-}
-
diff --git a/src/mesa/pipe/nv40/nv40_state.c b/src/mesa/pipe/nv40/nv40_state.c
index 937de7face..e491579483 100644
--- a/src/mesa/pipe/nv40/nv40_state.c
+++ b/src/mesa/pipe/nv40/nv40_state.c
@@ -549,7 +549,7 @@ nv40_set_framebuffer_state(struct pipe_context *pipe,
const struct pipe_framebuffer_state *fb)
{
struct nv40_context *nv40 = (struct nv40_context *)pipe;
- struct pipe_region *region[4], *zregion;
+ struct pipe_surface *rt[4], *zeta;
uint32_t rt_enable, rt_format, w, h;
int i, colour_format = 0, zeta_format = 0;
@@ -567,7 +567,7 @@ nv40_set_framebuffer_state(struct pipe_context *pipe,
h = fb->cbufs[i]->height;
colour_format = fb->cbufs[i]->format;
rt_enable |= (NV40TCL_RT_ENABLE_COLOR0 << i);
- region[i] = fb->cbufs[i]->region;
+ rt[i] = fb->cbufs[i];
}
}
@@ -585,7 +585,7 @@ nv40_set_framebuffer_state(struct pipe_context *pipe,
}
zeta_format = fb->zbuf->format;
- zregion = fb->zbuf->region;
+ zeta = fb->zbuf;
}
if (fb->sbuf) {
@@ -599,21 +599,21 @@ nv40_set_framebuffer_state(struct pipe_context *pipe,
if (zeta_format) {
assert(fb->sbuf->format == zeta_format);
- assert(fb->sbuf->region == zregion);
+ assert(fb->sbuf == zeta);
} else {
zeta_format = fb->sbuf->format;
- zregion = fb->sbuf->region;
+ zeta = fb->sbuf;
}
}
rt_format = NV40TCL_RT_FORMAT_TYPE_LINEAR;
switch (colour_format) {
- case PIPE_FORMAT_U_A8_R8_G8_B8:
+ case PIPE_FORMAT_A8R8G8B8_UNORM:
case 0:
rt_format |= NV40TCL_RT_FORMAT_COLOR_A8R8G8B8;
break;
- case PIPE_FORMAT_U_R5_G6_B5:
+ case PIPE_FORMAT_R5G6B5_UNORM:
rt_format |= NV40TCL_RT_FORMAT_COLOR_R5G6B5;
break;
default:
@@ -621,13 +621,12 @@ nv40_set_framebuffer_state(struct pipe_context *pipe,
}
switch (zeta_format) {
- case PIPE_FORMAT_U_Z16:
+ case PIPE_FORMAT_Z16_UNORM:
rt_format |= NV40TCL_RT_FORMAT_ZETA_Z16;
break;
- case PIPE_FORMAT_Z24_S8:
- rt_format |= NV40TCL_RT_FORMAT_ZETA_Z24S8;
- break;
+ case PIPE_FORMAT_Z24S8_UNORM:
case 0:
+ rt_format |= NV40TCL_RT_FORMAT_ZETA_Z24S8;
break;
default:
assert(0);
@@ -635,51 +634,47 @@ nv40_set_framebuffer_state(struct pipe_context *pipe,
if (rt_enable & NV40TCL_RT_ENABLE_COLOR0) {
BEGIN_RING(curie, NV40TCL_DMA_COLOR0, 1);
- OUT_RELOCo(region[0]->buffer, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
+ OUT_RELOCo(rt[0]->buffer, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
BEGIN_RING(curie, NV40TCL_COLOR0_PITCH, 2);
- OUT_RING (region[0]->pitch * region[0]->cpp);
- OUT_RELOCl(region[0]->buffer, 0,
- NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
+ OUT_RING (rt[0]->pitch * rt[0]->cpp);
+ OUT_RELOCl(rt[0]->buffer, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
}
if (rt_enable & NV40TCL_RT_ENABLE_COLOR1) {
BEGIN_RING(curie, NV40TCL_DMA_COLOR1, 1);
- OUT_RELOCo(region[1]->buffer, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
+ OUT_RELOCo(rt[1]->buffer, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
BEGIN_RING(curie, NV40TCL_COLOR1_OFFSET, 2);
- OUT_RELOCl(region[1]->buffer, 0,
- NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
- OUT_RING (region[1]->pitch * region[1]->cpp);
+ OUT_RELOCl(rt[1]->buffer, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
+ OUT_RING (rt[1]->pitch * rt[1]->cpp);
}
if (rt_enable & NV40TCL_RT_ENABLE_COLOR2) {
BEGIN_RING(curie, NV40TCL_DMA_COLOR2, 1);
- OUT_RELOCo(region[2]->buffer, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
+ OUT_RELOCo(rt[2]->buffer, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
BEGIN_RING(curie, NV40TCL_COLOR2_OFFSET, 1);
- OUT_RELOCl(region[2]->buffer, 0,
- NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
+ OUT_RELOCl(rt[2]->buffer, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
BEGIN_RING(curie, NV40TCL_COLOR2_PITCH, 1);
- OUT_RING (region[2]->pitch * region[2]->cpp);
+ OUT_RING (rt[2]->pitch * rt[2]->cpp);
}
if (rt_enable & NV40TCL_RT_ENABLE_COLOR3) {
BEGIN_RING(curie, NV40TCL_DMA_COLOR3, 1);
- OUT_RELOCo(region[3]->buffer, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
+ OUT_RELOCo(rt[3]->buffer, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
BEGIN_RING(curie, NV40TCL_COLOR3_OFFSET, 1);
- OUT_RELOCl(region[3]->buffer, 0,
- NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
+ OUT_RELOCl(rt[3]->buffer, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
BEGIN_RING(curie, NV40TCL_COLOR3_PITCH, 1);
- OUT_RING (region[3]->pitch * region[3]->cpp);
+ OUT_RING (rt[3]->pitch * rt[3]->cpp);
}
if (zeta_format) {
BEGIN_RING(curie, NV40TCL_DMA_ZETA, 1);
- OUT_RELOCo(zregion->buffer,
+ OUT_RELOCo(zeta->buffer,
NOUVEAU_BO_VRAM | NOUVEAU_BO_WR | NOUVEAU_BO_RD);
BEGIN_RING(curie, NV40TCL_ZETA_OFFSET, 1);
- OUT_RELOCl(zregion->buffer, 0,
- NOUVEAU_BO_VRAM | NOUVEAU_BO_WR | NOUVEAU_BO_RD);
+ OUT_RELOCl(zeta->buffer, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR |
+ NOUVEAU_BO_RD);
BEGIN_RING(curie, NV40TCL_ZETA_PITCH, 1);
- OUT_RING (zregion->pitch * zregion->cpp);
+ OUT_RING (zeta->pitch * zeta->cpp);
}
BEGIN_RING(curie, NV40TCL_RT_ENABLE, 1);
@@ -725,7 +720,7 @@ nv40_set_scissor_state(struct pipe_context *pipe,
static void
nv40_set_texture_state(struct pipe_context *pipe, unsigned unit,
- struct pipe_mipmap_tree *miptree)
+ struct pipe_texture *miptree)
{
struct nv40_context *nv40 = (struct nv40_context *)pipe;
diff --git a/src/mesa/pipe/nv40/nv40_state.h b/src/mesa/pipe/nv40/nv40_state.h
index c6d22ceaa8..80c76cd25b 100644
--- a/src/mesa/pipe/nv40/nv40_state.h
+++ b/src/mesa/pipe/nv40/nv40_state.h
@@ -124,4 +124,16 @@ struct nv40_depth_stencil_state {
} stencil;
};
+struct nv40_miptree {
+ struct pipe_texture base;
+
+ struct pipe_buffer_handle *buffer;
+ uint total_size;
+
+ struct {
+ uint pitch;
+ uint *image_offset;
+ } level[PIPE_MAX_TEXTURE_LEVELS];
+};
+
#endif
diff --git a/src/mesa/pipe/nv40/nv40_state_tex.c b/src/mesa/pipe/nv40/nv40_state_tex.c
index 6902b41ba7..30462a2a3d 100644
--- a/src/mesa/pipe/nv40/nv40_state_tex.c
+++ b/src/mesa/pipe/nv40/nv40_state_tex.c
@@ -21,18 +21,18 @@ struct nv40_texture_format {
static struct nv40_texture_format
nv40_texture_formats[] = {
- _(U_A8_R8_G8_B8, A8R8G8B8, S1, S1, S1, S1, X, Y, Z, W),
- _(U_A1_R5_G5_B5, A1R5G5B5, S1, S1, S1, S1, X, Y, Z, W),
- _(U_A4_R4_G4_B4, A4R4G4B4, S1, S1, S1, S1, X, Y, Z, W),
- _(U_R5_G6_B5 , R5G6B5 , S1, S1, S1, ONE, X, Y, Z, W),
- _(U_L8 , L8 , S1, S1, S1, ONE, X, X, X, X),
- _(U_A8 , L8 , ZERO, ZERO, ZERO, S1, X, X, X, X),
- _(U_I8 , L8 , S1, S1, S1, S1, X, X, X, X),
- _(U_A8_L8 , A8L8 , S1, S1, S1, S1, Z, W, X, Y),
-// _(RGB_DXT1 , 0x86, S1, S1, S1, ONE, X, Y, Z, W, 0x00, 0x00),
-// _(RGBA_DXT1 , 0x86, S1, S1, S1, S1, X, Y, Z, W, 0x00, 0x00),
-// _(RGBA_DXT3 , 0x87, S1, S1, S1, S1, X, Y, Z, W, 0x00, 0x00),
-// _(RGBA_DXT5 , 0x88, S1, S1, S1, S1, X, Y, Z, W, 0x00, 0x00),
+ _(A8R8G8B8_UNORM, A8R8G8B8, S1, S1, S1, S1, X, Y, Z, W),
+ _(A1R5G5B5_UNORM, A1R5G5B5, S1, S1, S1, S1, X, Y, Z, W),
+ _(A4R4G4B4_UNORM, A4R4G4B4, S1, S1, S1, S1, X, Y, Z, W),
+ _(R5G6B5_UNORM , R5G6B5 , S1, S1, S1, ONE, X, Y, Z, W),
+ _(U_L8 , L8 , S1, S1, S1, ONE, X, X, X, X),
+ _(U_A8 , L8 , ZERO, ZERO, ZERO, S1, X, X, X, X),
+ _(U_I8 , L8 , S1, S1, S1, S1, X, X, X, X),
+ _(U_A8_L8 , A8L8 , S1, S1, S1, S1, Z, W, X, Y),
+// _(RGB_DXT1 , 0x86, S1, S1, S1, ONE, X, Y, Z, W, 0x00, 0x00),
+// _(RGBA_DXT1 , 0x86, S1, S1, S1, S1, X, Y, Z, W, 0x00, 0x00),
+// _(RGBA_DXT3 , 0x87, S1, S1, S1, S1, X, Y, Z, W, 0x00, 0x00),
+// _(RGBA_DXT5 , 0x88, S1, S1, S1, S1, X, Y, Z, W, 0x00, 0x00),
{},
};
@@ -50,30 +50,32 @@ nv40_tex_format(uint pipe_format)
return NULL;
}
+
static void
nv40_tex_unit_enable(struct nv40_context *nv40, int unit)
{
struct nv40_sampler_state *ps = nv40->tex_sampler[unit];
- struct pipe_mipmap_tree *mt = nv40->tex_miptree[unit];
+ struct pipe_texture *pt = nv40->tex_miptree[unit];
+ struct nv40_miptree *nv40mt = (struct nv40_miptree *)pt;
struct nv40_texture_format *tf;
uint32_t txf, txs, txp;
int swizzled = 0; /*XXX: implement in region code? */
- tf = nv40_tex_format(mt->format);
+ tf = nv40_tex_format(pt->format);
if (!tf || !tf->defined) {
- NOUVEAU_ERR("Unsupported texture format: 0x%x\n", mt->format);
+ NOUVEAU_ERR("Unsupported texture format: 0x%x\n", pt->format);
return;
}
txf = ps->fmt;
txf |= tf->format | 0x8000;
- txf |= ((mt->last_level - mt->first_level + 1) <<
+ txf |= ((pt->last_level - pt->first_level + 1) <<
NV40TCL_TEX_FORMAT_MIPMAP_COUNT_SHIFT);
if (1) /* XXX */
txf |= NV40TCL_TEX_FORMAT_NO_BORDER;
- switch (mt->target) {
+ switch (pt->target) {
case PIPE_TEXTURE_CUBE:
txf |= NV40TCL_TEX_FORMAT_CUBIC;
/* fall-through */
@@ -87,25 +89,25 @@ nv40_tex_unit_enable(struct nv40_context *nv40, int unit)
txf |= NV40TCL_TEX_FORMAT_DIMS_1D;
break;
default:
- NOUVEAU_ERR("Unknown target %d\n", mt->target);
+ NOUVEAU_ERR("Unknown target %d\n", pt->target);
return;
}
if (swizzled) {
txp = 0;
} else {
- txp = mt->pitch * mt->cpp;
+ txp = nv40mt->level[0].pitch;
txf |= NV40TCL_TEX_FORMAT_LINEAR;
}
txs = tf->swizzle;
- if (mt->format == PIPE_FORMAT_U_A8_L8)
+ if (pt->format == PIPE_FORMAT_U_A8_L8)
txs |= (1<<16); /*nfi*/
BEGIN_RING(curie, NV40TCL_TEX_OFFSET(unit), 8);
- OUT_RELOCl(mt->region->buffer, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_GART |
+ OUT_RELOCl(nv40mt->buffer, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_GART |
NOUVEAU_BO_RD);
- OUT_RELOCd(mt->region->buffer, txf, NOUVEAU_BO_VRAM | NOUVEAU_BO_GART |
+ OUT_RELOCd(nv40mt->buffer, txf, NOUVEAU_BO_VRAM | NOUVEAU_BO_GART |
NOUVEAU_BO_OR | NOUVEAU_BO_RD, NV40TCL_TEX_FORMAT_DMA0,
NV40TCL_TEX_FORMAT_DMA1);
OUT_RING (ps->wrap);
@@ -113,10 +115,10 @@ nv40_tex_unit_enable(struct nv40_context *nv40, int unit)
(0x00078000) /* mipmap related? */);
OUT_RING (txs);
OUT_RING (ps->filt | 0x3fd6 /*voodoo*/);
- OUT_RING ((mt->width0 << NV40TCL_TEX_SIZE0_W_SHIFT) | mt->height0);
+ OUT_RING ((pt->width[0] << NV40TCL_TEX_SIZE0_W_SHIFT) | pt->height[0]);
OUT_RING (ps->bcol);
BEGIN_RING(curie, NV40TCL_TEX_SIZE1(unit), 1);
- OUT_RING ((mt->depth0 << NV40TCL_TEX_SIZE1_DEPTH_SHIFT) | txp);
+ OUT_RING ((pt->depth[0] << NV40TCL_TEX_SIZE1_DEPTH_SHIFT) | txp);
}
void
diff --git a/src/mesa/pipe/nv40/nv40_surface.c b/src/mesa/pipe/nv40/nv40_surface.c
index 5292b5171f..b4562f26e6 100644
--- a/src/mesa/pipe/nv40/nv40_surface.c
+++ b/src/mesa/pipe/nv40/nv40_surface.c
@@ -56,15 +56,15 @@ nv40_get_tile_rgba(struct pipe_context *pipe,
uint x, uint y, uint w, uint h, float *p)
{
const unsigned *src
- = ((const unsigned *) (ps->region->map + ps->offset))
- + y * ps->region->pitch + x;
+ = ((const unsigned *) (ps->map + ps->offset))
+ + y * ps->pitch + x;
unsigned i, j;
unsigned w0 = w;
CLIP_TILE;
switch (ps->format) {
- case PIPE_FORMAT_U_A8_R8_G8_B8:
+ case PIPE_FORMAT_A8R8G8B8_UNORM:
for (i = 0; i < h; i++) {
float *pRow = p;
for (j = 0; j < w; j++) {
@@ -75,11 +75,11 @@ nv40_get_tile_rgba(struct pipe_context *pipe,
pRow[3] = UBYTE_TO_FLOAT((pixel >> 24) & 0xff);
pRow += 4;
}
- src += ps->region->pitch;
+ src += ps->pitch;
p += w0 * 4;
}
break;
- case PIPE_FORMAT_Z24_S8:
+ case PIPE_FORMAT_Z24S8_UNORM:
{
const float scale = 1.0 / (float) 0xffffff;
for (i = 0; i < h; i++) {
@@ -92,7 +92,7 @@ nv40_get_tile_rgba(struct pipe_context *pipe,
pRow[3] = ((pixel & 0xffffff) >> 8) * scale;
pRow += 4;
}
- src += ps->region->pitch;
+ src += ps->pitch;
p += w0 * 4;
}
}
@@ -122,13 +122,13 @@ nv40_get_tile(struct pipe_context *pipe,
uint x, uint y, uint w, uint h,
void *p, int dst_stride)
{
- const uint cpp = ps->region->cpp;
+ const uint cpp = ps->cpp;
const uint w0 = w;
const ubyte *pSrc;
ubyte *pDest;
uint i;
- assert(ps->region->map);
+ assert(ps->map);
CLIP_TILE;
@@ -136,13 +136,13 @@ nv40_get_tile(struct pipe_context *pipe,
dst_stride = w0 * cpp;
}
- pSrc = ps->region->map + ps->offset + (y * ps->region->pitch + x) * cpp;
+ pSrc = ps->map + ps->offset + (y * ps->pitch + x) * cpp;
pDest = (ubyte *) p;
for (i = 0; i < h; i++) {
memcpy(pDest, pSrc, w0 * cpp);
pDest += dst_stride;
- pSrc += ps->region->pitch * cpp;
+ pSrc += ps->pitch * cpp;
}
}
@@ -156,13 +156,13 @@ nv40_put_tile(struct pipe_context *pipe,
uint x, uint y, uint w, uint h,
const void *p, int src_stride)
{
- const uint cpp = ps->region->cpp;
+ const uint cpp = ps->cpp;
const uint w0 = w;
const ubyte *pSrc;
ubyte *pDest;
uint i;
- assert(ps->region->map);
+ assert(ps->map);
CLIP_TILE;
@@ -171,52 +171,81 @@ nv40_put_tile(struct pipe_context *pipe,
}
pSrc = (const ubyte *) p;
- pDest = ps->region->map + ps->offset + (y * ps->region->pitch + x) * cpp;
+ pDest = ps->map + ps->offset + (y * ps->pitch + x) * cpp;
for (i = 0; i < h; i++) {
memcpy(pDest, pSrc, w0 * cpp);
- pDest += ps->region->pitch * cpp;
+ pDest += ps->pitch * cpp;
pSrc += src_stride;
}
}
-/*
- * XXX note: same as code in sp_surface.c
- */
static struct pipe_surface *
nv40_get_tex_surface(struct pipe_context *pipe,
- struct pipe_mipmap_tree *mt,
+ struct pipe_texture *pt,
unsigned face, unsigned level, unsigned zslice)
{
- struct pipe_surface *ps;
- unsigned offset; /* in bytes */
+ struct pipe_winsys *ws = pipe->winsys;
+ struct nv40_miptree *nv40mt = (struct nv40_miptree *)pt;
+ struct pipe_surface *ps;
- offset = mt->level[level].level_offset;
+ ps = ws->surface_alloc(ws, pt->format);
+ if (!ps)
+ return NULL;
+ ws->buffer_reference(ws, &ps->buffer, nv40mt->buffer);
+ ps->cpp = pt->cpp;
+ ps->width = pt->width[level];
+ ps->height = pt->height[level];
+ ps->pitch = nv40mt->level[level].pitch / ps->cpp;
- if (mt->target == PIPE_TEXTURE_CUBE) {
- offset += mt->level[level].image_offset[face] * mt->cpp;
- }
- else if (mt->target == PIPE_TEXTURE_3D) {
- offset += mt->level[level].image_offset[zslice] * mt->cpp;
- }
- else {
- assert(face == 0);
- assert(zslice == 0);
- }
+ if (pt->target == PIPE_TEXTURE_CUBE) {
+ ps->offset = nv40mt->level[level].image_offset[face];
+ } else
+ if (pt->target == PIPE_TEXTURE_3D) {
+ ps->offset = nv40mt->level[level].image_offset[zslice];
+ } else {
+ ps->offset = nv40mt->level[level].image_offset[0];
+ }
- ps = pipe->winsys->surface_alloc(pipe->winsys, mt->format);
- if (ps) {
- assert(ps->format);
- assert(ps->refcount);
- pipe_region_reference(&ps->region, mt->region);
- ps->width = mt->level[level].width;
- ps->height = mt->level[level].height;
- ps->offset = offset;
- }
- return ps;
+ return ps;
}
+static void
+nv40_surface_data(struct pipe_context *pipe, struct pipe_surface *dest,
+ unsigned destx, unsigned desty, const void *src,
+ unsigned src_stride, unsigned srcx, unsigned srcy,
+ unsigned width, unsigned height)
+{
+ struct nv40_context *nv40 = (struct nv40_context *)pipe;
+ struct nouveau_winsys *nvws = nv40->nvws;
+
+ nvws->surface_data(nvws, dest, destx, desty, src, src_stride,
+ srcx, srcy, width, height);
+}
+
+static void
+nv40_surface_copy(struct pipe_context *pipe, struct pipe_surface *dest,
+ unsigned destx, unsigned desty, struct pipe_surface *src,
+ unsigned srcx, unsigned srcy, unsigned width, unsigned height)
+{
+ struct nv40_context *nv40 = (struct nv40_context *)pipe;
+ struct nouveau_winsys *nvws = nv40->nvws;
+
+ nvws->surface_copy(nvws, dest, destx, desty, src, srcx, srcy,
+ width, height);
+}
+
+static void
+nv40_surface_fill(struct pipe_context *pipe, struct pipe_surface *dest,
+ unsigned destx, unsigned desty, unsigned width,
+ unsigned height, unsigned value)
+{
+ struct nv40_context *nv40 = (struct nv40_context *)pipe;
+ struct nouveau_winsys *nvws = nv40->nvws;
+
+ nvws->surface_fill(nvws, dest, destx, desty, width, height, value);
+}
void
nv40_init_surface_functions(struct nv40_context *nv40)
@@ -226,4 +255,7 @@ nv40_init_surface_functions(struct nv40_context *nv40)
nv40->pipe.put_tile = nv40_put_tile;
nv40->pipe.get_tile_rgba = nv40_get_tile_rgba;
nv40->pipe.put_tile_rgba = nv40_put_tile_rgba;
+ nv40->pipe.surface_data = nv40_surface_data;
+ nv40->pipe.surface_copy = nv40_surface_copy;
+ nv40->pipe.surface_fill = nv40_surface_fill;
}
diff --git a/src/mesa/pipe/nv50/Makefile b/src/mesa/pipe/nv50/Makefile
index af3fa0e7ec..d3d011b14b 100644
--- a/src/mesa/pipe/nv50/Makefile
+++ b/src/mesa/pipe/nv50/Makefile
@@ -9,7 +9,6 @@ DRIVER_SOURCES = \
nv50_draw.c \
nv50_miptree.c \
nv50_query.c \
- nv50_region.c \
nv50_state.c \
nv50_surface.c \
nv50_vbo.c
diff --git a/src/mesa/pipe/nv50/nv50_clear.c b/src/mesa/pipe/nv50/nv50_clear.c
index 85af1af78d..2b453a49d1 100644
--- a/src/mesa/pipe/nv50/nv50_clear.c
+++ b/src/mesa/pipe/nv50/nv50_clear.c
@@ -10,6 +10,5 @@ void
nv50_clear(struct pipe_context *pipe, struct pipe_surface *ps,
unsigned clearValue)
{
- pipe->region_fill(pipe, ps->region, 0, 0, 0, ps->width, ps->height,
- clearValue);
+ pipe->surface_fill(pipe, ps, 0, 0, ps->width, ps->height, clearValue);
}
diff --git a/src/mesa/pipe/nv50/nv50_context.c b/src/mesa/pipe/nv50/nv50_context.c
index 6fceb13174..25ead1b564 100644
--- a/src/mesa/pipe/nv50/nv50_context.c
+++ b/src/mesa/pipe/nv50/nv50_context.c
@@ -10,8 +10,8 @@ static boolean
nv50_is_format_supported(struct pipe_context *pipe, uint format)
{
switch (format) {
- case PIPE_FORMAT_U_A8_R8_G8_B8:
- case PIPE_FORMAT_Z24_S8:
+ case PIPE_FORMAT_A8R8G8B8_UNORM:
+ case PIPE_FORMAT_Z24S8_UNORM:
return TRUE;
default:
break;
@@ -193,17 +193,12 @@ nv50_create(struct pipe_winsys *pipe_winsys, struct nouveau_winsys *nvws,
nv50->pipe.draw_elements = nv50_draw_elements;
nv50->pipe.clear = nv50_clear;
- nv50->pipe.begin_query = nv50_query_begin;
- nv50->pipe.end_query = nv50_query_end;
- nv50->pipe.wait_query = nv50_query_wait;
-
- nv50->pipe.mipmap_tree_layout = nv50_miptree_layout;
-
nv50->pipe.flush = nv50_flush;
- nv50_init_region_functions(nv50);
+ nv50_init_miptree_functions(nv50);
nv50_init_surface_functions(nv50);
nv50_init_state_functions(nv50);
+ nv50_init_query_functions(nv50);
nv50->draw = draw_create();
assert(nv50->draw);
diff --git a/src/mesa/pipe/nv50/nv50_context.h b/src/mesa/pipe/nv50/nv50_context.h
index f7fa48553d..5be4e5cb1b 100644
--- a/src/mesa/pipe/nv50/nv50_context.h
+++ b/src/mesa/pipe/nv50/nv50_context.h
@@ -30,16 +30,14 @@ struct nv50_context {
};
-extern void nv50_init_region_functions(struct nv50_context *nv50);
+extern void nv50_init_miptree_functions(struct nv50_context *nv50);
extern void nv50_init_surface_functions(struct nv50_context *nv50);
extern void nv50_init_state_functions(struct nv50_context *nv50);
+extern void nv50_init_query_functions(struct nv50_context *nv50);
/* nv50_draw.c */
extern struct draw_stage *nv50_draw_render_stage(struct nv50_context *nv50);
-/* nv50_miptree.c */
-extern boolean nv50_miptree_layout(struct pipe_context *,
- struct pipe_mipmap_tree *);
/* nv50_vbo.c */
extern boolean nv50_draw_arrays(struct pipe_context *, unsigned mode,
unsigned start, unsigned count);
@@ -53,10 +51,4 @@ extern boolean nv50_draw_elements(struct pipe_context *pipe,
extern void nv50_clear(struct pipe_context *pipe, struct pipe_surface *ps,
unsigned clearValue);
-/* nv50_query.c */
-extern void nv50_query_begin(struct pipe_context *, struct pipe_query_object *);
-extern void nv50_query_end(struct pipe_context *, struct pipe_query_object *);
-extern void nv50_query_wait(struct pipe_context *, struct pipe_query_object *);
-
-
#endif
diff --git a/src/mesa/pipe/nv50/nv50_miptree.c b/src/mesa/pipe/nv50/nv50_miptree.c
index cf0e530f31..51442d64f3 100644
--- a/src/mesa/pipe/nv50/nv50_miptree.c
+++ b/src/mesa/pipe/nv50/nv50_miptree.c
@@ -4,10 +4,21 @@
#include "nv50_context.h"
-boolean
-nv50_miptree_layout(struct pipe_context *pipe, struct pipe_mipmap_tree *mt)
+static void
+nv50_miptree_create(struct pipe_context *pipe, struct pipe_texture **pt)
{
NOUVEAU_ERR("unimplemented\n");
- return TRUE;
}
+static void
+nv50_miptree_release(struct pipe_context *pipe, struct pipe_texture **pt)
+{
+ NOUVEAU_ERR("unimplemented\n");
+}
+
+void
+nv50_init_miptree_functions(struct nv50_context *nv50)
+{
+ nv50->pipe.texture_create = nv50_miptree_create;
+ nv50->pipe.texture_release = nv50_miptree_release;
+}
diff --git a/src/mesa/pipe/nv50/nv50_query.c b/src/mesa/pipe/nv50/nv50_query.c
index 1ce48943b9..51cf6804d7 100644
--- a/src/mesa/pipe/nv50/nv50_query.c
+++ b/src/mesa/pipe/nv50/nv50_query.c
@@ -3,21 +3,28 @@
#include "nv50_context.h"
#include "nv50_dma.h"
-void
+static void
nv50_query_begin(struct pipe_context *pipe, struct pipe_query_object *q)
{
NOUVEAU_ERR("unimplemented\n");
}
-void
+static void
nv50_query_end(struct pipe_context *pipe, struct pipe_query_object *q)
{
NOUVEAU_ERR("unimplemented\n");
}
-void
+static void
nv50_query_wait(struct pipe_context *pipe, struct pipe_query_object *q)
{
NOUVEAU_ERR("unimplemented\n");
}
+void
+nv50_init_query_functions(struct nv50_context *nv50)
+{
+ nv50->pipe.begin_query = nv50_query_begin;
+ nv50->pipe.end_query = nv50_query_end;
+ nv50->pipe.wait_query = nv50_query_wait;
+}
diff --git a/src/mesa/pipe/nv50/nv50_region.c b/src/mesa/pipe/nv50/nv50_region.c
deleted file mode 100644
index d5a071c8b2..0000000000
--- a/src/mesa/pipe/nv50/nv50_region.c
+++ /dev/null
@@ -1,85 +0,0 @@
-#include "pipe/p_defines.h"
-#include "pipe/p_winsys.h"
-
-#include "nv50_context.h"
-#include "nv50_dma.h"
-
-static ubyte *
-nv50_region_map(struct pipe_context *pipe, struct pipe_region *region)
-{
- struct nv50_context *nv50 = (struct nv50_context *)pipe;
- struct pipe_winsys *ws = nv50->pipe.winsys;
-
- if (!region->map_refcount++) {
- region->map = ws->buffer_map(ws, region->buffer,
- PIPE_BUFFER_FLAG_WRITE |
- PIPE_BUFFER_FLAG_READ);
- }
-
- return region->map;
-}
-
-static void
-nv50_region_unmap(struct pipe_context *pipe, struct pipe_region *region)
-{
- struct nv50_context *nv50 = (struct nv50_context *)pipe;
- struct pipe_winsys *ws = nv50->pipe.winsys;
-
- if (!--region->map_refcount) {
- ws->buffer_unmap(ws, region->buffer);
- region->map = NULL;
- }
-}
-
-static void
-nv50_region_data(struct pipe_context *pipe,
- struct pipe_region *dst,
- unsigned dst_offset,
- unsigned dstx, unsigned dsty,
- const void *src, unsigned src_pitch,
- unsigned srcx, unsigned srcy, unsigned width, unsigned height)
-{
- struct nv50_context *nv50 = (struct nv50_context *)pipe;
- struct nouveau_winsys *nvws = nv50->nvws;
-
- nvws->region_data(nvws, dst, dst_offset, dstx, dsty,
- src, src_pitch, srcx, srcy, width, height);
-}
-
-
-static void
-nv50_region_copy(struct pipe_context *pipe, struct pipe_region *dst,
- unsigned dst_offset, unsigned dstx, unsigned dsty,
- struct pipe_region *src, unsigned src_offset,
- unsigned srcx, unsigned srcy, unsigned width, unsigned height)
-{
- struct nv50_context *nv50 = (struct nv50_context *)pipe;
- struct nouveau_winsys *nvws = nv50->nvws;
-
- nvws->region_copy(nvws, dst, dst_offset, dstx, dsty,
- src, src_offset, srcx, srcy, width, height);
-}
-
-static void
-nv50_region_fill(struct pipe_context *pipe,
- struct pipe_region *dst, unsigned dst_offset,
- unsigned dstx, unsigned dsty,
- unsigned width, unsigned height, unsigned value)
-{
- struct nv50_context *nv50 = (struct nv50_context *)pipe;
- struct nouveau_winsys *nvws = nv50->nvws;
-
- nvws->region_fill(nvws, dst, dst_offset, dstx, dsty,
- width, height, value);
-}
-
-void
-nv50_init_region_functions(struct nv50_context *nv50)
-{
- nv50->pipe.region_map = nv50_region_map;
- nv50->pipe.region_unmap = nv50_region_unmap;
- nv50->pipe.region_data = nv50_region_data;
- nv50->pipe.region_copy = nv50_region_copy;
- nv50->pipe.region_fill = nv50_region_fill;
-}
-
diff --git a/src/mesa/pipe/nv50/nv50_state.c b/src/mesa/pipe/nv50/nv50_state.c
index 0674c30dc8..778b9f5c9a 100644
--- a/src/mesa/pipe/nv50/nv50_state.c
+++ b/src/mesa/pipe/nv50/nv50_state.c
@@ -169,7 +169,7 @@ nv50_set_scissor_state(struct pipe_context *pipe,
static void
nv50_set_texture_state(struct pipe_context *pipe, unsigned unit,
- struct pipe_mipmap_tree *miptree)
+ struct pipe_texture *pt)
{
}
diff --git a/src/mesa/pipe/nv50/nv50_surface.c b/src/mesa/pipe/nv50/nv50_surface.c
index 68013c0c1d..7e294cdfdf 100644
--- a/src/mesa/pipe/nv50/nv50_surface.c
+++ b/src/mesa/pipe/nv50/nv50_surface.c
@@ -56,15 +56,15 @@ nv50_get_tile_rgba(struct pipe_context *pipe,
uint x, uint y, uint w, uint h, float *p)
{
const unsigned *src
- = ((const unsigned *) (ps->region->map + ps->offset))
- + y * ps->region->pitch + x;
+ = ((const unsigned *) (ps->map + ps->offset))
+ + y * ps->pitch + x;
unsigned i, j;
unsigned w0 = w;
CLIP_TILE;
switch (ps->format) {
- case PIPE_FORMAT_U_A8_R8_G8_B8:
+ case PIPE_FORMAT_A8R8G8B8_UNORM:
for (i = 0; i < h; i++) {
float *pRow = p;
for (j = 0; j < w; j++) {
@@ -75,11 +75,11 @@ nv50_get_tile_rgba(struct pipe_context *pipe,
pRow[3] = UBYTE_TO_FLOAT((pixel >> 24) & 0xff);
pRow += 4;
}
- src += ps->region->pitch;
+ src += ps->pitch;
p += w0 * 4;
}
break;
- case PIPE_FORMAT_Z24_S8:
+ case PIPE_FORMAT_Z24S8_UNORM:
{
const float scale = 1.0 / (float) 0xffffff;
for (i = 0; i < h; i++) {
@@ -92,7 +92,7 @@ nv50_get_tile_rgba(struct pipe_context *pipe,
pRow[3] = ((pixel & 0xffffff) >> 8) * scale;
pRow += 4;
}
- src += ps->region->pitch;
+ src += ps->pitch;
p += w0 * 4;
}
}
@@ -122,13 +122,13 @@ nv50_get_tile(struct pipe_context *pipe,
uint x, uint y, uint w, uint h,
void *p, int dst_stride)
{
- const uint cpp = ps->region->cpp;
+ const uint cpp = ps->cpp;
const uint w0 = w;
const ubyte *pSrc;
ubyte *pDest;
uint i;
- assert(ps->region->map);
+ assert(ps->map);
CLIP_TILE;
@@ -136,13 +136,13 @@ nv50_get_tile(struct pipe_context *pipe,
dst_stride = w0 * cpp;
}
- pSrc = ps->region->map + ps->offset + (y * ps->region->pitch + x) * cpp;
+ pSrc = ps->map + ps->offset + (y * ps->pitch + x) * cpp;
pDest = (ubyte *) p;
for (i = 0; i < h; i++) {
memcpy(pDest, pSrc, w0 * cpp);
pDest += dst_stride;
- pSrc += ps->region->pitch * cpp;
+ pSrc += ps->pitch * cpp;
}
}
@@ -156,13 +156,13 @@ nv50_put_tile(struct pipe_context *pipe,
uint x, uint y, uint w, uint h,
const void *p, int src_stride)
{
- const uint cpp = ps->region->cpp;
+ const uint cpp = ps->cpp;
const uint w0 = w;
const ubyte *pSrc;
ubyte *pDest;
uint i;
- assert(ps->region->map);
+ assert(ps->map);
CLIP_TILE;
@@ -171,52 +171,60 @@ nv50_put_tile(struct pipe_context *pipe,
}
pSrc = (const ubyte *) p;
- pDest = ps->region->map + ps->offset + (y * ps->region->pitch + x) * cpp;
+ pDest = ps->map + ps->offset + (y * ps->pitch + x) * cpp;
for (i = 0; i < h; i++) {
memcpy(pDest, pSrc, w0 * cpp);
- pDest += ps->region->pitch * cpp;
+ pDest += ps->pitch * cpp;
pSrc += src_stride;
}
}
-/*
- * XXX note: same as code in sp_surface.c
- */
static struct pipe_surface *
nv50_get_tex_surface(struct pipe_context *pipe,
- struct pipe_mipmap_tree *mt,
+ struct pipe_texture *pt,
unsigned face, unsigned level, unsigned zslice)
{
- struct pipe_surface *ps;
- unsigned offset; /* in bytes */
+ NOUVEAU_ERR("unimplemented\n");
+ return NULL;
+}
- offset = mt->level[level].level_offset;
+static void
+nv50_surface_data(struct pipe_context *pipe, struct pipe_surface *dest,
+ unsigned destx, unsigned desty, const void *src,
+ unsigned src_stride, unsigned srcx, unsigned srcy,
+ unsigned width, unsigned height)
+{
+ struct nv50_context *nv50 = (struct nv50_context *)pipe;
+ struct nouveau_winsys *nvws = nv50->nvws;
- if (mt->target == PIPE_TEXTURE_CUBE) {
- offset += mt->level[level].image_offset[face] * mt->cpp;
- }
- else if (mt->target == PIPE_TEXTURE_3D) {
- offset += mt->level[level].image_offset[zslice] * mt->cpp;
- }
- else {
- assert(face == 0);
- assert(zslice == 0);
- }
+ nvws->surface_data(nvws, dest, destx, desty, src, src_stride,
+ srcx, srcy, width, height);
+}
- ps = pipe->winsys->surface_alloc(pipe->winsys, mt->format);
- if (ps) {
- assert(ps->format);
- assert(ps->refcount);
- pipe_region_reference(&ps->region, mt->region);
- ps->width = mt->level[level].width;
- ps->height = mt->level[level].height;
- ps->offset = offset;
- }
- return ps;
+static void
+nv50_surface_copy(struct pipe_context *pipe, struct pipe_surface *dest,
+ unsigned destx, unsigned desty, struct pipe_surface *src,
+ unsigned srcx, unsigned srcy, unsigned width, unsigned height)
+{
+ struct nv50_context *nv50 = (struct nv50_context *)pipe;
+ struct nouveau_winsys *nvws = nv50->nvws;
+
+ nvws->surface_copy(nvws, dest, destx, desty, src, srcx, srcy,
+ width, height);
}
+static void
+nv50_surface_fill(struct pipe_context *pipe, struct pipe_surface *dest,
+ unsigned destx, unsigned desty, unsigned width,
+ unsigned height, unsigned value)
+{
+ struct nv50_context *nv50 = (struct nv50_context *)pipe;
+ struct nouveau_winsys *nvws = nv50->nvws;
+
+ nvws->surface_fill(nvws, dest, destx, desty, width, height, value);
+}
void
nv50_init_surface_functions(struct nv50_context *nv50)
@@ -226,4 +234,7 @@ nv50_init_surface_functions(struct nv50_context *nv50)
nv50->pipe.put_tile = nv50_put_tile;
nv50->pipe.get_tile_rgba = nv50_get_tile_rgba;
nv50->pipe.put_tile_rgba = nv50_put_tile_rgba;
+ nv50->pipe.surface_data = nv50_surface_data;
+ nv50->pipe.surface_copy = nv50_surface_copy;
+ nv50->pipe.surface_fill = nv50_surface_fill;
}