From 0c25ac52425e6d6eb037b99ab90f41b47e3f4491 Mon Sep 17 00:00:00 2001 From: Younes Manton Date: Tue, 22 Jul 2008 22:26:26 -0400 Subject: g3dvl: Add Nouveau winsys, libdriclient. Nouveau winsys is based on Mesa's Nouveau winsys and soft-links to most of it. The 'nouveau_context' and 'nouveau_screen' code contains most of the changes, 'nouveau_winsys_pipe', 'nouveau_swapbuffers' and 'nouveau_lock' contain some minor changes. The driclient library contains the DRI userland stuff, most of which was based on Mesa's DRI code. --- src/gallium/winsys/g3dvl/nouveau/nouveau_context.c | 371 +++++++++++++++++++++ 1 file changed, 371 insertions(+) create mode 100644 src/gallium/winsys/g3dvl/nouveau/nouveau_context.c (limited to 'src/gallium/winsys/g3dvl/nouveau/nouveau_context.c') diff --git a/src/gallium/winsys/g3dvl/nouveau/nouveau_context.c b/src/gallium/winsys/g3dvl/nouveau/nouveau_context.c new file mode 100644 index 0000000000..5e173c7672 --- /dev/null +++ b/src/gallium/winsys/g3dvl/nouveau/nouveau_context.c @@ -0,0 +1,371 @@ +#include "pipe/p_defines.h" +#include "pipe/p_context.h" +#include "pipe/p_screen.h" +#include "pipe/p_util.h" + +#include "nouveau_context.h" +#include "nouveau_dri.h" +#include "nouveau_local.h" +#include "nouveau_screen.h" +#include "nouveau_winsys_pipe.h" + +/* +#ifdef DEBUG +static const struct dri_debug_control debug_control[] = { + { "bo", DEBUG_BO }, + { NULL, 0 } +}; +int __nouveau_debug = 0; +#endif +*/ + +/* + * TODO: Re-examine dri_screen, dri_context, nouveau_screen, nouveau_context + * relationships, seems like there is a lot of room for simplification there. + */ + +static void +nouveau_channel_context_destroy(struct nouveau_channel_context *nvc) +{ + nouveau_grobj_free(&nvc->NvCtxSurf2D); + nouveau_grobj_free(&nvc->NvImageBlit); + nouveau_grobj_free(&nvc->NvGdiRect); + nouveau_grobj_free(&nvc->NvM2MF); + nouveau_grobj_free(&nvc->Nv2D); + nouveau_grobj_free(&nvc->NvSwzSurf); + nouveau_grobj_free(&nvc->NvSIFM); + + nouveau_notifier_free(&nvc->sync_notifier); + + nouveau_channel_free(&nvc->channel); + + FREE(nvc); +} + +static struct nouveau_channel_context * +nouveau_channel_context_create(struct nouveau_device *dev) +{ + struct nouveau_channel_context *nvc; + int ret; + + nvc = CALLOC_STRUCT(nouveau_channel_context); + if (!nvc) + return NULL; + + if ((ret = nouveau_channel_alloc(dev, 0x8003d001, 0x8003d002, + &nvc->channel))) { + NOUVEAU_ERR("Error creating GPU channel: %d\n", ret); + nouveau_channel_context_destroy(nvc); + return NULL; + } + + nvc->next_handle = 0x80000000; + + if ((ret = nouveau_notifier_alloc(nvc->channel, nvc->next_handle++, 1, + &nvc->sync_notifier))) { + NOUVEAU_ERR("Error creating channel sync notifier: %d\n", ret); + nouveau_channel_context_destroy(nvc); + return NULL; + } + + switch (dev->chipset & 0xf0) { + case 0x50: + case 0x80: + case 0x90: + ret = nouveau_surface_channel_create_nv50(nvc); + break; + default: + ret = nouveau_surface_channel_create_nv04(nvc); + break; + } + + if (ret) { + NOUVEAU_ERR("Error initialising surface objects: %d\n", ret); + nouveau_channel_context_destroy(nvc); + return NULL; + } + + return nvc; +} + +int +nouveau_context_create(dri_context_t *dri_context) +{ + dri_screen_t *dri_screen = dri_context->dri_screen; + struct nouveau_screen *nv_screen = dri_screen->private; + struct nouveau_context *nv = CALLOC_STRUCT(nouveau_context); + struct pipe_context *pipe = NULL; + struct nouveau_channel_context *nvc = NULL; + struct nouveau_device *dev = nv_screen->device; + int i; + + switch (dev->chipset & 0xf0) { + case 0x10: + case 0x20: + /* NV10 */ + case 0x30: + /* NV30 */ + case 0x40: + case 0x60: + /* NV40 */ + case 0x50: + case 0x80: + case 0x90: + /* G80 */ + break; + default: + NOUVEAU_ERR("Unsupported chipset: NV%02x\n", dev->chipset); + return 1; + } + + dri_context->private = (void*)nv; + nv->dri_context = dri_context; + nv->nv_screen = nv_screen; + + { + struct nouveau_device_priv *nvdev = nouveau_device(dev); + + nvdev->ctx = dri_context->drm_context; + nvdev->lock = (drmLock*)&dri_screen->sarea->lock; + } + + /* + driParseConfigFiles(&nv->dri_option_cache, &nv_screen->option_cache, + nv->dri_screen->myNum, "nouveau"); +#ifdef DEBUG + __nouveau_debug = driParseDebugString(getenv("NOUVEAU_DEBUG"), + debug_control); +#endif + */ + + /*XXX: Hack up a fake region and buffer object for front buffer. + * This will go away with TTM, replaced with a simple reference + * of the front buffer handle passed to us by the DDX. + */ + { + 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)); + fb_bo->drm.offset = nv_screen->front_offset; + fb_bo->drm.flags = NOUVEAU_MEM_FB; + fb_bo->drm.size = nv_screen->front_pitch * + nv_screen->front_height; + fb_bo->refcount = 1; + fb_bo->base.flags = NOUVEAU_BO_PIN | NOUVEAU_BO_VRAM; + fb_bo->base.offset = fb_bo->drm.offset; + fb_bo->base.handle = (unsigned long)fb_bo; + 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)); + if (nv_screen->front_cpp == 2) + fb_surf->format = PIPE_FORMAT_R5G6B5_UNORM; + else + fb_surf->format = PIPE_FORMAT_A8R8G8B8_UNORM; + pf_get_block(fb_surf->format, &fb_surf->block); + fb_surf->width = nv_screen->front_pitch / nv_screen->front_cpp; + fb_surf->height = nv_screen->front_height; + fb_surf->stride = fb_surf->width * fb_surf->block.size; + fb_surf->refcount = 1; + fb_surf->buffer = &fb_buf->base; + + nv->frontbuffer = fb_surf; + } + + nvc = nv_screen->nvc; + + if (!nvc) { + nvc = nouveau_channel_context_create(dev); + if (!nvc) { + NOUVEAU_ERR("Failed initialising GPU context\n"); + return 1; + } + nv_screen->nvc = nvc; + } + + nvc->refcount++; + nv->nvc = nvc; + + /* Find a free slot for a pipe context, allocate a new one if needed */ + nv->pctx_id = -1; + for (i = 0; i < nvc->nr_pctx; i++) { + if (nvc->pctx[i] == NULL) { + nv->pctx_id = i; + break; + } + } + + if (nv->pctx_id < 0) { + nv->pctx_id = nvc->nr_pctx++; + nvc->pctx = + realloc(nvc->pctx, + sizeof(struct pipe_context *) * nvc->nr_pctx); + } + + /* Create pipe */ + switch (dev->chipset & 0xf0) { + case 0x50: + case 0x80: + case 0x90: + if (nouveau_surface_init_nv50(nv)) + return 1; + break; + default: + if (nouveau_surface_init_nv04(nv)) + return 1; + break; + } + + if (!getenv("NOUVEAU_FORCE_SOFTPIPE")) { + struct pipe_screen *pscreen; + + pipe = nouveau_pipe_create(nv); + if (!pipe) + NOUVEAU_ERR("Couldn't create hw pipe\n"); + pscreen = nvc->pscreen; + + nv->cap.hw_vertex_buffer = + pscreen->get_param(pscreen, NOUVEAU_CAP_HW_VTXBUF); + nv->cap.hw_index_buffer = + pscreen->get_param(pscreen, NOUVEAU_CAP_HW_IDXBUF); + } + + /* XXX: nouveau_winsys_softpipe needs a mesa header removed before we can compile it. */ + /* + if (!pipe) { + NOUVEAU_MSG("Using softpipe\n"); + pipe = nouveau_create_softpipe(nv); + if (!pipe) { + NOUVEAU_ERR("Error creating pipe, bailing\n"); + return 1; + } + } + */ + if (!pipe) { + NOUVEAU_ERR("Error creating pipe, bailing\n"); + return 1; + } + + pipe->priv = nv; + + return 0; +} + +void +nouveau_context_destroy(dri_context_t *dri_context) +{ + struct nouveau_context *nv = dri_context->private; + struct nouveau_channel_context *nvc = nv->nvc; + + assert(nv); + + if (nv->pctx_id >= 0) { + nvc->pctx[nv->pctx_id] = NULL; + if (--nvc->refcount <= 0) { + nouveau_channel_context_destroy(nvc); + nv->nv_screen->nvc = NULL; + } + } + + free(nv); +} + +int +nouveau_context_bind(struct nouveau_context *nv, dri_drawable_t *dri_drawable) +{ + assert(nv); + assert(dri_drawable); + + if (nv->dri_drawable != dri_drawable) + { + nv->dri_drawable = dri_drawable; + dri_drawable->private = nv; + } + + return 0; +} + +int +nouveau_context_unbind(struct nouveau_context *nv) +{ + assert(nv); + + nv->dri_drawable = NULL; + + return 0; +} + +/* Show starts here */ + +int bind_pipe_drawable(struct pipe_context *pipe, Drawable drawable) +{ + struct nouveau_context *nv; + dri_drawable_t *dri_drawable; + + nv = pipe->priv; + + driCreateDrawable(nv->nv_screen->dri_screen, drawable, &dri_drawable); + + nouveau_context_bind(nv, dri_drawable); + + return 0; +} + +int unbind_pipe_drawable(struct pipe_context *pipe) +{ + nouveau_context_unbind(pipe->priv); + + return 0; +} + +struct pipe_context* create_pipe_context(Display *display, int screen) +{ + dri_screen_t *dri_screen; + dri_framebuffer_t dri_framebuf; + dri_context_t *dri_context; + struct nouveau_context *nv; + + driCreateScreen(display, screen, &dri_screen, &dri_framebuf); + driCreateContext(dri_screen, XDefaultVisual(display, screen), &dri_context); + + nouveau_screen_create(dri_screen, &dri_framebuf); + nouveau_context_create(dri_context); + + nv = dri_context->private; + + return nv->nvc->pctx[nv->pctx_id]; +} + +int destroy_pipe_context(struct pipe_context *pipe) +{ + struct pipe_screen *screen; + struct pipe_winsys *winsys; + struct nouveau_context *nv; + dri_screen_t *dri_screen; + dri_context_t *dri_context; + + assert(pipe); + + screen = pipe->screen; + winsys = pipe->winsys; + nv = pipe->priv; + dri_context = nv->dri_context; + dri_screen = dri_context->dri_screen; + + pipe->destroy(pipe); + screen->destroy(screen); + free(winsys); + + nouveau_context_destroy(dri_context); + nouveau_screen_destroy(dri_screen); + driDestroyContext(dri_context); + driDestroyScreen(dri_screen); + + return 0; +} + -- cgit v1.2.3 From 59f23e92e24b93eb48f4e0552dd8e397aefd1714 Mon Sep 17 00:00:00 2001 From: Younes Manton Date: Fri, 12 Sep 2008 13:22:43 -0400 Subject: g3dvl: Update softlinks to nouveau winsys files, related fixes. --- .../state_trackers/g3dvl/vl_r16snorm_mc_buf.c | 2 +- src/gallium/winsys/g3dvl/nouveau/nouveau_bo.c | 2 +- src/gallium/winsys/g3dvl/nouveau/nouveau_channel.c | 2 +- src/gallium/winsys/g3dvl/nouveau/nouveau_context.c | 37 ++++---- src/gallium/winsys/g3dvl/nouveau/nouveau_device.c | 2 +- src/gallium/winsys/g3dvl/nouveau/nouveau_dma.c | 2 +- src/gallium/winsys/g3dvl/nouveau/nouveau_dma.h | 2 +- src/gallium/winsys/g3dvl/nouveau/nouveau_dri.h | 2 +- src/gallium/winsys/g3dvl/nouveau/nouveau_drmif.h | 2 +- src/gallium/winsys/g3dvl/nouveau/nouveau_fence.c | 2 +- src/gallium/winsys/g3dvl/nouveau/nouveau_grobj.c | 2 +- src/gallium/winsys/g3dvl/nouveau/nouveau_local.h | 2 +- .../winsys/g3dvl/nouveau/nouveau_notifier.c | 2 +- src/gallium/winsys/g3dvl/nouveau/nouveau_pushbuf.c | 2 +- .../winsys/g3dvl/nouveau/nouveau_resource.c | 2 +- src/gallium/winsys/g3dvl/nouveau/nouveau_screen.c | 13 ++- src/gallium/winsys/g3dvl/nouveau/nouveau_winsys.c | 2 +- .../winsys/g3dvl/nouveau/nouveau_winsys_pipe.c | 11 +-- .../winsys/g3dvl/nouveau/nouveau_winsys_pipe.h | 2 +- .../winsys/g3dvl/nouveau/nouveau_winsys_softpipe.c | 2 +- src/gallium/winsys/g3dvl/nouveau/nv04_surface.c | 2 +- src/gallium/winsys/g3dvl/nouveau/nv50_surface.c | 2 +- src/gallium/winsys/g3dvl/xsp_winsys.c | 105 ++++++++++----------- src/libXvMC/Makefile | 2 +- 24 files changed, 101 insertions(+), 105 deletions(-) (limited to 'src/gallium/winsys/g3dvl/nouveau/nouveau_context.c') diff --git a/src/gallium/state_trackers/g3dvl/vl_r16snorm_mc_buf.c b/src/gallium/state_trackers/g3dvl/vl_r16snorm_mc_buf.c index 93839e8aa9..cfbad08038 100644 --- a/src/gallium/state_trackers/g3dvl/vl_r16snorm_mc_buf.c +++ b/src/gallium/state_trackers/g3dvl/vl_r16snorm_mc_buf.c @@ -6,10 +6,10 @@ #include #include #include -#include #include #include #include +#include #include "vl_render.h" #include "vl_shader_build.h" #include "vl_surface.h" diff --git a/src/gallium/winsys/g3dvl/nouveau/nouveau_bo.c b/src/gallium/winsys/g3dvl/nouveau/nouveau_bo.c index 73ac4a4171..1005282dd4 120000 --- a/src/gallium/winsys/g3dvl/nouveau/nouveau_bo.c +++ b/src/gallium/winsys/g3dvl/nouveau/nouveau_bo.c @@ -1 +1 @@ -../../dri/nouveau/nouveau_bo.c \ No newline at end of file +../../drm/nouveau/nouveau_bo.c \ No newline at end of file diff --git a/src/gallium/winsys/g3dvl/nouveau/nouveau_channel.c b/src/gallium/winsys/g3dvl/nouveau/nouveau_channel.c index 6c9b2c48d8..5af8202950 120000 --- a/src/gallium/winsys/g3dvl/nouveau/nouveau_channel.c +++ b/src/gallium/winsys/g3dvl/nouveau/nouveau_channel.c @@ -1 +1 @@ -../../dri/nouveau/nouveau_channel.c \ No newline at end of file +../../drm/nouveau/nouveau_channel.c \ No newline at end of file diff --git a/src/gallium/winsys/g3dvl/nouveau/nouveau_context.c b/src/gallium/winsys/g3dvl/nouveau/nouveau_context.c index 5e173c7672..06a61fcda3 100644 --- a/src/gallium/winsys/g3dvl/nouveau/nouveau_context.c +++ b/src/gallium/winsys/g3dvl/nouveau/nouveau_context.c @@ -1,7 +1,7 @@ #include "pipe/p_defines.h" #include "pipe/p_context.h" #include "pipe/p_screen.h" -#include "pipe/p_util.h" +#include "util/u_memory.h" #include "nouveau_context.h" #include "nouveau_dri.h" @@ -150,7 +150,7 @@ nouveau_context_create(dri_context_t *dri_context) fb_bo = calloc(1, sizeof(struct nouveau_bo_priv)); fb_bo->drm.offset = nv_screen->front_offset; fb_bo->drm.flags = NOUVEAU_MEM_FB; - fb_bo->drm.size = nv_screen->front_pitch * + fb_bo->drm.size = nv_screen->front_pitch * nv_screen->front_height; fb_bo->refcount = 1; fb_bo->base.flags = NOUVEAU_BO_PIN | NOUVEAU_BO_VRAM; @@ -280,7 +280,7 @@ nouveau_context_bind(struct nouveau_context *nv, dri_drawable_t *dri_drawable) { assert(nv); assert(dri_drawable); - + if (nv->dri_drawable != dri_drawable) { nv->dri_drawable = dri_drawable; @@ -294,9 +294,9 @@ int nouveau_context_unbind(struct nouveau_context *nv) { assert(nv); - + nv->dri_drawable = NULL; - + return 0; } @@ -306,20 +306,20 @@ int bind_pipe_drawable(struct pipe_context *pipe, Drawable drawable) { struct nouveau_context *nv; dri_drawable_t *dri_drawable; - + nv = pipe->priv; - + driCreateDrawable(nv->nv_screen->dri_screen, drawable, &dri_drawable); - + nouveau_context_bind(nv, dri_drawable); - + return 0; } int unbind_pipe_drawable(struct pipe_context *pipe) { nouveau_context_unbind(pipe->priv); - + return 0; } @@ -329,15 +329,15 @@ struct pipe_context* create_pipe_context(Display *display, int screen) dri_framebuffer_t dri_framebuf; dri_context_t *dri_context; struct nouveau_context *nv; - + driCreateScreen(display, screen, &dri_screen, &dri_framebuf); driCreateContext(dri_screen, XDefaultVisual(display, screen), &dri_context); - + nouveau_screen_create(dri_screen, &dri_framebuf); nouveau_context_create(dri_context); - + nv = dri_context->private; - + return nv->nvc->pctx[nv->pctx_id]; } @@ -348,15 +348,15 @@ int destroy_pipe_context(struct pipe_context *pipe) struct nouveau_context *nv; dri_screen_t *dri_screen; dri_context_t *dri_context; - + assert(pipe); - + screen = pipe->screen; winsys = pipe->winsys; nv = pipe->priv; dri_context = nv->dri_context; dri_screen = dri_context->dri_screen; - + pipe->destroy(pipe); screen->destroy(screen); free(winsys); @@ -365,7 +365,6 @@ int destroy_pipe_context(struct pipe_context *pipe) nouveau_screen_destroy(dri_screen); driDestroyContext(dri_context); driDestroyScreen(dri_screen); - + return 0; } - diff --git a/src/gallium/winsys/g3dvl/nouveau/nouveau_device.c b/src/gallium/winsys/g3dvl/nouveau/nouveau_device.c index 47d52dafa8..63f1fa040c 120000 --- a/src/gallium/winsys/g3dvl/nouveau/nouveau_device.c +++ b/src/gallium/winsys/g3dvl/nouveau/nouveau_device.c @@ -1 +1 @@ -../../dri/nouveau/nouveau_device.c \ No newline at end of file +../../drm/nouveau/nouveau_device.c \ No newline at end of file diff --git a/src/gallium/winsys/g3dvl/nouveau/nouveau_dma.c b/src/gallium/winsys/g3dvl/nouveau/nouveau_dma.c index 45078c964f..cd0d32e537 120000 --- a/src/gallium/winsys/g3dvl/nouveau/nouveau_dma.c +++ b/src/gallium/winsys/g3dvl/nouveau/nouveau_dma.c @@ -1 +1 @@ -../../dri/nouveau/nouveau_dma.c \ No newline at end of file +../../drm/nouveau/nouveau_dma.c \ No newline at end of file diff --git a/src/gallium/winsys/g3dvl/nouveau/nouveau_dma.h b/src/gallium/winsys/g3dvl/nouveau/nouveau_dma.h index 6b9ec77741..e6c7d4bc96 120000 --- a/src/gallium/winsys/g3dvl/nouveau/nouveau_dma.h +++ b/src/gallium/winsys/g3dvl/nouveau/nouveau_dma.h @@ -1 +1 @@ -../../dri/nouveau/nouveau_dma.h \ No newline at end of file +../../drm/nouveau/nouveau_dma.h \ No newline at end of file diff --git a/src/gallium/winsys/g3dvl/nouveau/nouveau_dri.h b/src/gallium/winsys/g3dvl/nouveau/nouveau_dri.h index 0e6c9fce35..c8f9dbdc3a 120000 --- a/src/gallium/winsys/g3dvl/nouveau/nouveau_dri.h +++ b/src/gallium/winsys/g3dvl/nouveau/nouveau_dri.h @@ -1 +1 @@ -../../dri/nouveau/nouveau_dri.h \ No newline at end of file +../../drm/nouveau/nouveau_dri.h \ No newline at end of file diff --git a/src/gallium/winsys/g3dvl/nouveau/nouveau_drmif.h b/src/gallium/winsys/g3dvl/nouveau/nouveau_drmif.h index 473b7d4812..27082c9d34 120000 --- a/src/gallium/winsys/g3dvl/nouveau/nouveau_drmif.h +++ b/src/gallium/winsys/g3dvl/nouveau/nouveau_drmif.h @@ -1 +1 @@ -../../dri/nouveau/nouveau_drmif.h \ No newline at end of file +../../drm/nouveau/nouveau_drmif.h \ No newline at end of file diff --git a/src/gallium/winsys/g3dvl/nouveau/nouveau_fence.c b/src/gallium/winsys/g3dvl/nouveau/nouveau_fence.c index ef1f0c6afe..51a50527e6 120000 --- a/src/gallium/winsys/g3dvl/nouveau/nouveau_fence.c +++ b/src/gallium/winsys/g3dvl/nouveau/nouveau_fence.c @@ -1 +1 @@ -../../dri/nouveau/nouveau_fence.c \ No newline at end of file +../../drm/nouveau/nouveau_fence.c \ No newline at end of file diff --git a/src/gallium/winsys/g3dvl/nouveau/nouveau_grobj.c b/src/gallium/winsys/g3dvl/nouveau/nouveau_grobj.c index 428186544c..db17c72e6d 120000 --- a/src/gallium/winsys/g3dvl/nouveau/nouveau_grobj.c +++ b/src/gallium/winsys/g3dvl/nouveau/nouveau_grobj.c @@ -1 +1 @@ -../../dri/nouveau/nouveau_grobj.c \ No newline at end of file +../../drm/nouveau/nouveau_grobj.c \ No newline at end of file diff --git a/src/gallium/winsys/g3dvl/nouveau/nouveau_local.h b/src/gallium/winsys/g3dvl/nouveau/nouveau_local.h index 6b878aad22..4e9d3042cb 120000 --- a/src/gallium/winsys/g3dvl/nouveau/nouveau_local.h +++ b/src/gallium/winsys/g3dvl/nouveau/nouveau_local.h @@ -1 +1 @@ -../../dri/nouveau/nouveau_local.h \ No newline at end of file +../../drm/nouveau/nouveau_local.h \ No newline at end of file diff --git a/src/gallium/winsys/g3dvl/nouveau/nouveau_notifier.c b/src/gallium/winsys/g3dvl/nouveau/nouveau_notifier.c index 3024a612a7..703bc3ce4a 120000 --- a/src/gallium/winsys/g3dvl/nouveau/nouveau_notifier.c +++ b/src/gallium/winsys/g3dvl/nouveau/nouveau_notifier.c @@ -1 +1 @@ -../../dri/nouveau/nouveau_notifier.c \ No newline at end of file +../../drm/nouveau/nouveau_notifier.c \ No newline at end of file diff --git a/src/gallium/winsys/g3dvl/nouveau/nouveau_pushbuf.c b/src/gallium/winsys/g3dvl/nouveau/nouveau_pushbuf.c index dae31d9799..4ac137cada 120000 --- a/src/gallium/winsys/g3dvl/nouveau/nouveau_pushbuf.c +++ b/src/gallium/winsys/g3dvl/nouveau/nouveau_pushbuf.c @@ -1 +1 @@ -../../dri/nouveau/nouveau_pushbuf.c \ No newline at end of file +../../drm/nouveau/nouveau_pushbuf.c \ No newline at end of file diff --git a/src/gallium/winsys/g3dvl/nouveau/nouveau_resource.c b/src/gallium/winsys/g3dvl/nouveau/nouveau_resource.c index e0d71e9d2b..2241af328f 120000 --- a/src/gallium/winsys/g3dvl/nouveau/nouveau_resource.c +++ b/src/gallium/winsys/g3dvl/nouveau/nouveau_resource.c @@ -1 +1 @@ -../../dri/nouveau/nouveau_resource.c \ No newline at end of file +../../drm/nouveau/nouveau_resource.c \ No newline at end of file diff --git a/src/gallium/winsys/g3dvl/nouveau/nouveau_screen.c b/src/gallium/winsys/g3dvl/nouveau/nouveau_screen.c index daea3fff68..f80d00050c 100644 --- a/src/gallium/winsys/g3dvl/nouveau/nouveau_screen.c +++ b/src/gallium/winsys/g3dvl/nouveau/nouveau_screen.c @@ -1,5 +1,5 @@ #include "pipe/p_context.h" -#include "pipe/p_util.h" +#include "util/u_memory.h" #include "nouveau_context.h" #include #include "nouveau_dri.h" @@ -23,11 +23,11 @@ int nouveau_check_dri_drm_ddx(dri_version_t *dri, dri_version_t *drm, dri_versio static const dri_version_t ddx_expected = {0, 0, NOUVEAU_DRM_HEADER_PATCHLEVEL}; static const dri_version_t dri_expected = {4, 0, 0}; static const dri_version_t drm_expected = {0, 0, NOUVEAU_DRM_HEADER_PATCHLEVEL}; - + assert(dri); assert(drm); assert(ddx); - + if (dri->major != dri_expected.major || dri->minor < dri_expected.minor) { NOUVEAU_ERR("Unexpected DRI version.\n"); @@ -43,17 +43,17 @@ int nouveau_check_dri_drm_ddx(dri_version_t *dri, dri_version_t *drm, dri_versio NOUVEAU_ERR("Unexpected DDX version.\n"); return 1; } - + return 0; } int nouveau_screen_create(dri_screen_t *dri_screen, dri_framebuffer_t *dri_framebuf) -{ +{ struct nouveau_dri *nv_dri = dri_framebuf->private; struct nouveau_screen *nv_screen; int ret; - + if (nouveau_check_dri_drm_ddx(&dri_screen->dri, &dri_screen->drm, &dri_screen->ddx)) return 1; @@ -89,4 +89,3 @@ nouveau_screen_destroy(dri_screen_t *dri_screen) FREE(nv_screen); } - diff --git a/src/gallium/winsys/g3dvl/nouveau/nouveau_winsys.c b/src/gallium/winsys/g3dvl/nouveau/nouveau_winsys.c index 43de49b98b..ce4052d557 120000 --- a/src/gallium/winsys/g3dvl/nouveau/nouveau_winsys.c +++ b/src/gallium/winsys/g3dvl/nouveau/nouveau_winsys.c @@ -1 +1 @@ -../../dri/nouveau/nouveau_winsys.c \ No newline at end of file +../../drm/nouveau/nouveau_winsys.c \ No newline at end of file diff --git a/src/gallium/winsys/g3dvl/nouveau/nouveau_winsys_pipe.c b/src/gallium/winsys/g3dvl/nouveau/nouveau_winsys_pipe.c index b835bd5760..5d5380c250 100644 --- a/src/gallium/winsys/g3dvl/nouveau/nouveau_winsys_pipe.c +++ b/src/gallium/winsys/g3dvl/nouveau/nouveau_winsys_pipe.c @@ -1,7 +1,7 @@ #include "pipe/p_winsys.h" #include "pipe/p_defines.h" -#include "pipe/p_util.h" #include "pipe/p_inlines.h" +#include "util/u_memory.h" #include "nouveau_context.h" #include "nouveau_local.h" @@ -29,7 +29,7 @@ static struct pipe_surface * nouveau_surface_alloc(struct pipe_winsys *ws) { struct pipe_surface *surf; - + surf = CALLOC_STRUCT(pipe_surface); if (!surf) return NULL; @@ -59,10 +59,10 @@ nouveau_surface_alloc_storage ) { const unsigned int ALIGNMENT = 256; - + assert(pws); assert(surface); - + surface->width = width; surface->height = height; surface->format = format; @@ -72,7 +72,7 @@ nouveau_surface_alloc_storage surface->stride = round_up(surface->nblocksx * surface->block.size, ALIGNMENT); surface->usage = flags; surface->buffer = pws->buffer_create(pws, ALIGNMENT, PIPE_BUFFER_USAGE_PIXEL, surface->stride * surface->nblocksy); - + return 0; } @@ -258,4 +258,3 @@ nouveau_create_pipe_winsys(struct nouveau_context *nv) return &nvpws->pws; } - diff --git a/src/gallium/winsys/g3dvl/nouveau/nouveau_winsys_pipe.h b/src/gallium/winsys/g3dvl/nouveau/nouveau_winsys_pipe.h index 264716fef0..9d9460883e 120000 --- a/src/gallium/winsys/g3dvl/nouveau/nouveau_winsys_pipe.h +++ b/src/gallium/winsys/g3dvl/nouveau/nouveau_winsys_pipe.h @@ -1 +1 @@ -../../dri/nouveau/nouveau_winsys_pipe.h \ No newline at end of file +../../drm/nouveau/nouveau_winsys_pipe.h \ No newline at end of file diff --git a/src/gallium/winsys/g3dvl/nouveau/nouveau_winsys_softpipe.c b/src/gallium/winsys/g3dvl/nouveau/nouveau_winsys_softpipe.c index 83faccde96..ec613ecbf6 120000 --- a/src/gallium/winsys/g3dvl/nouveau/nouveau_winsys_softpipe.c +++ b/src/gallium/winsys/g3dvl/nouveau/nouveau_winsys_softpipe.c @@ -1 +1 @@ -../../dri/nouveau/nouveau_winsys_softpipe.c \ No newline at end of file +../../drm/nouveau/nouveau_winsys_softpipe.c \ No newline at end of file diff --git a/src/gallium/winsys/g3dvl/nouveau/nv04_surface.c b/src/gallium/winsys/g3dvl/nouveau/nv04_surface.c index e05f0671d6..4455d8f924 120000 --- a/src/gallium/winsys/g3dvl/nouveau/nv04_surface.c +++ b/src/gallium/winsys/g3dvl/nouveau/nv04_surface.c @@ -1 +1 @@ -../../dri/nouveau/nv04_surface.c \ No newline at end of file +../../drm/nouveau/nv04_surface.c \ No newline at end of file diff --git a/src/gallium/winsys/g3dvl/nouveau/nv50_surface.c b/src/gallium/winsys/g3dvl/nouveau/nv50_surface.c index 3850748229..19f102001e 120000 --- a/src/gallium/winsys/g3dvl/nouveau/nv50_surface.c +++ b/src/gallium/winsys/g3dvl/nouveau/nv50_surface.c @@ -1 +1 @@ -../../dri/nouveau/nv50_surface.c \ No newline at end of file +../../drm/nouveau/nv50_surface.c \ No newline at end of file diff --git a/src/gallium/winsys/g3dvl/xsp_winsys.c b/src/gallium/winsys/g3dvl/xsp_winsys.c index 0100fe37bd..42e7841df8 100644 --- a/src/gallium/winsys/g3dvl/xsp_winsys.c +++ b/src/gallium/winsys/g3dvl/xsp_winsys.c @@ -2,8 +2,8 @@ #include #include #include -#include #include +#include #include /* pipe_winsys implementation */ @@ -33,79 +33,79 @@ struct xsp_buffer static struct pipe_buffer* xsp_buffer_create(struct pipe_winsys *pws, unsigned alignment, unsigned usage, unsigned size) { struct xsp_buffer *buffer; - + assert(pws); - + buffer = calloc(1, sizeof(struct xsp_buffer)); buffer->base.refcount = 1; buffer->base.alignment = alignment; buffer->base.usage = usage; buffer->base.size = size; buffer->data = align_malloc(size, alignment); - + return (struct pipe_buffer*)buffer; } static struct pipe_buffer* xsp_user_buffer_create(struct pipe_winsys *pws, void *data, unsigned size) { struct xsp_buffer *buffer; - + assert(pws); - + buffer = calloc(1, sizeof(struct xsp_buffer)); buffer->base.refcount = 1; buffer->base.size = size; buffer->is_user_buffer = TRUE; buffer->data = data; - + return (struct pipe_buffer*)buffer; } static void* xsp_buffer_map(struct pipe_winsys *pws, struct pipe_buffer *buffer, unsigned flags) { struct xsp_buffer *xsp_buf = (struct xsp_buffer*)buffer; - + assert(pws); assert(buffer); - + xsp_buf->mapped_data = xsp_buf->data; - + return xsp_buf->mapped_data; } static void xsp_buffer_unmap(struct pipe_winsys *pws, struct pipe_buffer *buffer) { struct xsp_buffer *xsp_buf = (struct xsp_buffer*)buffer; - + assert(pws); assert(buffer); - + xsp_buf->mapped_data = NULL; } static void xsp_buffer_destroy(struct pipe_winsys *pws, struct pipe_buffer *buffer) { struct xsp_buffer *xsp_buf = (struct xsp_buffer*)buffer; - + assert(pws); assert(buffer); - + if (!xsp_buf->is_user_buffer) align_free(xsp_buf->data); - + free(xsp_buf); } static struct pipe_surface* xsp_surface_alloc(struct pipe_winsys *pws) { struct pipe_surface *surface; - + assert(pws); - + surface = calloc(1, sizeof(struct pipe_surface)); surface->refcount = 1; surface->winsys = pws; - + return surface; } @@ -127,10 +127,10 @@ static int xsp_surface_alloc_storage ) { const unsigned int ALIGNMENT = 1; - + assert(pws); assert(surface); - + surface->width = width; surface->height = height; surface->format = format; @@ -140,28 +140,28 @@ static int xsp_surface_alloc_storage surface->stride = round_up(surface->nblocksx * surface->block.size, ALIGNMENT); surface->usage = flags; surface->buffer = pws->buffer_create(pws, ALIGNMENT, PIPE_BUFFER_USAGE_PIXEL, surface->stride * surface->nblocksy); - + return 0; } static void xsp_surface_release(struct pipe_winsys *pws, struct pipe_surface **surface) { struct pipe_surface *s; - + assert(pws); assert(surface); assert(*surface); - + s = *surface; - + s->refcount--; - + if (s->refcount == 0) { pipe_buffer_reference(pws, &s->buffer, NULL); free(s); } - + *surface = NULL; } @@ -176,7 +176,7 @@ static int xsp_fence_signalled(struct pipe_winsys *pws, struct pipe_fence_handle { assert(pws); assert(fence); - + return 0; } @@ -184,30 +184,30 @@ static int xsp_fence_finish(struct pipe_winsys *pws, struct pipe_fence_handle *f { assert(pws); assert(fence); - + return 0; } static void xsp_flush_frontbuffer(struct pipe_winsys *pws, struct pipe_surface *surface, void *context_private) -{ +{ struct xsp_pipe_winsys *xsp_winsys; struct xsp_context *xsp_context; - + assert(pws); assert(surface); assert(context_private); - + xsp_winsys = (struct xsp_pipe_winsys*)pws; xsp_context = (struct xsp_context*)context_private; - + if (!xsp_context->drawable_bound) return; - + xsp_winsys->fbimage.width = surface->width; xsp_winsys->fbimage.height = surface->height; xsp_winsys->fbimage.bytes_per_line = surface->width * (xsp_winsys->fbimage.bits_per_pixel >> 3); xsp_winsys->fbimage.data = pipe_surface_map(surface, 0); - + XPutImage ( xsp_context->display, @@ -236,25 +236,25 @@ static const char* xsp_get_name(struct pipe_winsys *pws) int bind_pipe_drawable(struct pipe_context *pipe, Drawable drawable) { struct xsp_context *xsp_context; - + assert(pipe); - + xsp_context = pipe->priv; xsp_context->drawable = drawable; xsp_context->drawable_bound = 1; - + return 0; } int unbind_pipe_drawable(struct pipe_context *pipe) { struct xsp_context *xsp_context; - + assert(pipe); - + xsp_context = pipe->priv; xsp_context->drawable_bound = 0; - + return 0; } @@ -264,9 +264,9 @@ struct pipe_context* create_pipe_context(Display *display, int screen) struct xsp_context *xsp_context; struct pipe_screen *sp_screen; struct pipe_context *sp_pipe; - + assert(display); - + xsp_winsys = calloc(1, sizeof(struct xsp_pipe_winsys)); xsp_winsys->base.buffer_create = xsp_buffer_create; xsp_winsys->base.user_buffer_create = xsp_user_buffer_create; @@ -281,7 +281,7 @@ struct pipe_context* create_pipe_context(Display *display, int screen) xsp_winsys->base.fence_finish = xsp_fence_finish; xsp_winsys->base.flush_frontbuffer = xsp_flush_frontbuffer; xsp_winsys->base.get_name = xsp_get_name; - + { /* XXX: Can't use the returned XImage* directly, since we don't have control over winsys destruction @@ -299,22 +299,22 @@ struct pipe_context* create_pipe_context(Display *display, int screen) 32, 0 ); - + memcpy(&xsp_winsys->fbimage, template, sizeof(XImage)); XInitImage(&xsp_winsys->fbimage); - + XDestroyImage(template); } - + sp_screen = softpipe_create_screen((struct pipe_winsys*)xsp_winsys); sp_pipe = softpipe_create(sp_screen, (struct pipe_winsys*)xsp_winsys, NULL); - + xsp_context = calloc(1, sizeof(struct xsp_context)); xsp_context->display = display; xsp_context->screen = screen; - + sp_pipe->priv = xsp_context; - + return sp_pipe; } @@ -322,16 +322,15 @@ int destroy_pipe_context(struct pipe_context *pipe) { struct pipe_screen *screen; struct pipe_winsys *winsys; - + assert(pipe); - + screen = pipe->screen; winsys = pipe->winsys; free(pipe->priv); pipe->destroy(pipe); screen->destroy(screen); free(winsys); - + return 0; } - diff --git a/src/libXvMC/Makefile b/src/libXvMC/Makefile index 8565d271c7..4de26e9620 100644 --- a/src/libXvMC/Makefile +++ b/src/libXvMC/Makefile @@ -47,7 +47,7 @@ endif all: ${TARGET} ifeq (${DRIVER}, softpipe) -${TARGET}: g3dvl +${TARGET}: ${OBJECTS} g3dvl $(CC) ${LDFLAGS} -shared -Wl,-soname,${SONAME} -o $@ ${OBJECTS} ${LIBS} g3dvl: -- cgit v1.2.3