--- /dev/null
+#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
#include "cell_screen.h"
#include "cell_texture.h"
#include "cell_buffer.h"
+#include "cell_public.h"
#include "state_tracker/sw_winsys.h"
return (struct cell_screen *)pipe;
}
-extern struct pipe_screen *
-cell_create_screen(struct sw_winsys *winsys);
-
#endif /* CELL_SCREEN_H */
--- /dev/null
+#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
#include "lp_screen.h"
#include "lp_context.h"
#include "lp_debug.h"
+#include "lp_public.h"
#include "state_tracker/sw_winsys.h"
}
-struct pipe_screen *
-llvmpipe_create_screen(struct sw_winsys *winsys);
#endif /* LP_SCREEN_H */
--- /dev/null
+#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
#include "sp_screen.h"
#include "sp_context.h"
#include "sp_buffer.h"
+#include "sp_public.h"
static const char *
-/**
- * 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 */
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
#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 );
}
-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
ws_xlib = env.ConvenienceLibrary(
target = 'ws_xlib',
source = [
- 'xlib_cell.c',
- 'xlib_llvmpipe.c',
- 'xlib_softpipe.c',
'xlib_sw_winsys.c',
]
)
+++ /dev/null
-/**************************************************************************
- *
- * 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;
-}
+++ /dev/null
-
-#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
+++ /dev/null
-/**************************************************************************
- *
- * 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 */
+++ /dev/null
-/**************************************************************************
- *
- * 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 */
+++ /dev/null
-/**************************************************************************
- *
- * 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,
-};
-
-
-
#include "state_tracker/xlib_sw_winsys.h"
-#include "xlib.h"
-
#include <X11/Xlib.h>
#include <X11/Xlibint.h>
#include <X11/Xutil.h>
* 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)
{