diff options
author | Ben Skeggs <skeggsb@gmail.com> | 2007-12-12 14:19:59 +1100 |
---|---|---|
committer | Ben Skeggs <skeggsb@gmail.com> | 2007-12-12 14:20:58 +1100 |
commit | 79bca7dd884da33c06ecd3dabb893f9cfed1aaed (patch) | |
tree | adb844a1d95f794e9e24d22093b778cbabddd8a0 /src/mesa/drivers/dri | |
parent | 58915980127ab4e57b6b40a8c42f44be4a12aeae (diff) |
nouveau: adapt
Some things that worked before are now broken, there's an "XXX:" around one
of the culprits in the GL state tracker so hopefully it'll get fixed soon!
Diffstat (limited to 'src/mesa/drivers/dri')
-rw-r--r-- | src/mesa/drivers/dri/nouveau_winsys/nouveau_winsys_pipe.c | 42 |
1 files changed, 29 insertions, 13 deletions
diff --git a/src/mesa/drivers/dri/nouveau_winsys/nouveau_winsys_pipe.c b/src/mesa/drivers/dri/nouveau_winsys/nouveau_winsys_pipe.c index fdfad4a539..1e160f04ed 100644 --- a/src/mesa/drivers/dri/nouveau_winsys/nouveau_winsys_pipe.c +++ b/src/mesa/drivers/dri/nouveau_winsys/nouveau_winsys_pipe.c @@ -34,18 +34,8 @@ nouveau_get_name(struct pipe_winsys *pws) return "Nouveau/DRI"; } -static unsigned -nouveau_surface_pitch(struct pipe_winsys *ws, unsigned cpp, unsigned width, - unsigned flags) -{ - unsigned pitch = width * cpp; - - pitch = (pitch + 63) & ~63; - return pitch / cpp; -} - static struct pipe_surface * -nouveau_surface_alloc(struct pipe_winsys *ws, unsigned format) +nouveau_surface_alloc(struct pipe_winsys *ws) { struct pipe_surface *surf; @@ -53,12 +43,38 @@ nouveau_surface_alloc(struct pipe_winsys *ws, unsigned format) if (!surf) return NULL; - surf->format = format; surf->refcount = 1; surf->winsys = ws; return surf; } +static int +nouveau_surface_alloc_storage(struct pipe_winsys *ws, struct pipe_surface *surf, + unsigned width, unsigned height, + enum pipe_format format, unsigned flags) +{ + unsigned pitch = ((width * pf_get_size(format)) + 63) & ~63; + int ret; + + surf->format = format; + surf->width = width; + surf->height = height; + surf->cpp = pf_get_size(format); + surf->pitch = pitch / surf->cpp; + + surf->buffer = ws->buffer_create(ws, 256, 0, 0); + 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; +} + static void nouveau_surface_release(struct pipe_winsys *ws, struct pipe_surface **s) { @@ -209,8 +225,8 @@ nouveau_create_pipe_winsys(struct nouveau_context *nv) pws->flush_frontbuffer = nouveau_flush_frontbuffer; pws->printf = nouveau_printf; - pws->surface_pitch = nouveau_surface_pitch; pws->surface_alloc = nouveau_surface_alloc; + pws->surface_alloc_storage = nouveau_surface_alloc_storage; pws->surface_release = nouveau_surface_release; pws->buffer_create = nouveau_pipe_bo_create; |