summaryrefslogtreecommitdiff
path: root/src/mesa/pipe/nv40
diff options
context:
space:
mode:
authorBen Skeggs <skeggsb@gmail.com>2008-01-28 18:32:46 +1100
committerBen Skeggs <skeggsb@gmail.com>2008-01-28 18:32:46 +1100
commit3e39bc3d87a82d81ffaf383303ada32e530b879e (patch)
tree530249743415875917c0ebbf53eaf92d7901bd2d /src/mesa/pipe/nv40
parenta556034514582dc8e1b8b65f56020031d513331b (diff)
nouveau: quicky-port to gallium changes
Diffstat (limited to 'src/mesa/pipe/nv40')
-rw-r--r--src/mesa/pipe/nv40/nv40_context.h14
-rw-r--r--src/mesa/pipe/nv40/nv40_draw.c18
-rw-r--r--src/mesa/pipe/nv40/nv40_fragprog.c10
-rw-r--r--src/mesa/pipe/nv40/nv40_miptree.c8
-rw-r--r--src/mesa/pipe/nv40/nv40_state.c32
-rw-r--r--src/mesa/pipe/nv40/nv40_state.h4
-rw-r--r--src/mesa/pipe/nv40/nv40_surface.c18
-rw-r--r--src/mesa/pipe/nv40/nv40_vbo.c12
-rw-r--r--src/mesa/pipe/nv40/nv40_vertprog.c2
9 files changed, 38 insertions, 80 deletions
diff --git a/src/mesa/pipe/nv40/nv40_context.h b/src/mesa/pipe/nv40/nv40_context.h
index df8489f3a6..2d069619d7 100644
--- a/src/mesa/pipe/nv40/nv40_context.h
+++ b/src/mesa/pipe/nv40/nv40_context.h
@@ -48,17 +48,17 @@ struct nv40_context {
unsigned vp_samplers;
uint32_t rt_enable;
- struct pipe_buffer_handle *rt[4];
- struct pipe_buffer_handle *zeta;
+ struct pipe_buffer *rt[4];
+ struct pipe_buffer *zeta;
struct {
- struct pipe_buffer_handle *buffer;
+ struct pipe_buffer *buffer;
uint32_t format;
} tex[16];
unsigned vb_enable;
struct {
- struct pipe_buffer_handle *buffer;
+ struct pipe_buffer *buffer;
unsigned delta;
} vb[16];
@@ -69,14 +69,14 @@ struct nv40_context {
struct nv40_vertex_program *active;
struct nv40_vertex_program *current;
- struct pipe_buffer_handle *constant_buf;
+ struct pipe_buffer *constant_buf;
} vertprog;
struct {
struct nv40_fragment_program *active;
struct nv40_fragment_program *current;
- struct pipe_buffer_handle *constant_buf;
+ struct pipe_buffer *constant_buf;
} fragprog;
struct pipe_vertex_buffer vtxbuf[PIPE_ATTRIB_MAX];
@@ -124,7 +124,7 @@ extern void nv40_state_tex_update(struct nv40_context *nv40);
extern boolean nv40_draw_arrays(struct pipe_context *, unsigned mode,
unsigned start, unsigned count);
extern boolean nv40_draw_elements(struct pipe_context *pipe,
- struct pipe_buffer_handle *indexBuffer,
+ struct pipe_buffer *indexBuffer,
unsigned indexSize,
unsigned mode, unsigned start,
unsigned count);
diff --git a/src/mesa/pipe/nv40/nv40_draw.c b/src/mesa/pipe/nv40/nv40_draw.c
index 6ad2b66cce..d361d5f07d 100644
--- a/src/mesa/pipe/nv40/nv40_draw.c
+++ b/src/mesa/pipe/nv40/nv40_draw.c
@@ -9,33 +9,26 @@ struct nv40_draw_stage {
};
static void
-nv40_draw_begin(struct draw_stage *draw)
-{
- NOUVEAU_ERR("\n");
-}
-
-static void
-nv40_draw_end(struct draw_stage *draw)
+nv40_draw_point(struct draw_stage *draw, struct prim_header *prim)
{
NOUVEAU_ERR("\n");
}
static void
-nv40_draw_point(struct draw_stage *draw, struct prim_header *prim)
+nv40_draw_line(struct draw_stage *draw, struct prim_header *prim)
{
NOUVEAU_ERR("\n");
}
static void
-nv40_draw_line(struct draw_stage *draw, struct prim_header *prim)
+nv40_draw_tri(struct draw_stage *draw, struct prim_header *prim)
{
NOUVEAU_ERR("\n");
}
static void
-nv40_draw_tri(struct draw_stage *draw, struct prim_header *prim)
+nv40_draw_flush(struct draw_stage *draw, unsigned flags)
{
- NOUVEAU_ERR("\n");
}
static void
@@ -57,11 +50,10 @@ nv40_draw_render_stage(struct nv40_context *nv40)
nv40draw->nv40 = nv40;
nv40draw->draw.draw = nv40->draw;
- nv40draw->draw.begin = nv40_draw_begin;
nv40draw->draw.point = nv40_draw_point;
nv40draw->draw.line = nv40_draw_line;
nv40draw->draw.tri = nv40_draw_tri;
- nv40draw->draw.end = nv40_draw_end;
+ nv40draw->draw.flush = nv40_draw_flush;
nv40draw->draw.reset_stipple_counter = nv40_draw_reset_stipple_counter;
nv40draw->draw.destroy = nv40_draw_destroy;
diff --git a/src/mesa/pipe/nv40/nv40_fragprog.c b/src/mesa/pipe/nv40/nv40_fragprog.c
index fded11d170..714634396d 100644
--- a/src/mesa/pipe/nv40/nv40_fragprog.c
+++ b/src/mesa/pipe/nv40/nv40_fragprog.c
@@ -769,7 +769,7 @@ nv40_fragprog_bind(struct nv40_context *nv40, struct nv40_fragment_program *fp)
if (fp->nr_consts) {
float *map = ws->buffer_map(ws, nv40->fragprog.constant_buf,
- PIPE_BUFFER_FLAG_READ);
+ PIPE_BUFFER_USAGE_CPU_READ);
for (i = 0; i < fp->nr_consts; i++) {
struct nv40_fragment_program_data *fpd = &fp->consts[i];
uint32_t *p = &fp->insn[fpd->offset];
@@ -788,10 +788,10 @@ nv40_fragprog_bind(struct nv40_context *nv40, struct nv40_fragment_program *fp)
uint32_t *map;
if (!fp->buffer)
- fp->buffer = ws->buffer_create(ws, 0x100, 0, 0);
- ws->buffer_data(ws, fp->buffer, fp->insn_len * 4, NULL, 0);
-
- map = ws->buffer_map(ws, fp->buffer, PIPE_BUFFER_FLAG_WRITE);
+ fp->buffer = ws->buffer_create(ws, 0x100, 0,
+ fp->insn_len * 4);
+ map = ws->buffer_map(ws, fp->buffer,
+ PIPE_BUFFER_USAGE_CPU_WRITE);
#if 0
for (i = 0; i < fp->insn_len; i++) {
diff --git a/src/mesa/pipe/nv40/nv40_miptree.c b/src/mesa/pipe/nv40/nv40_miptree.c
index 625c2fc32d..48062d1ae8 100644
--- a/src/mesa/pipe/nv40/nv40_miptree.c
+++ b/src/mesa/pipe/nv40/nv40_miptree.c
@@ -1,6 +1,7 @@
#include "pipe/p_state.h"
#include "pipe/p_defines.h"
#include "pipe/p_util.h"
+#include "pipe/p_inlines.h"
#include "nv40_context.h"
@@ -65,14 +66,13 @@ nv40_miptree_create(struct pipe_context *pipe, struct pipe_texture **pt)
nv40_miptree_layout(nv40mt);
- nv40mt->buffer = ws->buffer_create(ws, 256, 0, 0);
+ nv40mt->buffer = ws->buffer_create(ws, 256, PIPE_BUFFER_USAGE_PIXEL,
+ nv40mt->total_size);
if (!nv40mt->buffer) {
free(nv40mt);
return;
}
- ws->buffer_data(ws, nv40mt->buffer, nv40mt->total_size, NULL,
- PIPE_BUFFER_USAGE_PIXEL);
*pt = &nv40mt->base;
}
@@ -87,7 +87,7 @@ nv40_miptree_release(struct pipe_context *pipe, struct pipe_texture **pt)
struct nv40_miptree *nv40mt = (struct nv40_miptree *)mt;
int l;
- ws->buffer_reference(ws, &nv40mt->buffer, NULL);
+ pipe_buffer_reference(ws, &nv40mt->buffer, NULL);
for (l = mt->first_level; l <= mt->last_level; l++) {
if (nv40mt->level[l].image_offset)
free(nv40mt->level[l].image_offset);
diff --git a/src/mesa/pipe/nv40/nv40_state.c b/src/mesa/pipe/nv40/nv40_state.c
index 03a9e735c0..c619948b55 100644
--- a/src/mesa/pipe/nv40/nv40_state.c
+++ b/src/mesa/pipe/nv40/nv40_state.c
@@ -563,35 +563,17 @@ nv40_set_framebuffer_state(struct pipe_context *pipe,
NV40TCL_RT_ENABLE_COLOR3))
rt_enable |= NV40TCL_RT_ENABLE_MRT;
- if (fb->zbuf) {
+ if (fb->zsbuf) {
if (colour_format) {
- assert(w == fb->zbuf->width);
- assert(h == fb->zbuf->height);
+ assert(w == fb->zsbuf->width);
+ assert(h == fb->zsbuf->height);
} else {
- w = fb->zbuf->width;
- h = fb->zbuf->height;
+ w = fb->zsbuf->width;
+ h = fb->zsbuf->height;
}
- zeta_format = fb->zbuf->format;
- zeta = fb->zbuf;
- }
-
- if (fb->sbuf) {
- if (colour_format) {
- assert(w == fb->sbuf->width);
- assert(h == fb->sbuf->height);
- } else {
- w = fb->zbuf->width;
- h = fb->zbuf->height;
- }
-
- if (zeta_format) {
- assert(fb->sbuf->format == zeta_format);
- assert(fb->sbuf == zeta);
- } else {
- zeta_format = fb->sbuf->format;
- zeta = fb->sbuf;
- }
+ zeta_format = fb->zsbuf->format;
+ zeta = fb->zsbuf;
}
rt_format = NV40TCL_RT_FORMAT_TYPE_LINEAR;
diff --git a/src/mesa/pipe/nv40/nv40_state.h b/src/mesa/pipe/nv40/nv40_state.h
index 4c4c847c9a..24eea36db3 100644
--- a/src/mesa/pipe/nv40/nv40_state.h
+++ b/src/mesa/pipe/nv40/nv40_state.h
@@ -96,7 +96,7 @@ struct nv40_fragment_program {
struct nv40_fragment_program_data *consts;
unsigned nr_consts;
- struct pipe_buffer_handle *buffer;
+ struct pipe_buffer *buffer;
uint32_t fp_control;
};
@@ -134,7 +134,7 @@ struct nv40_depth_stencil_alpha_state {
struct nv40_miptree {
struct pipe_texture base;
- struct pipe_buffer_handle *buffer;
+ struct pipe_buffer *buffer;
uint total_size;
struct {
diff --git a/src/mesa/pipe/nv40/nv40_surface.c b/src/mesa/pipe/nv40/nv40_surface.c
index 159837388f..d8f87d9adc 100644
--- a/src/mesa/pipe/nv40/nv40_surface.c
+++ b/src/mesa/pipe/nv40/nv40_surface.c
@@ -84,7 +84,7 @@ nv40_get_tex_surface(struct pipe_context *pipe, struct pipe_texture *pt,
ps = ws->surface_alloc(ws);
if (!ps)
return NULL;
- ws->buffer_reference(ws, &ps->buffer, nv40mt->buffer);
+ pipe_buffer_reference(ws, &ps->buffer, nv40mt->buffer);
ps->format = pt->format;
ps->cpp = pt->cpp;
ps->width = pt->width[level];
@@ -104,19 +104,6 @@ nv40_get_tex_surface(struct pipe_context *pipe, struct pipe_texture *pt,
}
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 = 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)
@@ -144,9 +131,6 @@ nv40_init_surface_functions(struct nv40_context *nv40)
{
nv40->pipe.is_format_supported = nv40_surface_format_supported;
nv40->pipe.get_tex_surface = nv40_get_tex_surface;
- nv40->pipe.get_tile = pipe_get_tile_raw;
- nv40->pipe.put_tile = pipe_put_tile_raw;
- 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/nv40/nv40_vbo.c b/src/mesa/pipe/nv40/nv40_vbo.c
index 3de87ecab5..3fa8ddcb81 100644
--- a/src/mesa/pipe/nv40/nv40_vbo.c
+++ b/src/mesa/pipe/nv40/nv40_vbo.c
@@ -46,7 +46,7 @@ nv40_vbo_static_attrib(struct nv40_context *nv40, int attrib,
type = nv40_vbo_type(ve->src_format);
ncomp = nv40_vbo_ncomp(ve->src_format);
- map = ws->buffer_map(ws, vb->buffer, PIPE_BUFFER_FLAG_READ);
+ map = ws->buffer_map(ws, vb->buffer, PIPE_BUFFER_USAGE_CPU_READ);
map += vb->buffer_offset + ve->src_offset;
switch (type) {
@@ -149,7 +149,7 @@ nv40_vbo_arrays_update(struct nv40_context *nv40)
static boolean
nv40_vbo_validate_state(struct nv40_context *nv40,
- struct pipe_buffer_handle *ib, unsigned ib_format)
+ struct pipe_buffer *ib, unsigned ib_format)
{
unsigned inputs;
@@ -297,7 +297,7 @@ nv40_draw_elements_u32(struct nv40_context *nv40, void *ib,
static boolean
nv40_draw_elements_inline(struct pipe_context *pipe,
- struct pipe_buffer_handle *ib, unsigned ib_size,
+ struct pipe_buffer *ib, unsigned ib_size,
unsigned mode, unsigned start, unsigned count)
{
struct nv40_context *nv40 = nv40_context(pipe);
@@ -306,7 +306,7 @@ nv40_draw_elements_inline(struct pipe_context *pipe,
assert(nv40_vbo_validate_state(nv40, NULL, 0));
- map = ws->buffer_map(ws, ib, PIPE_BUFFER_FLAG_READ);
+ map = ws->buffer_map(ws, ib, PIPE_BUFFER_USAGE_CPU_READ);
if (!ib)
assert(0);
@@ -338,7 +338,7 @@ nv40_draw_elements_inline(struct pipe_context *pipe,
static boolean
nv40_draw_elements_vbo(struct pipe_context *pipe,
- struct pipe_buffer_handle *ib, unsigned ib_size,
+ struct pipe_buffer *ib, unsigned ib_size,
unsigned mode, unsigned start, unsigned count)
{
struct nv40_context *nv40 = nv40_context(pipe);
@@ -388,7 +388,7 @@ nv40_draw_elements_vbo(struct pipe_context *pipe,
boolean
nv40_draw_elements(struct pipe_context *pipe,
- struct pipe_buffer_handle *indexBuffer, unsigned indexSize,
+ struct pipe_buffer *indexBuffer, unsigned indexSize,
unsigned mode, unsigned start, unsigned count)
{
if (indexSize != 1) {
diff --git a/src/mesa/pipe/nv40/nv40_vertprog.c b/src/mesa/pipe/nv40/nv40_vertprog.c
index bd052fe834..e15ddbbcde 100644
--- a/src/mesa/pipe/nv40/nv40_vertprog.c
+++ b/src/mesa/pipe/nv40/nv40_vertprog.c
@@ -727,7 +727,7 @@ nv40_vertprog_bind(struct nv40_context *nv40, struct nv40_vertex_program *vp)
if (nv40->vertprog.constant_buf) {
map = ws->buffer_map(ws, nv40->vertprog.constant_buf,
- PIPE_BUFFER_FLAG_READ);
+ PIPE_BUFFER_USAGE_CPU_READ);
}
for (i = 0; i < vp->nr_consts; i++) {