From 0e59cd33e6a38567801c7da541e4caffbd6cccd3 Mon Sep 17 00:00:00 2001 From: Younes Manton Date: Sun, 23 May 2010 19:56:12 -0400 Subject: vl: Get softpipe working again. Still segfaults on softpipe->destroy() in the draw module when freeing a vertex buffer. --- src/gallium/winsys/g3dvl/vl_winsys.h | 6 ++-- src/gallium/winsys/g3dvl/xlib/xsp_winsys.c | 46 ++++++++++++++++-------------- 2 files changed, 29 insertions(+), 23 deletions(-) (limited to 'src/gallium/winsys') diff --git a/src/gallium/winsys/g3dvl/vl_winsys.h b/src/gallium/winsys/g3dvl/vl_winsys.h index d95e9c58335..c75ff9f32f5 100644 --- a/src/gallium/winsys/g3dvl/vl_winsys.h +++ b/src/gallium/winsys/g3dvl/vl_winsys.h @@ -37,6 +37,7 @@ struct pipe_video_context; struct vl_screen { + Display *display; enum pipe_format format; struct pipe_screen *pscreen; }; @@ -60,7 +61,8 @@ vl_video_create(struct vl_screen *vscreen, void vl_video_destroy(struct vl_context *vctx); -Drawable -vl_video_bind_drawable(struct vl_context *vctx, Drawable drawable); +void* +vl_displaytarget_get(struct vl_screen *vscreen, Drawable drawable, + unsigned *width, unsigned *height); #endif diff --git a/src/gallium/winsys/g3dvl/xlib/xsp_winsys.c b/src/gallium/winsys/g3dvl/xlib/xsp_winsys.c index 1df78e986d6..e5d4664d4e8 100644 --- a/src/gallium/winsys/g3dvl/xlib/xsp_winsys.c +++ b/src/gallium/winsys/g3dvl/xlib/xsp_winsys.c @@ -27,16 +27,9 @@ #include #include -//#include -//#include -//#include -//#include -//#include #include -//#include #include #include -//#include /* TODO: Find a good way to calculate this */ static enum pipe_format VisualToPipe(Visual *visual) @@ -45,21 +38,31 @@ static enum pipe_format VisualToPipe(Visual *visual) return PIPE_FORMAT_B8G8R8X8_UNORM; } -Drawable -vl_video_bind_drawable(struct vl_context *vctx, Drawable drawable) +/* XXX: Not thread-safe */ +static struct xlib_drawable xdraw; + +void* +vl_displaytarget_get(struct vl_screen *vscreen, Drawable drawable, + unsigned *width_out, unsigned *height_out) { -#if 0 - struct xsp_context *xsp_context = (struct xsp_context*)vctx; - Drawable old_drawable; + Window root; + int x, y; + unsigned int width, height; + unsigned int border_width; + unsigned int depth; - assert(vctx); + assert(vscreen); + + if (XGetGeometry(vscreen->display, drawable, &root, &x, &y, &width, &height, &border_width, &depth) == BadDrawable) + return NULL; - old_drawable = xsp_context->drawable; - xsp_context->drawable = drawable; + if (width_out) *width_out = width; + if (height_out) *height_out = height; - return old_drawable; -#endif - return None; + xdraw.depth = depth; + xdraw.drawable = drawable; + + return &xdraw; } struct vl_screen* @@ -81,14 +84,15 @@ vl_screen_create(Display *display, int screen) } vscreen->pscreen = softpipe_create_screen(winsys); - if (!vscreen->pscreen) { winsys->destroy(winsys); FREE(vscreen); return NULL; } - vscreen->format = VisualToPipe(XDefaultVisual(display, screen)); + vscreen->display = display; + xdraw.visual = XDefaultVisual(display, screen); + vscreen->format = VisualToPipe(xdraw.visual); return vscreen; } @@ -134,7 +138,7 @@ void vl_video_destroy(struct vl_context *vctx) { assert(vctx); -#if 0 +#if 1 vctx->vpipe->destroy(vctx->vpipe); #endif FREE(vctx); -- cgit v1.2.3