nouveau: quicky-port to gallium changes
authorBen Skeggs <skeggsb@gmail.com>
Mon, 28 Jan 2008 07:32:46 +0000 (18:32 +1100)
committerBen Skeggs <skeggsb@gmail.com>
Mon, 28 Jan 2008 07:32:46 +0000 (18:32 +1100)
23 files changed:
src/mesa/drivers/dri/nouveau_winsys/nouveau_context.c
src/mesa/drivers/dri/nouveau_winsys/nouveau_context.h
src/mesa/drivers/dri/nouveau_winsys/nouveau_local.h
src/mesa/drivers/dri/nouveau_winsys/nouveau_winsys.c
src/mesa/drivers/dri/nouveau_winsys/nouveau_winsys_pipe.c
src/mesa/drivers/dri/nouveau_winsys/nouveau_winsys_pipe.h
src/mesa/drivers/dri/nouveau_winsys/nv04_surface.c
src/mesa/drivers/dri/nouveau_winsys/nv50_surface.c
src/mesa/pipe/nouveau/nouveau_push.h
src/mesa/pipe/nouveau/nouveau_winsys.h
src/mesa/pipe/nv40/nv40_context.h
src/mesa/pipe/nv40/nv40_draw.c
src/mesa/pipe/nv40/nv40_fragprog.c
src/mesa/pipe/nv40/nv40_miptree.c
src/mesa/pipe/nv40/nv40_state.c
src/mesa/pipe/nv40/nv40_state.h
src/mesa/pipe/nv40/nv40_surface.c
src/mesa/pipe/nv40/nv40_vbo.c
src/mesa/pipe/nv40/nv40_vertprog.c
src/mesa/pipe/nv50/nv50_context.h
src/mesa/pipe/nv50/nv50_draw.c
src/mesa/pipe/nv50/nv50_surface.c
src/mesa/pipe/nv50/nv50_vbo.c

