gallium: create helper for swrast+xlib combination
Several targets may want to reuse this code. It's pretty simple, not sure if this is really a win.
This commit is contained in:
parent
c27ffc5215
commit
d0aea65032
|
@ -131,7 +131,8 @@ C_SOURCES = \
|
||||||
vl/vl_mpeg12_mc_renderer.c \
|
vl/vl_mpeg12_mc_renderer.c \
|
||||||
vl/vl_compositor.c \
|
vl/vl_compositor.c \
|
||||||
vl/vl_csc.c \
|
vl/vl_csc.c \
|
||||||
vl/vl_shader_build.c
|
vl/vl_shader_build.c \
|
||||||
|
target-helpers/swrast_xlib.c
|
||||||
|
|
||||||
GALLIVM_SOURCES = \
|
GALLIVM_SOURCES = \
|
||||||
gallivm/lp_bld_alpha.c \
|
gallivm/lp_bld_alpha.c \
|
||||||
|
|
|
@ -9,8 +9,9 @@ struct pipe_screen;
|
||||||
struct pipe_surface;
|
struct pipe_surface;
|
||||||
|
|
||||||
/* This is what the xlib software winsys expects to find in the
|
/* This is what the xlib software winsys expects to find in the
|
||||||
* "private" field of flush_frontbuffers(). Xlib-based state trackers
|
* "private" field of flush_frontbuffers().
|
||||||
* somehow need to know this.
|
*
|
||||||
|
* Xlib-based state trackers somehow need to know this.
|
||||||
*/
|
*/
|
||||||
struct xlib_drawable {
|
struct xlib_drawable {
|
||||||
Visual *visual;
|
Visual *visual;
|
||||||
|
@ -18,12 +19,6 @@ struct xlib_drawable {
|
||||||
Drawable 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 );
|
|
||||||
};
|
|
||||||
|
|
||||||
/* This is the public interface to the ws/xlib module. Why isn't it
|
/* This is the public interface to the ws/xlib module. Why isn't it
|
||||||
* being defined in that directory?
|
* being defined in that directory?
|
||||||
|
|
|
@ -63,7 +63,7 @@
|
||||||
#include "pipe/p_screen.h"
|
#include "pipe/p_screen.h"
|
||||||
#include "pipe/p_context.h"
|
#include "pipe/p_context.h"
|
||||||
|
|
||||||
#include "xm_winsys.h"
|
#include "xm_public.h"
|
||||||
#include <GL/glx.h>
|
#include <GL/glx.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -29,11 +29,13 @@
|
||||||
#ifndef XM_WINSYS_H
|
#ifndef XM_WINSYS_H
|
||||||
#define XM_WINSYS_H
|
#define XM_WINSYS_H
|
||||||
|
|
||||||
struct pipe_context;
|
struct xm_driver;
|
||||||
struct pipe_screen;
|
|
||||||
struct pipe_surface;
|
|
||||||
struct xlib_drawable;
|
|
||||||
|
|
||||||
|
/* This is the driver interface required by the glx/xlib state tracker.
|
||||||
|
*/
|
||||||
|
struct xm_driver {
|
||||||
|
struct pipe_screen *(*create_pipe_screen)( Display *display );
|
||||||
|
};
|
||||||
|
|
||||||
extern void
|
extern void
|
||||||
xmesa_set_driver( const struct xm_driver *driver );
|
xmesa_set_driver( const struct xm_driver *driver );
|
|
@ -30,81 +30,19 @@
|
||||||
* Authors:
|
* Authors:
|
||||||
* Keith Whitwell
|
* Keith Whitwell
|
||||||
*/
|
*/
|
||||||
|
#include "pipe/p_compiler.h"
|
||||||
#include "state_tracker/xlib_sw_winsys.h"
|
#include "target-helpers/swrast_xlib.h"
|
||||||
#include "xm_winsys.h"
|
#include "xm_public.h"
|
||||||
#include "util/u_debug.h"
|
|
||||||
#include "softpipe/sp_public.h"
|
|
||||||
#include "llvmpipe/lp_public.h"
|
|
||||||
#include "identity/id_public.h"
|
|
||||||
#include "trace/tr_public.h"
|
|
||||||
#include "cell/ppu/cell_public.h"
|
|
||||||
|
|
||||||
|
|
||||||
/* advertise OpenGL support */
|
/* advertise OpenGL support */
|
||||||
PUBLIC const int st_api_OpenGL = 1;
|
PUBLIC const int st_api_OpenGL = 1;
|
||||||
|
|
||||||
|
|
||||||
static struct pipe_screen *
|
|
||||||
create_screen( struct sw_winsys *winsys )
|
|
||||||
{
|
|
||||||
#if defined(GALLIUM_CELL)
|
|
||||||
if (!debug_get_bool_option("GALLIUM_NOCELL", FALSE))
|
|
||||||
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;
|
|
||||||
|
|
||||||
/* Finally we have somewhere to inject layers into the stack in a
|
|
||||||
* clean fashion:
|
|
||||||
*/
|
|
||||||
if (debug_get_bool_option("GALLIUM_WRAP", FALSE)) {
|
|
||||||
screen = identity_screen_create(screen);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (debug_get_bool_option("GALLIUM_TRACE", FALSE)) {
|
|
||||||
screen = trace_screen_create( screen );
|
|
||||||
}
|
|
||||||
|
|
||||||
return screen;
|
|
||||||
|
|
||||||
fail:
|
|
||||||
if (winsys)
|
|
||||||
winsys->destroy( winsys );
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
struct xm_driver xlib_driver =
|
struct xm_driver xlib_driver =
|
||||||
{
|
{
|
||||||
.create_pipe_screen = xlib_create_screen,
|
.create_pipe_screen = swrast_xlib_create_screen,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Build the rendering stack.
|
/* Build the rendering stack.
|
||||||
*/
|
*/
|
||||||
static void _init( void ) __attribute__((constructor));
|
static void _init( void ) __attribute__((constructor));
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
#include "pipe/p_error.h"
|
#include "pipe/p_error.h"
|
||||||
#include "pipe/p_context.h"
|
#include "pipe/p_context.h"
|
||||||
|
|
||||||
#include "xm_winsys.h"
|
#include "xm_public.h"
|
||||||
|
|
||||||
#include "i965/brw_winsys.h"
|
#include "i965/brw_winsys.h"
|
||||||
#include "i965/brw_screen.h"
|
#include "i965/brw_screen.h"
|
||||||
|
|
Loading…
Reference in New Issue