diff options
author | Christian König <[email protected]> | 2010-11-11 21:07:42 +0100 |
---|---|---|
committer | Christian König <[email protected]> | 2010-11-11 21:07:42 +0100 |
commit | 195bbe8ce218533569dde1368d04da0fd229913d (patch) | |
tree | 29d3db04673f59dcfd6663c524a5c1343d5cbee6 /src/gallium/targets | |
parent | 99b57bc20e839043ec6160502814085a0976fccc (diff) | |
parent | d67df5dd9db1cede92f1b177c890f83809bb4582 (diff) |
Merge remote branch 'origin/master' into pipe-video
Diffstat (limited to 'src/gallium/targets')
26 files changed, 561 insertions, 592 deletions
diff --git a/src/gallium/targets/Makefile.dri b/src/gallium/targets/Makefile.dri index 59961e982aa..3fb4cc6b861 100644 --- a/src/gallium/targets/Makefile.dri +++ b/src/gallium/targets/Makefile.dri @@ -80,7 +80,7 @@ $(LIBNAME): $(OBJECTS) $(MESA_MODULES) $(PIPE_DRIVERS) Makefile \ $(OBJECTS) $(PIPE_DRIVERS) \ -Wl,--start-group $(MESA_MODULES) -Wl,--end-group \ $(DRI_LIB_DEPS) $(DRIVER_EXTRAS) - $(CXX) $(CFLAGS) -o [email protected] $(TOP)/src/mesa/drivers/dri/common/dri_test.o [email protected] $(DRI_LIB_DEPS); + $(CXX) $(CFLAGS) -o [email protected] $(TOP)/src/mesa/drivers/dri/common/dri_test.o [email protected] $(DRI_LIB_DEPS) $(LDFLAGS); @rm -f [email protected] mv -f [email protected] $@ diff --git a/src/gallium/targets/Makefile.xorg b/src/gallium/targets/Makefile.xorg index 87eedd7136c..47040bb14c8 100644 --- a/src/gallium/targets/Makefile.xorg +++ b/src/gallium/targets/Makefile.xorg @@ -42,7 +42,7 @@ endif default: depend $(TOP)/$(LIB_DIR)/gallium $(LIBNAME) $(LIBNAME_STAGING) $(LIBNAME): $(OBJECTS) Makefile ../Makefile.xorg $(LIBS) $(DRIVER_PIPES) - $(MKLIB) -linker $(CC) -noprefix -o $@ $(LDFLAGS) $(OBJECTS) $(DRIVER_PIPES) $(GALLIUM_AUXILIARIES) $(DRIVER_LINKS) + $(MKLIB) -linker '$(CC)' -noprefix -o $@ $(LDFLAGS) $(OBJECTS) $(DRIVER_PIPES) $(GALLIUM_AUXILIARIES) $(DRIVER_LINKS) depend: $(C_SOURCES) $(CPP_SOURCES) $(ASM_SOURCES) $(SYMLINKS) $(GENERATED_SOURCES) rm -f depend diff --git a/src/gallium/targets/SConscript b/src/gallium/targets/SConscript deleted file mode 100644 index e447d093610..00000000000 --- a/src/gallium/targets/SConscript +++ /dev/null @@ -1,41 +0,0 @@ -import os -Import('*') - -# Compatibility with old build scripts: -# -if 'mesa' in env['statetrackers']: - if 'xlib' in env['winsys'] and 'libgl-xlib' not in env['targets']: - env['targets'].append('libgl-xlib') - if 'gdi' in env['winsys'] and 'libgl-gdi' not in env['targets']: - env['targets'].append('libgl-gdi') - -if not 'graw-xlib' in env['targets'] and not 'graw-null' in env['targets'] and not env['msvc']: - # XXX: disable until MSVC can link correctly - SConscript('graw-null/SConscript') - - -if env['dri']: - SConscript([ - 'SConscript.dri' - ]) - -if 'xorg' in env['statetrackers']: - if 'vmware' in env['winsys']: - SConscript([ - 'xorg-vmwgfx/SConscript', - ]) - -if 'egl' in env['statetrackers']: - SConscript([ - 'egl-gdi/SConscript', - ]) - -# Ideally all non-target directories would produce convenience -# libraries, and the actual shared libraries and other installables -# would be finally assembled in the targets subtree: -# -for target in env['targets']: - SConscript(os.path.join(target, 'SConscript')) - - - diff --git a/src/gallium/targets/SConscript.dri b/src/gallium/targets/SConscript.dri index bc8d179e3d9..bc3671a256b 100644 --- a/src/gallium/targets/SConscript.dri +++ b/src/gallium/targets/SConscript.dri @@ -3,68 +3,71 @@ Import('*') +if not env['dri']: + Return() + drienv = env.Clone() drienv.Replace(CPPPATH = [ - '#src/mesa/drivers/dri/common', - '#include', - '#include/GL/internal', - '#src/mapi', - '#src/gallium/include', - '#src/gallium/auxiliary', - '#src/gallium/drivers', - '#src/gallium/winsys', - '#src/mesa', - '#src/mesa/main', - '#src/mesa/glapi', - '#src/mesa/math', - '#src/mesa/transform', - '#src/mesa/shader', - '#src/mesa/swrast', - '#src/mesa/swrast_setup', - '#src/egl/main', - '#src/egl/drivers/dri', + '#src/mesa/drivers/dri/common', + '#include', + '#include/GL/internal', + '#src/mapi', + '#src/gallium/include', + '#src/gallium/auxiliary', + '#src/gallium/drivers', + '#src/gallium/winsys', + '#src/mesa', + '#src/mesa/main', + '#src/mesa/glapi', + '#src/mesa/math', + '#src/mesa/transform', + '#src/mesa/shader', + '#src/mesa/swrast', + '#src/mesa/swrast_setup', + '#src/egl/main', + '#src/egl/drivers/dri', ]) drienv.ParseConfig('pkg-config --cflags --libs libdrm') dri_common_utils = drienv.SharedObject( - target = 'utils.o', - source = '#src/mesa/drivers/dri/common/utils.c' + target = 'utils.o', + source = '#src/mesa/drivers/dri/common/utils.c' ) dri_common_xmlconfig = drienv.SharedObject( - target = 'xmlconfig.o', - source = '#src/mesa/drivers/dri/common/xmlconfig.c' + target = 'xmlconfig.o', + source = '#src/mesa/drivers/dri/common/xmlconfig.c' ) dri_common_vblank = drienv.SharedObject( - target = 'vblank.o', - source = '#src/mesa/drivers/dri/common/vblank.c' + target = 'vblank.o', + source = '#src/mesa/drivers/dri/common/vblank.c' ) dri_common_dri_util = drienv.SharedObject( - target = 'dri_util.o', - source = '#src/mesa/drivers/dri/common/dri_util.c' + target = 'dri_util.o', + source = '#src/mesa/drivers/dri/common/dri_util.c' ) dri_common_drisw_util = drienv.SharedObject( - target = 'drisw_util.o', - source = '#src/mesa/drivers/dri/common/drisw_util.c' + target = 'drisw_util.o', + source = '#src/mesa/drivers/dri/common/drisw_util.c' ) COMMON_DRI_SW_OBJECTS = [ - dri_common_utils, - dri_common_xmlconfig, - dri_common_drisw_util, + dri_common_utils, + dri_common_xmlconfig, + dri_common_drisw_util, ] COMMON_DRI_DRM_OBJECTS = [ - dri_common_utils, - dri_common_xmlconfig, - dri_common_vblank, - dri_common_dri_util, + dri_common_utils, + dri_common_xmlconfig, + dri_common_vblank, + dri_common_dri_util, ] drienv.AppendUnique(LIBS = [ @@ -73,36 +76,7 @@ drienv.AppendUnique(LIBS = [ ]) Export([ - 'drienv', - 'COMMON_DRI_SW_OBJECTS', - 'COMMON_DRI_DRM_OBJECTS', -]) - -SConscript([ - 'dri-swrast/SConscript', + 'drienv', + 'COMMON_DRI_SW_OBJECTS', + 'COMMON_DRI_DRM_OBJECTS', ]) - -if 'vmware' in env['winsys']: - SConscript([ - 'dri-vmwgfx/SConscript', - ]) - -if 'i915' in env['winsys']: - SConscript([ - 'dri-i915/SConscript', - ]) - -if 'i965' in env['winsys']: - SConscript([ - 'dri-i965/SConscript', - ]) - -if 'radeon' in env['winsys']: - SConscript([ - 'dri-radeong/SConscript', - ]) - -if 'r600' in env['winsys']: - SConscript([ - 'dri-r600/SConscript', - ]) diff --git a/src/gallium/targets/dri-i915/SConscript b/src/gallium/targets/dri-i915/SConscript index 172f92d6b82..ab60013830e 100644 --- a/src/gallium/targets/dri-i915/SConscript +++ b/src/gallium/targets/dri-i915/SConscript @@ -1,9 +1,5 @@ Import('*') -if not 'i915' in env['drivers']: - print 'warning: i915 pipe driver not built skipping i915_dri.so' - Return() - env = drienv.Clone() env.ParseConfig('pkg-config --cflags --libs libdrm_intel') @@ -24,8 +20,10 @@ env.Prepend(LIBS = [ COMMON_DRI_DRM_OBJECTS ]) -env.LoadableModule( +module = env.LoadableModule( target = 'i915_dri.so', source = 'target.c', SHLIBPREFIX = '', ) + +env.Alias('dri-i915', module)
\ No newline at end of file diff --git a/src/gallium/targets/dri-i965/SConscript b/src/gallium/targets/dri-i965/SConscript index 684e3488f71..669f70d6b8d 100644 --- a/src/gallium/targets/dri-i965/SConscript +++ b/src/gallium/targets/dri-i965/SConscript @@ -1,9 +1,5 @@ Import('*') -if not 'i965' in env['drivers']: - print 'warning: i965 pipe driver not built skipping i965_dri.so' - Return() - env = drienv.Clone() env.ParseConfig('pkg-config --cflags --libs libdrm_intel') @@ -27,8 +23,10 @@ env.Prepend(LIBS = [ COMMON_DRI_DRM_OBJECTS ]) -env.LoadableModule( +module = env.LoadableModule( target = 'i965_dri.so', source = 'target.c', SHLIBPREFIX = '', ) + +env.Alias('dri-i965', module)
\ No newline at end of file diff --git a/src/gallium/targets/dri-r300/SConscript b/src/gallium/targets/dri-r300/SConscript index 33a458f2e68..005b4bbf7f1 100644 --- a/src/gallium/targets/dri-r300/SConscript +++ b/src/gallium/targets/dri-r300/SConscript @@ -1,9 +1,5 @@ Import('*') -if not 'r300' in env['drivers']: - print 'warning: r300 pipe driver not built skipping r300_dri.so' - Return() - env = drienv.Clone() env.ParseConfig('pkg-config --cflags --libs libdrm_radeon') @@ -23,8 +19,10 @@ env.Prepend(LIBS = [ COMMON_DRI_DRM_OBJECTS ]) -env.SharedLibrary( +module = env.SharedLibrary( target ='r300_dri.so', source = 'target.c', SHLIBPREFIX = '', ) + +env.Alias('dri-r300', module)
\ No newline at end of file diff --git a/src/gallium/targets/dri-r600/SConscript b/src/gallium/targets/dri-r600/SConscript index 64d6d2a7f6f..aa771db2d1a 100644 --- a/src/gallium/targets/dri-r600/SConscript +++ b/src/gallium/targets/dri-r600/SConscript @@ -1,9 +1,5 @@ Import('*') -if not 'r600' in env['drivers']: - print 'warning: r600 pipe driver not built skipping r600_dri.so' - Return() - env = drienv.Clone() env.ParseConfig('pkg-config --cflags --libs libdrm_radeon') @@ -22,8 +18,10 @@ env.Prepend(LIBS = [ COMMON_DRI_DRM_OBJECTS ]) -env.SharedLibrary( +module = env.SharedLibrary( target ='r600_dri.so', source = 'target.c', SHLIBPREFIX = '', ) + +env.Alias('dri-r600', module) diff --git a/src/gallium/targets/dri-swrast/SConscript b/src/gallium/targets/dri-swrast/SConscript index d8143471194..b67483800e4 100644 --- a/src/gallium/targets/dri-swrast/SConscript +++ b/src/gallium/targets/dri-swrast/SConscript @@ -27,15 +27,16 @@ if True: if env['llvm']: env.Append(CPPDEFINES = 'GALLIUM_LLVMPIPE') - env.Tool('udis86') env.Prepend(LIBS = [llvmpipe]) swrastg_sources = [ 'swrast_drm_api.c' ] -env.LoadableModule( +module = env.LoadableModule( target ='swrastg_dri.so', source = swrastg_sources, SHLIBPREFIX = '', ) + +env.Alias('dri-swrast', module) diff --git a/src/gallium/targets/dri-vmwgfx/Makefile b/src/gallium/targets/dri-vmwgfx/Makefile index 97c703b3739..38f78932e13 100644 --- a/src/gallium/targets/dri-vmwgfx/Makefile +++ b/src/gallium/targets/dri-vmwgfx/Makefile @@ -12,6 +12,7 @@ PIPE_DRIVERS = \ C_SOURCES = \ target.c \ + vmw_powf.c \ $(COMMON_GALLIUM_SOURCES) DRIVER_DEFINES = \ diff --git a/src/gallium/targets/dri-vmwgfx/SConscript b/src/gallium/targets/dri-vmwgfx/SConscript index 7afabc7429f..7888e4f2c8b 100644 --- a/src/gallium/targets/dri-vmwgfx/SConscript +++ b/src/gallium/targets/dri-vmwgfx/SConscript @@ -1,9 +1,5 @@ Import('*') -if not 'svga' in env['drivers']: - print 'warning: svga pipe driver not built skipping vmwgfx_dri.so' - Return() - env = drienv.Clone() env.Append(CPPDEFINES = ['GALLIUM_RBUG', 'GALLIUM_TRACE']) @@ -20,8 +16,10 @@ env.Prepend(LIBS = [ COMMON_DRI_DRM_OBJECTS ]) -env.LoadableModule( +module = env.LoadableModule( target = 'vmwgfx_dri.so', source = 'target.c', SHLIBPREFIX = '', ) + +env.Alias('dri-vmwgfx', module)
\ No newline at end of file diff --git a/src/gallium/targets/dri-vmwgfx/vmw_powf.c b/src/gallium/targets/dri-vmwgfx/vmw_powf.c new file mode 100644 index 00000000000..ca5e39b389a --- /dev/null +++ b/src/gallium/targets/dri-vmwgfx/vmw_powf.c @@ -0,0 +1,17 @@ +/** + * Powf may leave an unresolved symbol pointing to a libstdc++.so powf. + * However, not all libstdc++.so include this function, so optionally + * replace the powf function with calls to expf and logf. + */ + +#ifdef VMW_RESOLVE_POWF + +extern float expf(float x); +extern float logf(float x); +extern float powf(float x, float y); + +float powf(float x, float y) { + return expf(logf(x)*y); +} + +#endif diff --git a/src/gallium/targets/egl-gdi/SConscript b/src/gallium/targets/egl-gdi/SConscript index 8f8b28ef67b..d52eeb70fd5 100644 --- a/src/gallium/targets/egl-gdi/SConscript +++ b/src/gallium/targets/egl-gdi/SConscript @@ -3,45 +3,53 @@ Import('*') -if env['platform'] == 'windows': - - env = env.Clone() - - env.Append(CPPPATH = [ - '#/src/gallium/state_trackers/egl', - '#/src/gallium/state_trackers/vega', - '#/src/egl/main', - '#/src/mesa', - ]) - - env.Append(CPPDEFINES = [ - 'FEATURE_VG=1', - 'GALLIUM_SOFTPIPE', - 'GALLIUM_RBUG', - 'GALLIUM_TRACE', - ]) - - env.Append(LIBS = [ - 'gdi32', - 'user32', - 'kernel32', - 'ws2_32', - ]) - - env['no_import_lib'] = 1 - - drivers = [softpipe] - if env['llvm']: - env.Append(CPPDEFINES = 'GALLIUM_LLVMPIPE') - drivers += [llvmpipe] - drivers += [identity, trace, rbug] - - apis = [vgapi, st_vega] - - egl_gallium = env.SharedLibrary( - target ='egl_gallium', - source = 'egl-static.c', - LIBS = st_egl_gdi + ws_gdi + drivers + apis + gallium + egl + env['LIBS'], - ) - - env.InstallSharedLibrary(egl_gallium) +env = env.Clone() + +env.Append(CPPPATH = [ + '#/src/gallium/state_trackers/egl', + '#/src/gallium/state_trackers/vega', + '#/src/egl/main', + '#/src/mesa', +]) + +env.Append(CPPDEFINES = [ + 'FEATURE_VG=1', + 'GALLIUM_SOFTPIPE', + 'GALLIUM_RBUG', + 'GALLIUM_TRACE', +]) + +env.Append(LIBS = [ + 'gdi32', + 'user32', + 'kernel32', + 'ws2_32', +]) + +env.Prepend(LIBS = [ + st_egl_gdi, + ws_gdi, + identity, + trace, + rbug, + softpipe, + vgapi, + st_vega, + gallium, + egl, +]) + +if env['llvm']: + env.Append(CPPDEFINES = 'GALLIUM_LLVMPIPE') + env.Prepend(LIBS = [llvmpipe]) + +egl_gallium = env.SharedLibrary( + target ='egl_gallium', + source = 'egl-static.c', +) + +env['no_import_lib'] = 1 + +egl_gdi = env.InstallSharedLibrary(egl_gallium) + +env.Alias('egl-gdi', egl_gdi) diff --git a/src/gallium/targets/egl/Makefile b/src/gallium/targets/egl/Makefile index 57979c4e9d4..63e9352144e 100644 --- a/src/gallium/targets/egl/Makefile +++ b/src/gallium/targets/egl/Makefile @@ -54,9 +54,8 @@ egl_LIBS += $(TOP)/src/gallium/winsys/sw/fbdev/libfbdev.a endif # EGL_RENDERABLE_TYPE is a compile time attribute -egl_CPPFLAGS += $(API_DEFINES) ifneq ($(filter $(GL_LIB), $(EGL_CLIENT_APIS)),) -egl_CPPFLAGS += -DFEATURE_GL=1 +egl_CPPFLAGS += $(API_DEFINES) endif ifneq ($(filter $(GLESv1_CM_LIB), $(EGL_CLIENT_APIS)),) egl_CPPFLAGS += -DFEATURE_ES1=1 diff --git a/src/gallium/targets/graw-gdi/SConscript b/src/gallium/targets/graw-gdi/SConscript new file mode 100644 index 00000000000..8ee8915acec --- /dev/null +++ b/src/gallium/targets/graw-gdi/SConscript @@ -0,0 +1,41 @@ +####################################################################### +# SConscript for graw-gdi + +Import('*') + +env = env.Clone() + +env.Append(CPPPATH = [ + '#src/gallium/winsys/sw', +]) + +env.Prepend(LIBS = [ + gallium, + 'gdi32', + identity, + rbug, + trace, + 'user32', + 'ws2_32', +]) + +sources = [ + 'graw_gdi.c', + graw_util, +] + +env.Append(CPPDEFINES = 'GALLIUM_SOFTPIPE') +env.Prepend(LIBS = [softpipe]) + +graw = env.SharedLibrary( + target = 'graw', + source = sources, + LIBS = ws_gdi + env['LIBS'], +) + +if env['platform'] == 'windows': + graw = env.FindIxes(graw, 'LIBPREFIX', 'LIBSUFFIX') +else: + graw = env.FindIxes(graw, 'SHLIBPREFIX', 'SHLIBSUFFIX') + +env.Alias('graw-gdi', graw) diff --git a/src/gallium/targets/graw-gdi/graw_gdi.c b/src/gallium/targets/graw-gdi/graw_gdi.c new file mode 100644 index 00000000000..bd6242b0779 --- /dev/null +++ b/src/gallium/targets/graw-gdi/graw_gdi.c @@ -0,0 +1,157 @@ +/************************************************************************** + * + * Copyright 2010 VMware, Inc. + * 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 "gdi/gdi_sw_winsys.h" +#include "pipe/p_screen.h" +#include "state_tracker/graw.h" +#include "target-helpers/wrap_screen.h" +#include "target-helpers/inline_sw_helper.h" +#include <windows.h> + + +static LRESULT CALLBACK +window_proc(HWND hWnd, + UINT uMsg, + WPARAM wParam, + LPARAM lParam) +{ + switch (uMsg) { + case WM_DESTROY: + PostQuitMessage(0); + break; + + default: + return DefWindowProc(hWnd, uMsg, wParam, lParam); + } + + return 0; +} + +static struct { + void (* draw)(void); +} graw; + +struct pipe_screen * +graw_create_window_and_screen(int x, + int y, + unsigned width, + unsigned height, + enum pipe_format format, + void **handle) +{ + struct sw_winsys *winsys = NULL; + struct pipe_screen *screen = NULL; + WNDCLASSEX wc = {sizeof(wc)}; + UINT style = WS_VISIBLE | WS_TILEDWINDOW; + RECT rect; + HWND hWnd = NULL; + HDC hDC = NULL; + + if (format != PIPE_FORMAT_R8G8B8A8_UNORM) + goto fail; + + winsys = gdi_create_sw_winsys(); + if (winsys == NULL) + goto fail; + + screen = sw_screen_create(winsys); + if (screen == NULL) + goto fail; + + wc.style = CS_OWNDC | CS_HREDRAW | CS_VREDRAW; + wc.lpfnWndProc = window_proc; + wc.lpszClassName = "graw-gdi"; + wc.hInstance = GetModuleHandle(NULL); + wc.hIcon = LoadIcon(NULL, IDI_APPLICATION); + wc.hCursor = LoadCursor(NULL, IDC_ARROW); + wc.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1); + RegisterClassEx(&wc); + + SetRect(&rect, 0, 0, width, height); + AdjustWindowRectEx(&rect, style, FALSE, 0); + + hWnd = CreateWindowEx(0, + wc.lpszClassName, + wc.lpszClassName, + style, + x, + y, + rect.right - rect.left, + rect.bottom - rect.top, + NULL, + NULL, + wc.hInstance, + 0); + if (hWnd == NULL) + goto fail; + + hDC = GetDC(hWnd); + if (hDC == NULL) + goto fail; + + *handle = (void *)hDC; + + return gallium_wrap_screen(screen); + +fail: + if (hWnd) + DestroyWindow(hWnd); + + if (screen) + screen->destroy(screen); + + return NULL; +} + +void +graw_set_display_func(void (* draw)(void)) +{ + graw.draw = draw; +} + +void +graw_main_loop(void) +{ + for (;;) { + MSG msg; + + while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { + if (msg.message == WM_QUIT) { + return; + } + TranslateMessage(&msg); + DispatchMessage(&msg); + } + + if (graw.draw) { + graw.draw(); + } + + Sleep(0); + } +} diff --git a/src/gallium/targets/graw-null/SConscript b/src/gallium/targets/graw-null/SConscript index 3416989d8eb..ebac1728f04 100644 --- a/src/gallium/targets/graw-null/SConscript +++ b/src/gallium/targets/graw-null/SConscript @@ -5,54 +5,28 @@ Import('*') env = env.Clone() -env.Prepend(LIBS = [ - ws_null, - trace, - rbug, - identity, -# gallium, -]) - -env.Append(CPPPATH = [ - '#src/gallium/drivers', -]) +graw_util = env.SharedObject( + source = ['graw_util.c'], +) -if env['platform'] == 'windows': - # For trace - env.Append(LIBS = [ - 'ws2_32', - ]) +env = env.Clone() sources = [ 'graw_null.c', - '../graw-xlib/graw_util.c', + graw_util, ] -if True: - env.Append(CPPDEFINES = 'GALLIUM_SOFTPIPE') - env.Prepend(LIBS = [softpipe]) - -if env['llvm']: - env.Append(CPPDEFINES = 'GALLIUM_LLVMPIPE') - env.Tool('udis86') - env.Prepend(LIBS = [llvmpipe]) - -# Need this for trace, identity drivers referenced by -# gallium_wrap_screen(). -# env.Prepend(LIBS = [gallium]) # TODO: write a wrapper function http://www.scons.org/wiki/WrapperFunctions graw = env.SharedLibrary( - target ='graw', + target = 'graw', source = sources, ) -env.InstallSharedLibrary(graw, version=(1, 0)) - if env['platform'] == 'windows': graw = env.FindIxes(graw, 'LIBPREFIX', 'LIBSUFFIX') else: graw = env.FindIxes(graw, 'SHLIBPREFIX', 'SHLIBSUFFIX') -Export('graw') +Export('graw_util', 'graw') diff --git a/src/gallium/targets/graw-null/graw_null.c b/src/gallium/targets/graw-null/graw_null.c index 5939a5acd3c..f1fe3872c94 100644 --- a/src/gallium/targets/graw-null/graw_null.c +++ b/src/gallium/targets/graw-null/graw_null.c @@ -1,31 +1,5 @@ -#include "pipe/p_compiler.h" -#include "util/u_debug.h" -#include "util/u_memory.h" -#include "target-helpers/wrap_screen.h" -#include "sw/null/null_sw_winsys.h" -#include "os/os_time.h" #include "state_tracker/graw.h" -#ifdef GALLIUM_SOFTPIPE -#include "softpipe/sp_public.h" -#endif - -#ifdef GALLIUM_LLVMPIPE -#include "llvmpipe/lp_public.h" -#endif - -/* Haven't figured out a decent way to build the helper code yet - - * #include it here temporarily. - */ -#include "sw/sw_public.h" -#include "sw/sw.c" - -#include <stdio.h> - - -static struct { - void (*draw)(void); -} graw; @@ -37,45 +11,7 @@ graw_create_window_and_screen( int x, enum pipe_format format, void **handle) { - const char *default_driver; - const char *driver; - struct pipe_screen *screen = NULL; - struct sw_winsys *winsys = NULL; - static int dummy; - - - /* Create the underlying winsys, which performs presents to Xlib - * drawables: - */ - winsys = null_sw_create(); - if (winsys == NULL) - return NULL; - -#if defined(GALLIUM_LLVMPIPE) - default_driver = "llvmpipe"; -#elif defined(GALLIUM_SOFTPIPE) - default_driver = "softpipe"; -#else - default_driver = ""; -#endif - - driver = debug_get_option("GALLIUM_DRIVER", default_driver); - -#if defined(GALLIUM_LLVMPIPE) - if (screen == NULL && strcmp(driver, "llvmpipe") == 0) - screen = llvmpipe_create_screen( winsys ); -#endif - -#if defined(GALLIUM_SOFTPIPE) - if (screen == NULL) - screen = softpipe_create_screen( winsys ); -#endif - - *handle = &dummy; - - /* Inject any wrapping layers we want to here: - */ - return gallium_wrap_screen( screen ); + return NULL; } @@ -83,13 +19,10 @@ graw_create_window_and_screen( int x, void graw_set_display_func( void (*draw)( void ) ) { - graw.draw = draw; } void graw_main_loop( void ) { - graw.draw(); - os_time_sleep(100000); } diff --git a/src/gallium/targets/graw-null/graw_util.c b/src/gallium/targets/graw-null/graw_util.c new file mode 100644 index 00000000000..e5cf526d33a --- /dev/null +++ b/src/gallium/targets/graw-null/graw_util.c @@ -0,0 +1,92 @@ + +#include "pipe/p_compiler.h" +#include "pipe/p_context.h" +#include "pipe/p_state.h" +#include "tgsi/tgsi_text.h" +#include "util/u_debug.h" +#include "util/u_memory.h" +#include "state_tracker/graw.h" + + +/* Helper functions. These are the same for all graw implementations. + */ +PUBLIC void * +graw_parse_geometry_shader(struct pipe_context *pipe, + const char *text) +{ + struct tgsi_token tokens[1024]; + struct pipe_shader_state state; + + if (!tgsi_text_translate(text, tokens, Elements(tokens))) + return NULL; + + state.tokens = tokens; + return pipe->create_gs_state(pipe, &state); +} + +PUBLIC void * +graw_parse_vertex_shader(struct pipe_context *pipe, + const char *text) +{ + struct tgsi_token tokens[1024]; + struct pipe_shader_state state; + + if (!tgsi_text_translate(text, tokens, Elements(tokens))) + return NULL; + + state.tokens = tokens; + return pipe->create_vs_state(pipe, &state); +} + +PUBLIC void * +graw_parse_fragment_shader(struct pipe_context *pipe, + const char *text) +{ + struct tgsi_token tokens[1024]; + struct pipe_shader_state state; + + if (!tgsi_text_translate(text, tokens, Elements(tokens))) + return NULL; + + state.tokens = tokens; + return pipe->create_fs_state(pipe, &state); +} + +static char out_filename[256] = ""; + +PUBLIC boolean +graw_parse_args(int *argi, + int argc, + char *argv[]) +{ + if (strcmp(argv[*argi], "-o") == 0) { + if (*argi + 1 >= argc) { + return FALSE; + } + + strncpy(out_filename, argv[*argi + 1], sizeof(out_filename) - 1); + out_filename[sizeof(out_filename) - 1] = '\0'; + *argi += 2; + return TRUE; + } + + return FALSE; +} + +PUBLIC boolean +graw_save_surface_to_file(struct pipe_context *pipe, + struct pipe_surface *surface, + const char *filename) +{ + if (!filename || !*filename) { + filename = out_filename; + if (!filename || !*filename) { + return FALSE; + } + } + + /* XXX: Make that working in release builds. + */ + debug_dump_surface_bmp(pipe, filename, surface); + return TRUE; +} diff --git a/src/gallium/targets/graw-xlib/SConscript b/src/gallium/targets/graw-xlib/SConscript index 21fce948f43..e50eb8a03d7 100644 --- a/src/gallium/targets/graw-xlib/SConscript +++ b/src/gallium/targets/graw-xlib/SConscript @@ -3,56 +3,41 @@ Import('*') -if env['platform'] != 'linux': - Return() - env = env.Clone() -env.Tool('x11') - env.Prepend(LIBS = [ ws_xlib, trace, rbug, identity, -# gallium, + gallium, ]) +env.Prepend(LIBS = env['X11_LIBS']) + env.Append(CPPPATH = [ '#src/gallium/drivers', '#src/gallium/include/state_tracker', ]) - sources = [ 'graw_xlib.c', - 'graw_util.c', + graw_util ] -env.Tool('x11') - if True: env.Append(CPPDEFINES = 'GALLIUM_SOFTPIPE') env.Prepend(LIBS = [softpipe]) if env['llvm']: env.Append(CPPDEFINES = 'GALLIUM_LLVMPIPE') - env.Tool('udis86') env.Prepend(LIBS = [llvmpipe]) -# Need this for trace, identity drivers referenced by -# gallium_wrap_screen(). -# -env.Prepend(LIBS = [gallium]) - -# TODO: write a wrapper function http://www.scons.org/wiki/WrapperFunctions graw = env.SharedLibrary( target ='graw', source = sources, ) -env.InstallSharedLibrary(graw, version=(1, 0)) - -graw = env.FindIxes(graw, 'SHLIBPREFIX', 'SHLIBSUFFIX') +graw = env.InstallSharedLibrary(graw, version=(1, 0)) -Export('graw') +env.Alias('graw-xlib', graw) diff --git a/src/gallium/targets/graw-xlib/graw_util.c b/src/gallium/targets/graw-xlib/graw_util.c deleted file mode 100644 index fc7c9ae6f92..00000000000 --- a/src/gallium/targets/graw-xlib/graw_util.c +++ /dev/null @@ -1,50 +0,0 @@ - -#include "pipe/p_compiler.h" -#include "pipe/p_context.h" -#include "pipe/p_state.h" -#include "tgsi/tgsi_text.h" -#include "util/u_memory.h" -#include "state_tracker/graw.h" - - -/* Helper functions. These are the same for all graw implementations. - */ -void *graw_parse_geometry_shader(struct pipe_context *pipe, - const char *text) -{ - struct tgsi_token tokens[1024]; - struct pipe_shader_state state; - - if (!tgsi_text_translate(text, tokens, Elements(tokens))) - return NULL; - - state.tokens = tokens; - return pipe->create_gs_state(pipe, &state); -} - -void *graw_parse_vertex_shader(struct pipe_context *pipe, - const char *text) -{ - struct tgsi_token tokens[1024]; - struct pipe_shader_state state; - - if (!tgsi_text_translate(text, tokens, Elements(tokens))) - return NULL; - - state.tokens = tokens; - return pipe->create_vs_state(pipe, &state); -} - -void *graw_parse_fragment_shader(struct pipe_context *pipe, - const char *text) -{ - struct tgsi_token tokens[1024]; - struct pipe_shader_state state; - - if (!tgsi_text_translate(text, tokens, Elements(tokens))) - return NULL; - - state.tokens = tokens; - return pipe->create_fs_state(pipe, &state); -} - diff --git a/src/gallium/targets/graw-xlib/graw_xlib.c b/src/gallium/targets/graw-xlib/graw_xlib.c index 8b64a0b819c..8658e19e3a3 100644 --- a/src/gallium/targets/graw-xlib/graw_xlib.c +++ b/src/gallium/targets/graw-xlib/graw_xlib.c @@ -4,22 +4,8 @@ #include "util/u_debug.h" #include "util/u_memory.h" #include "target-helpers/wrap_screen.h" +#include "target-helpers/inline_sw_helper.h" #include "state_tracker/xlib_sw_winsys.h" - -#ifdef GALLIUM_SOFTPIPE -#include "softpipe/sp_public.h" -#endif - -#ifdef GALLIUM_LLVMPIPE -#include "llvmpipe/lp_public.h" -#endif - -/* Haven't figured out a decent way to build the helper code yet - - * #include it here temporarily. - */ -#include "sw/sw_public.h" -#include "sw/sw.c" - #include "state_tracker/graw.h" #include <X11/Xlib.h> @@ -36,8 +22,6 @@ static struct { static struct pipe_screen * graw_create_screen( void ) { - const char *default_driver; - const char *driver; struct pipe_screen *screen = NULL; struct sw_winsys *winsys = NULL; @@ -48,25 +32,7 @@ graw_create_screen( void ) if (winsys == NULL) return NULL; -#if defined(GALLIUM_LLVMPIPE) - default_driver = "llvmpipe"; -#elif defined(GALLIUM_SOFTPIPE) - default_driver = "softpipe"; -#else - default_driver = ""; -#endif - - driver = debug_get_option("GALLIUM_DRIVER", default_driver); - -#if defined(GALLIUM_LLVMPIPE) - if (screen == NULL && strcmp(driver, "llvmpipe") == 0) - screen = llvmpipe_create_screen( winsys ); -#endif - -#if defined(GALLIUM_SOFTPIPE) - if (screen == NULL) - screen = softpipe_create_screen( winsys ); -#endif + screen = sw_screen_create( winsys ); /* Inject any wrapping layers we want to here: */ @@ -74,9 +40,6 @@ graw_create_screen( void ) } - - - struct pipe_screen * graw_create_window_and_screen( int x, int y, diff --git a/src/gallium/targets/libgl-gdi/SConscript b/src/gallium/targets/libgl-gdi/SConscript index 12fe403f62f..339238756ab 100644 --- a/src/gallium/targets/libgl-gdi/SConscript +++ b/src/gallium/targets/libgl-gdi/SConscript @@ -3,45 +3,46 @@ Import('*') -if env['platform'] == 'windows': - - env = env.Clone() - - env.Append(CPPPATH = [ - '#src/gallium/state_trackers/wgl', - '#src/gallium/winsys/sw', - ]) - - env.Append(LIBS = [ - 'gdi32', - 'user32', - 'kernel32', - 'ws2_32', - talloc, - ]) - - sources = [] - drivers = [] - - if True: - sources = ['gdi_softpipe_winsys.c'] - drivers = [softpipe] - - if env['llvm']: - sources = ['gdi_llvmpipe_winsys.c'] - drivers = [llvmpipe] - - if env['gcc']: - sources += ['#src/gallium/state_trackers/wgl/opengl32.mingw.def'] - else: - sources += ['#src/gallium/state_trackers/wgl/opengl32.def'] - - drivers += [trace, rbug] - - env['no_import_lib'] = 1 - - env.SharedLibrary( - target ='opengl32', - source = sources, - LIBS = wgl + ws_gdi + glapi + mesa + drivers + gallium + glsl + env['LIBS'], - ) +env = env.Clone() + +env.Append(CPPPATH = [ + '#src/gallium/state_trackers/wgl', + '#src/gallium/winsys/sw', +]) + +env.Append(LIBS = [ + 'gdi32', + 'user32', + 'kernel32', + 'ws2_32', + talloc, +]) + +sources = [] +drivers = [] + +if True: + sources = ['gdi_softpipe_winsys.c'] + drivers = [softpipe] + +if env['llvm']: + sources = ['gdi_llvmpipe_winsys.c'] + drivers = [llvmpipe] + +if env['gcc']: + sources += ['#src/gallium/state_trackers/wgl/opengl32.mingw.def'] +else: + sources += ['#src/gallium/state_trackers/wgl/opengl32.def'] + +drivers += [trace, rbug] + +env['no_import_lib'] = 1 + +opengl32 = env.SharedLibrary( + target ='opengl32', + source = sources, + LIBS = wgl + ws_gdi + glapi + mesa + drivers + gallium + glsl + env['LIBS'], +) + +env.Alias('opengl32', opengl32) +env.Alias('libgl-gdi', opengl32) diff --git a/src/gallium/targets/libgl-xlib/SConscript b/src/gallium/targets/libgl-xlib/SConscript index 27b562e1d5d..582760eac93 100644 --- a/src/gallium/targets/libgl-xlib/SConscript +++ b/src/gallium/targets/libgl-xlib/SConscript @@ -3,17 +3,6 @@ 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() - env = env.Clone() env.Append(CPPPATH = [ @@ -25,6 +14,8 @@ env.Append(CPPPATH = [ env.Append(CPPDEFINES = ['USE_XSHM']) +env.Prepend(LIBS = env['X11_LIBS']) + env.Prepend(LIBS = [ st_xlib, ws_xlib, @@ -42,8 +33,6 @@ sources = [ 'xlib.c', ] -env.Tool('x11') - if True: env.Append(CPPDEFINES = 'GALLIUM_SOFTPIPE') env.Prepend(LIBS = [softpipe]) @@ -54,10 +43,10 @@ if True: if env['llvm']: env.Append(CPPDEFINES = 'GALLIUM_LLVMPIPE') - env.Tool('udis86') env.Prepend(LIBS = [llvmpipe]) -if 'cell' in env['drivers']: +if False: + # TODO: Detect Cell SDK env.Append(CPPDEFINES = 'GALLIUM_CELL') env.Prepend(LIBS = [cell]) @@ -67,6 +56,8 @@ libgl = env.SharedLibrary( source = sources, ) -if not env['dri']: - # Only install this libGL.so if DRI not enabled - env.InstallSharedLibrary(libgl, version=(1, 5)) +if True: + # XXX: Only install this libGL.so if DRI not enabled + libgl = env.InstallSharedLibrary(libgl, version=(1, 5)) + +env.Alias('libgl-xlib', libgl) diff --git a/src/gallium/targets/libgl-xlib/xlib.c b/src/gallium/targets/libgl-xlib/xlib.c index 2f8cd2d404a..b0d1e529104 100644 --- a/src/gallium/targets/libgl-xlib/xlib.c +++ b/src/gallium/targets/libgl-xlib/xlib.c @@ -33,92 +33,17 @@ #include "pipe/p_compiler.h" #include "util/u_debug.h" #include "target-helpers/wrap_screen.h" +#include "target-helpers/inline_sw_helper.h" #include "state_tracker/xlib_sw_winsys.h" #include "xm_public.h" #include "state_tracker/st_api.h" #include "state_tracker/st_gl_api.h" -/* Helper function to choose and instantiate one of the software rasterizers: - * cell, llvmpipe, softpipe. - * - * This function could be shared, but currently causes headaches for - * the build systems, particularly scons if we try. Long term, want - * to avoid having global #defines for things like GALLIUM_LLVMPIPE, - * GALLIUM_CELL, etc. Scons already eliminates those #defines, so - * things that are painful for it now are likely to be painful for - * other build systems in the future. - * - * Copies (full or partial): - * targets/libgl-xlib - * targets/graw-xlib - * targets/dri-swrast - * winsys/sw/drm - * drivers/sw - * - */ - -#ifdef GALLIUM_SOFTPIPE -#include "softpipe/sp_public.h" -#endif - -#ifdef GALLIUM_LLVMPIPE -#include "llvmpipe/lp_public.h" -#endif - -#ifdef GALLIUM_CELL -#include "cell/ppu/cell_public.h" -#endif - -#ifdef GALLIUM_GALAHAD -#include "galahad/glhd_public.h" -#endif - -static struct pipe_screen * -swrast_create_screen(struct sw_winsys *winsys) -{ - const char *default_driver; - const char *driver; - struct pipe_screen *screen = NULL; - -#if defined(GALLIUM_CELL) - default_driver = "cell"; -#elif defined(GALLIUM_LLVMPIPE) - default_driver = "llvmpipe"; -#elif defined(GALLIUM_SOFTPIPE) - default_driver = "softpipe"; -#else - default_driver = ""; -#endif - - driver = debug_get_option("GALLIUM_DRIVER", default_driver); - -#if defined(GALLIUM_CELL) - if (screen == NULL && strcmp(driver, "cell") == 0) - screen = cell_create_screen( winsys ); -#endif - -#if defined(GALLIUM_LLVMPIPE) - if (screen == NULL && strcmp(driver, "llvmpipe") == 0) - screen = llvmpipe_create_screen( winsys ); -#endif - -#if defined(GALLIUM_SOFTPIPE) - if (screen == NULL) - screen = softpipe_create_screen( winsys ); -#endif - #if defined(GALLIUM_GALAHAD) - if (screen) { - struct pipe_screen *galahad_screen = galahad_screen_create(screen); - if (galahad_screen) - screen = galahad_screen; - } +#include "galahad/glhd_public.h" #endif - return screen; -} - /* Helper function to build a subset of a driver stack consisting of * one of the software rasterizers (cell, llvmpipe, softpipe) and the * xlib winsys. @@ -138,10 +63,19 @@ swrast_xlib_create_screen( Display *display ) /* Create a software rasterizer on top of that winsys: */ - screen = swrast_create_screen( winsys ); + screen = sw_screen_create( winsys ); if (screen == NULL) goto fail; + /* XXX will fix soon */ +#if defined(GALLIUM_GALAHAD) + if (screen) { + struct pipe_screen *galahad_screen = galahad_screen_create( screen ); + if (galahad_screen) + screen = galahad_screen; + } +#endif + /* Inject any wrapping layers we want to here: */ return gallium_wrap_screen( screen ); @@ -195,7 +129,6 @@ extern void (*linker_foo(const unsigned char *procName))() #include "GL/gl.h" #include "glapi/glapi.h" #include "glapi/glapitable.h" -#include "glapi/glapidispatch.h" #if defined(USE_MGL_NAMESPACE) #define NAME(func) mgl##func @@ -204,10 +137,10 @@ extern void (*linker_foo(const unsigned char *procName))() #endif #define DISPATCH(FUNC, ARGS, MESSAGE) \ - CALL_ ## FUNC(GET_DISPATCH(), ARGS); + GET_DISPATCH()->FUNC ARGS #define RETURN_DISPATCH(FUNC, ARGS, MESSAGE) \ - return CALL_ ## FUNC(GET_DISPATCH(), ARGS); + return GET_DISPATCH()->FUNC ARGS /* skip normal ones */ #define _GLAPI_SKIP_NORMAL_ENTRY_POINTS diff --git a/src/gallium/targets/xorg-vmwgfx/SConscript b/src/gallium/targets/xorg-vmwgfx/SConscript index 43b2c74f9ce..099d49cf1b7 100644 --- a/src/gallium/targets/xorg-vmwgfx/SConscript +++ b/src/gallium/targets/xorg-vmwgfx/SConscript @@ -2,62 +2,62 @@ import os.path Import('*') -if not 'svga' in env['drivers']: - print 'warning: svga pipe driver not built skipping vmwgfx_drv.so' - Return() - -if env['platform'] == 'linux': - - env = env.Clone() - - env.ParseConfig('pkg-config --cflags --libs libdrm xorg-server') - - env.Prepend(CPPPATH = [ - '#/include', - '#/src/gallium', - '#/src/mesa', - '#/src/gallium/drivers/svga', - '#/src/gallium/drivers/svga/include', - ]) - - env.Append(CPPDEFINES = [ - ]) - - if env['gcc']: - env.Append(CPPDEFINES = [ - 'HAVE_STDINT_H', - 'HAVE_SYS_TYPES_H', - ]) - - env.Append(CFLAGS = [ - '-std=gnu99', - '-D_FILE_OFFSET_BITS=64', - ]) - - env.Prepend(LIBPATH = [ - ]) - - env.Prepend(LIBS = [ - trace, - rbug, - st_xorg, - svgadrm, - svga, - gallium, - ]) - - sources = [ - 'vmw_ioctl.c', - 'vmw_ctrl.c', - 'vmw_screen.c', - 'vmw_video.c', - 'vmw_xorg.c', - ] - - # TODO: write a wrapper function http://www.scons.org/wiki/WrapperFunctions - env.LoadableModule( - target ='vmwgfx_drv.so', - source = sources, - LIBS = env['LIBS'], - SHLIBPREFIX = '', - ) +env = env.Clone() + +env.ParseConfig('pkg-config --cflags --libs libdrm xorg-server') + +if env['kms']: + env.ParseConfig('pkg-config --cflags --libs libkms') + +env.Prepend(CPPPATH = [ + '#/include', + '#/src/gallium', + '#/src/mesa', + '#/src/gallium/drivers/svga', + '#/src/gallium/drivers/svga/include', +]) + +env.Append(CPPDEFINES = [ +]) + +if env['gcc']: + env.Append(CPPDEFINES = [ + 'HAVE_STDINT_H', + 'HAVE_SYS_TYPES_H', + ]) + +env.Append(CFLAGS = [ + '-std=gnu99', + '-D_FILE_OFFSET_BITS=64', +]) + +env.Prepend(LIBPATH = [ +]) + +env.Prepend(LIBS = [ + trace, + rbug, + st_xorg, + svgadrm, + svga, + gallium, +]) + +sources = [ + 'vmw_ioctl.c', + 'vmw_ctrl.c', + 'vmw_screen.c', + 'vmw_target.c', + 'vmw_video.c', + 'vmw_xorg.c', +] + +# TODO: write a wrapper function http://www.scons.org/wiki/WrapperFunctions +module = env.LoadableModule( + target ='vmwgfx_drv.so', + source = sources, + LIBS = env['LIBS'], + SHLIBPREFIX = '', +) + +env.Alias('xorg-vmwgfx', module) |