index 9c524fa0017f391152d5e21b0f074c50cda6022e..01fada5b89b282851e79c247d90343171e479a58 100644 (file)
@@ -73,6 +73,7 @@ nouveau_context_create(const __GLcontextModes *glVis,
         */
        {
                struct pipe_surface *fb_surf;
+               struct nouveau_pipe_buffer *fb_buf;
                struct nouveau_bo_priv *fb_bo;
 
                fb_bo = calloc(1, sizeof(struct nouveau_bo_priv));
@@ -87,12 +88,15 @@ nouveau_context_create(const __GLcontextModes *glVis,
                fb_bo->base.size = fb_bo->drm.size;
                fb_bo->base.device = nv_screen->device;
 
+               fb_buf = calloc(1, sizeof(struct nouveau_pipe_buffer));
+               fb_buf->bo = &fb_bo->base;
+
                fb_surf = calloc(1, sizeof(struct pipe_surface));
                fb_surf->cpp = nv_screen->front_cpp;
                fb_surf->pitch = nv_screen->front_pitch / fb_surf->cpp;
                fb_surf->height = nv_screen->front_height;
                fb_surf->refcount = 1;
-               fb_surf->buffer = (void *)fb_bo;
+               fb_surf->buffer = &fb_buf->base;
 
                nv->frontbuffer = fb_surf;
        }
index 2fd3336065cc121ff335d17e2ea2c50f1bd577a3..7a74f7deecd2b3336f61806d2fabb568388dec08 100644 (file)
@@ -54,9 +54,6 @@ struct nouveau_context {
        void (*surface_copy_done)(struct nouveau_context *);
        int (*surface_fill)(struct nouveau_context *, struct pipe_surface *,
                            unsigned, unsigned, unsigned, unsigned, unsigned);
-       int (*surface_data)(struct nouveau_context *, struct pipe_surface *,
-                           unsigned, unsigned, const void *, unsigned,
-                           unsigned, unsigned, unsigned, unsigned);
 };
 
 extern GLboolean nouveau_context_create(const __GLcontextModes *,
index a53b69920288bd1365203616be0dd71851c26622..7a539c81a943f7bf93549f162a89c815aa6848ae 100644 (file)
@@ -60,9 +60,9 @@
        OUT_RING  (nv->o->handle);                                             \
 } while(0)
 
-#define OUT_RELOC(bo,data,flags,vor,tor) do {                                  \
-       nouveau_pushbuf_emit_reloc(nv->channel, nv->channel->pushbuf->cur,     \
-                                  (void*)(bo), (data), (flags), (vor), (tor));\
+#define OUT_RELOC(buf,data,flags,vor,tor) do {                                 \
+       nouveau_pipe_emit_reloc(nv->channel, nv->channel->pushbuf->cur,        \
+                                  buf, (data), (flags), (vor), (tor));        \
        OUT_RING(0);                                                           \
 } while(0)
 
index f5e45461000647d64cfa7684ed9cff9fe0a27749..ddf3cba5f02557eb95a236082bbe7a52bf531183 100644 (file)
@@ -59,16 +59,13 @@ nouveau_pipe_surface_fill(struct nouveau_winsys *nvws, struct pipe_surface *dst,
        return 0;
 }
 
-static int
-nouveau_pipe_surface_data(struct nouveau_winsys *nvws, struct pipe_surface *dst,
-                         unsigned dx, unsigned dy, const void *src,
-                         unsigned src_pitch, unsigned sx, unsigned sy,
-                         unsigned w, unsigned h)
+int
+nouveau_pipe_emit_reloc(struct nouveau_channel *chan, void *ptr,
+                       struct pipe_buffer *buf, uint32_t data,
+                       uint32_t flags, uint32_t vor, uint32_t tor)
 {
-       if (nvws->nv->surface_data(nvws->nv, dst, dx, dy, src, src_pitch, sx,
-                                  sy, w, h))
-               return 1;
-       return 0;
+       return nouveau_pushbuf_emit_reloc(chan, ptr, nouveau_buffer(buf)->bo,
+                                         data, flags, vor, tor);
 }
 
 struct pipe_context *
@@ -102,7 +99,7 @@ nouveau_pipe_create(struct nouveau_context *nv)
        nvws->res_alloc         = nouveau_resource_alloc;
        nvws->res_free          = nouveau_resource_free;
 
-       nvws->push_reloc        = nouveau_pushbuf_emit_reloc;
+       nvws->push_reloc        = nouveau_pipe_emit_reloc;
        nvws->push_flush        = nouveau_pushbuf_flush;
 
        nvws->grobj_alloc       = nouveau_pipe_grobj_alloc;
@@ -117,7 +114,6 @@ nouveau_pipe_create(struct nouveau_context *nv)
 
        nvws->surface_copy      = nouveau_pipe_surface_copy;
        nvws->surface_fill      = nouveau_pipe_surface_fill;
-       nvws->surface_data      = nouveau_pipe_surface_data;
 
        return hw_create(nouveau_create_pipe_winsys(nv), nvws, nv->chipset);
 }
index 1e160f04edd92c5989f21e76b4fa30eb897ffe98..f2087aaf9a29689040f9dabd4d8b0753005526c4 100644 (file)
@@ -1,6 +1,7 @@
 #include "pipe/p_winsys.h"
 #include "pipe/p_defines.h"
 #include "pipe/p_util.h"
+#include "pipe/p_inlines.h"
 
 #include "nouveau_context.h"
 #include "nouveau_device.h"
