summaryrefslogtreecommitdiff
path: root/src/mesa/pipe/nv50
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/pipe/nv50')
-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
9 files changed, 84 insertions, 155 deletions
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;
}