diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/include/state_tracker/xlib_sw_winsys.h | 17 | ||||
-rw-r--r-- | src/gallium/state_trackers/glx/xlib/SConscript | 2 | ||||
-rw-r--r-- | src/gallium/state_trackers/glx/xlib/xm_winsys.h | 11 | ||||
-rw-r--r-- | src/gallium/targets/Makefile | 12 | ||||
-rw-r--r-- | src/gallium/targets/SConscript | 16 | ||||
-rw-r--r-- | src/gallium/targets/libgl-xlib/Makefile | 98 | ||||
-rw-r--r-- | src/gallium/targets/libgl-xlib/SConscript | 64 | ||||
-rw-r--r-- | src/gallium/targets/libgl-xlib/xlib.c (renamed from src/gallium/winsys/xlib/xlib.c) | 58 | ||||
-rw-r--r-- | src/gallium/winsys/xlib/Makefile | 90 | ||||
-rw-r--r-- | src/gallium/winsys/xlib/SConscript | 83 | ||||
-rw-r--r-- | src/gallium/winsys/xlib/xlib.h | 7 | ||||
-rw-r--r-- | src/gallium/winsys/xlib/xlib_brw_context.c | 209 | ||||
-rw-r--r-- | src/gallium/winsys/xlib/xlib_sw_winsys.c | 1 |
13 files changed, 250 insertions, 418 deletions
diff --git a/src/gallium/include/state_tracker/xlib_sw_winsys.h b/src/gallium/include/state_tracker/xlib_sw_winsys.h index 71d39b9cdb9..c703d3b66ca 100644 --- a/src/gallium/include/state_tracker/xlib_sw_winsys.h +++ b/src/gallium/include/state_tracker/xlib_sw_winsys.h @@ -4,7 +4,9 @@ #include "state_tracker/sw_winsys.h" #include <X11/Xlib.h> -struct sw_winsys *xlib_create_sw_winsys( Display *display ); + +struct pipe_screen; +struct pipe_surface; /* This is what the xlib software winsys expects to find in the * "private" field of flush_frontbuffers(). Xlib-based state trackers @@ -17,9 +19,16 @@ struct xlib_drawable { GC gc; /* temporary? */ }; -void -xlib_sw_display(struct xlib_drawable *xm_buffer, - struct sw_displaytarget *dt); +struct xm_driver { + struct pipe_screen *(*create_pipe_screen)( Display *display ); + + void (*display_surface)( struct xlib_drawable *, + struct pipe_surface * ); +}; + +/* Called by the libgl-xlib target code to build the rendering stack. + */ +struct xm_driver *xlib_sw_winsys_init( void ); #endif diff --git a/src/gallium/state_trackers/glx/xlib/SConscript b/src/gallium/state_trackers/glx/xlib/SConscript index fa96df357d5..bb202351509 100644 --- a/src/gallium/state_trackers/glx/xlib/SConscript +++ b/src/gallium/state_trackers/glx/xlib/SConscript @@ -13,8 +13,6 @@ if env['platform'] == 'linux' \ '#/src/mesa/main', ]) - env.Append(CPPDEFINES = ['USE_XSHM']) - st_xlib = env.ConvenienceLibrary( target = 'st_xlib', source = [ diff --git a/src/gallium/state_trackers/glx/xlib/xm_winsys.h b/src/gallium/state_trackers/glx/xlib/xm_winsys.h index fc4444bee0e..648f1c90efa 100644 --- a/src/gallium/state_trackers/glx/xlib/xm_winsys.h +++ b/src/gallium/state_trackers/glx/xlib/xm_winsys.h @@ -34,17 +34,6 @@ struct pipe_screen; struct pipe_surface; struct xlib_drawable; -#include <X11/Xlib.h> - -struct xm_driver { - - struct pipe_screen *(*create_pipe_screen)( Display *display ); - - void (*display_surface)( struct xlib_drawable *, - struct pipe_surface * ); - -}; - extern void xmesa_set_driver( const struct xm_driver *driver ); diff --git a/src/gallium/targets/Makefile b/src/gallium/targets/Makefile new file mode 100644 index 00000000000..a0bc5eb14fa --- /dev/null +++ b/src/gallium/targets/Makefile @@ -0,0 +1,12 @@ +# src/gallium/winsys/Makefile +TOP = ../../.. +include $(TOP)/configs/current + +SUBDIRS = $(GALLIUM_TARGET_DIRS) + +default install clean: + @for dir in $(SUBDIRS) ; do \ + if [ -d $$dir ] ; then \ + (cd $$dir && $(MAKE) $@) || exit 1; \ + fi \ + done diff --git a/src/gallium/targets/SConscript b/src/gallium/targets/SConscript new file mode 100644 index 00000000000..46cbe656f4f --- /dev/null +++ b/src/gallium/targets/SConscript @@ -0,0 +1,16 @@ +Import('*') + +#if env['dri']: +# SConscript([ +# 'drm/SConscript', +# ]) + +if 'xlib' in env['winsys']: + SConscript([ + 'libgl-xlib/SConscript', + ]) + +#if 'gdi' in env['winsys']: +# SConscript([ +# 'gdi/SConscript', +# ]) diff --git a/src/gallium/targets/libgl-xlib/Makefile b/src/gallium/targets/libgl-xlib/Makefile new file mode 100644 index 00000000000..8ffe4dbf242 --- /dev/null +++ b/src/gallium/targets/libgl-xlib/Makefile @@ -0,0 +1,98 @@ +# src/gallium/targets/libgl-xlib/Makefile + +# This makefile produces a "stand-alone" libGL.so which is based on +# Xlib (no DRI HW acceleration) + + +TOP = ../../../.. +include $(TOP)/configs/current + + +GL_MAJOR = 1 +GL_MINOR = 5 +GL_TINY = 0$(MESA_MAJOR)0$(MESA_MINOR)0$(MESA_TINY) + + +INCLUDE_DIRS = \ + -I$(TOP)/include \ + -I$(TOP)/src/mesa \ + -I$(TOP)/src/mesa/main \ + -I$(TOP)/src/gallium/include \ + -I$(TOP)/src/gallium/drivers \ + -I$(TOP)/src/gallium/state_trackers/glx/xlib \ + -I$(TOP)/src/gallium/auxiliary + +DEFINES += \ + -DGALLIUM_SOFTPIPE +#-DGALLIUM_CELL will be defined by the config */ + +XLIB_TARGET_SOURCES = \ + xlib.c + + +XLIB_TARGET_OBJECTS = $(XLIB_TARGET_SOURCES:.c=.o) + + +# Note: CELL_SPU_LIB is only defined for cell configs + +LIBS = \ + $(GALLIUM_DRIVERS) \ + $(TOP)/src/gallium/state_trackers/glx/xlib/libxlib.a \ + $(TOP)/src/gallium/winsys/xlib/libws_xlib.a \ + $(TOP)/src/mesa/libglapi.a \ + $(TOP)/src/mesa/libmesagallium.a \ + $(GALLIUM_AUXILIARIES) \ + $(CELL_SPU_LIB) \ + + +.SUFFIXES : .cpp + +.c.o: + $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@ + +.cpp.o: + $(CXX) -c $(INCLUDE_DIRS) $(CXXFLAGS) $< -o $@ + + + +default: $(TOP)/$(LIB_DIR)/gallium $(TOP)/$(LIB_DIR)/gallium/$(GL_LIB_NAME) + +$(TOP)/$(LIB_DIR)/gallium: + @ mkdir -p $(TOP)/$(LIB_DIR)/gallium + +# Make the libGL.so library +$(TOP)/$(LIB_DIR)/gallium/$(GL_LIB_NAME): $(XLIB_TARGET_OBJECTS) $(LIBS) Makefile + $(TOP)/bin/mklib -o $(GL_LIB) \ + -linker "$(CC)" \ + -major $(GL_MAJOR) -minor $(GL_MINOR) -patch $(GL_TINY) \ + -install $(TOP)/$(LIB_DIR)/gallium \ + $(MKLIB_OPTIONS) $(XLIB_TARGET_OBJECTS) \ + -Wl,--start-group $(LIBS) -Wl,--end-group $(GL_LIB_DEPS) + + +depend: $(XLIB_TARGET_SOURCES) + @ echo "running $(MKDEP)" + @ rm -f depend # workaround oops on gutsy?!? + @ touch depend + $(MKDEP) $(MKDEP_OPTIONS) $(DEFINES) $(INCLUDE_DIRS) $(XLIB_TARGET_SOURCES) \ + > /dev/null 2>/dev/null + + +install: default + $(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/include/GL + $(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR) + $(INSTALL) -m 644 $(TOP)/include/GL/*.h $(DESTDIR)$(INSTALL_DIR)/include/GL + @if [ -e $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME) ]; then \ + $(MINSTALL) $(TOP)/$(LIB_DIR)/libGL* $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR); \ + fi + + +# Emacs tags +tags: + etags `find . -name \*.[ch]` $(TOP)/include/GL/*.h + +clean: + -rm -f *.o + + +include depend diff --git a/src/gallium/targets/libgl-xlib/SConscript b/src/gallium/targets/libgl-xlib/SConscript new file mode 100644 index 00000000000..92e508ee50c --- /dev/null +++ b/src/gallium/targets/libgl-xlib/SConscript @@ -0,0 +1,64 @@ +####################################################################### +# SConscript for xlib winsys + +Import('*') + +if env['platform'] != 'linux': + Return() + +if 'mesa' not in env['statetrackers']: + print 'warning: Mesa state tracker disabled: skipping build of xlib libGL.so' + Return() + +if env['dri']: + print 'warning: DRI enabled: skipping build of xlib libGL.so' + Return() + +if not set(('softpipe', 'llvmpipe', 'cell')).intersection(env['drivers']): + print 'warning: no supported pipe driver: skipping build of xlib libGL.so' + Return() + +env = env.Clone() + +env.Append(CPPPATH = [ + '#/src/mesa', + '#/src/mesa/main', + '#src/gallium/state_trackers/glx/xlib', +]) + +env.Append(CPPDEFINES = ['USE_XSHM']) + +sources = [ + 'xlib.c', +] + +drivers = [trace] + +if 'softpipe' in env['drivers']: + env.Append(CPPDEFINES = 'GALLIUM_SOFTPIPE') + sources += ['xlib_softpipe.c', 'xlib_sw_winsys.c'] + drivers += [softpipe] + +if 'llvmpipe' in env['drivers']: + env.Tool('llvm') + if 'LLVM_VERSION' in env: + env.Append(CPPDEFINES = 'GALLIUM_LLVMPIPE') + env.Tool('udis86') + sources += ['xlib_llvmpipe.c', 'xlib_sw_winsys.c'] + drivers += [llvmpipe] + +if 'cell' in env['drivers']: + env.Append(CPPDEFINES = 'GALLIUM_CELL') + sources += ['xlib_cell.c'] + drivers += [cell] + +# TODO: write a wrapper function http://www.scons.org/wiki/WrapperFunctions +libgl = env.SharedLibrary( + target ='GL', + source = sources, + LIBS = st_xlib + glapi + mesa + glsl + drivers + gallium + env['LIBS'], +) + +if not env['dri']: + # Only install this libGL.so if DRI not enabled + env.InstallSharedLibrary(libgl, version=(1, 5)) diff --git a/src/gallium/winsys/xlib/xlib.c b/src/gallium/targets/libgl-xlib/xlib.c index 9b91c980d15..7cae0884e84 100644 --- a/src/gallium/winsys/xlib/xlib.c +++ b/src/gallium/targets/libgl-xlib/xlib.c @@ -31,63 +31,31 @@ * Keith Whitwell */ -#include "xlib.h" +#include "state_tracker/xlib_sw_winsys.h" #include "xm_winsys.h" #include "util/u_debug.h" -/* Todo, replace all this with callback-structs provided by the - * individual implementations. - */ - -enum mode { - MODE_CELL, - MODE_LLVMPIPE, - MODE_SOFTPIPE -}; /* advertise OpenGL support */ PUBLIC const int st_api_OpenGL = 1; -static enum mode get_mode() -{ -#ifdef GALLIUM_CELL - if (!getenv("GALLIUM_NOCELL")) - return MODE_CELL; -#endif - -#if defined(GALLIUM_LLVMPIPE) - return MODE_LLVMPIPE; -#else - return MODE_SOFTPIPE; -#endif -} - static void _init( void ) __attribute__((constructor)); +/* Build the rendering stack. + */ static void _init( void ) { - enum mode xlib_mode = get_mode(); + struct xm_driver *driver; - switch (xlib_mode) { - case MODE_CELL: -#if defined(GALLIUM_CELL) - xmesa_set_driver( &xlib_cell_driver ); -#endif - break; - case MODE_LLVMPIPE: -#if defined(GALLIUM_LLVMPIPE) - xmesa_set_driver( &xlib_llvmpipe_driver ); -#endif - break; - case MODE_SOFTPIPE: -#if defined(GALLIUM_SOFTPIPE) - xmesa_set_driver( &xlib_softpipe_driver ); -#endif - break; - default: - assert(0); - break; - } + /* 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 ); } diff --git a/src/gallium/winsys/xlib/Makefile b/src/gallium/winsys/xlib/Makefile index 129300423a6..056b6a308fd 100644 --- a/src/gallium/winsys/xlib/Makefile +++ b/src/gallium/winsys/xlib/Makefile @@ -1,101 +1,19 @@ -# src/gallium/winsys/xlib/Makefile - -# This makefile produces a "stand-alone" libGL.so which is based on -# Xlib (no DRI HW acceleration) - - TOP = ../../../.. include $(TOP)/configs/current +LIBNAME = ws_xlib -GL_MAJOR = 1 -GL_MINOR = 5 -GL_TINY = 0$(MESA_MAJOR)0$(MESA_MINOR)0$(MESA_TINY) - - -INCLUDE_DIRS = \ - -I$(TOP)/include \ - -I$(TOP)/src/mesa \ - -I$(TOP)/src/mesa/main \ +LIBRARY_INCLUDES = \ -I$(TOP)/src/gallium/include \ -I$(TOP)/src/gallium/drivers \ - -I$(TOP)/src/gallium/state_trackers/glx/xlib \ -I$(TOP)/src/gallium/auxiliary -DEFINES += \ - -DGALLIUM_SOFTPIPE -#-DGALLIUM_CELL will be defined by the config */ - -XLIB_WINSYS_SOURCES = \ - xlib.c \ +C_SOURCES = \ xlib_cell.c \ xlib_sw_winsys.c \ xlib_llvmpipe.c \ xlib_softpipe.c - -XLIB_WINSYS_OBJECTS = $(XLIB_WINSYS_SOURCES:.c=.o) - - -# Note: CELL_SPU_LIB is only defined for cell configs - -LIBS = \ - $(GALLIUM_DRIVERS) \ - $(TOP)/src/gallium/state_trackers/glx/xlib/libxlib.a \ - $(TOP)/src/mesa/libglapi.a \ - $(TOP)/src/mesa/libmesagallium.a \ - $(GALLIUM_AUXILIARIES) \ - $(CELL_SPU_LIB) \ - - -.SUFFIXES : .cpp - -.c.o: - $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@ - -.cpp.o: - $(CXX) -c $(INCLUDE_DIRS) $(CXXFLAGS) $< -o $@ - - - -default: $(TOP)/$(LIB_DIR)/gallium $(TOP)/$(LIB_DIR)/gallium/$(GL_LIB_NAME) - -$(TOP)/$(LIB_DIR)/gallium: - @ mkdir -p $(TOP)/$(LIB_DIR)/gallium - -# Make the libGL.so library -$(TOP)/$(LIB_DIR)/gallium/$(GL_LIB_NAME): $(XLIB_WINSYS_OBJECTS) $(LIBS) Makefile - $(TOP)/bin/mklib -o $(GL_LIB) \ - -linker "$(CC)" \ - -major $(GL_MAJOR) -minor $(GL_MINOR) -patch $(GL_TINY) \ - -install $(TOP)/$(LIB_DIR)/gallium \ - $(MKLIB_OPTIONS) $(XLIB_WINSYS_OBJECTS) \ - -Wl,--start-group $(LIBS) -Wl,--end-group $(GL_LIB_DEPS) - - -depend: $(XLIB_WINSYS_SOURCES) - @ echo "running $(MKDEP)" - @ rm -f depend # workaround oops on gutsy?!? - @ touch depend - $(MKDEP) $(MKDEP_OPTIONS) $(DEFINES) $(INCLUDE_DIRS) $(XLIB_WINSYS_SOURCES) \ - > /dev/null 2>/dev/null - - -install: default - $(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/include/GL - $(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR) - $(INSTALL) -m 644 $(TOP)/include/GL/*.h $(DESTDIR)$(INSTALL_DIR)/include/GL - @if [ -e $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME) ]; then \ - $(MINSTALL) $(TOP)/$(LIB_DIR)/libGL* $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR); \ - fi - - -# Emacs tags -tags: - etags `find . -name \*.[ch]` $(TOP)/include/GL/*.h - -clean: - -rm -f *.o +include ../../Makefile.template -include depend diff --git a/src/gallium/winsys/xlib/SConscript b/src/gallium/winsys/xlib/SConscript index 92e508ee50c..26a13e42b5c 100644 --- a/src/gallium/winsys/xlib/SConscript +++ b/src/gallium/winsys/xlib/SConscript @@ -1,64 +1,29 @@ ####################################################################### # SConscript for xlib winsys -Import('*') - -if env['platform'] != 'linux': - Return() - -if 'mesa' not in env['statetrackers']: - print 'warning: Mesa state tracker disabled: skipping build of xlib libGL.so' - Return() - -if env['dri']: - print 'warning: DRI enabled: skipping build of xlib libGL.so' - Return() - -if not set(('softpipe', 'llvmpipe', 'cell')).intersection(env['drivers']): - print 'warning: no supported pipe driver: skipping build of xlib libGL.so' - Return() - -env = env.Clone() -env.Append(CPPPATH = [ - '#/src/mesa', - '#/src/mesa/main', - '#src/gallium/state_trackers/glx/xlib', -]) - -env.Append(CPPDEFINES = ['USE_XSHM']) - -sources = [ - 'xlib.c', -] - -drivers = [trace] - -if 'softpipe' in env['drivers']: - env.Append(CPPDEFINES = 'GALLIUM_SOFTPIPE') - sources += ['xlib_softpipe.c', 'xlib_sw_winsys.c'] - drivers += [softpipe] - -if 'llvmpipe' in env['drivers']: - env.Tool('llvm') - if 'LLVM_VERSION' in env: - env.Append(CPPDEFINES = 'GALLIUM_LLVMPIPE') - env.Tool('udis86') - sources += ['xlib_llvmpipe.c', 'xlib_sw_winsys.c'] - drivers += [llvmpipe] - -if 'cell' in env['drivers']: - env.Append(CPPDEFINES = 'GALLIUM_CELL') - sources += ['xlib_cell.c'] - drivers += [cell] - -# TODO: write a wrapper function http://www.scons.org/wiki/WrapperFunctions -libgl = env.SharedLibrary( - target ='GL', - source = sources, - LIBS = st_xlib + glapi + mesa + glsl + drivers + gallium + env['LIBS'], -) +Import('*') -if not env['dri']: - # Only install this libGL.so if DRI not enabled - env.InstallSharedLibrary(libgl, version=(1, 5)) +if env['platform'] == 'linux' \ + and 'mesa' in env['statetrackers']: + + env = env.Clone() + + env.Append(CPPPATH = [ + '#/src/gallium/include', + '#/src/gallium/auxiliary', + '#/src/gallium/drivers', + ]) + + env.Append(CPPDEFINES = ['USE_XSHM']) + + st_xlib = env.ConvenienceLibrary( + target = 'ws_xlib', + source = [ + 'xlib_cell.c', + 'xlib_llvmpipe.c', + 'xlib_softpipe.c', + 'xlib_sw_winsys.c', + ] + ) + Export('ws_xlib') diff --git a/src/gallium/winsys/xlib/xlib.h b/src/gallium/winsys/xlib/xlib.h index 8e091d0c084..3c200486168 100644 --- a/src/gallium/winsys/xlib/xlib.h +++ b/src/gallium/winsys/xlib/xlib.h @@ -3,11 +3,16 @@ #define XLIB_H #include "pipe/p_compiler.h" -#include "xm_winsys.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_brw_context.c b/src/gallium/winsys/xlib/xlib_brw_context.c deleted file mode 100644 index 22bf41a46f7..00000000000 --- a/src/gallium/winsys/xlib/xlib_brw_context.c +++ /dev/null @@ -1,209 +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 "glxheader.h" */ -/* #include "xmesaP.h" */ - -#include "util/u_simple_screen.h" -#include "util/u_inlines.h" -#include "util/u_math.h" -#include "util/u_memory.h" -#include "i965simple/brw_winsys.h" -#include "xlib_brw_aub.h" -#include "xlib_brw.h" - - - - -#define XBCWS_BATCHBUFFER_SIZE 1024 - - -/* The backend to the brw driver (ie struct brw_winsys) is actually a - * per-context entity. - */ -struct xlib_brw_context_winsys { - struct brw_winsys brw_context_winsys; /**< batch buffer funcs */ - struct aub_context *aub; - - struct pipe_winsys *pipe_winsys; - - unsigned batch_data[XBCWS_BATCHBUFFER_SIZE]; - unsigned batch_nr; - unsigned batch_size; - unsigned batch_alloc; -}; - - -/* Turn a brw_winsys into an xlib_brw_context_winsys: - */ -static inline struct xlib_brw_context_winsys * -xlib_brw_context_winsys( struct brw_winsys *sws ) -{ - return (struct xlib_brw_context_winsys *)sws; -} - - -/* Simple batchbuffer interface: - */ - -static unsigned *xbcws_batch_start( struct brw_winsys *sws, - unsigned dwords, - unsigned relocs ) -{ - struct xlib_brw_context_winsys *xbcws = xlib_brw_context_winsys(sws); - - if (xbcws->batch_size < xbcws->batch_nr + dwords) - return NULL; - - xbcws->batch_alloc = xbcws->batch_nr + dwords; - return (void *)1; /* not a valid pointer! */ -} - -static void xbcws_batch_dword( struct brw_winsys *sws, - unsigned dword ) -{ - struct xlib_brw_context_winsys *xbcws = xlib_brw_context_winsys(sws); - - assert(xbcws->batch_nr < xbcws->batch_alloc); - xbcws->batch_data[xbcws->batch_nr++] = dword; -} - -static void xbcws_batch_reloc( struct brw_winsys *sws, - struct pipe_buffer *buf, - unsigned access_flags, - unsigned delta ) -{ - struct xlib_brw_context_winsys *xbcws = xlib_brw_context_winsys(sws); - - assert(xbcws->batch_nr < xbcws->batch_alloc); - xbcws->batch_data[xbcws->batch_nr++] = - ( xlib_brw_get_buffer_offset( NULL, buf, access_flags ) + - delta ); -} - -static void xbcws_batch_end( struct brw_winsys *sws ) -{ - struct xlib_brw_context_winsys *xbcws = xlib_brw_context_winsys(sws); - - assert(xbcws->batch_nr <= xbcws->batch_alloc); - xbcws->batch_alloc = 0; -} - -static void xbcws_batch_flush( struct brw_winsys *sws, - struct pipe_fence_handle **fence ) -{ - struct xlib_brw_context_winsys *xbcws = xlib_brw_context_winsys(sws); - assert(xbcws->batch_nr <= xbcws->batch_size); - - if (xbcws->batch_nr) { - xlib_brw_commands_aub( xbcws->pipe_winsys, - xbcws->batch_data, - xbcws->batch_nr ); - } - - xbcws->batch_nr = 0; -} - - - -/* Really a per-device function, just pass through: - */ -static unsigned xbcws_get_buffer_offset( struct brw_winsys *sws, - struct pipe_buffer *buf, - unsigned access_flags ) -{ - struct xlib_brw_context_winsys *xbcws = xlib_brw_context_winsys(sws); - - return xlib_brw_get_buffer_offset( xbcws->pipe_winsys, - buf, - access_flags ); -} - - -/* Really a per-device function, just pass through: - */ -static void xbcws_buffer_subdata_typed( struct brw_winsys *sws, - struct pipe_buffer *buf, - unsigned long offset, - unsigned long size, - const void *data, - unsigned data_type ) -{ - struct xlib_brw_context_winsys *xbcws = xlib_brw_context_winsys(sws); - - xlib_brw_buffer_subdata_typed( xbcws->pipe_winsys, - buf, - offset, - size, - data, - data_type ); -} - - -/** - * Create i965 hardware rendering context, but plugged into a - * dump-to-aubfile backend. - */ -struct pipe_context * -xlib_create_brw_context( struct pipe_screen *screen, - void *unused ) -{ - struct xlib_brw_context_winsys *xbcws = CALLOC_STRUCT( xlib_brw_context_winsys ); - - /* Fill in this struct with callbacks that i965simple will need to - * communicate with the window system, buffer manager, etc. - */ - xbcws->brw_context_winsys.batch_start = xbcws_batch_start; - xbcws->brw_context_winsys.batch_dword = xbcws_batch_dword; - xbcws->brw_context_winsys.batch_reloc = xbcws_batch_reloc; - xbcws->brw_context_winsys.batch_end = xbcws_batch_end; - xbcws->brw_context_winsys.batch_flush = xbcws_batch_flush; - xbcws->brw_context_winsys.buffer_subdata_typed = xbcws_buffer_subdata_typed; - xbcws->brw_context_winsys.get_buffer_offset = xbcws_get_buffer_offset; - - xbcws->pipe_winsys = screen->winsys; /* redundant */ - - xbcws->batch_size = XBCWS_BATCHBUFFER_SIZE; - - /* Create the i965simple context: - */ -#ifdef GALLIUM_CELL - return NULL; -#else - return brw_create( screen, - &xbcws->brw_context_winsys, - 0 ); -#endif -} diff --git a/src/gallium/winsys/xlib/xlib_sw_winsys.c b/src/gallium/winsys/xlib/xlib_sw_winsys.c index 21649a0b1f5..3e8fefb5824 100644 --- a/src/gallium/winsys/xlib/xlib_sw_winsys.c +++ b/src/gallium/winsys/xlib/xlib_sw_winsys.c @@ -34,7 +34,6 @@ -#include "xm_api.h" #undef ASSERT #undef Elements |