@@ -54,7 +55,6 @@ nouveau_surface_alloc_storage(struct pipe_winsys *ws, struct pipe_surface *surf,
                              enum pipe_format format, unsigned flags)
 {
        unsigned pitch = ((width * pf_get_size(format)) + 63) & ~63;
-       int ret;
 
        surf->format = format;
        surf->width = width;
@@ -62,16 +62,11 @@ nouveau_surface_alloc_storage(struct pipe_winsys *ws, struct pipe_surface *surf,
        surf->cpp = pf_get_size(format);
        surf->pitch = pitch / surf->cpp;
 
-       surf->buffer = ws->buffer_create(ws, 256, 0, 0);
+       surf->buffer = ws->buffer_create(ws, 256, PIPE_BUFFER_USAGE_PIXEL,
+                                        pitch * height);
        if (!surf->buffer)
                return 1;
 
-       ret = ws->buffer_data(ws, surf->buffer, pitch * height, NULL, 0);
-       if (ret) {
-               ws->buffer_reference(ws, &surf->buffer, NULL);
-               return ret;
-       }
-
        return 0;
 }
 
@@ -83,131 +78,87 @@ nouveau_surface_release(struct pipe_winsys *ws, struct pipe_surface **s)
        *s = NULL;
        if (--surf->refcount <= 0) {
                if (surf->buffer)
-                       ws->buffer_reference(ws, &surf->buffer, NULL);
+                       pipe_buffer_reference(ws, &surf->buffer, NULL);
                free(surf);
        }
 }
 
-static struct pipe_buffer_handle *
+static struct pipe_buffer *
 nouveau_pipe_bo_create(struct pipe_winsys *pws, unsigned alignment,
-                      unsigned flags, unsigned hint)
+                      unsigned usage, unsigned size)
 {
        struct nouveau_pipe_winsys *nvpws = (struct nouveau_pipe_winsys *)pws;
        struct nouveau_device *dev = nvpws->nv->nv_screen->device;
-       struct nouveau_bo *nvbo = NULL;
+       struct nouveau_pipe_buffer *nvbuf;
+
+       nvbuf = calloc(1, sizeof(*nvbuf));
+       if (!nvbuf)
+               return NULL;
+       nvbuf->base.refcount = 1;
+       nvbuf->base.alignment = alignment;
+       nvbuf->base.usage = usage;
+       nvbuf->base.size = size;
 
-       if (nouveau_bo_new(dev, NOUVEAU_BO_LOCAL, alignment, 0, &nvbo))
+       if (nouveau_bo_new(dev, NOUVEAU_BO_LOCAL, alignment, size, &nvbuf->bo)) {
+               free(nvbuf);
                return NULL;
-       return (struct pipe_buffer_handle *)nvbo;
+       }
+
+       return &nvbuf->base;
 }
 
