Commit 3c57c01a authored by Keith Whitwell's avatar Keith Whitwell

ws/xlib: remove self-knowledge about users of xlib winsys

Several software rasterizers can make use of this winsys, but there
isn't any reason why the winsys itself should know about them.

This change moves that information into the libgl-xlib target.

Need to fix up other targets making use of this winsys.
parent 27a7f945
#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
......@@ -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"
......
......@@ -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 */
#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
......@@ -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"
......
......@@ -76,7 +76,5 @@ llvmpipe_screen( struct pipe_screen *pipe )
}
struct pipe_screen *
llvmpipe_create_screen(struct sw_winsys *winsys);
#endif /* LP_SCREEN_H */
#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
......@@ -36,6 +36,7 @@
#include "sp_screen.h"
#include "sp_context.h"
#include "sp_buffer.h"
#include "sp_public.h"
static const char *
......
......@@ -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 */
......@@ -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
......@@ -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 );
}
......
......@@ -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
......
......@@ -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',
]
)
......
/**************************************************************************
*
* 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;
}
#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
/**************************************************************************
*
* 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 */
/**************************************************************************
*
* 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 */
/**************************************************************************
*
* 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,
};
......@@ -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)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment