summaryrefslogtreecommitdiffstats
path: root/src/gallium/winsys/g3dvl
diff options
context:
space:
mode:
authorYounes Manton <[email protected]>2010-05-23 19:56:12 -0400
committerYounes Manton <[email protected]>2010-05-23 19:56:12 -0400
commit0e59cd33e6a38567801c7da541e4caffbd6cccd3 (patch)
tree04aac05bd29c2694ecac9eb3bb3eff51ec4fb31e /src/gallium/winsys/g3dvl
parent2c29a93e875dd96fb08c65ec659efc3eb2d5c15e (diff)
vl: Get softpipe working again.
Still segfaults on softpipe->destroy() in the draw module when freeing a vertex buffer.
Diffstat (limited to 'src/gallium/winsys/g3dvl')
-rw-r--r--src/gallium/winsys/g3dvl/vl_winsys.h6
-rw-r--r--src/gallium/winsys/g3dvl/xlib/xsp_winsys.c46
2 files changed, 29 insertions, 23 deletions
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 <vl_winsys.h>
#include <state_tracker/xlib_sw_winsys.h>
-//#include <X11/Xutil.h>
-//#include <util/u_simple_screen.h>
-//#include <pipe/p_state.h>
-//#include <util/u_inlines.h>
-//#include <util/u_format.h>
#include <util/u_memory.h>
-//#include <util/u_math.h>
#include <softpipe/sp_public.h>
#include <softpipe/sp_video_context.h>
-//#include <softpipe/sp_texture.h>
/* 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);