-static struct pipe_buffer_handle *
+static struct pipe_buffer *
 nouveau_pipe_bo_user_create(struct pipe_winsys *pws, void *ptr, unsigned bytes)
 {
        struct nouveau_pipe_winsys *nvpws = (struct nouveau_pipe_winsys *)pws;
        struct nouveau_device *dev = nvpws->nv->nv_screen->device;
-       struct nouveau_bo *nvbo = NULL;
+       struct nouveau_pipe_buffer *nvbuf;
 
-       if (nouveau_bo_user(dev, ptr, bytes, &nvbo))
+       nvbuf = calloc(1, sizeof(*nvbuf));
+       if (!nvbuf)
                return NULL;
-       return (struct pipe_buffer_handle *)nvbo;
-}
-
-static void *
-nouveau_pipe_bo_map(struct pipe_winsys *pws, struct pipe_buffer_handle *bo,
-                   unsigned flags)
-{
-       struct nouveau_bo *nvbo = (struct nouveau_bo *)bo;
-       uint32_t map_flags = 0;
+       nvbuf->base.refcount = 1;
+       nvbuf->base.size = bytes;
 
-       if (flags & PIPE_BUFFER_FLAG_READ)
-               map_flags |= NOUVEAU_BO_RD;
-       if (flags & PIPE_BUFFER_FLAG_WRITE)
-               map_flags |= NOUVEAU_BO_WR;
-
-       if (nouveau_bo_map(nvbo, map_flags))
+       if (nouveau_bo_user(dev, ptr, bytes, &nvbuf->bo)) {
+               free(nvbuf);
                return NULL;
-       return nvbo->map;
-}
-
-static void
-nouveau_pipe_bo_unmap(struct pipe_winsys *pws, struct pipe_buffer_handle *bo)
-{
-       struct nouveau_bo *nvbo = (struct nouveau_bo *)bo;
-
-       nouveau_bo_unmap(nvbo);
-}
-
-static void
-nouveau_pipe_bo_reference(struct pipe_winsys *pws,
-                         struct pipe_buffer_handle **ptr,
-                         struct pipe_buffer_handle *bo)
-{
-       struct nouveau_pipe_winsys *nvpws = (struct nouveau_pipe_winsys *)pws;
-       struct nouveau_context *nv = nvpws->nv;
-       struct nouveau_device *dev = nv->nv_screen->device;
-
-       if (*ptr) {
-               struct nouveau_bo *nvbo = (struct nouveau_bo *)*ptr;
-               FIRE_RING();
-               nouveau_bo_del(&nvbo);
-               *ptr = NULL;
        }
 
-       if (bo) {
-               struct nouveau_bo *nvbo = (struct nouveau_bo *)bo, *new = NULL;
-               nouveau_bo_ref(dev, nvbo->handle, &new);
-               *ptr = bo;
-       }
+       return &nvbuf->base;
 }
 
-static int
-nouveau_pipe_bo_data(struct pipe_winsys *pws, struct pipe_buffer_handle *bo,
-                    unsigned size, const void *data, unsigned usage)
+static void
+nouveau_pipe_bo_del(struct pipe_winsys *ws, struct pipe_buffer *buf)
 {
-       struct nouveau_bo *nvbo = (struct nouveau_bo *)bo;
-
-       if (nvbo->size != size)
-               nouveau_bo_resize(nvbo, size);
+       struct nouveau_pipe_buffer *nvbuf = nouveau_buffer(buf);
 
-       if (data) {
-               if (nouveau_bo_map(nvbo, NOUVEAU_BO_WR))
-                       return 1;
-               memcpy(nvbo->map, data, size);
-               nouveau_bo_unmap(nvbo);
-       }
-
-       return 0;
+       nouveau_bo_del(&nvbuf->bo);
 }
 
-static int
-nouveau_pipe_bo_subdata(struct pipe_winsys *pws, struct pipe_buffer_handle *bo,
-                       unsigned long offset, unsigned long size,
-                       const void *data)
+static void *
+nouveau_pipe_bo_map(struct pipe_winsys *pws, struct pipe_buffer *buf,
+                   unsigned flags)
 {
-       struct nouveau_bo *nvbo = (struct nouveau_bo *)bo;
+       struct nouveau_pipe_buffer *nvbuf = nouveau_buffer(buf);
+       uint32_t map_flags = 0;
 
-       if (nouveau_bo_map(nvbo, NOUVEAU_BO_WR))
-               return 1;
-       memcpy(nvbo->map + offset, data, size);
-       nouveau_bo_unmap(nvbo);
+       if (flags & PIPE_BUFFER_USAGE_CPU_READ)
+               map_flags |= NOUVEAU_BO_RD;
+       if (flags & PIPE_BUFFER_USAGE_CPU_WRITE)
+               map_flags |= NOUVEAU_BO_WR;
 
-       return 0;
+       if (nouveau_bo_map(nvbuf->bo, map_flags))
+               return NULL;
+       return nvbuf->bo->map;
 }
 
-static int
-nouveau_pipe_bo_get_subdata(struct pipe_winsys *pws,
-                           struct pipe_buffer_handle *bo, unsigned long offset,
-                           unsigned long size, void *data)
+static void
+nouveau_pipe_bo_unmap(struct pipe_winsys *pws, struct pipe_buffer *buf)
 {
-       struct nouveau_bo *nvbo = (struct nouveau_bo *)bo;
+       struct nouveau_pipe_buffer *nvbuf = nouveau_buffer(buf);
 
-       if (nouveau_bo_map(nvbo, NOUVEAU_BO_RD))
-               return 1;
-       memcpy(data, nvbo->map + offset, size);
-       nouveau_bo_unmap(nvbo);
-
-       return 0;
+       nouveau_bo_unmap(nvbuf->bo);
 }
 
 struct pipe_winsys *
@@ -230,13 +181,10 @@ nouveau_create_pipe_winsys(struct nouveau_context *nv)
        pws->surface_release = nouveau_surface_release;
 
        pws->buffer_create = nouveau_pipe_bo_create;
+       pws->buffer_destroy = nouveau_pipe_bo_del;
        pws->user_buffer_create = nouveau_pipe_bo_user_create;
        pws->buffer_map = nouveau_pipe_bo_map;
        pws->buffer_unmap = nouveau_pipe_bo_unmap;
-       pws->buffer_reference = nouveau_pipe_bo_reference;
-       pws->buffer_data = nouveau_pipe_bo_data;
-       pws->buffer_subdata = nouveau_pipe_bo_subdata;
-       pws->buffer_get_subdata= nouveau_pipe_bo_get_subdata;
 
        pws->get_name = nouveau_get_name;
 
index bcac60851cbd51ab6c0a0a23d5f481222f940f61..6a03ac0d773f4922f813caba18ce34c4daa0c8e0 100644 (file)
@@ -5,6 +5,17 @@
 #include "pipe/p_winsys.h"
 #include "nouveau_context.h"
 
+struct nouveau_pipe_buffer {
+       struct pipe_buffer base;
+       struct nouveau_bo *bo;
+};
+
+static inline struct nouveau_pipe_buffer *
+nouveau_buffer(struct pipe_buffer *buf)
+{
+       return (struct nouveau_pipe_buffer *)buf;
+}
+
 struct nouveau_pipe_winsys {
        struct pipe_winsys pws;
 
index 2288f9c71a8a3fb9960d39f62683c99ee64cb7c3..fe1ea4ed70f20296764560fe6d8f4a8c6db432ba 100644 (file)
@@ -159,15 +159,6 @@ nv04_surface_fill(struct nouveau_context *nv, struct pipe_surface *dst,
        return 0;
 }
 
-static int
-nv04_surface_data(struct nouveau_context *nv, struct pipe_surface *dst,
-                 unsigned dx, unsigned dy, const void *src, unsigned src_pitch,
-                 unsigned sx, unsigned sy, unsigned w, unsigned h)
-{
-       NOUVEAU_ERR("unimplemented!!\n");
-       return 0;
-}
-
 int
 nouveau_surface_init_nv04(struct nouveau_context *nv)
 {
@@ -230,7 +221,6 @@ nouveau_surface_init_nv04(struct nouveau_context *nv)
        nv->surface_copy = nv04_surface_copy_blit;
        nv->surface_copy_done = nv04_surface_copy_done;
        nv->surface_fill = nv04_surface_fill;
-       nv->surface_data = nv04_surface_data;
        return 0;
 }
 
index d00378d904574db3c34ba175a4fba005f5decdea..15a100286131154d9f32310d3ec24394e592d498 100644 (file)
@@ -133,15 +133,6 @@ nv50_surface_fill(struct nouveau_context *nv, struct pipe_surface *dst,
        return 0;
 }
 
-static int
-nv50_surface_data(struct nouveau_context *nv, struct pipe_surface *dst,
-                 unsigned dx, unsigned dy, const void *src, unsigned src_pitch,
-                 unsigned sx, unsigned sy, unsigned w, unsigned h)
-{
-       NOUVEAU_ERR("unimplemented!!\n");
-       return 0;
-}
-
 int
 nouveau_surface_init_nv50(struct nouveau_context *nv)
 {
@@ -164,7 +155,6 @@ nouveau_surface_init_nv50(struct nouveau_context *nv)
        nv->surface_copy = nv50_surface_copy;
        nv->surface_copy_done = nv50_surface_copy_done;
        nv->surface_fill = nv50_surface_fill;
-       nv->surface_data = nv50_surface_data;
        return 0;
 }
 
index 0fc972d2a229d5fd9e8eb9a5b46267ab50a9ba44..117e3535cf70bf861fcf737f8396bc1e2c6cf49e 100644 (file)
@@ -45,8 +45,7 @@
        NOUVEAU_PUSH_CONTEXT(pc);                                              \
        pc->nvws->push_reloc(pc->nvws->channel,                                \
                             pc->nvws->channel->pushbuf->cur,                  \
-                            (struct nouveau_bo *)(bo),                        \
-                            (data), (flags), (vor), (tor));                   \
+                            (bo), (data), (flags), (vor), (tor));             \
        OUT_RING(0);                                                           \
 } while(0)
 
