nouveau: very quick port to tex-surface changes.
authorBen Skeggs <skeggsb@gmail.com>
Mon, 26 May 2008 15:22:22 +0000 (01:22 +1000)
committerBen Skeggs <skeggsb@gmail.com>
Mon, 26 May 2008 15:23:31 +0000 (01:23 +1000)
probably the last match-gallium-upstream merge for a bit, some cleanup+nv50
work coming RSN...

16 files changed:
src/gallium/drivers/nv10/nv10_context.c
src/gallium/drivers/nv10/nv10_context.h
src/gallium/drivers/nv10/nv10_miptree.c
src/gallium/drivers/nv10/nv10_screen.c
src/gallium/drivers/nv30/nv30_context.c
src/gallium/drivers/nv30/nv30_context.h
src/gallium/drivers/nv30/nv30_miptree.c
src/gallium/drivers/nv30/nv30_screen.c
src/gallium/drivers/nv40/nv40_context.c
src/gallium/drivers/nv40/nv40_context.h
src/gallium/drivers/nv40/nv40_miptree.c
src/gallium/drivers/nv40/nv40_screen.c
src/gallium/drivers/nv50/nv50_context.c
src/gallium/drivers/nv50/nv50_context.h
src/gallium/drivers/nv50/nv50_miptree.c
src/gallium/drivers/nv50/nv50_screen.c

index 79253f8a2b327beaf272cfe0ca9a374dad30921f..9fcd0b0fc3ab755281d61e4258efb28ec1d99205 100644 (file)
@@ -285,7 +285,6 @@ nv10_create(struct pipe_screen *pscreen, unsigned pctx_id)
 
        nv10_init_surface_functions(nv10);
        nv10_init_state_functions(nv10);
-       nv10_init_miptree_functions(nv10);
 
        nv10->draw = draw_create();
        assert(nv10->draw);
index 433d04dc2a8c7f452256b782e1b2d51480314d0a..5636dfc9d227f4bdf391ac3bac0e8a1ecf06ba03 100644 (file)
@@ -109,7 +109,6 @@ nv10_context(struct pipe_context *pipe)
 
 extern void nv10_init_state_functions(struct nv10_context *nv10);
 extern void nv10_init_surface_functions(struct nv10_context *nv10);
-extern void nv10_init_miptree_functions(struct nv10_context *nv10);
 
 extern void nv10_screen_init_miptree_functions(struct pipe_screen *pscreen);
 
index 4dfc675a6b9143719734466d5fa81861c3a66389..1b9947354d6d60fc3d8a192a9c54b4080ccf0aa2 100644 (file)
@@ -52,7 +52,7 @@ nv10_miptree_layout(struct nv10_miptree *nv10mt)
 }
 
 static struct pipe_texture *
-nv10_miptree_create(struct pipe_screen *screen, struct pipe_texture *pt)
+nv10_miptree_create(struct pipe_screen *screen, const struct pipe_texture *pt)
 {
        struct pipe_winsys *ws = screen->winsys;
        struct nv10_miptree *mt;
@@ -105,7 +105,8 @@ nv10_miptree_update(struct pipe_context *pipe, struct pipe_texture *mt,
 
 static struct pipe_surface *
 nv10_miptree_surface_get(struct pipe_screen *screen, struct pipe_texture *pt,
-                        unsigned face, unsigned level, unsigned zslice)
+                        unsigned face, unsigned level, unsigned zslice,
+                        unsigned flags)
 {
        struct pipe_winsys *ws = screen->winsys;
        struct nv10_miptree *nv10mt = (struct nv10_miptree *)pt;
@@ -130,9 +131,10 @@ nv10_miptree_surface_get(struct pipe_screen *screen, struct pipe_texture *pt,
        return ps;
 }
 
-void nv10_init_miptree_functions(struct nv10_context *nv10)
+static void
+nv10_miptree_surface_release(struct pipe_screen *screen,
+                            struct pipe_surface **surface)
 {
-       nv10->pipe.texture_update = nv10_miptree_update;
 }
 
 void nv10_screen_init_miptree_functions(struct pipe_screen *pscreen)
@@ -140,5 +142,6 @@ void nv10_screen_init_miptree_functions(struct pipe_screen *pscreen)
        pscreen->texture_create = nv10_miptree_create;
        pscreen->texture_release = nv10_miptree_release;
        pscreen->get_tex_surface = nv10_miptree_surface_get;
+       pscreen->tex_surface_release = nv10_miptree_surface_release;
 }
 
index 5fe3a0308119ab6e7f47a5200265ee53d64395c6..67787d8e9ce5973c647223119af059dcaf2932d1 100644 (file)
@@ -117,6 +117,28 @@ nv10_screen_is_format_supported(struct pipe_screen *screen,
        return FALSE;
 }
 
+static void *
+nv10_surface_map(struct pipe_screen *screen, struct pipe_surface *surface,
+                unsigned flags )
+{
+       struct pipe_winsys *ws = screen->winsys;
+       void *map;
+
+       map = ws->buffer_map(ws, surface->buffer, flags);
+       if (!map)
+               return NULL;
+
+       return map + surface->offset;
+}
+
+static void
+nv10_surface_unmap(struct pipe_screen *screen, struct pipe_surface *surface)
+{
+       struct pipe_winsys *ws = screen->winsys;
+
+       ws->buffer_unmap(ws, surface->buffer);
+}
+
 static void
 nv10_screen_destroy(struct pipe_screen *pscreen)
 {
@@ -180,6 +202,9 @@ nv10_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws)
 
        screen->pipe.is_format_supported = nv10_screen_is_format_supported;
 
+       screen->pipe.surface_map = nv10_surface_map;
+       screen->pipe.surface_unmap = nv10_surface_unmap;
+
        nv10_screen_init_miptree_functions(&screen->pipe);
 
        return &screen->pipe;
index 7a2fee78751c344fc81e7106f1f8081ae6857f89..b2d9d3f1814ce5e638196c0489983bb13968adbf 100644 (file)
@@ -66,7 +66,6 @@ nv30_create(struct pipe_screen *pscreen, unsigned pctx_id)
        nv30_init_query_functions(nv30);
        nv30_init_surface_functions(nv30);
        nv30_init_state_functions(nv30);
-       nv30_init_miptree_functions(nv30);
 
        /* Create, configure, and install fallback swtnl path */
        nv30->draw = draw_create();
index f49450f82d9e21e81216ac6c4ef6c60989baafe9..333bd4875c61e8cd1871edc38af4cc4d0c957885 100644 (file)
@@ -134,7 +134,6 @@ nv30_context(struct pipe_context *pipe)
 
 extern void nv30_init_state_functions(struct nv30_context *nv30);
 extern void nv30_init_surface_functions(struct nv30_context *nv30);
-extern void nv30_init_miptree_functions(struct nv30_context *nv30);
 extern void nv30_init_query_functions(struct nv30_context *nv30);
 
 extern void nv30_screen_init_miptree_functions(struct pipe_screen *pscreen);
index 10ab46e19a5495e5e3a1f556879a02293e9992eb..6078b1865e2e246ed7ca75b282ad16e7aac94b05 100644 (file)
@@ -100,15 +100,10 @@ nv30_miptree_release(struct pipe_screen *pscreen, struct pipe_texture **pt)
        }
 }
 
-static void
-nv30_miptree_update(struct pipe_context *pipe, struct pipe_texture *mt,
-                   uint face, uint levels)
-{
-}
-
 static struct pipe_surface *
-nv30_miptree_surface(struct pipe_screen *pscreen, struct pipe_texture *pt,
-                     unsigned face, unsigned level, unsigned zslice)
+nv30_miptree_surface_new(struct pipe_screen *pscreen, struct pipe_texture *pt,
+                        unsigned face, unsigned level, unsigned zslice,
+                        unsigned flags)
 {
        struct pipe_winsys *ws = pscreen->winsys;
        struct nv30_miptree *nv30mt = (struct nv30_miptree *)pt;
@@ -136,10 +131,10 @@ nv30_miptree_surface(struct pipe_screen *pscreen, struct pipe_texture *pt,
        return ps;
 }
 
-void
-nv30_init_miptree_functions(struct nv30_context *nv30)
+static void
+nv30_miptree_surface_del(struct pipe_screen *pscreen,
+                        struct pipe_surface **psurface)
 {
-       nv30->pipe.texture_update = nv30_miptree_update;
 }
 
 void
@@ -147,6 +142,7 @@ nv30_screen_init_miptree_functions(struct pipe_screen *pscreen)
 {
        pscreen->texture_create = nv30_miptree_create;
        pscreen->texture_release = nv30_miptree_release;
-       pscreen->get_tex_surface = nv30_miptree_surface;
+       pscreen->get_tex_surface = nv30_miptree_surface_new;
+       pscreen->tex_surface_release = nv30_miptree_surface_del;
 }
 
index bb77776ff15e801f4ba5ab04a1b510fb99cb5d47..9c576369891dbb74b3e25d91f245a779ead2d88b 100644 (file)
@@ -124,6 +124,28 @@ nv30_screen_surface_format_supported(struct pipe_screen *pscreen,
        return FALSE;
 }
 
+static void *
+nv30_surface_map(struct pipe_screen *screen, struct pipe_surface *surface,
+                unsigned flags )
+{
+       struct pipe_winsys *ws = screen->winsys;
+       void *map;
+
+       map = ws->buffer_map(ws, surface->buffer, flags);
+       if (!map)
+               return NULL;
+
+       return map + surface->offset;
+}
+
+static void
+nv30_surface_unmap(struct pipe_screen *screen, struct pipe_surface *surface)
+{
+       struct pipe_winsys *ws = screen->winsys;
+
+       ws->buffer_unmap(ws, surface->buffer);
+}
+
 static void
 nv30_screen_destroy(struct pipe_screen *pscreen)
 {
@@ -300,6 +322,9 @@ nv30_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws)
 
        screen->pipe.is_format_supported = nv30_screen_surface_format_supported;
 
+       screen->pipe.surface_map = nv30_surface_map;
+       screen->pipe.surface_unmap = nv30_surface_unmap;
+
        nv30_screen_init_miptree_functions(&screen->pipe);
 
        return &screen->pipe;
index d9d9accea8d61d77a91fd6ca22c07aa3c6b5101a..a40f14895f4ae743b94cc5338adc7e09549ebe4b 100644 (file)
@@ -59,7 +59,6 @@ nv40_create(struct pipe_screen *pscreen, unsigned pctx_id)
        nv40_init_query_functions(nv40);
        nv40_init_surface_functions(nv40);
        nv40_init_state_functions(nv40);
-       nv40_init_miptree_functions(nv40);
 
        /* Create, configure, and install fallback swtnl path */
        nv40->draw = draw_create();
index 77b3da0ab91923240c3b0949288c6230392d7cc4..d8d1891dff0ae42a1df24435c3b8783989c8e11f 100644 (file)
@@ -172,7 +172,6 @@ struct nv40_state_entry {
 
 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);
 
 extern void nv40_screen_init_miptree_functions(struct pipe_screen *pscreen);
index 1b19217223215bee5543b915c862a75d0ce9384d..23da6e36a3e4992de36a7ef76f40ccd3491ba21b 100644 (file)
@@ -100,15 +100,10 @@ nv40_miptree_release(struct pipe_screen *pscreen, struct pipe_texture **pt)
        }
 }
 
-static void
-nv40_miptree_update(struct pipe_context *pipe, struct pipe_texture *mt,
-                   uint face, uint levels)
-{
-}
-
 static struct pipe_surface *
-nv40_miptree_surface(struct pipe_screen *pscreen, struct pipe_texture *pt,
-                     unsigned face, unsigned level, unsigned zslice)
+nv40_miptree_surface_new(struct pipe_screen *pscreen, struct pipe_texture *pt,
+                        unsigned face, unsigned level, unsigned zslice,
+                        unsigned flags)
 {
        struct pipe_winsys *ws = pscreen->winsys;
        struct nv40_miptree *nv40mt = (struct nv40_miptree *)pt;
@@ -136,10 +131,10 @@ nv40_miptree_surface(struct pipe_screen *pscreen, struct pipe_texture *pt,
        return ps;
 }
 
-void
-nv40_init_miptree_functions(struct nv40_context *nv40)
+static void
+nv40_miptree_surface_del(struct pipe_screen *pscreen,
+                        struct pipe_surface **psurface)
 {
-       nv40->pipe.texture_update = nv40_miptree_update;
 }
 
 void
@@ -147,6 +142,7 @@ nv40_screen_init_miptree_functions(struct pipe_screen *pscreen)
 {
        pscreen->texture_create = nv40_miptree_create;
        pscreen->texture_release = nv40_miptree_release;
-       pscreen->get_tex_surface = nv40_miptree_surface;
+       pscreen->get_tex_surface = nv40_miptree_surface_new;
+       pscreen->tex_surface_release = nv40_miptree_surface_del;
 }
 
index 51640533938c4c06dad2e678357334b0da31c969..ed0215b4862d53889a6a17439c054931a2cef78b 100644 (file)
@@ -133,6 +133,28 @@ nv40_screen_surface_format_supported(struct pipe_screen *pscreen,
        return FALSE;
 }
 
+static void *
+nv40_surface_map(struct pipe_screen *screen, struct pipe_surface *surface,
+                unsigned flags )
+{
+       struct pipe_winsys *ws = screen->winsys;
+       void *map;
+
+       map = ws->buffer_map(ws, surface->buffer, flags);
+       if (!map)
+               return NULL;
+
+       return map + surface->offset;
+}
+
+static void
+nv40_surface_unmap(struct pipe_screen *screen, struct pipe_surface *surface)
+{
+       struct pipe_winsys *ws = screen->winsys;
+
+       ws->buffer_unmap(ws, surface->buffer);
+}
+
 static void
 nv40_screen_destroy(struct pipe_screen *pscreen)
 {
@@ -282,6 +304,9 @@ nv40_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws)
 
        screen->pipe.is_format_supported = nv40_screen_surface_format_supported;
 
+       screen->pipe.surface_map = nv40_surface_map;
+       screen->pipe.surface_unmap = nv40_surface_unmap;
+
        nv40_screen_init_miptree_functions(&screen->pipe);
 
        return &screen->pipe;
index 6eb1878b847785379ec3c722de11a3413ba8f267..a225c4bf728a42ebe122b7bcfe3cc9a29898cbcf 100644 (file)
@@ -55,7 +55,6 @@ nv50_create(struct pipe_screen *pscreen, unsigned pctx_id)
 
        nv50->pipe.flush = nv50_flush;
 
-       nv50_init_miptree_functions(nv50);
        nv50_init_surface_functions(nv50);
        nv50_init_state_functions(nv50);
        nv50_init_query_functions(nv50);
index f532fa6bfb39cbba9098313fb6f26858188af111..e68c702deaef39c7cddb884b90d5e9c84b47d6c3 100644 (file)
@@ -71,7 +71,6 @@ nv50_context(struct pipe_context *pipe)
        return (struct nv50_context *)pipe;
 }
 
-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);
index 58584934b18698f6e752a7e7ec1fa3e6058c2435..ccb916d6accf1866eff9c1bc90d135e90506b36c 100644 (file)
@@ -56,8 +56,9 @@ nv50_miptree_release(struct pipe_screen *pscreen, struct pipe_texture **ppt)
 }
 
 static struct pipe_surface *
-nv50_miptree_surface(struct pipe_screen *pscreen, struct pipe_texture *pt,
-                    unsigned face, unsigned level, unsigned zslice)
+nv50_miptree_surface_new(struct pipe_screen *pscreen, struct pipe_texture *pt,
+                        unsigned face, unsigned level, unsigned zslice,
+                        unsigned flags)
 {
        struct pipe_winsys *ws = pscreen->winsys;
        struct nv50_miptree *mt = nv50_miptree(pt);
@@ -80,22 +81,18 @@ nv50_miptree_surface(struct pipe_screen *pscreen, struct pipe_texture *pt,
        return ps;
 }
 
-void
-nv50_screen_init_miptree_functions(struct pipe_screen *pscreen)
-{
-       pscreen->texture_create = nv50_miptree_create;
-       pscreen->texture_release = nv50_miptree_release;
-       pscreen->get_tex_surface = nv50_miptree_surface;
-}
-
 static void
-nv50_miptree_update(struct pipe_context *pipe, struct pipe_texture *mt,
-                   uint face, uint levels)
+nv50_miptree_surface_del(struct pipe_screen *pscreen,
+                        struct pipe_surface **psurface)
 {
 }
 
 void
-nv50_init_miptree_functions(struct nv50_context *nv50)
+nv50_screen_init_miptree_functions(struct pipe_screen *pscreen)
 {
-       nv50->pipe.texture_update = nv50_miptree_update;
+       pscreen->texture_create = nv50_miptree_create;
+       pscreen->texture_release = nv50_miptree_release;
+       pscreen->get_tex_surface = nv50_miptree_surface_new;
+       pscreen->tex_surface_release = nv50_miptree_surface_del;
 }
+
index d069639dc48f916002f6a73de06a1422c61d8cf0..29c057a14535be64bcf13a44dc755844487109c2 100644 (file)
@@ -117,6 +117,28 @@ nv50_screen_get_paramf(struct pipe_screen *pscreen, int param)
        }
 }
 
+static void *
+nv50_surface_map(struct pipe_screen *screen, struct pipe_surface *surface,
+                unsigned flags )
+{
+       struct pipe_winsys *ws = screen->winsys;
+       void *map;
+
+       map = ws->buffer_map(ws, surface->buffer, flags);
+       if (!map)
+               return NULL;
+
+       return map + surface->offset;
+}
+
+static void
+nv50_surface_unmap(struct pipe_screen *screen, struct pipe_surface *surface)
+{
+       struct pipe_winsys *ws = screen->winsys;
+
+       ws->buffer_unmap(ws, surface->buffer);
+}
+
 static void
 nv50_screen_destroy(struct pipe_screen *pscreen)
 {
@@ -209,6 +231,9 @@ nv50_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws)
 
        screen->pipe.is_format_supported = nv50_screen_is_format_supported;
 
+       screen->pipe.surface_map = nv50_surface_map;
+       screen->pipe.surface_unmap = nv50_surface_unmap;
+
        nv50_screen_init_miptree_functions(&screen->pipe);
 
        return &screen->pipe;