summaryrefslogtreecommitdiffstats
path: root/src/gallium/winsys/xlib/xm_winsys.c
diff options
context:
space:
mode:
authorKeith Whitwell <[email protected]>2008-05-02 12:00:13 +0100
committerKeith Whitwell <[email protected]>2008-05-02 12:00:13 +0100
commitc3a8a41faabed4c9b84a6fbaf7a86a089b8fcbba (patch)
treef9ae084994ac92d139e38d4ce84a82cfa01c5f69 /src/gallium/winsys/xlib/xm_winsys.c
parent731e7b961cd081ac6a64b636937716ce3a623c2c (diff)
parent5e49037caa4cf9062efd0bbebf67b467684b633b (diff)
Merge branch 'gallium-0.1' into gallium-tex-surfaces
Diffstat (limited to 'src/gallium/winsys/xlib/xm_winsys.c')
-rw-r--r--src/gallium/winsys/xlib/xm_winsys.c81
1 files changed, 23 insertions, 58 deletions
diff --git a/src/gallium/winsys/xlib/xm_winsys.c b/src/gallium/winsys/xlib/xm_winsys.c
index fd2f56eff24..8ca90ef4c6c 100644
--- a/src/gallium/winsys/xlib/xm_winsys.c
+++ b/src/gallium/winsys/xlib/xm_winsys.c
@@ -37,6 +37,7 @@
#include "xmesaP.h"
#undef ASSERT
+#undef Elements
#include "pipe/p_winsys.h"
#include "pipe/p_format.h"
@@ -88,18 +89,6 @@ struct xmesa_surface
};
-/**
- * Derived from softpipe_winsys.
- * We just need one extra field which indicates the pixel format to use for
- * drawing surfaces so that we're compatible with the XVisual/window format.
- */
-struct xmesa_softpipe_winsys
-{
- struct softpipe_winsys spws;
- enum pipe_format pixelformat;
-};
-
-
struct xmesa_pipe_winsys
{
struct pipe_winsys base;
@@ -119,12 +108,7 @@ xmesa_surface(struct pipe_surface *ps)
return (struct xmesa_surface *) ps;
}
-/** cast wrapper */
-static INLINE struct xmesa_softpipe_winsys *
-xmesa_softpipe_winsys(struct softpipe_winsys *spws)
-{
- return (struct xmesa_softpipe_winsys *) spws;
-}
+
/**
* Turn the softpipe opaque buffer pointer into a dri_bufmgr opaque
@@ -526,8 +510,7 @@ xm_surface_alloc_storage(struct pipe_winsys *winsys,
/**
- * Called via pipe->surface_alloc() to create new surfaces (textures,
- * renderbuffers, etc.
+ * Called via winsys->surface_alloc() to create new surfaces.
*/
static struct pipe_surface *
xm_surface_alloc(struct pipe_winsys *ws)
@@ -612,10 +595,19 @@ xmesa_get_pipe_winsys_aub(struct xmesa_visual *xm_vis)
{
static struct xmesa_pipe_winsys *ws = NULL;
- if (!ws && getenv("XM_AUB")) {
+ if (!ws) {
ws = (struct xmesa_pipe_winsys *) xmesa_create_pipe_winsys_aub();
}
- else if (!ws) {
+ return &ws->base;
+}
+
+
+struct pipe_winsys *
+xmesa_get_pipe_winsys(struct xmesa_visual *xm_vis)
+{
+ static struct xmesa_pipe_winsys *ws = NULL;
+
+ if (!ws) {
ws = CALLOC_STRUCT(xmesa_pipe_winsys);
ws->xm_visual = xm_vis;
@@ -646,45 +638,19 @@ xmesa_get_pipe_winsys_aub(struct xmesa_visual *xm_vis)
}
-/**
- * Called via softpipe_winsys->is_format_supported().
- * This function is only called to test formats for front/back color surfaces.
- * The winsys being queried will have been created at glXCreateContext
- * time, with a pixel format corresponding to the context's visual.
- */
-static boolean
-xmesa_is_format_supported(struct softpipe_winsys *sws,
- enum pipe_format format)
-{
- struct xmesa_softpipe_winsys *xmws = xmesa_softpipe_winsys(sws);
- return (format == xmws->pixelformat);
-}
-
-
-/**
- * Return pointer to a softpipe_winsys object.
- */
-static struct softpipe_winsys *
-xmesa_get_softpipe_winsys(uint pixelformat)
-{
- struct xmesa_softpipe_winsys *xmws
- = CALLOC_STRUCT(xmesa_softpipe_winsys);
- if (!xmws)
- return NULL;
-
- xmws->spws.is_format_supported = xmesa_is_format_supported;
- xmws->pixelformat = pixelformat;
-
- return &xmws->spws;
-}
-
-
struct pipe_context *
xmesa_create_pipe_context(XMesaContext xmesa, uint pixelformat)
{
- struct pipe_winsys *pws = xmesa_get_pipe_winsys_aub(xmesa->xm_visual);
+ struct pipe_winsys *pws;
struct pipe_context *pipe;
+ if (getenv("XM_AUB")) {
+ pws = xmesa_get_pipe_winsys_aub(xmesa->xm_visual);
+ }
+ else {
+ pws = xmesa_get_pipe_winsys(xmesa->xm_visual);
+ }
+
#ifdef GALLIUM_CELL
if (!getenv("GALLIUM_NOCELL")) {
struct cell_winsys *cws = cell_get_winsys(pixelformat);
@@ -695,10 +661,9 @@ xmesa_create_pipe_context(XMesaContext xmesa, uint pixelformat)
else
#endif
{
- struct softpipe_winsys *spws = xmesa_get_softpipe_winsys(pixelformat);
struct pipe_screen *screen = softpipe_create_screen(pws);
- pipe = softpipe_create(screen, pws, spws);
+ pipe = softpipe_create(screen, pws, NULL);
}
if (pipe)