index 27c991077e7e4873dbeec0deaacd08299db234d8..0b394cfce6b94686e4bcb94c972b8e63b794e6a5 100644 (file)
@@ -25,7 +25,7 @@ struct nouveau_winsys {
        void (*res_free)(struct nouveau_resource **);
 
        int  (*push_reloc)(struct nouveau_channel *, void *ptr,
-                          struct nouveau_bo *, uint32_t data,
+                          struct pipe_buffer *, uint32_t data,
                           uint32_t flags, uint32_t vor, uint32_t tor);
        int  (*push_flush)(struct nouveau_channel *, unsigned size);
                               
@@ -47,9 +47,6 @@ struct nouveau_winsys {
                            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 *
index df8489f3a6b2ef08a29d5b97fa8b260a812cb226..2d069619d7c4097e1698bac181ca308172e1959b 100644 (file)
@@ -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);
index 6ad2b66cce83ae1e4fef69569a418989a02a8abe..d361d5f07d9824011407ce5a61aab9deeff63e14 100644 (file)
@@ -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;
 
index fded11d1703527c74a9e1312046c0d730230f4d0..714634396d22267370f03165b9be4e6e2e554584 100644 (file)
@@ -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++) {
index 625c2fc32d7fcfc25aa083bb94a93ae866e4263a..48062d1ae8a506610dc24ea108f94ab4945535d2 100644 (file)
@@ -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);
index 03a9e735c07d99db966595f8cd9fbfbc250fda16..c619948b55aa07e9e2b54e3e7b6ca43421109160 100644 (file)
@@ -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;
index 4c4c847c9a13a1f971d6b59a05d3fc5089e7a5ef..24eea36db3a97fa71c226176dc0980189192d1ae 100644 (file)
@@ -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 {
index 159837388f3cd045609483a667e215c416687298..d8f87d9adc2e9f45ca272ae97f501b2c96794053 100644 (file)
@@ -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];
@@ -103,19 +103,6 @@ nv40_get_tex_surface(struct pipe_context *pipe, struct pipe_texture *pt,
        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 = 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,
@@ -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;
 }
