summaryrefslogtreecommitdiff
path: root/src/gallium/targets
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/targets')
-rw-r--r--src/gallium/targets/Makefile.dri2
-rw-r--r--src/gallium/targets/Makefile.xorg2
-rw-r--r--src/gallium/targets/SConscript41
-rw-r--r--src/gallium/targets/SConscript.dri108
-rw-r--r--src/gallium/targets/dri-i915/SConscript8
-rw-r--r--src/gallium/targets/dri-i965/SConscript8
-rw-r--r--src/gallium/targets/dri-noop/Makefile34
-rw-r--r--src/gallium/targets/dri-noop/SConscript31
-rw-r--r--src/gallium/targets/dri-noop/swrast_drm_api.c63
-rw-r--r--src/gallium/targets/dri-r300/SConscript8
-rw-r--r--src/gallium/targets/dri-r600/SConscript8
-rw-r--r--src/gallium/targets/dri-swrast/SConscript5
-rw-r--r--src/gallium/targets/dri-vmwgfx/Makefile1
-rw-r--r--src/gallium/targets/dri-vmwgfx/SConscript8
-rw-r--r--src/gallium/targets/dri-vmwgfx/vmw_powf.c17
-rw-r--r--src/gallium/targets/egl-gdi/SConscript92
-rw-r--r--src/gallium/targets/egl/Makefile17
-rw-r--r--src/gallium/targets/graw-gdi/SConscript43
-rw-r--r--src/gallium/targets/graw-gdi/graw_gdi.c157
-rw-r--r--src/gallium/targets/graw-null/SConscript40
-rw-r--r--src/gallium/targets/graw-null/graw_null.c69
-rw-r--r--src/gallium/targets/graw-null/graw_util.c92
-rw-r--r--src/gallium/targets/graw-xlib/SConscript34
-rw-r--r--src/gallium/targets/graw-xlib/graw_util.c50
-rw-r--r--src/gallium/targets/graw-xlib/graw_xlib.c45
-rw-r--r--src/gallium/targets/libgl-gdi/SConscript84
-rw-r--r--src/gallium/targets/libgl-gdi/gdi_softpipe_winsys.c124
-rw-r--r--src/gallium/targets/libgl-gdi/libgl_gdi.c (renamed from src/gallium/targets/libgl-gdi/gdi_llvmpipe_winsys.c)77
-rw-r--r--src/gallium/targets/libgl-xlib/Makefile4
-rw-r--r--src/gallium/targets/libgl-xlib/SConscript40
-rw-r--r--src/gallium/targets/libgl-xlib/xlib.c90
-rw-r--r--src/gallium/targets/xorg-vmwgfx/SConscript118
32 files changed, 761 insertions, 759 deletions
diff --git a/src/gallium/targets/Makefile.dri b/src/gallium/targets/Makefile.dri
index 59961e982a..3fb4cc6b86 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 $@.test $(TOP)/src/mesa/drivers/dri/common/dri_test.o $@.tmp $(DRI_LIB_DEPS);
+ $(CXX) $(CFLAGS) -o $@.test $(TOP)/src/mesa/drivers/dri/common/dri_test.o $@.tmp $(DRI_LIB_DEPS) $(LDFLAGS);
@rm -f $@.test
mv -f $@.tmp $@
diff --git a/src/gallium/targets/Makefile.xorg b/src/gallium/targets/Makefile.xorg
index 87eedd7136..47040bb14c 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 e447d09361..0000000000
--- 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 bc8d179e3d..bc3671a256 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 172f92d6b8..ab60013830 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 684e3488f7..669f70d6b8 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-noop/Makefile b/src/gallium/targets/dri-noop/Makefile
new file mode 100644
index 0000000000..21c5f4f9f2
--- /dev/null
+++ b/src/gallium/targets/dri-noop/Makefile
@@ -0,0 +1,34 @@
+TOP = ../../../..
+include $(TOP)/configs/current
+
+LIBNAME = noop_dri.so
+
+DRIVER_DEFINES = \
+ -D__NOT_HAVE_DRM_H
+
+PIPE_DRIVERS = \
+ $(TOP)/src/gallium/state_trackers/dri/sw/libdrisw.a \
+ $(TOP)/src/gallium/winsys/sw/dri/libswdri.a \
+ $(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a \
+ $(TOP)/src/gallium/drivers/trace/libtrace.a \
+ $(TOP)/src/gallium/drivers/rbug/librbug.a \
+ $(TOP)/src/gallium/drivers/noop/libnoop.a
+
+SWRAST_COMMON_GALLIUM_SOURCES = \
+ $(TOP)/src/mesa/drivers/dri/common/utils.c \
+ $(TOP)/src/mesa/drivers/dri/common/drisw_util.c \
+ $(TOP)/src/mesa/drivers/dri/common/xmlconfig.c
+
+C_SOURCES = \
+ swrast_drm_api.c \
+ $(SWRAST_COMMON_GALLIUM_SOURCES) \
+ $(DRIVER_SOURCES)
+
+ASM_SOURCES =
+
+include ../Makefile.dri
+
+INCLUDES += \
+ -I$(TOP)/src/gallium/winsys/sw/dri
+
+symlinks:
diff --git a/src/gallium/targets/dri-noop/SConscript b/src/gallium/targets/dri-noop/SConscript
new file mode 100644
index 0000000000..9c04ee6631
--- /dev/null
+++ b/src/gallium/targets/dri-noop/SConscript
@@ -0,0 +1,31 @@
+Import('*')
+
+env = drienv.Clone()
+
+env.Append(CPPPATH = [
+ '#/src/gallium/winsys/sw/dri',
+])
+
+env.Prepend(LIBS = [
+ st_drisw,
+ ws_dri,
+ noop,
+ mesa,
+ glsl,
+ gallium,
+ COMMON_DRI_SW_OBJECTS
+])
+
+env.Prepend(LIBS = [noop])
+
+swrastg_sources = [
+ 'swrast_drm_api.c'
+]
+
+module = env.LoadableModule(
+ target ='noop_dri.so',
+ source = swrastg_sources,
+ SHLIBPREFIX = '',
+)
+
+env.Alias('dri-noop', module)
diff --git a/src/gallium/targets/dri-noop/swrast_drm_api.c b/src/gallium/targets/dri-noop/swrast_drm_api.c
new file mode 100644
index 0000000000..a99779f183
--- /dev/null
+++ b/src/gallium/targets/dri-noop/swrast_drm_api.c
@@ -0,0 +1,63 @@
+/**************************************************************************
+ *
+ * Copyright 2009, VMware, Inc.
+ * All Rights Reserved.
+ * Copyright 2010 George Sapountzis <gsapountzis@gmail.com>
+ *
+ * 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 above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * 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 VMWARE 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.
+ *
+ **************************************************************************/
+
+#include "pipe/p_compiler.h"
+#include "util/u_memory.h"
+#include "dri_sw_winsys.h"
+#include "noop/noop_public.h"
+
+#include "target-helpers/inline_debug_helper.h"
+#include "target-helpers/inline_sw_helper.h"
+
+
+struct pipe_screen *
+drisw_create_screen(struct drisw_loader_funcs *lf)
+{
+ struct sw_winsys *winsys = NULL;
+ struct pipe_screen *screen = NULL;
+
+ winsys = dri_create_sw_winsys(lf);
+ if (winsys == NULL)
+ return NULL;
+
+ screen = noop_screen_create(winsys);
+ if (!screen)
+ goto fail;
+
+ screen = debug_screen_wrap(screen);
+
+ return screen;
+
+fail:
+ if (winsys)
+ winsys->destroy(winsys);
+
+ return NULL;
+}
+
+/* vim: set sw=3 ts=8 sts=3 expandtab: */
diff --git a/src/gallium/targets/dri-r300/SConscript b/src/gallium/targets/dri-r300/SConscript
index 33a458f2e6..005b4bbf7f 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 64d6d2a7f6..aa771db2d1 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 d814347119..b67483800e 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 97c703b373..38f78932e1 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 7afabc7429..7888e4f2c8 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 0000000000..ca5e39b389
--- /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 8f8b28ef67..d52eeb70fd 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 38e60dbafb..63e9352144 100644
--- a/src/gallium/targets/egl/Makefile
+++ b/src/gallium/targets/egl/Makefile
@@ -39,7 +39,7 @@ egl_CPPFLAGS := \
-I$(TOP)/src/gallium/state_trackers/egl \
-I$(TOP)/src/egl/main \
-DPIPE_PREFIX=\"$(PIPE_PREFIX)\" -DST_PREFIX=\"$(ST_PREFIX)\"
-egl_SYS := -lm $(DLOPEN_LIBS) -L$(TOP)/$(LIB_DIR) -lEGL
+egl_SYS := -lm $(DLOPEN_LIBS) -lEGL
egl_LIBS := $(TOP)/src/gallium/state_trackers/egl/libegl.a
ifneq ($(findstring x11, $(EGL_PLATFORMS)),)
@@ -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
@@ -134,17 +133,17 @@ GL_LIBS := $(TOP)/src/mesa/libmesagallium.a
# OpenGL ES 1.x state tracker
GLESv1_CM_CPPFLAGS := -I$(TOP)/src/mesa
-GLESv1_CM_SYS := $(DRI_LIB_DEPS) -L$(TOP)/$(LIB_DIR) -l$(GLESv1_CM_LIB)
+GLESv1_CM_SYS := $(DRI_LIB_DEPS) -l$(GLESv1_CM_LIB)
GLESv1_CM_LIBS := $(TOP)/src/mesa/libes1gallium.a
# OpenGL ES 2.x state tracker
GLESv2_CPPFLAGS := -I$(TOP)/src/mesa
-GLESv2_SYS := $(DRI_LIB_DEPS) -L$(TOP)/$(LIB_DIR) -l$(GLESv2_LIB)
+GLESv2_SYS := $(DRI_LIB_DEPS) -l$(GLESv2_LIB)
GLESv2_LIBS := $(TOP)/src/mesa/libes2gallium.a
# OpenVG state tracker
OpenVG_CPPFLAGS := -I$(TOP)/src/gallium/state_trackers/vega
-OpenVG_SYS := -lm -L$(TOP)/$(LIB_DIR) -l$(VG_LIB)
+OpenVG_SYS := -lm -l$(VG_LIB)
OpenVG_LIBS := $(TOP)/src/gallium/state_trackers/vega/libvega.a
@@ -181,14 +180,16 @@ OUTPUTS := $(addprefix $(OUTPUT_PATH)/, $(OUTPUTS))
default: $(OUTPUTS)
define mklib
-$(MKLIB) -o $(notdir $@) -noprefix -linker '$(CC)' -ldflags '$(LDFLAGS)' \
+$(MKLIB) -o $(notdir $@) -noprefix -linker '$(CC)' \
+ -L$(TOP)/$(LIB_DIR) -ldflags '$(LDFLAGS)' \
-install $(OUTPUT_PATH) $(MKLIB_OPTIONS) $< \
-Wl,--start-group $(common_LIBS) $($(1)_LIBS) -Wl,--end-group \
$(common_SYS) $($(1)_SYS)
endef
define mklib-cxx
-$(MKLIB) -o $(notdir $@) -noprefix -linker '$(CXX)' -ldflags '$(LDFLAGS)' \
+$(MKLIB) -o $(notdir $@) -noprefix -linker '$(CXX)' \
+ -L$(TOP)/$(LIB_DIR) -ldflags '$(LDFLAGS)' \
-cplusplus -install $(OUTPUT_PATH) $(MKLIB_OPTIONS) $< \
-Wl,--start-group $(common_LIBS) $($(1)_LIBS) -Wl,--end-group \
$(common_SYS) $($(1)_SYS)
diff --git a/src/gallium/targets/graw-gdi/SConscript b/src/gallium/targets/graw-gdi/SConscript
new file mode 100644
index 0000000000..352efe95d0
--- /dev/null
+++ b/src/gallium/targets/graw-gdi/SConscript
@@ -0,0 +1,43 @@
+#######################################################################
+# SConscript for graw-gdi
+
+Import('*')
+
+env = env.Clone()
+
+env.Append(CPPPATH = [
+ '#src/gallium/winsys/sw',
+])
+
+env.Prepend(LIBS = [
+ gallium,
+ 'gdi32',
+ 'user32',
+ 'ws2_32',
+])
+
+sources = [
+ 'graw_gdi.c',
+ graw_util,
+]
+
+if True:
+ env.Append(CPPDEFINES = ['GALLIUM_TRACE', 'GALLIUM_RBUG', 'GALLIUM_GALAHAD', 'GALLIUM_SOFTPIPE'])
+ env.Prepend(LIBS = [trace, rbug, galahad, softpipe])
+
+if env['llvm']:
+ env.Append(CPPDEFINES = 'GALLIUM_LLVMPIPE')
+ env.Prepend(LIBS = [llvmpipe])
+
+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 0000000000..17ca2a761c
--- /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/inline_debug_helper.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 debug_screen_wrap(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 3416989d8e..ebac1728f0 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 5939a5acd3..f1fe3872c9 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 0000000000..e5cf526d33
--- /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 21fce948f4..42cb349cc9 100644
--- a/src/gallium/targets/graw-xlib/SConscript
+++ b/src/gallium/targets/graw-xlib/SConscript
@@ -3,56 +3,40 @@
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',
])
+env.Append(CPPDEFINES = ['GALLIUM_RBUG', 'GALLIUM_TRACE', 'GALLIUM_GALAHAD'])
sources = [
'graw_xlib.c',
- 'graw_util.c',
+ graw_util
]
-env.Tool('x11')
-
if True:
- env.Append(CPPDEFINES = 'GALLIUM_SOFTPIPE')
- env.Prepend(LIBS = [softpipe])
+ env.Append(CPPDEFINES = ['GALLIUM_TRACE', 'GALLIUM_RBUG', 'GALLIUM_GALAHAD', 'GALLIUM_SOFTPIPE'])
+ env.Prepend(LIBS = [trace, rbug, galahad, 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 fc7c9ae6f9..0000000000
--- 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 8b64a0b819..578086f8f9 100644
--- a/src/gallium/targets/graw-xlib/graw_xlib.c
+++ b/src/gallium/targets/graw-xlib/graw_xlib.c
@@ -3,23 +3,9 @@
#include "pipe/p_screen.h"
#include "util/u_debug.h"
#include "util/u_memory.h"
-#include "target-helpers/wrap_screen.h"
+#include "target-helpers/inline_sw_helper.h"
+#include "target-helpers/inline_debug_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,35 +32,14 @@ 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:
*/
- return gallium_wrap_screen( screen );
+ return debug_screen_wrap( screen );
}
-
-
-
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 12fe403f62..6fa0851a1a 100644
--- a/src/gallium/targets/libgl-gdi/SConscript
+++ b/src/gallium/targets/libgl-gdi/SConscript
@@ -3,45 +3,45 @@
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 = ['libgl_gdi.c']
+drivers = []
+
+if True:
+ drivers += [softpipe]
+
+if env['llvm']:
+ env.Append(CPPDEFINES = 'HAVE_LLVMPIPE')
+ 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-gdi/gdi_softpipe_winsys.c b/src/gallium/targets/libgl-gdi/gdi_softpipe_winsys.c
deleted file mode 100644
index 4ac507ff9c..0000000000
--- a/src/gallium/targets/libgl-gdi/gdi_softpipe_winsys.c
+++ /dev/null
@@ -1,124 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2009 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.
- *
- *
- **************************************************************************/
-
-/**
- * @file
- * LLVMpipe support.
- *
- * @author Jose Fonseca <jfonseca@vmware.com>
- */
-
-
-#include <windows.h>
-
-#include "stw_winsys.h"
-#include "gdi/gdi_sw_winsys.h"
-#include "softpipe/sp_texture.h"
-#include "softpipe/sp_screen.h"
-#include "softpipe/sp_public.h"
-
-
-static struct pipe_screen *
-gdi_softpipe_screen_create(void)
-{
- static struct sw_winsys *winsys;
- struct pipe_screen *screen;
-
- winsys = gdi_create_sw_winsys();
- if(!winsys)
- goto no_winsys;
-
- screen = softpipe_create_screen(winsys);
- if(!screen)
- goto no_screen;
-
- return screen;
-
-no_screen:
- winsys->destroy(winsys);
-no_winsys:
- return NULL;
-}
-
-
-
-
-static void
-gdi_softpipe_present(struct pipe_screen *screen,
- struct pipe_surface *surface,
- HDC hDC)
-{
- /* This will fail if any interposing layer (trace, debug, etc) has
- * been introduced between the state-trackers and softpipe.
- *
- * Ideally this would get replaced with a call to
- * pipe_screen::flush_frontbuffer().
- *
- * Failing that, it may be necessary for intervening layers to wrap
- * other structs such as this stw_winsys as well...
- */
- gdi_sw_display(softpipe_screen(screen)->winsys,
- softpipe_resource(surface->texture)->dt,
- hDC);
-}
-
-
-static const struct stw_winsys stw_winsys = {
- &gdi_softpipe_screen_create,
- &gdi_softpipe_present,
- NULL, /* get_adapter_luid */
- NULL, /* shared_surface_open */
- NULL, /* shared_surface_close */
- NULL /* compose */
-};
-
-
-BOOL WINAPI
-DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpReserved)
-{
- switch (fdwReason) {
- case DLL_PROCESS_ATTACH:
- stw_init(&stw_winsys);
- stw_init_thread();
- break;
-
- case DLL_THREAD_ATTACH:
- stw_init_thread();
- break;
-
- case DLL_THREAD_DETACH:
- stw_cleanup_thread();
- break;
-
- case DLL_PROCESS_DETACH:
- stw_cleanup_thread();
- stw_cleanup();
- break;
- }
- return TRUE;
-}
diff --git a/src/gallium/targets/libgl-gdi/gdi_llvmpipe_winsys.c b/src/gallium/targets/libgl-gdi/libgl_gdi.c
index 58c941a03b..1d6e664eab 100644
--- a/src/gallium/targets/libgl-gdi/gdi_llvmpipe_winsys.c
+++ b/src/gallium/targets/libgl-gdi/libgl_gdi.c
@@ -1,6 +1,6 @@
/**************************************************************************
*
- * Copyright 2009 VMware, Inc.
+ * Copyright 2009-2010 VMware, Inc.
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
@@ -28,7 +28,7 @@
/**
* @file
- * LLVMpipe support.
+ * Softpipe/LLVMpipe support.
*
* @author Jose Fonseca <jfonseca@vmware.com>
*/
@@ -36,24 +36,56 @@
#include <windows.h>
+#include "util/u_debug.h"
#include "stw_winsys.h"
#include "gdi/gdi_sw_winsys.h"
+
+#include "softpipe/sp_texture.h"
+#include "softpipe/sp_screen.h"
+#include "softpipe/sp_public.h"
+
+#ifdef HAVE_LLVMPIPE
#include "llvmpipe/lp_texture.h"
#include "llvmpipe/lp_screen.h"
#include "llvmpipe/lp_public.h"
+#endif
+
+
+static boolean use_llvmpipe = FALSE;
static struct pipe_screen *
-gdi_llvmpipe_screen_create(void)
+gdi_screen_create(void)
{
- static struct sw_winsys *winsys;
- struct pipe_screen *screen;
+ const char *default_driver;
+ const char *driver;
+ struct pipe_screen *screen = NULL;
+ struct sw_winsys *winsys;
winsys = gdi_create_sw_winsys();
if(!winsys)
goto no_winsys;
- screen = llvmpipe_create_screen(winsys);
+#ifdef HAVE_LLVMPIPE
+ default_driver = "llvmpipe";
+#else
+ default_driver = "softpipe";
+#endif
+
+ driver = debug_get_option("GALLIUM_DRIVER", default_driver);
+
+#ifdef HAVE_LLVMPIPE
+ if (strcmp(driver, "llvmpipe") == 0) {
+ screen = llvmpipe_create_screen( winsys );
+ }
+#endif
+
+ if (screen == NULL) {
+ screen = softpipe_create_screen( winsys );
+ } else {
+ use_llvmpipe = TRUE;
+ }
+
if(!screen)
goto no_screen;
@@ -66,15 +98,13 @@ no_winsys:
}
-
-
static void
-gdi_llvmpipe_present(struct pipe_screen *screen,
- struct pipe_surface *surface,
- HDC hDC)
+gdi_present(struct pipe_screen *screen,
+ struct pipe_surface *surface,
+ HDC hDC)
{
/* This will fail if any interposing layer (trace, debug, etc) has
- * been introduced between the state-trackers and llvmpipe.
+ * been introduced between the state-trackers and the pipe driver.
*
* Ideally this would get replaced with a call to
* pipe_screen::flush_frontbuffer().
@@ -82,15 +112,28 @@ gdi_llvmpipe_present(struct pipe_screen *screen,
* Failing that, it may be necessary for intervening layers to wrap
* other structs such as this stw_winsys as well...
*/
- gdi_sw_display(llvmpipe_screen(screen)->winsys,
- llvmpipe_resource(surface->texture)->dt,
- hDC);
+
+ struct sw_winsys *winsys = NULL;
+ struct sw_displaytarget *dt = NULL;
+
+#ifdef HAVE_LLVMPIPE
+ if (use_llvmpipe) {
+ winsys = llvmpipe_screen(screen)->winsys;
+ dt = llvmpipe_resource(surface->texture)->dt;
+ gdi_sw_display(winsys, dt, hDC);
+ return;
+ }
+#endif
+
+ winsys = softpipe_screen(screen)->winsys,
+ dt = softpipe_resource(surface->texture)->dt,
+ gdi_sw_display(winsys, dt, hDC);
}
static const struct stw_winsys stw_winsys = {
- &gdi_llvmpipe_screen_create,
- &gdi_llvmpipe_present,
+ &gdi_screen_create,
+ &gdi_present,
NULL, /* get_adapter_luid */
NULL, /* shared_surface_open */
NULL, /* shared_surface_close */
diff --git a/src/gallium/targets/libgl-xlib/Makefile b/src/gallium/targets/libgl-xlib/Makefile
index 076a040a5a..fb537c3155 100644
--- a/src/gallium/targets/libgl-xlib/Makefile
+++ b/src/gallium/targets/libgl-xlib/Makefile
@@ -26,6 +26,8 @@ INCLUDE_DIRS = \
DEFINES += \
-DGALLIUM_SOFTPIPE \
+ -DGALLIUM_RBUG \
+ -DGALLIUM_TRACE \
-DGALLIUM_GALAHAD
#-DGALLIUM_CELL will be defined by the config */
@@ -44,7 +46,7 @@ LIBS = \
$(TOP)/src/gallium/winsys/sw/xlib/libws_xlib.a \
$(TOP)/src/gallium/drivers/trace/libtrace.a \
$(TOP)/src/gallium/drivers/rbug/librbug.a \
- $(TOP)/src/gallium/drivers/identity/libidentity.a \
+ $(TOP)/src/gallium/drivers/galahad/libgalahad.a \
$(TOP)/src/mapi/glapi/libglapi.a \
$(TOP)/src/mesa/libmesagallium.a \
$(GALLIUM_AUXILIARIES) \
diff --git a/src/gallium/targets/libgl-xlib/SConscript b/src/gallium/targets/libgl-xlib/SConscript
index 27b562e1d5..d932736be7 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,12 +14,11 @@ env.Append(CPPPATH = [
env.Append(CPPDEFINES = ['USE_XSHM'])
+env.Prepend(LIBS = env['X11_LIBS'])
+
env.Prepend(LIBS = [
st_xlib,
ws_xlib,
- trace,
- rbug,
- identity,
glapi,
mesa,
glsl,
@@ -42,22 +30,16 @@ sources = [
'xlib.c',
]
-env.Tool('x11')
-
if True:
- env.Append(CPPDEFINES = 'GALLIUM_SOFTPIPE')
- env.Prepend(LIBS = [softpipe])
-
-if True:
- env.Append(CPPDEFINES = 'GALLIUM_GALAHAD')
- env.Prepend(LIBS = [galahad])
+ env.Append(CPPDEFINES = ['GALLIUM_TRACE', 'GALLIUM_RBUG', 'GALLIUM_GALAHAD', 'GALLIUM_SOFTPIPE'])
+ env.Prepend(LIBS = [trace, rbug, galahad, softpipe])
if env['llvm']:
- env.Append(CPPDEFINES = 'GALLIUM_LLVMPIPE')
- env.Tool('udis86')
+ env.Append(CPPDEFINES = ['GALLIUM_LLVMPIPE'])
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 +49,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 2f8cd2d404..9a3e0e07b0 100644
--- a/src/gallium/targets/libgl-xlib/xlib.c
+++ b/src/gallium/targets/libgl-xlib/xlib.c
@@ -32,92 +32,15 @@
*/
#include "pipe/p_compiler.h"
#include "util/u_debug.h"
-#include "target-helpers/wrap_screen.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"
+#include "target-helpers/inline_sw_helper.h"
+#include "target-helpers/inline_debug_helper.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;
- }
-#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
@@ -138,13 +61,13 @@ 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;
/* Inject any wrapping layers we want to here:
*/
- return gallium_wrap_screen( screen );
+ return debug_screen_wrap( screen );
fail:
if (winsys)
@@ -195,7 +118,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 +126,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 43b2c74f9c..099d49cf1b 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)