summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/drivers/cell/ppu/cell_public.h10
-rw-r--r--src/gallium/drivers/cell/ppu/cell_screen.c1
-rw-r--r--src/gallium/drivers/cell/ppu/cell_screen.h3
-rw-r--r--src/gallium/drivers/llvmpipe/lp_public.h10
-rw-r--r--src/gallium/drivers/llvmpipe/lp_screen.c1
-rw-r--r--src/gallium/drivers/llvmpipe/lp_screen.h2
-rw-r--r--src/gallium/drivers/softpipe/sp_public.h10
-rw-r--r--src/gallium/drivers/softpipe/sp_screen.c1
-rw-r--r--src/gallium/drivers/softpipe/sp_screen.h8
-rw-r--r--src/gallium/include/state_tracker/xlib_sw_winsys.h10
-rw-r--r--src/gallium/targets/libgl-xlib/xlib.c65
-rw-r--r--src/gallium/winsys/xlib/Makefile6
-rw-r--r--src/gallium/winsys/xlib/SConscript3
-rw-r--r--src/gallium/winsys/xlib/xlib.c49
-rw-r--r--src/gallium/winsys/xlib/xlib.h18
-rw-r--r--src/gallium/winsys/xlib/xlib_cell.c95
-rw-r--r--src/gallium/winsys/xlib/xlib_llvmpipe.c79
-rw-r--r--src/gallium/winsys/xlib/xlib_softpipe.c68
-rw-r--r--src/gallium/winsys/xlib/xlib_sw_winsys.c4
19 files changed, 96 insertions, 347 deletions
diff --git a/src/gallium/drivers/cell/ppu/cell_public.h b/src/gallium/drivers/cell/ppu/cell_public.h
new file mode 100644
index 00000000000..7e2e093565d
--- /dev/null
+++ b/src/gallium/drivers/cell/ppu/cell_public.h
@@ -0,0 +1,10 @@
+#ifndef CELL_PUBLIC_H
+#define CELL_PUBLIC_H
+
+struct pipe_screen;
+struct sw_winsys;
+
+struct pipe_screen *
+cell_create_screen(struct sw_winsys *winsys);
+
+#endif
diff --git a/src/gallium/drivers/cell/ppu/cell_screen.c b/src/gallium/drivers/cell/ppu/cell_screen.c
index fc04767a1ee..31fd963d19a 100644
--- a/src/gallium/drivers/cell/ppu/cell_screen.c
+++ b/src/gallium/drivers/cell/ppu/cell_screen.c
@@ -36,6 +36,7 @@
#include "cell_screen.h"
#include "cell_texture.h"
#include "cell_buffer.h"
+#include "cell_public.h"
#include "state_tracker/sw_winsys.h"
diff --git a/src/gallium/drivers/cell/ppu/cell_screen.h b/src/gallium/drivers/cell/ppu/cell_screen.h
index 6a22433b564..baff9d3b7d4 100644
--- a/src/gallium/drivers/cell/ppu/cell_screen.h
+++ b/src/gallium/drivers/cell/ppu/cell_screen.h
@@ -51,8 +51,5 @@ cell_screen( struct pipe_screen *pipe )
return (struct cell_screen *)pipe;
}
-extern struct pipe_screen *
-cell_create_screen(struct sw_winsys *winsys);
-
#endif /* CELL_SCREEN_H */
diff --git a/src/gallium/drivers/llvmpipe/lp_public.h b/src/gallium/drivers/llvmpipe/lp_public.h
new file mode 100644
index 00000000000..ec6b660b48e
--- /dev/null
+++ b/src/gallium/drivers/llvmpipe/lp_public.h
@@ -0,0 +1,10 @@
+#ifndef LP_PUBLIC_H
+#define LP_PUBLIC_H
+
+struct pipe_screen;
+struct sw_winsys;
+
+struct pipe_screen *
+llvmpipe_create_screen(struct sw_winsys *winsys);
+
+#endif
diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c
index 9bb3043320c..5093f58bb19 100644
--- a/src/gallium/drivers/llvmpipe/lp_screen.c
+++ b/src/gallium/drivers/llvmpipe/lp_screen.c
@@ -38,6 +38,7 @@
#include "lp_screen.h"
#include "lp_context.h"
#include "lp_debug.h"
+#include "lp_public.h"
#include "state_tracker/sw_winsys.h"
diff --git a/src/gallium/drivers/llvmpipe/lp_screen.h b/src/gallium/drivers/llvmpipe/lp_screen.h
index 0c862836050..f4e62cbf08e 100644
--- a/src/gallium/drivers/llvmpipe/lp_screen.h
+++ b/src/gallium/drivers/llvmpipe/lp_screen.h
@@ -76,7 +76,5 @@ llvmpipe_screen( struct pipe_screen *pipe )
}
-struct pipe_screen *
-llvmpipe_create_screen(struct sw_winsys *winsys);
#endif /* LP_SCREEN_H */
diff --git a/src/gallium/drivers/softpipe/sp_public.h b/src/gallium/drivers/softpipe/sp_public.h
new file mode 100644
index 00000000000..62d0903d87a
--- /dev/null
+++ b/src/gallium/drivers/softpipe/sp_public.h
@@ -0,0 +1,10 @@
+#ifndef SP_PUBLIC_H
+#define SP_PUBLIC_H
+
+struct pipe_screen;
+struct sw_winsys;
+
+struct pipe_screen *
+softpipe_create_screen(struct sw_winsys *winsys);
+
+#endif
diff --git a/src/gallium/drivers/softpipe/sp_screen.c b/src/gallium/drivers/softpipe/sp_screen.c
index 44680ea70c8..e0a2ef604e9 100644
--- a/src/gallium/drivers/softpipe/sp_screen.c
+++ b/src/gallium/drivers/softpipe/sp_screen.c
@@ -36,6 +36,7 @@
#include "sp_screen.h"
#include "sp_context.h"
#include "sp_buffer.h"
+#include "sp_public.h"
static const char *
diff --git a/src/gallium/drivers/softpipe/sp_screen.h b/src/gallium/drivers/softpipe/sp_screen.h
index 4d7d8bada2c..f741454c9e5 100644
--- a/src/gallium/drivers/softpipe/sp_screen.h
+++ b/src/gallium/drivers/softpipe/sp_screen.h
@@ -59,12 +59,4 @@ softpipe_screen( struct pipe_screen *pipe )
-/**
- * Create a softpipe screen that uses the
- * given winsys for allocating buffers.
- */
-struct pipe_screen *softpipe_create_screen( struct sw_winsys * );
-
-
-
#endif /* SP_SCREEN_H */
diff --git a/src/gallium/include/state_tracker/xlib_sw_winsys.h b/src/gallium/include/state_tracker/xlib_sw_winsys.h
index 3cb679426d6..13dc8377126 100644
--- a/src/gallium/include/state_tracker/xlib_sw_winsys.h
+++ b/src/gallium/include/state_tracker/xlib_sw_winsys.h
@@ -18,13 +18,17 @@ struct xlib_drawable {
Drawable drawable;
};
-
+/* This is the interface required by the glx/xlib state tracker. Why
+ * is it being defined in this file?
+ */
struct xm_driver {
struct pipe_screen *(*create_pipe_screen)( Display *display );
};
-/* Called by the libgl-xlib target code to build the rendering stack.
+/* This is the public interface to the ws/xlib module. Why isn't it
+ * being defined in that directory?
*/
-struct xm_driver *xlib_sw_winsys_init( void );
+struct sw_winsys *xlib_create_sw_winsys( Display *display );
+
#endif
diff --git a/src/gallium/targets/libgl-xlib/xlib.c b/src/gallium/targets/libgl-xlib/xlib.c
index 7cae0884e84..6651bd538ee 100644
--- a/src/gallium/targets/libgl-xlib/xlib.c
+++ b/src/gallium/targets/libgl-xlib/xlib.c
@@ -34,28 +34,71 @@
#include "state_tracker/xlib_sw_winsys.h"
#include "xm_winsys.h"
#include "util/u_debug.h"
-
+#include "softpipe/sp_public.h"
+#include "llvmpipe/lp_public.h"
+#include "cell/ppu/cell_public.h"
/* advertise OpenGL support */
PUBLIC const int st_api_OpenGL = 1;
-static void _init( void ) __attribute__((constructor));
+
+static struct pipe_screen *
+create_screen( struct sw_winsys *winsys )
+{
+#if defined(GALLIUM_CELL)
+ if (!getenv("GALLIUM_NOCELL"))
+ return cell_create_screen( winsys );
+#endif
+
+#if defined(GALLIUM_LLVMPIPE)
+ return llvmpipe_create_screen( winsys );
+#endif
+
+ return softpipe_create_screen( winsys );
+}
+
+
+
+static struct pipe_screen *
+xlib_create_screen( Display *display )
+{
+ struct sw_winsys *winsys;
+ struct pipe_screen *screen;
+
+ winsys = xlib_create_sw_winsys( display );
+ if (winsys == NULL)
+ return NULL;
+
+ screen = create_screen(winsys);
+ if (screen == NULL)
+ goto fail;
+
+ return screen;
+
+fail:
+ if (winsys)
+ winsys->destroy( winsys );
+
+ return NULL;
+}
+
+
+struct xm_driver xlib_driver =
+{
+ .create_pipe_screen = xlib_create_screen,
+};
+
+
+
/* Build the rendering stack.
*/
+static void _init( void ) __attribute__((constructor));
static void _init( void )
{
- struct xm_driver *driver;
-
- /* Initialize the xlib software winsys. Later on, once Display and
- * other parameters are known, this will be used to create the
- * gallium driver (such as softpipe), etc.
- */
- driver = xlib_sw_winsys_init();
-
/* Initialize the xlib libgl code, pass in the winsys:
*/
- xmesa_set_driver( driver );
+ xmesa_set_driver( &xlib_driver );
}
diff --git a/src/gallium/winsys/xlib/Makefile b/src/gallium/winsys/xlib/Makefile
index bb631b16cea..68542b488df 100644
--- a/src/gallium/winsys/xlib/Makefile
+++ b/src/gallium/winsys/xlib/Makefile
@@ -9,11 +9,7 @@ LIBRARY_INCLUDES = \
-I$(TOP)/src/gallium/auxiliary
C_SOURCES = \
- xlib.c \
- xlib_cell.c \
- xlib_sw_winsys.c \
- xlib_llvmpipe.c \
- xlib_softpipe.c
+ xlib_sw_winsys.c
include ../../Makefile.template
diff --git a/src/gallium/winsys/xlib/SConscript b/src/gallium/winsys/xlib/SConscript
index 1a1879f1287..d4009df9916 100644
--- a/src/gallium/winsys/xlib/SConscript
+++ b/src/gallium/winsys/xlib/SConscript
@@ -18,9 +18,6 @@ if env['platform'] == 'linux' \
ws_xlib = env.ConvenienceLibrary(
target = 'ws_xlib',
source = [
- 'xlib_cell.c',
- 'xlib_llvmpipe.c',
- 'xlib_softpipe.c',
'xlib_sw_winsys.c',
]
)
diff --git a/src/gallium/winsys/xlib/xlib.c b/src/gallium/winsys/xlib/xlib.c
deleted file mode 100644
index 6ca9e362e72..00000000000
--- a/src/gallium/winsys/xlib/xlib.c
+++ /dev/null
@@ -1,49 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2007 Tungsten Graphics, Inc., Bismarck, ND., USA
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- * USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- *
- **************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell
- */
-
-#include "xlib.h"
-#include "util/u_debug.h"
-
-struct xm_driver *xlib_sw_winsys_init( void )
-{
-#if defined(GALLIUM_CELL)
- if (!getenv("GALLIUM_NOCELL"))
- return &xlib_cell_driver;
-#endif
-
-#if defined(GALLIUM_LLVMPIPE)
- return &xlib_llvmpipe_driver;
-#endif
-
- return &xlib_softpipe_driver;
-}
diff --git a/src/gallium/winsys/xlib/xlib.h b/src/gallium/winsys/xlib/xlib.h
deleted file mode 100644
index 3c200486168..00000000000
--- a/src/gallium/winsys/xlib/xlib.h
+++ /dev/null
@@ -1,18 +0,0 @@
-
-#ifndef XLIB_H
-#define XLIB_H
-
-#include "pipe/p_compiler.h"
-#include "state_tracker/xlib_sw_winsys.h"
-
-extern struct xm_driver xlib_softpipe_driver;
-extern struct xm_driver xlib_llvmpipe_driver;
-extern struct xm_driver xlib_cell_driver;
-
-struct sw_winsys *xlib_create_sw_winsys( Display *display );
-
-void xlib_sw_display(struct xlib_drawable *xm_buffer,
- struct sw_displaytarget *dt);
-
-
-#endif
diff --git a/src/gallium/winsys/xlib/xlib_cell.c b/src/gallium/winsys/xlib/xlib_cell.c
deleted file mode 100644
index d943953bd1a..00000000000
--- a/src/gallium/winsys/xlib/xlib_cell.c
+++ /dev/null
@@ -1,95 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2007 Tungsten Graphics, Inc., Bismarck, ND., USA
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- * USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- *
- **************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell
- * Brian Paul
- */
-
-
-#include "xlib.h"
-
-#if defined(GALLIUM_CELL)
-
-#include "cell/ppu/cell_texture.h"
-#include "cell/ppu/cell_screen.h"
-#include "state_tracker/sw_winsys.h"
-#include "util/u_debug.h"
-
-
-/**
- * Display/copy the image in the surface into the X window specified
- * by the XMesaBuffer.
- */
-static void
-xm_cell_displaytarget_display(struct sw_winsys *ws,
- struct sw_displaytarget *dt,
- void *context_private)
-{
- struct xlib_drawable *xlib_drawable = (struct xlib_drawable *)context_private;
- xlib_sw_display(xlib_drawable, dt);
-}
-
-
-static struct pipe_screen *
-xlib_create_cell_screen( Display *dpy )
-{
- struct sw_winsys *winsys;
- struct pipe_screen *screen;
-
- winsys = xlib_create_sw_winsys( dpy );
- if (winsys == NULL)
- return NULL;
-
- /* Plug in a little cell-specific code:
- */
-
- winsys->displaytarget_display = xm_cell_displaytarget_display;
-
- screen = cell_create_screen(winsys);
- if (screen == NULL)
- goto fail;
-
- return screen;
-
-fail:
- if (winsys)
- winsys->destroy( winsys );
-
- return NULL;
-}
-
-
-struct xm_driver xlib_cell_driver =
-{
- .create_pipe_screen = xlib_create_cell_screen,
-};
-
-
-#endif /* GALLIUM_CELL */
diff --git a/src/gallium/winsys/xlib/xlib_llvmpipe.c b/src/gallium/winsys/xlib/xlib_llvmpipe.c
deleted file mode 100644
index 8b66b7459d9..00000000000
--- a/src/gallium/winsys/xlib/xlib_llvmpipe.c
+++ /dev/null
@@ -1,79 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2007 Tungsten Graphics, Inc., Bismarck, ND., USA
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- * USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- *
- **************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell
- * Brian Paul
- */
-
-
-
-
-#include "xlib.h"
-
-
-#if defined(GALLIUM_LLVMPIPE)
-
-#include "llvmpipe/lp_texture.h"
-#include "llvmpipe/lp_screen.h"
-#include "state_tracker/xlib_sw_winsys.h"
-#include "util/u_debug.h"
-
-static struct pipe_screen *
-xlib_create_llvmpipe_screen( Display *display )
-{
- struct sw_winsys *winsys;
- struct pipe_screen *screen;
-
- winsys = xlib_create_sw_winsys( display );
- if (winsys == NULL)
- return NULL;
-
- screen = llvmpipe_create_screen(winsys);
- if (screen == NULL)
- goto fail;
-
- return screen;
-
-fail:
- if (winsys)
- winsys->destroy( winsys );
-
- return NULL;
-}
-
-
-struct xm_driver xlib_llvmpipe_driver =
-{
- .create_pipe_screen = xlib_create_llvmpipe_screen,
-};
-
-
-
-#endif /* GALLIUM_LLVMPIPE */
diff --git a/src/gallium/winsys/xlib/xlib_softpipe.c b/src/gallium/winsys/xlib/xlib_softpipe.c
deleted file mode 100644
index 08b7f08837f..00000000000
--- a/src/gallium/winsys/xlib/xlib_softpipe.c
+++ /dev/null
@@ -1,68 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2007 Tungsten Graphics, Inc., Bismarck, ND., USA
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- * USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- *
- **************************************************************************/
-
-
-#include "xlib.h"
-#include "softpipe/sp_texture.h"
-#include "softpipe/sp_screen.h"
-#include "state_tracker/xlib_sw_winsys.h"
-#include "util/u_debug.h"
-
-static struct pipe_screen *
-xlib_create_softpipe_screen( Display *display )
-{
- struct sw_winsys *winsys;
- struct pipe_screen *screen;
-
- winsys = xlib_create_sw_winsys( display );
- if (winsys == NULL)
- return NULL;
-
- screen = softpipe_create_screen(winsys);
- if (screen == NULL)
- goto fail;
-
- return screen;
-
-fail:
- if (winsys)
- winsys->destroy( winsys );
-
- return NULL;
-}
-
-
-
-
-struct xm_driver xlib_softpipe_driver =
-{
- .create_pipe_screen = xlib_create_softpipe_screen,
-};
-
-
-
diff --git a/src/gallium/winsys/xlib/xlib_sw_winsys.c b/src/gallium/winsys/xlib/xlib_sw_winsys.c
index d03e39a2495..0ee589943e4 100644
--- a/src/gallium/winsys/xlib/xlib_sw_winsys.c
+++ b/src/gallium/winsys/xlib/xlib_sw_winsys.c
@@ -47,8 +47,6 @@
#include "state_tracker/xlib_sw_winsys.h"
-#include "xlib.h"
-
#include <X11/Xlib.h>
#include <X11/Xlibint.h>
#include <X11/Xutil.h>
@@ -274,7 +272,7 @@ xm_displaytarget_destroy(struct sw_winsys *ws,
* Display/copy the image in the surface into the X window specified
* by the XMesaBuffer.
*/
-void
+static void
xlib_sw_display(struct xlib_drawable *xlib_drawable,
struct sw_displaytarget *dt)
{