index 3de87ecab5e93c95be368a034e4be2b2df9d8ea8..3fa8ddcb81b1b7641db784962bf71badbd744c11 100644 (file)
@@ -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) {
index bd052fe8341d4bc91e7118834e10c06bef43f0e0..e15ddbbcde53732c930f31632e52125b7e624b24 100644 (file)
@@ -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++) {
index c43202c3d5710e714f7a9cbaa50728aa29e4f458..5491c0cbb5da7e8c3ef77905828e8914fc3dce8a 100644 (file)
@@ -45,7 +45,7 @@ extern struct draw_stage *nv50_draw_render_stage(struct nv50_context *nv50);
 extern boolean nv50_draw_arrays(struct pipe_context *, unsigned mode,
                                unsigned start, unsigned count);
 extern boolean nv50_draw_elements(struct pipe_context *pipe,
-                                 struct pipe_buffer_handle *indexBuffer,
+                                 struct pipe_buffer *indexBuffer,
                                  unsigned indexSize,
                                  unsigned mode, unsigned start,
                                  unsigned count);
index 97088920284df7417943dd10e75fcca61e6fe5b2..85d347f5e00220fdb3f3559187f7009d89d6ed49 100644 (file)
@@ -9,33 +9,26 @@ struct nv50_draw_stage {
 };
 
 static void
-nv50_draw_begin(struct draw_stage *draw)
-{
-       NOUVEAU_ERR("\n");
-}
-
-static void
-nv50_draw_end(struct draw_stage *draw)
+nv50_draw_point(struct draw_stage *draw, struct prim_header *prim)
 {
        NOUVEAU_ERR("\n");
 }
 
 static void
-nv50_draw_point(struct draw_stage *draw, struct prim_header *prim)
+nv50_draw_line(struct draw_stage *draw, struct prim_header *prim)
 {
        NOUVEAU_ERR("\n");
 }
 
 static void
-nv50_draw_line(struct draw_stage *draw, struct prim_header *prim)
+nv50_draw_tri(struct draw_stage *draw, struct prim_header *prim)
 {
        NOUVEAU_ERR("\n");
 }
 
 static void
-nv50_draw_tri(struct draw_stage *draw, struct prim_header *prim)
+nv50_draw_flush(struct draw_stage *draw, unsigned flags)
 {
-       NOUVEAU_ERR("\n");
 }
 
 static void
@@ -51,11 +44,10 @@ nv50_draw_render_stage(struct nv50_context *nv50)
 
        nv50draw->nv50 = nv50;
        nv50draw->draw.draw = nv50->draw;
-       nv50draw->draw.begin = nv50_draw_begin;
        nv50draw->draw.point = nv50_draw_point;
        nv50draw->draw.line = nv50_draw_line;
        nv50draw->draw.tri = nv50_draw_tri;
-       nv50draw->draw.end = nv50_draw_end;
+       nv50draw->draw.flush = nv50_draw_flush;
        nv50draw->draw.reset_stipple_counter = nv50_draw_reset_stipple_counter;
 
        return &nv50draw->draw;
index d207994688949424305536503ab36a9f665ee3e4..cfb370da77e0172ffc071062b70dbf595c024471 100644 (file)
@@ -42,19 +42,6 @@ nv50_get_tex_surface(struct pipe_context *pipe,
        return NULL;
 }
 
-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;
-
-       nvws->surface_data(nvws, dest, destx, desty, src, src_stride,
-                          srcx, srcy, width, height);
-}
-
 static void
 nv50_surface_copy(struct pipe_context *pipe, struct pipe_surface *dest,
                  unsigned destx, unsigned desty, struct pipe_surface *src,
@@ -82,9 +69,6 @@ void
 nv50_init_surface_functions(struct nv50_context *nv50)
 {
    nv50->pipe.get_tex_surface = nv50_get_tex_surface;
-   nv50->pipe.get_tile = pipe_get_tile_raw;
-   nv50->pipe.put_tile = pipe_put_tile_raw;
-   nv50->pipe.surface_data = nv50_surface_data;
    nv50->pipe.surface_copy = nv50_surface_copy;
    nv50->pipe.surface_fill = nv50_surface_fill;
 }
index 0c9d2806d78c7e72798690c1eebb49b5ad4c8bd2..6c0dc23a439cddfc2a06037032296c949d6bcd6d 100644 (file)
@@ -15,7 +15,7 @@ nv50_draw_arrays(struct pipe_context *pipe, unsigned mode, unsigned start,
 
 boolean
 nv50_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)
 {
        NOUVEAU_ERR("unimplemented\n");