summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers
diff options
context:
space:
mode:
authorChristian König <[email protected]>2010-11-11 21:07:42 +0100
committerChristian König <[email protected]>2010-11-11 21:07:42 +0100
commit195bbe8ce218533569dde1368d04da0fd229913d (patch)
tree29d3db04673f59dcfd6663c524a5c1343d5cbee6 /src/gallium/state_trackers
parent99b57bc20e839043ec6160502814085a0976fccc (diff)
parentd67df5dd9db1cede92f1b177c890f83809bb4582 (diff)
Merge remote branch 'origin/master' into pipe-video
Diffstat (limited to 'src/gallium/state_trackers')
-rw-r--r--src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp14
-rw-r--r--src/gallium/state_trackers/dri/SConscript4
-rw-r--r--src/gallium/state_trackers/dri/common/dri_context.c3
-rw-r--r--src/gallium/state_trackers/dri/common/dri_drawable.h3
-rw-r--r--src/gallium/state_trackers/dri/common/dri_screen.c3
-rw-r--r--src/gallium/state_trackers/dri/drm/SConscript37
-rw-r--r--src/gallium/state_trackers/dri/sw/SConscript37
-rw-r--r--src/gallium/state_trackers/egl/Makefile2
-rw-r--r--src/gallium/state_trackers/egl/SConscript52
-rw-r--r--src/gallium/state_trackers/egl/common/egl_g3d.c26
-rw-r--r--src/gallium/state_trackers/egl/common/egl_g3d_api.c74
-rw-r--r--src/gallium/state_trackers/egl/common/egl_g3d_image.c18
-rw-r--r--src/gallium/state_trackers/egl/common/egl_g3d_st.c3
-rw-r--r--src/gallium/state_trackers/egl/common/native.h37
-rw-r--r--src/gallium/state_trackers/egl/common/native_buffer.h59
-rw-r--r--src/gallium/state_trackers/egl/drm/modeset.c29
-rw-r--r--src/gallium/state_trackers/egl/drm/native_drm.c27
-rw-r--r--src/gallium/state_trackers/egl/fbdev/native_fbdev.c32
-rw-r--r--src/gallium/state_trackers/egl/gdi/native_gdi.c31
-rw-r--r--src/gallium/state_trackers/egl/x11/native_dri2.c36
-rw-r--r--src/gallium/state_trackers/egl/x11/native_x11.h1
-rw-r--r--src/gallium/state_trackers/egl/x11/native_ximage.c31
-rw-r--r--src/gallium/state_trackers/glx/xlib/SConscript37
-rw-r--r--src/gallium/state_trackers/python/SConscript107
-rw-r--r--src/gallium/state_trackers/vega/SConscript81
-rw-r--r--src/gallium/state_trackers/vega/api_filters.c2
-rw-r--r--src/gallium/state_trackers/vega/api_images.c2
-rw-r--r--src/gallium/state_trackers/vega/api_masks.c2
-rw-r--r--src/gallium/state_trackers/vega/api_paint.c1
-rw-r--r--src/gallium/state_trackers/vega/api_path.c4
-rw-r--r--src/gallium/state_trackers/vega/api_text.c1
-rw-r--r--src/gallium/state_trackers/vega/image.c2
-rw-r--r--src/gallium/state_trackers/vega/paint.c2
-rw-r--r--src/gallium/state_trackers/vega/polygon.c1
-rw-r--r--src/gallium/state_trackers/vega/renderer.c3
-rw-r--r--src/gallium/state_trackers/vega/shaders_cache.c2
-rw-r--r--src/gallium/state_trackers/vega/vg_context.c1
-rw-r--r--src/gallium/state_trackers/wgl/SConscript71
-rw-r--r--src/gallium/state_trackers/xorg/SConscript52
-rw-r--r--src/gallium/state_trackers/xorg/xorg_driver.c2
40 files changed, 618 insertions, 314 deletions
diff --git a/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp b/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp
index e1c34611d14..c246fc5ef76 100644
--- a/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp
+++ b/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp
@@ -1101,6 +1101,7 @@ struct GalliumDXGISwapChain : public GalliumDXGIObject<IDXGISwapChain, GalliumDX
struct pipe_resource* dst;
struct pipe_resource* src;
struct pipe_surface* dst_surface;
+ enum native_attachment att;
void* present_cookie;
hr = parent->backend->BeginPresent(desc.OutputWindow, &present_cookie, &cur_window, &rect, &rgndata, &preserve_aspect_ratio);
@@ -1221,16 +1222,9 @@ struct GalliumDXGISwapChain : public GalliumDXGIObject<IDXGISwapChain, GalliumDX
pipe->flush(pipe, PIPE_FLUSH_RENDER_CACHE | PIPE_FLUSH_FRAME, 0);
- if(db)
- {
- if(!surface->swap_buffers(surface))
- return DXGI_ERROR_DEVICE_REMOVED;
- }
- else
- {
- if(!surface->flush_frontbuffer(surface))
- return DXGI_ERROR_DEVICE_REMOVED;
- }
+ att = (db) ? NATIVE_ATTACHMENT_BACK_LEFT : NATIVE_ATTACHMENT_FRONT_LEFT;
+ if(!surface->present(surface, att, FALSE, 0))
+ return DXGI_ERROR_DEVICE_REMOVED;
end_present:
parent->backend->EndPresent(desc.OutputWindow, present_cookie);
diff --git a/src/gallium/state_trackers/dri/SConscript b/src/gallium/state_trackers/dri/SConscript
index aba60fb8c5b..7702d8e6323 100644
--- a/src/gallium/state_trackers/dri/SConscript
+++ b/src/gallium/state_trackers/dri/SConscript
@@ -1,6 +1,6 @@
Import('*')
SConscript([
- 'sw/SConscript',
- 'drm/SConscript',
+ 'sw/SConscript',
+ 'drm/SConscript',
])
diff --git a/src/gallium/state_trackers/dri/common/dri_context.c b/src/gallium/state_trackers/dri/common/dri_context.c
index 770b37037f5..3d5d24e692c 100644
--- a/src/gallium/state_trackers/dri/common/dri_context.c
+++ b/src/gallium/state_trackers/dri/common/dri_context.c
@@ -178,7 +178,8 @@ dri_make_current(__DRIcontext * cPriv,
read->texture_stamp = driReadPriv->lastStamp - 1;
}
- ctx->stapi->make_current(ctx->stapi, ctx->st, &draw->base, &read->base);
+ ctx->stapi->make_current(ctx->stapi, ctx->st,
+ (draw) ? &draw->base : NULL, (read) ? &read->base : NULL);
return GL_TRUE;
}
diff --git a/src/gallium/state_trackers/dri/common/dri_drawable.h b/src/gallium/state_trackers/dri/common/dri_drawable.h
index 837d3983748..2ff6b713293 100644
--- a/src/gallium/state_trackers/dri/common/dri_drawable.h
+++ b/src/gallium/state_trackers/dri/common/dri_drawable.h
@@ -70,7 +70,8 @@ struct dri_drawable
static INLINE struct dri_drawable *
dri_drawable(__DRIdrawable * driDrawPriv)
{
- return (struct dri_drawable *)driDrawPriv->driverPrivate;
+ return (struct dri_drawable *) (driDrawPriv)
+ ? driDrawPriv->driverPrivate : NULL;
}
/***********************************************************************
diff --git a/src/gallium/state_trackers/dri/common/dri_screen.c b/src/gallium/state_trackers/dri/common/dri_screen.c
index 252ad1768d8..1302e9bc013 100644
--- a/src/gallium/state_trackers/dri/common/dri_screen.c
+++ b/src/gallium/state_trackers/dri/common/dri_screen.c
@@ -231,6 +231,9 @@ dri_fill_st_visual(struct st_visual *stvis, struct dri_screen *screen,
{
memset(stvis, 0, sizeof(*stvis));
+ if (!mode)
+ return;
+
stvis->samples = mode->samples;
stvis->render_buffer = ST_ATTACHMENT_INVALID;
diff --git a/src/gallium/state_trackers/dri/drm/SConscript b/src/gallium/state_trackers/dri/drm/SConscript
index 2a0af65f9bd..b188f76f910 100644
--- a/src/gallium/state_trackers/dri/drm/SConscript
+++ b/src/gallium/state_trackers/dri/drm/SConscript
@@ -3,25 +3,26 @@
Import('*')
-if env['dri']:
+env = env.Clone()
- env = env.Clone()
+env.ParseConfig('pkg-config --cflags --libs libdrm')
- env.ParseConfig('pkg-config --cflags --libs libdrm')
+env.Append(CPPPATH = [
+ '#/src/mapi',
+ '#/src/mesa',
+ '#/src/gallium/state_trackers/dri/common',
+ '#/src/mesa/drivers/dri/common',
+])
- env.Append(CPPPATH = [
- '#/src/mapi',
- '#/src/mesa',
- '#/src/gallium/state_trackers/dri/common',
- '#/src/mesa/drivers/dri/common',
- ])
+sources = [
+ 'dri_context.c',
+ 'dri_drawable.c',
+ 'dri_screen.c',
+ 'dri2.c',
+]
- st_dri = env.ConvenienceLibrary(
- target = 'st_dri',
- source = [ 'dri_context.c',
- 'dri_drawable.c',
- 'dri_screen.c',
- 'dri2.c',
- ]
- )
- Export('st_dri')
+st_dri = env.ConvenienceLibrary(
+ target = 'st_dri',
+ source = sources,
+)
+Export('st_dri')
diff --git a/src/gallium/state_trackers/dri/sw/SConscript b/src/gallium/state_trackers/dri/sw/SConscript
index d2eb66668e0..d0c3efc6faa 100644
--- a/src/gallium/state_trackers/dri/sw/SConscript
+++ b/src/gallium/state_trackers/dri/sw/SConscript
@@ -3,25 +3,26 @@
Import('*')
-if env['dri']:
+env = env.Clone()
- env = env.Clone()
+env.Append(CPPPATH = [
+ '#/src/mapi',
+ '#/src/mesa',
+ '#/src/gallium/state_trackers/dri/common',
+ '#/src/mesa/drivers/dri/common',
+])
- env.Append(CPPPATH = [
- '#/src/mapi',
- '#/src/mesa',
- '#/src/gallium/state_trackers/dri/common',
- '#/src/mesa/drivers/dri/common',
- ])
+env.Append(CPPDEFINES = [('__NOT_HAVE_DRM_H', '1')])
- env.Append(CPPDEFINES = [('__NOT_HAVE_DRM_H', '1')])
+sources = [
+ 'dri_context.c',
+ 'dri_drawable.c',
+ 'dri_screen.c',
+ 'drisw.c',
+]
- st_drisw = env.ConvenienceLibrary(
- target = 'st_drisw',
- source = [ 'dri_context.c',
- 'dri_drawable.c',
- 'dri_screen.c',
- 'drisw.c',
- ]
- )
- Export('st_drisw')
+st_drisw = env.ConvenienceLibrary(
+ target = 'st_drisw',
+ source = sources,
+)
+Export('st_drisw')
diff --git a/src/gallium/state_trackers/egl/Makefile b/src/gallium/state_trackers/egl/Makefile
index 8dbfc5b8e56..8cfcef968ed 100644
--- a/src/gallium/state_trackers/egl/Makefile
+++ b/src/gallium/state_trackers/egl/Makefile
@@ -17,7 +17,7 @@ x11_INCLUDES = \
-I$(TOP)/src/mapi \
-I$(TOP)/src/mesa \
$(X11_CFLAGS) \
- $(shell pkg-config --cflags-only-I libdrm)
+ $(shell pkg-config --cflags-only-I libdrm dri2proto)
x11_SOURCES = $(wildcard x11/*.c) \
$(TOP)/src/glx/dri2.c
diff --git a/src/gallium/state_trackers/egl/SConscript b/src/gallium/state_trackers/egl/SConscript
index efcce25e317..50c76819954 100644
--- a/src/gallium/state_trackers/egl/SConscript
+++ b/src/gallium/state_trackers/egl/SConscript
@@ -3,34 +3,32 @@
Import('*')
-if 'egl' in env['statetrackers']:
+env = env.Clone()
- env = env.Clone()
+env.Append(CPPPATH = [
+ '#/src/egl/main',
+ '#/src/gallium/winsys/sw',
+ '.',
+])
+env.Append(CPPDEFINES = [
+ 'HAVE_GDI_BACKEND',
+])
- env.Append(CPPPATH = [
- '#/src/egl/main',
- '#/src/gallium/winsys/sw',
- '.',
- ])
- env.Append(CPPDEFINES = [
- 'HAVE_GDI_BACKEND',
- ])
+common_sources = [
+ 'common/egl_g3d.c',
+ 'common/egl_g3d_api.c',
+ 'common/egl_g3d_image.c',
+ 'common/egl_g3d_st.c',
+ 'common/egl_g3d_sync.c',
+ 'common/native_helper.c',
+]
- common_sources = [
- 'common/egl_g3d.c',
- 'common/egl_g3d_api.c',
- 'common/egl_g3d_image.c',
- 'common/egl_g3d_st.c',
- 'common/egl_g3d_sync.c',
- 'common/native_helper.c',
- ]
+gdi_sources = common_sources + [
+ 'gdi/native_gdi.c',
+]
- gdi_sources = common_sources + [
- 'gdi/native_gdi.c',
- ]
-
- st_egl_gdi = env.ConvenienceLibrary(
- target = 'st_egl_gdi',
- source = gdi_sources,
- )
- Export('st_egl_gdi')
+st_egl_gdi = env.ConvenienceLibrary(
+ target = 'st_egl_gdi',
+ source = gdi_sources,
+)
+Export('st_egl_gdi')
diff --git a/src/gallium/state_trackers/egl/common/egl_g3d.c b/src/gallium/state_trackers/egl/common/egl_g3d.c
index 30ddcd5bc14..a3750ac56fb 100644
--- a/src/gallium/state_trackers/egl/common/egl_g3d.c
+++ b/src/gallium/state_trackers/egl/common/egl_g3d.c
@@ -156,7 +156,8 @@ egl_g3d_add_screens(_EGLDriver *drv, _EGLDisplay *dpy)
*/
static EGLBoolean
init_config_attributes(_EGLConfig *conf, const struct native_config *nconf,
- EGLint api_mask, enum pipe_format depth_stencil_format)
+ EGLint api_mask, enum pipe_format depth_stencil_format,
+ EGLBoolean preserve_buffer, EGLint max_swap_interval)
{
uint rgba[4], depth_stencil[2], buffer_size;
EGLint surface_type;
@@ -238,6 +239,11 @@ init_config_attributes(_EGLConfig *conf, const struct native_config *nconf,
conf->TransparentBlueValue = nconf->transparent_rgb_values[2];
}
+ conf->MinSwapInterval = 0;
+ conf->MaxSwapInterval = max_swap_interval;
+ if (preserve_buffer)
+ conf->SurfaceType |= EGL_SWAP_BEHAVIOR_PRESERVED_BIT;
+
return _eglValidateConfig(conf, EGL_FALSE);
}
@@ -247,7 +253,8 @@ init_config_attributes(_EGLConfig *conf, const struct native_config *nconf,
static EGLBoolean
egl_g3d_init_config(_EGLDriver *drv, _EGLDisplay *dpy,
_EGLConfig *conf, const struct native_config *nconf,
- enum pipe_format depth_stencil_format)
+ enum pipe_format depth_stencil_format,
+ int preserve_buffer, int max_swap_interval)
{
struct egl_g3d_config *gconf = egl_g3d_config(conf);
EGLint buffer_mask, api_mask;
@@ -288,7 +295,8 @@ egl_g3d_init_config(_EGLDriver *drv, _EGLDisplay *dpy,
}
valid = init_config_attributes(&gconf->base,
- nconf, api_mask, depth_stencil_format);
+ nconf, api_mask, depth_stencil_format,
+ preserve_buffer, max_swap_interval);
if (!valid) {
_eglLog(_EGL_DEBUG, "skip invalid config 0x%x", nconf->native_visual_id);
return EGL_FALSE;
@@ -349,6 +357,7 @@ egl_g3d_add_configs(_EGLDriver *drv, _EGLDisplay *dpy, EGLint id)
const struct native_config **native_configs;
enum pipe_format depth_stencil_formats[8];
int num_formats, num_configs, i, j;
+ int preserve_buffer, max_swap_interval;
native_configs = gdpy->native->get_configs(gdpy->native, &num_configs);
if (!num_configs) {
@@ -357,6 +366,11 @@ egl_g3d_add_configs(_EGLDriver *drv, _EGLDisplay *dpy, EGLint id)
return id;
}
+ preserve_buffer =
+ gdpy->native->get_param(gdpy->native, NATIVE_PARAM_PRESERVE_BUFFER);
+ max_swap_interval =
+ gdpy->native->get_param(gdpy->native, NATIVE_PARAM_MAX_SWAP_INTERVAL);
+
num_formats = egl_g3d_fill_depth_stencil_formats(dpy,
depth_stencil_formats);
@@ -368,7 +382,8 @@ egl_g3d_add_configs(_EGLDriver *drv, _EGLDisplay *dpy, EGLint id)
if (gconf) {
_eglInitConfig(&gconf->base, dpy, id);
if (!egl_g3d_init_config(drv, dpy, &gconf->base,
- native_configs[i], depth_stencil_formats[j])) {
+ native_configs[i], depth_stencil_formats[j],
+ preserve_buffer, max_swap_interval)) {
FREE(gconf);
break;
}
@@ -538,7 +553,8 @@ egl_g3d_initialize(_EGLDriver *drv, _EGLDisplay *dpy,
if (dpy->Platform == _EGL_PLATFORM_DRM) {
dpy->Extensions.MESA_drm_display = EGL_TRUE;
- dpy->Extensions.MESA_drm_image = EGL_TRUE;
+ if (gdpy->native->buffer)
+ dpy->Extensions.MESA_drm_image = EGL_TRUE;
}
if (egl_g3d_add_configs(drv, dpy, 1) == 1) {
diff --git a/src/gallium/state_trackers/egl/common/egl_g3d_api.c b/src/gallium/state_trackers/egl/common/egl_g3d_api.c
index c10245bb067..fd7dc8f8149 100644
--- a/src/gallium/state_trackers/egl/common/egl_g3d_api.c
+++ b/src/gallium/state_trackers/egl/common/egl_g3d_api.c
@@ -97,6 +97,70 @@ egl_g3d_choose_st(_EGLDriver *drv, _EGLContext *ctx,
return stapi;
}
+static int
+egl_g3d_compare_config(const _EGLConfig *conf1, const _EGLConfig *conf2,
+ void *priv_data)
+{
+ const _EGLConfig *criteria = (const _EGLConfig *) priv_data;
+
+ /* EGL_NATIVE_VISUAL_TYPE ignored? */
+ return _eglCompareConfigs(conf1, conf2, criteria, EGL_TRUE);
+}
+
+static EGLBoolean
+egl_g3d_match_config(const _EGLConfig *conf, const _EGLConfig *criteria)
+{
+ if (!_eglMatchConfig(conf, criteria))
+ return EGL_FALSE;
+
+ if (criteria->MatchNativePixmap != EGL_NONE &&
+ criteria->MatchNativePixmap != EGL_DONT_CARE) {
+ struct egl_g3d_display *gdpy = egl_g3d_display(conf->Display);
+ struct egl_g3d_config *gconf = egl_g3d_config(conf);
+ EGLNativePixmapType pix =
+ (EGLNativePixmapType) criteria->MatchNativePixmap;
+
+ if (!gdpy->native->is_pixmap_supported(gdpy->native, pix, gconf->native))
+ return EGL_FALSE;
+ }
+
+ return EGL_TRUE;
+}
+
+static EGLBoolean
+egl_g3d_choose_config(_EGLDriver *drv, _EGLDisplay *dpy, const EGLint *attribs,
+ EGLConfig *configs, EGLint size, EGLint *num_configs)
+{
+ _EGLConfig **tmp_configs, criteria;
+ EGLint tmp_size, i;
+
+ if (!num_configs)
+ return _eglError(EGL_BAD_PARAMETER, "eglChooseConfigs");
+
+ if (!_eglParseConfigAttribList(&criteria, dpy, attribs))
+ return _eglError(EGL_BAD_ATTRIBUTE, "eglChooseConfig");
+
+ tmp_configs = (_EGLConfig **) _eglFilterArray(dpy->Configs, &tmp_size,
+ (_EGLArrayForEach) egl_g3d_match_config, (void *) &criteria);
+ if (!tmp_configs)
+ return _eglError(EGL_BAD_ALLOC, "eglChooseConfig(out of memory)");
+
+ /* perform sorting of configs */
+ if (tmp_configs && tmp_size) {
+ _eglSortConfigs((const _EGLConfig **) tmp_configs, tmp_size,
+ egl_g3d_compare_config, (void *) &criteria);
+ size = MIN2(tmp_size, size);
+ for (i = 0; i < size; i++)
+ configs[i] = _eglGetConfigHandle(tmp_configs[i]);
+ }
+
+ free(tmp_configs);
+
+ *num_configs = size;
+
+ return EGL_TRUE;
+}
+
static _EGLContext *
egl_g3d_create_context(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *conf,
_EGLContext *share, const EGLint *attribs)
@@ -539,7 +603,10 @@ egl_g3d_swap_buffers(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf)
PIPE_FLUSH_RENDER_CACHE | PIPE_FLUSH_FRAME, NULL);
}
- return gsurf->native->swap_buffers(gsurf->native);
+ return gsurf->native->present(gsurf->native,
+ NATIVE_ATTACHMENT_BACK_LEFT,
+ gsurf->base.SwapBehavior == EGL_BUFFER_PRESERVED,
+ gsurf->base.SwapInterval);
}
/**
@@ -607,8 +674,7 @@ egl_g3d_copy_buffers(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf,
if (psrc) {
gdpy->pipe->resource_copy_region(gdpy->pipe, ptex, subdst, 0, 0, 0,
gsurf->render_texture, subsrc, 0, 0, 0, ptex->width0, ptex->height0);
-
- nsurf->flush_frontbuffer(nsurf);
+ nsurf->present(nsurf, NATIVE_ATTACHMENT_FRONT_LEFT, FALSE, 0);
}
pipe_resource_reference(&ptex, NULL);
@@ -838,6 +904,8 @@ egl_g3d_init_driver_api(_EGLDriver *drv)
{
_eglInitDriverFallbacks(drv);
+ drv->API.ChooseConfig = egl_g3d_choose_config;
+
drv->API.CreateContext = egl_g3d_create_context;
drv->API.DestroyContext = egl_g3d_destroy_context;
drv->API.CreateWindowSurface = egl_g3d_create_window_surface;
diff --git a/src/gallium/state_trackers/egl/common/egl_g3d_image.c b/src/gallium/state_trackers/egl/common/egl_g3d_image.c
index be9c88e5e47..6a1f8cc697b 100644
--- a/src/gallium/state_trackers/egl/common/egl_g3d_image.c
+++ b/src/gallium/state_trackers/egl/common/egl_g3d_image.c
@@ -38,7 +38,7 @@
#include "egl_g3d_api.h"
#include "egl_g3d_image.h"
-/* move this to native display? */
+/* for struct winsys_handle */
#include "state_tracker/drm_driver.h"
/**
@@ -137,13 +137,11 @@ egl_g3d_reference_drm_buffer(_EGLDisplay *dpy, EGLint name,
_EGLImage *img, const EGLint *attribs)
{
struct egl_g3d_display *gdpy = egl_g3d_display(dpy);
- struct pipe_screen *screen = gdpy->native->screen;
struct pipe_resource templ;
struct winsys_handle wsh;
_EGLImageAttribs attrs;
EGLint format;
- /* winsys_handle is in theory platform-specific */
if (dpy->Platform != _EGL_PLATFORM_DRM)
return NULL;
@@ -178,9 +176,10 @@ egl_g3d_reference_drm_buffer(_EGLDisplay *dpy, EGLint name,
memset(&wsh, 0, sizeof(wsh));
wsh.handle = (unsigned) name;
- wsh.stride = attrs.DRMBufferStrideMESA;
+ wsh.stride =
+ attrs.DRMBufferStrideMESA * util_format_get_blocksize(templ.format);
- return screen->resource_from_handle(screen, &templ, &wsh);
+ return gdpy->native->buffer->import_buffer(gdpy->native, &templ, &wsh);
}
#endif /* EGL_MESA_drm_image */
@@ -302,10 +301,8 @@ egl_g3d_export_drm_image(_EGLDriver *drv, _EGLDisplay *dpy, _EGLImage *img,
{
struct egl_g3d_display *gdpy = egl_g3d_display(dpy);
struct egl_g3d_image *gimg = egl_g3d_image(img);
- struct pipe_screen *screen = gdpy->native->screen;
struct winsys_handle wsh;
- /* winsys_handle is in theory platform-specific */
if (dpy->Platform != _EGL_PLATFORM_DRM)
return EGL_FALSE;
@@ -313,9 +310,9 @@ egl_g3d_export_drm_image(_EGLDriver *drv, _EGLDisplay *dpy, _EGLImage *img,
if (name) {
memset(&handle, 0, sizeof(handle));
wsh.type = DRM_API_HANDLE_TYPE_SHARED;
- if (!screen->resource_get_handle(screen, gimg->texture, &wsh)) {
+ if (!gdpy->native->buffer->export_buffer(gdpy->native,
+ gimg->texture, &wsh))
return EGL_FALSE;
- }
*name = wsh.handle;
}
@@ -324,7 +321,8 @@ egl_g3d_export_drm_image(_EGLDriver *drv, _EGLDisplay *dpy, _EGLImage *img,
if (handle || stride) {
memset(&wsh, 0, sizeof(wsh));
wsh.type = DRM_API_HANDLE_TYPE_KMS;
- if (!screen->resource_get_handle(screen, gimg->texture, &wsh))
+ if (!gdpy->native->buffer->export_buffer(gdpy->native,
+ gimg->texture, &wsh))
return EGL_FALSE;
if (handle)
diff --git a/src/gallium/state_trackers/egl/common/egl_g3d_st.c b/src/gallium/state_trackers/egl/common/egl_g3d_st.c
index 0affe632cfe..25e2999590c 100644
--- a/src/gallium/state_trackers/egl/common/egl_g3d_st.c
+++ b/src/gallium/state_trackers/egl/common/egl_g3d_st.c
@@ -192,7 +192,8 @@ egl_g3d_st_framebuffer_flush_front(struct st_framebuffer_iface *stfbi,
_EGLSurface *surf = (_EGLSurface *) stfbi->st_manager_private;
struct egl_g3d_surface *gsurf = egl_g3d_surface(surf);
- return gsurf->native->flush_frontbuffer(gsurf->native);
+ return gsurf->native->present(gsurf->native,
+ NATIVE_ATTACHMENT_FRONT_LEFT, FALSE, 0);
}
static boolean
diff --git a/src/gallium/state_trackers/egl/common/native.h b/src/gallium/state_trackers/egl/common/native.h
index 3c3f57e2670..3886ca20562 100644
--- a/src/gallium/state_trackers/egl/common/native.h
+++ b/src/gallium/state_trackers/egl/common/native.h
@@ -34,6 +34,11 @@
#include "pipe/p_state.h"
#include "state_tracker/sw_winsys.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "native_buffer.h"
#include "native_modeset.h"
/**
@@ -54,7 +59,17 @@ enum native_param_type {
* Return TRUE if window/pixmap surfaces use the buffers of the native
* types.
*/
- NATIVE_PARAM_USE_NATIVE_BUFFER
+ NATIVE_PARAM_USE_NATIVE_BUFFER,
+
+ /**
+ * Return TRUE if native_surface::present can preserve the buffer.
+ */
+ NATIVE_PARAM_PRESERVE_BUFFER,
+
+ /**
+ * Return the maximum supported swap interval.
+ */
+ NATIVE_PARAM_MAX_SWAP_INTERVAL
};
struct native_surface {
@@ -66,17 +81,12 @@ struct native_surface {
void (*destroy)(struct native_surface *nsurf);
/**
- * Swap the front and back buffers so that the back buffer is visible. It
- * is no-op if the surface is single-buffered. The contents of the back
- * buffer after swapping may or may not be preserved.
- */
- boolean (*swap_buffers)(struct native_surface *nsurf);
-
- /**
- * Make the front buffer visible. In some native displays, changes to the
- * front buffer might not be visible immediately and require manual flush.
+ * Present the given buffer to the native engine.
*/
- boolean (*flush_frontbuffer)(struct native_surface *nsurf);
+ boolean (*present)(struct native_surface *nsurf,
+ enum native_attachment natt,
+ boolean preserve,
+ uint swap_interval);
/**
* Validate the buffers of the surface. textures, if not NULL, points to an
@@ -181,6 +191,7 @@ struct native_display {
EGLNativePixmapType pix,
const struct native_config *nconf);
+ const struct native_display_buffer *buffer;
const struct native_display_modeset *modeset;
};
@@ -232,4 +243,8 @@ native_get_drm_platform(void);
const struct native_platform *
native_get_fbdev_platform(void);
+#ifdef __cplusplus
+}
+#endif
+
#endif /* _NATIVE_H_ */
diff --git a/src/gallium/state_trackers/egl/common/native_buffer.h b/src/gallium/state_trackers/egl/common/native_buffer.h
new file mode 100644
index 00000000000..5c29ab97411
--- /dev/null
+++ b/src/gallium/state_trackers/egl/common/native_buffer.h
@@ -0,0 +1,59 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 7.9
+ *
+ * Copyright (C) 2010 LunarG Inc.
+ *
+ * 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, sublicense,
+ * 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 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 NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS 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.
+ *
+ * Authors:
+ * Chia-I Wu <[email protected]>
+ */
+
+#ifndef _NATIVE_BUFFER_H_
+#define _NATIVE_BUFFER_H_
+
+#include "pipe/p_compiler.h"
+
+struct native_display;
+struct pipe_resource;
+
+/**
+ * Buffer interface of the native display. It allows native buffers to be
+ * imported and exported.
+ *
+ * Just like a native window or a native pixmap, a native buffer is another
+ * native type. Its definition depends on the native display.
+ *
+ * For DRM platform, the type of a native buffer is struct winsys_handle.
+ */
+struct native_display_buffer {
+ struct pipe_resource *(*import_buffer)(struct native_display *ndpy,
+ const struct pipe_resource *templ,
+ void *buf);
+
+ /**
+ * The resource must be creatred with PIPE_BIND_SHARED.
+ */
+ boolean (*export_buffer)(struct native_display *ndpy,
+ struct pipe_resource *res,
+ void *buf);
+};
+
+#endif /* _NATIVE_BUFFER_H_ */
diff --git a/src/gallium/state_trackers/egl/drm/modeset.c b/src/gallium/state_trackers/egl/drm/modeset.c
index 5ed22f7b9d4..0cc06caa2a1 100644
--- a/src/gallium/state_trackers/egl/drm/modeset.c
+++ b/src/gallium/state_trackers/egl/drm/modeset.c
@@ -167,6 +167,32 @@ drm_surface_swap_buffers(struct native_surface *nsurf)
return TRUE;
}
+static boolean
+drm_surface_present(struct native_surface *nsurf,
+ enum native_attachment natt,
+ boolean preserve,
+ uint swap_interval)
+{
+ boolean ret;
+
+ if (preserve || swap_interval)
+ return FALSE;
+
+ switch (natt) {
+ case NATIVE_ATTACHMENT_FRONT_LEFT:
+ ret = drm_surface_flush_frontbuffer(nsurf);
+ break;
+ case NATIVE_ATTACHMENT_BACK_LEFT:
+ ret = drm_surface_swap_buffers(nsurf);
+ break;
+ default:
+ ret = FALSE;
+ break;
+ }
+
+ return ret;
+}
+
static void
drm_surface_wait(struct native_surface *nsurf)
{
@@ -225,8 +251,7 @@ drm_display_create_surface(struct native_display *ndpy,
resource_surface_set_size(drmsurf->rsurf, drmsurf->width, drmsurf->height);
drmsurf->base.destroy = drm_surface_destroy;
- drmsurf->base.swap_buffers = drm_surface_swap_buffers;
- drmsurf->base.flush_frontbuffer = drm_surface_flush_frontbuffer;
+ drmsurf->base.present = drm_surface_present;
drmsurf->base.validate = drm_surface_validate;
drmsurf->base.wait = drm_surface_wait;
diff --git a/src/gallium/state_trackers/egl/drm/native_drm.c b/src/gallium/state_trackers/egl/drm/native_drm.c
index f6dc5584370..3759c2a26dd 100644
--- a/src/gallium/state_trackers/egl/drm/native_drm.c
+++ b/src/gallium/state_trackers/egl/drm/native_drm.c
@@ -103,6 +103,9 @@ drm_display_get_param(struct native_display *ndpy,
int val;
switch (param) {
+ case NATIVE_PARAM_USE_NATIVE_BUFFER:
+ case NATIVE_PARAM_PRESERVE_BUFFER:
+ case NATIVE_PARAM_MAX_SWAP_INTERVAL:
default:
val = 0;
break;
@@ -182,6 +185,29 @@ drm_display_init_screen(struct native_display *ndpy)
return TRUE;
}
+static struct pipe_resource *
+drm_display_import_buffer(struct native_display *ndpy,
+ const struct pipe_resource *templ,
+ void *buf)
+{
+ return ndpy->screen->resource_from_handle(ndpy->screen,
+ templ, (struct winsys_handle *) buf);
+}
+
+static boolean
+drm_display_export_buffer(struct native_display *ndpy,
+ struct pipe_resource *res,
+ void *buf)
+{
+ return ndpy->screen->resource_get_handle(ndpy->screen,
+ res, (struct winsys_handle *) buf);
+}
+
+static struct native_display_buffer drm_display_buffer = {
+ drm_display_import_buffer,
+ drm_display_export_buffer
+};
+
static struct native_display *
drm_create_display(int fd, struct native_event_handler *event_handler,
void *user_data)
@@ -205,6 +231,7 @@ drm_create_display(int fd, struct native_event_handler *event_handler,
drmdpy->base.get_param = drm_display_get_param;
drmdpy->base.get_configs = drm_display_get_configs;
+ drmdpy->base.buffer = &drm_display_buffer;
drm_display_init_modeset(&drmdpy->base);
return &drmdpy->base;
diff --git a/src/gallium/state_trackers/egl/fbdev/native_fbdev.c b/src/gallium/state_trackers/egl/fbdev/native_fbdev.c
index e459402076d..1b5ea8bf9d5 100644
--- a/src/gallium/state_trackers/egl/fbdev/native_fbdev.c
+++ b/src/gallium/state_trackers/egl/fbdev/native_fbdev.c
@@ -137,6 +137,32 @@ fbdev_surface_swap_buffers(struct native_surface *nsurf)
return ret;
}
+static boolean
+fbdev_surface_present(struct native_surface *nsurf,
+ enum native_attachment natt,
+ boolean preserve,
+ uint swap_interval)
+{
+ boolean ret;
+
+ if (preserve || swap_interval)
+ return FALSE;
+
+ switch (natt) {
+ case NATIVE_ATTACHMENT_FRONT_LEFT:
+ ret = fbdev_surface_flush_frontbuffer(nsurf);
+ break;
+ case NATIVE_ATTACHMENT_BACK_LEFT:
+ ret = fbdev_surface_swap_buffers(nsurf);
+ break;
+ default:
+ ret = FALSE;
+ break;
+ }
+
+ return ret;
+}
+
static void
fbdev_surface_wait(struct native_surface *nsurf)
{
@@ -181,8 +207,7 @@ fbdev_display_create_scanout_surface(struct native_display *ndpy,
resource_surface_set_size(fbsurf->rsurf, fbsurf->width, fbsurf->height);
fbsurf->base.destroy = fbdev_surface_destroy;
- fbsurf->base.swap_buffers = fbdev_surface_swap_buffers;
- fbsurf->base.flush_frontbuffer = fbdev_surface_flush_frontbuffer;
+ fbsurf->base.present = fbdev_surface_present;
fbsurf->base.validate = fbdev_surface_validate;
fbsurf->base.wait = fbdev_surface_wait;
@@ -279,6 +304,9 @@ fbdev_display_get_param(struct native_display *ndpy,
int val;
switch (param) {
+ case NATIVE_PARAM_USE_NATIVE_BUFFER:
+ case NATIVE_PARAM_PRESERVE_BUFFER:
+ case NATIVE_PARAM_MAX_SWAP_INTERVAL:
default:
val = 0;
break;
diff --git a/src/gallium/state_trackers/egl/gdi/native_gdi.c b/src/gallium/state_trackers/egl/gdi/native_gdi.c
index 91701e5b7df..d259e6edc89 100644
--- a/src/gallium/state_trackers/egl/gdi/native_gdi.c
+++ b/src/gallium/state_trackers/egl/gdi/native_gdi.c
@@ -160,6 +160,32 @@ gdi_surface_swap_buffers(struct native_surface *nsurf)
}
static boolean
+gdi_surface_present(struct native_surface *nsurf,
+ enum native_attachment natt,
+ boolean preserve,
+ uint swap_interval)
+{
+ boolean ret;
+
+ if (preserve || swap_interval)
+ return FALSE;
+
+ switch (natt) {
+ case NATIVE_ATTACHMENT_FRONT_LEFT:
+ ret = gdi_surface_flush_frontbuffer(nsurf);
+ break;
+ case NATIVE_ATTACHMENT_BACK_LEFT:
+ ret = gdi_surface_swap_buffers(nsurf);
+ break;
+ default:
+ ret = FALSE;
+ break;
+ }
+
+ return ret;
+}
+
+static boolean
gdi_surface_validate(struct native_surface *nsurf, uint attachment_mask,
unsigned int *seq_num, struct pipe_resource **textures,
int *width, int *height)
@@ -231,8 +257,7 @@ gdi_display_create_window_surface(struct native_display *ndpy,
gdi_surface_update_geometry(&gsurf->base);
gsurf->base.destroy = gdi_surface_destroy;
- gsurf->base.swap_buffers = gdi_surface_swap_buffers;
- gsurf->base.flush_frontbuffer = gdi_surface_flush_frontbuffer;
+ gsurf->base.present = gdi_surface_present;
gsurf->base.validate = gdi_surface_validate;
gsurf->base.wait = gdi_surface_wait;
@@ -321,6 +346,8 @@ gdi_display_get_param(struct native_display *ndpy,
/* private buffers are allocated */
val = FALSE;
break;
+ case NATIVE_PARAM_PRESERVE_BUFFER:
+ case NATIVE_PARAM_MAX_SWAP_INTERVAL:
default:
val = 0;
break;
diff --git a/src/gallium/state_trackers/egl/x11/native_dri2.c b/src/gallium/state_trackers/egl/x11/native_dri2.c
index 1169e273c34..331a7de432a 100644
--- a/src/gallium/state_trackers/egl/x11/native_dri2.c
+++ b/src/gallium/state_trackers/egl/x11/native_dri2.c
@@ -338,6 +338,32 @@ dri2_surface_swap_buffers(struct native_surface *nsurf)
}
static boolean
+dri2_surface_present(struct native_surface *nsurf,
+ enum native_attachment natt,
+ boolean preserve,
+ uint swap_interval)
+{
+ boolean ret;
+
+ if (swap_interval)
+ return FALSE;
+
+ switch (natt) {
+ case NATIVE_ATTACHMENT_FRONT_LEFT:
+ ret = dri2_surface_flush_frontbuffer(nsurf);
+ break;
+ case NATIVE_ATTACHMENT_BACK_LEFT:
+ ret = dri2_surface_swap_buffers(nsurf);
+ break;
+ default:
+ ret = FALSE;
+ break;
+ }
+
+ return ret;
+}
+
+static boolean
dri2_surface_validate(struct native_surface *nsurf, uint attachment_mask,
unsigned int *seq_num, struct pipe_resource **textures,
int *width, int *height)
@@ -430,8 +456,7 @@ dri2_display_create_surface(struct native_display *ndpy,
dri2surf->color_format = dri2conf->base.color_format;
dri2surf->base.destroy = dri2_surface_destroy;
- dri2surf->base.swap_buffers = dri2_surface_swap_buffers;
- dri2surf->base.flush_frontbuffer = dri2_surface_flush_frontbuffer;
+ dri2surf->base.present = dri2_surface_present;
dri2surf->base.validate = dri2_surface_validate;
dri2surf->base.wait = dri2_surface_wait;
@@ -630,9 +655,14 @@ dri2_display_get_param(struct native_display *ndpy,
switch (param) {
case NATIVE_PARAM_USE_NATIVE_BUFFER:
- /* DRI2GetBuffers use the native buffers */
+ /* DRI2GetBuffers uses the native buffers */
+ val = TRUE;
+ break;
+ case NATIVE_PARAM_PRESERVE_BUFFER:
+ /* DRI2CopyRegion is used */
val = TRUE;
break;
+ case NATIVE_PARAM_MAX_SWAP_INTERVAL:
default:
val = 0;
break;
diff --git a/src/gallium/state_trackers/egl/x11/native_x11.h b/src/gallium/state_trackers/egl/x11/native_x11.h
index 0b47837e1b5..8945117276e 100644
--- a/src/gallium/state_trackers/egl/x11/native_x11.h
+++ b/src/gallium/state_trackers/egl/x11/native_x11.h
@@ -27,6 +27,7 @@
#define _NATIVE_X11_H_
#include "common/native.h"
+#include <X11/Xlib.h>
struct native_display *
x11_create_ximage_display(Display *dpy,
diff --git a/src/gallium/state_trackers/egl/x11/native_ximage.c b/src/gallium/state_trackers/egl/x11/native_ximage.c
index 4b32f6e36e0..84811fb6e14 100644
--- a/src/gallium/state_trackers/egl/x11/native_ximage.c
+++ b/src/gallium/state_trackers/egl/x11/native_ximage.c
@@ -175,6 +175,32 @@ ximage_surface_swap_buffers(struct native_surface *nsurf)
}
static boolean
+ximage_surface_present(struct native_surface *nsurf,
+ enum native_attachment natt,
+ boolean preserve,
+ uint swap_interval)
+{
+ boolean ret;
+
+ if (preserve || swap_interval)
+ return FALSE;
+
+ switch (natt) {
+ case NATIVE_ATTACHMENT_FRONT_LEFT:
+ ret = ximage_surface_flush_frontbuffer(nsurf);
+ break;
+ case NATIVE_ATTACHMENT_BACK_LEFT:
+ ret = ximage_surface_swap_buffers(nsurf);
+ break;
+ default:
+ ret = FALSE;
+ break;
+ }
+
+ return ret;
+}
+
+static boolean
ximage_surface_validate(struct native_surface *nsurf, uint attachment_mask,
unsigned int *seq_num, struct pipe_resource **textures,
int *width, int *height)
@@ -257,8 +283,7 @@ ximage_display_create_surface(struct native_display *ndpy,
xsurf->xdraw.drawable = xsurf->drawable;
xsurf->base.destroy = ximage_surface_destroy;
- xsurf->base.swap_buffers = ximage_surface_swap_buffers;
- xsurf->base.flush_frontbuffer = ximage_surface_flush_frontbuffer;
+ xsurf->base.present = ximage_surface_present;
xsurf->base.validate = ximage_surface_validate;
xsurf->base.wait = ximage_surface_wait;
@@ -416,6 +441,8 @@ ximage_display_get_param(struct native_display *ndpy,
/* private buffers are allocated */
val = FALSE;
break;
+ case NATIVE_PARAM_PRESERVE_BUFFER:
+ case NATIVE_PARAM_MAX_SWAP_INTERVAL:
default:
val = 0;
break;
diff --git a/src/gallium/state_trackers/glx/xlib/SConscript b/src/gallium/state_trackers/glx/xlib/SConscript
index 9df351a2769..9e7ebf3fc91 100644
--- a/src/gallium/state_trackers/glx/xlib/SConscript
+++ b/src/gallium/state_trackers/glx/xlib/SConscript
@@ -3,25 +3,24 @@
Import('*')
-if env['platform'] == 'linux' \
- and 'mesa' in env['statetrackers']:
+env = env.Clone()
- env = env.Clone()
+env.Append(CPPPATH = [
+ '#/src/mapi',
+ '#/src/mesa',
+ '#/src/mesa/main',
+])
- env.Append(CPPPATH = [
- '#/src/mapi',
- '#/src/mesa',
- '#/src/mesa/main',
- ])
+sources = [
+ 'glx_api.c',
+ 'glx_getproc.c',
+ 'glx_usefont.c',
+ 'xm_api.c',
+ 'xm_st.c',
+]
- st_xlib = env.ConvenienceLibrary(
- target = 'st_xlib',
- source = [
- 'glx_api.c',
- 'glx_getproc.c',
- 'glx_usefont.c',
- 'xm_api.c',
- 'xm_st.c',
- ]
- )
- Export('st_xlib')
+st_xlib = env.ConvenienceLibrary(
+ target = 'st_xlib',
+ source = sources,
+)
+Export('st_xlib')
diff --git a/src/gallium/state_trackers/python/SConscript b/src/gallium/state_trackers/python/SConscript
index aadeaa0a359..b8371865a61 100644
--- a/src/gallium/state_trackers/python/SConscript
+++ b/src/gallium/state_trackers/python/SConscript
@@ -3,57 +3,64 @@ import os.path
Import('*')
-if 'python' in env['statetrackers']:
-
- env = env.Clone()
-
- env.Tool('python')
-
- env.Tool('swig')
- env.Append(SWIGPATH = ['#src/gallium/include', '#src/gallium/include/pipe'])
- env.Append(SWIGFLAGS = ['-python', '-keyword'])
-
- env.Append(CPPPATH = '.')
-
- if env['platform'] == 'windows':
- env.Append(LIBS = [
- 'opengl32',
- 'gdi32',
- 'user32',
- 'kernel32',
- 'ws2_32',
- ])
- else:
- env.Append(CPPDEFINES = ['GCC_HASCLASSVISIBILITY'])
- env.Append(LIBS = [
- 'GL',
- 'X11',
- ])
-
- sources = [
- 'gallium.i',
- 'st_device.c',
- 'st_sample.c',
- 'st_hardpipe_winsys.c',
- 'st_softpipe_winsys.c',
- ]
-
- env.Prepend(LIBS = [
- ws_null,
- trace,
- gallium,
+if env['toolchain'] == 'crossmingw':
+ # Cross-compilation not supported
+ Return()
+
+if not env.Detect(['swig']):
+ Return()
+
+env = env.Clone()
+
+env.Tool('python')
+
+env.Tool('swig')
+env.Append(SWIGPATH = ['#src/gallium/include', '#src/gallium/include/pipe'])
+env.Append(SWIGFLAGS = ['-python', '-keyword'])
+
+env.Append(CPPPATH = '.')
+
+if env['platform'] == 'windows':
+ env.Append(LIBS = [
+ 'opengl32',
+ 'gdi32',
+ 'user32',
+ 'kernel32',
+ 'ws2_32',
+ ])
+else:
+ env.Append(CPPDEFINES = ['GCC_HASCLASSVISIBILITY'])
+ env.Append(LIBS = [
+ 'GL',
+ 'X11',
])
- if env['llvm']:
- env.Append(CPPDEFINES = ['HAVE_LLVMPIPE'])
- env.Prepend(LIBS = [llvmpipe])
- if True:
- env.Append(CPPDEFINES = ['HAVE_SOFTPIPE'])
- env.Prepend(LIBS = [softpipe])
+sources = [
+ 'gallium.i',
+ 'st_device.c',
+ 'st_sample.c',
+ 'st_hardpipe_winsys.c',
+ 'st_softpipe_winsys.c',
+]
+
+env.Prepend(LIBS = [
+ ws_null,
+ trace,
+ gallium,
+])
+
+if env['llvm']:
+ env.Append(CPPDEFINES = ['HAVE_LLVMPIPE'])
+ env.Prepend(LIBS = [llvmpipe])
+if True:
+ env.Append(CPPDEFINES = ['HAVE_SOFTPIPE'])
+ env.Prepend(LIBS = [softpipe])
+
+env['no_import_lib'] = 1
- env['no_import_lib'] = 1
+pyst = env.SharedLibrary(
+ target = '_gallium',
+ source = sources,
+)
- env.SharedLibrary(
- target = '_gallium',
- source = sources,
- )
+env.Alias('python', pyst)
diff --git a/src/gallium/state_trackers/vega/SConscript b/src/gallium/state_trackers/vega/SConscript
index 548053eb646..a25b8474e4d 100644
--- a/src/gallium/state_trackers/vega/SConscript
+++ b/src/gallium/state_trackers/vega/SConscript
@@ -3,49 +3,48 @@
Import('*')
-if 'egl' in env['statetrackers']:
+env = env.Clone()
- env = env.Clone()
+env.Append(CPPPATH = [
+ '#/src/mapi',
+])
- env.Append(CPPPATH = [
- '#/src/mapi',
- ])
+vega_sources = [
+ 'api.c',
+ 'api_context.c',
+ 'api_filters.c',
+ 'api_images.c',
+ 'api_masks.c',
+ 'api_misc.c',
+ 'api_paint.c',
+ 'api_params.c',
+ 'api_path.c',
+ 'api_text.c',
+ 'api_transform.c',
+ 'vgu.c',
+ 'vg_context.c',
+ 'vg_manager.c',
+ 'vg_state.c',
+ 'vg_translate.c',
+ 'polygon.c',
+ 'bezier.c',
+ 'path.c',
+ 'paint.c',
+ 'arc.c',
+ 'image.c',
+ 'renderer.c',
+ 'stroker.c',
+ 'mask.c',
+ 'shader.c',
+ 'shaders_cache.c',
+]
- vega_sources = [
- 'api.c',
- 'api_context.c',
- 'api_filters.c',
- 'api_images.c',
- 'api_masks.c',
- 'api_misc.c',
- 'api_paint.c',
- 'api_params.c',
- 'api_path.c',
- 'api_text.c',
- 'api_transform.c',
- 'vgu.c',
- 'vg_context.c',
- 'vg_manager.c',
- 'vg_state.c',
- 'vg_translate.c',
- 'polygon.c',
- 'bezier.c',
- 'path.c',
- 'paint.c',
- 'arc.c',
- 'image.c',
- 'renderer.c',
- 'stroker.c',
- 'mask.c',
- 'shader.c',
- 'shaders_cache.c',
- ]
+# vgapi_header must be generated first
+env.Depends(vega_sources, vgapi_header)
- # vgapi_header must be generated first
- env.Depends(vega_sources, vgapi_header)
+st_vega = env.ConvenienceLibrary(
+ target = 'st_vega',
+ source = vega_sources,
+)
- st_vega = env.ConvenienceLibrary(
- target = 'st_vega',
- source = vega_sources,
- )
- Export('st_vega')
+Export('st_vega')
diff --git a/src/gallium/state_trackers/vega/api_filters.c b/src/gallium/state_trackers/vega/api_filters.c
index 8ace9853368..4bd5d7e4bc2 100644
--- a/src/gallium/state_trackers/vega/api_filters.c
+++ b/src/gallium/state_trackers/vega/api_filters.c
@@ -37,10 +37,8 @@
#include "pipe/p_state.h"
#include "util/u_inlines.h"
#include "pipe/p_screen.h"
-#include "pipe/p_shader_tokens.h"
#include "util/u_format.h"
-#include "util/u_memory.h"
#include "util/u_sampler.h"
#include "util/u_string.h"
diff --git a/src/gallium/state_trackers/vega/api_images.c b/src/gallium/state_trackers/vega/api_images.c
index c36b3d2f3c8..7054d9bb7ed 100644
--- a/src/gallium/state_trackers/vega/api_images.c
+++ b/src/gallium/state_trackers/vega/api_images.c
@@ -36,9 +36,7 @@
#include "pipe/p_context.h"
#include "pipe/p_screen.h"
#include "util/u_inlines.h"
-#include "util/u_blit.h"
#include "util/u_tile.h"
-#include "util/u_memory.h"
static INLINE VGboolean supported_image_format(VGImageFormat format)
{
diff --git a/src/gallium/state_trackers/vega/api_masks.c b/src/gallium/state_trackers/vega/api_masks.c
index 94c1ff5375f..189390ec2d3 100644
--- a/src/gallium/state_trackers/vega/api_masks.c
+++ b/src/gallium/state_trackers/vega/api_masks.c
@@ -27,7 +27,6 @@
#include "VG/openvg.h"
#include "mask.h"
-#include "renderer.h"
#include "api.h"
#include "vg_context.h"
@@ -36,7 +35,6 @@
#include "util/u_pack_color.h"
#include "util/u_draw_quad.h"
-#include "util/u_memory.h"
#define DISABLE_1_1_MASKING 1
diff --git a/src/gallium/state_trackers/vega/api_paint.c b/src/gallium/state_trackers/vega/api_paint.c
index d88341b04ff..1411806455c 100644
--- a/src/gallium/state_trackers/vega/api_paint.c
+++ b/src/gallium/state_trackers/vega/api_paint.c
@@ -28,7 +28,6 @@
#include "vg_context.h"
#include "paint.h"
-#include "image.h"
#include "api.h"
VGPaint vegaCreatePaint(void)
diff --git a/src/gallium/state_trackers/vega/api_path.c b/src/gallium/state_trackers/vega/api_path.c
index 6c9a2e8d658..f76adddb584 100644
--- a/src/gallium/state_trackers/vega/api_path.c
+++ b/src/gallium/state_trackers/vega/api_path.c
@@ -28,13 +28,9 @@
#include "vg_context.h"
#include "path.h"
-#include "polygon.h"
-#include "paint.h"
#include "api.h"
#include "pipe/p_context.h"
-#include "util/u_inlines.h"
-#include "util/u_draw_quad.h"
VGPath vegaCreatePath(VGint pathFormat,
VGPathDatatype datatype,
diff --git a/src/gallium/state_trackers/vega/api_text.c b/src/gallium/state_trackers/vega/api_text.c
index b35f3be90ab..2a62da0a1de 100644
--- a/src/gallium/state_trackers/vega/api_text.c
+++ b/src/gallium/state_trackers/vega/api_text.c
@@ -27,7 +27,6 @@
#include "VG/openvg.h"
#include "vg_context.h"
-#include "api.h"
#include "util/u_memory.h"
diff --git a/src/gallium/state_trackers/vega/image.c b/src/gallium/state_trackers/vega/image.c
index c12dc71b860..28bbe420a21 100644
--- a/src/gallium/state_trackers/vega/image.c
+++ b/src/gallium/state_trackers/vega/image.c
@@ -32,13 +32,11 @@
#include "renderer.h"
#include "util_array.h"
#include "api_consts.h"
-#include "shaders_cache.h"
#include "shader.h"
#include "pipe/p_context.h"
#include "pipe/p_screen.h"
#include "util/u_inlines.h"
-#include "util/u_blit.h"
#include "util/u_format.h"
#include "util/u_tile.h"
#include "util/u_memory.h"
diff --git a/src/gallium/state_trackers/vega/paint.c b/src/gallium/state_trackers/vega/paint.c
index 2c0eb6b23d2..c0c8cddabe9 100644
--- a/src/gallium/state_trackers/vega/paint.c
+++ b/src/gallium/state_trackers/vega/paint.c
@@ -26,7 +26,6 @@
#include "paint.h"
-#include "shaders_cache.h"
#include "matrix.h"
#include "image.h"
#include "st_inlines.h"
@@ -34,7 +33,6 @@
#include "pipe/p_compiler.h"
#include "util/u_inlines.h"
-#include "util/u_format.h"
#include "util/u_memory.h"
#include "util/u_math.h"
#include "util/u_sampler.h"
diff --git a/src/gallium/state_trackers/vega/polygon.c b/src/gallium/state_trackers/vega/polygon.c
index bc94170eb96..ca8831064c9 100644
--- a/src/gallium/state_trackers/vega/polygon.c
+++ b/src/gallium/state_trackers/vega/polygon.c
@@ -29,7 +29,6 @@
#include "matrix.h" /*for floatsEqual*/
#include "vg_context.h"
#include "vg_state.h"
-#include "paint.h"
#include "renderer.h"
#include "util_array.h"
#include "VG/openvg.h"
diff --git a/src/gallium/state_trackers/vega/renderer.c b/src/gallium/state_trackers/vega/renderer.c
index 8c023044c45..c6f5f7a05b8 100644
--- a/src/gallium/state_trackers/vega/renderer.c
+++ b/src/gallium/state_trackers/vega/renderer.c
@@ -35,12 +35,9 @@
#include "pipe/p_shader_tokens.h"
#include "util/u_draw_quad.h"
-#include "util/u_format.h"
#include "util/u_simple_shaders.h"
#include "util/u_memory.h"
-#include "util/u_rect.h"
#include "util/u_sampler.h"
-#include "util/u_surface.h"
#include "cso_cache/cso_context.h"
diff --git a/src/gallium/state_trackers/vega/shaders_cache.c b/src/gallium/state_trackers/vega/shaders_cache.c
index 53e6bfcf16b..e002a7ed428 100644
--- a/src/gallium/state_trackers/vega/shaders_cache.c
+++ b/src/gallium/state_trackers/vega/shaders_cache.c
@@ -30,8 +30,6 @@
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
-#include "util/u_inlines.h"
-#include "pipe/p_screen.h"
#include "pipe/p_shader_tokens.h"
#include "tgsi/tgsi_build.h"
diff --git a/src/gallium/state_trackers/vega/vg_context.c b/src/gallium/state_trackers/vega/vg_context.c
index 5cb25906027..b1f98fa477d 100644
--- a/src/gallium/state_trackers/vega/vg_context.c
+++ b/src/gallium/state_trackers/vega/vg_context.c
@@ -37,7 +37,6 @@
#include "pipe/p_context.h"
#include "util/u_inlines.h"
-#include "pipe/p_shader_tokens.h"
#include "cso_cache/cso_context.h"
diff --git a/src/gallium/state_trackers/wgl/SConscript b/src/gallium/state_trackers/wgl/SConscript
index 0f580b859c6..ec55f042f90 100644
--- a/src/gallium/state_trackers/wgl/SConscript
+++ b/src/gallium/state_trackers/wgl/SConscript
@@ -2,41 +2,38 @@ import os
Import('*')
-if env['platform'] in ['windows']:
-
- env = env.Clone()
-
- env.Append(CPPPATH = [
- '#src/mapi',
- '#src/mesa',
- '.',
- ])
-
- env.AppendUnique(CPPDEFINES = [
- '_GDI32_', # prevent wgl* being declared __declspec(dllimport)
- 'BUILD_GL32', # declare gl* as __declspec(dllexport) in Mesa headers
- 'WIN32_THREADS', # use Win32 thread API
- 'WIN32_LEAN_AND_MEAN', # http://msdn2.microsoft.com/en-us/library/6dwk3a1z.aspx
- ])
-
- sources = [
- 'stw_context.c',
- 'stw_device.c',
- 'stw_ext_extensionsstring.c',
- 'stw_ext_gallium.c',
- 'stw_ext_pixelformat.c',
- 'stw_ext_swapinterval.c',
- 'stw_framebuffer.c',
- 'stw_getprocaddress.c',
- 'stw_pixelformat.c',
- 'stw_st.c',
- 'stw_tls.c',
- 'stw_wgl.c',
- ]
+env = env.Clone()
- wgl = env.ConvenienceLibrary(
- target ='wgl',
- source = sources,
- )
-
- Export('wgl')
+env.Append(CPPPATH = [
+ '#src/mapi',
+ '#src/mesa',
+ '.',
+])
+
+env.AppendUnique(CPPDEFINES = [
+ '_GDI32_', # prevent wgl* being declared __declspec(dllimport)
+ 'BUILD_GL32', # declare gl* as __declspec(dllexport) in Mesa headers
+ 'WIN32_THREADS', # use Win32 thread API
+ 'WIN32_LEAN_AND_MEAN', # http://msdn2.microsoft.com/en-us/library/6dwk3a1z.aspx
+])
+
+sources = [
+ 'stw_context.c',
+ 'stw_device.c',
+ 'stw_ext_extensionsstring.c',
+ 'stw_ext_gallium.c',
+ 'stw_ext_pixelformat.c',
+ 'stw_ext_swapinterval.c',
+ 'stw_framebuffer.c',
+ 'stw_getprocaddress.c',
+ 'stw_pixelformat.c',
+ 'stw_st.c',
+ 'stw_tls.c',
+ 'stw_wgl.c',
+]
+
+wgl = env.ConvenienceLibrary(
+ target ='wgl',
+ source = sources,
+)
+Export('wgl')
diff --git a/src/gallium/state_trackers/xorg/SConscript b/src/gallium/state_trackers/xorg/SConscript
index 0b598dab6e3..19315694b7c 100644
--- a/src/gallium/state_trackers/xorg/SConscript
+++ b/src/gallium/state_trackers/xorg/SConscript
@@ -3,34 +3,38 @@
Import('*')
-if 'xorg' in env['statetrackers']:
+env = env.Clone()
- env = env.Clone()
+env.Append(CPPPATH = [
+ '#/src/mesa',
+])
- env.Append(CPPPATH = [
- '#/src/mesa',
- ])
+env.ParseConfig('pkg-config --cflags --libs libdrm xorg-server')
- env.ParseConfig('pkg-config --cflags --libs libdrm xorg-server')
+if env['kms']:
+ env.Append(CPPDEFINES = ['HAVE_LIBKMS'])
- conf = env.Configure()
+conf = env.Configure()
- if conf.CheckHeader('X11/extensions/dpmsconst.h'):
- env.Append(CPPDEFINES = [('HAVE_XEXTPROTO_71', '1')])
+if conf.CheckHeader('X11/extensions/dpmsconst.h'):
+ env.Append(CPPDEFINES = [('HAVE_XEXTPROTO_71', '1')])
- conf.Finish()
+conf.Finish()
- st_xorg = env.ConvenienceLibrary(
- target = 'st_xorg',
- source = [ 'xorg_composite.c',
- 'xorg_crtc.c',
- 'xorg_dri2.c',
- 'xorg_driver.c',
- 'xorg_exa.c',
- 'xorg_exa_tgsi.c',
- 'xorg_output.c',
- 'xorg_renderer.c',
- 'xorg_xv.c',
- ]
- )
- Export('st_xorg')
+sources = [
+ 'xorg_composite.c',
+ 'xorg_crtc.c',
+ 'xorg_dri2.c',
+ 'xorg_driver.c',
+ 'xorg_exa.c',
+ 'xorg_exa_tgsi.c',
+ 'xorg_output.c',
+ 'xorg_renderer.c',
+ 'xorg_xv.c',
+]
+
+st_xorg = env.ConvenienceLibrary(
+ target = 'st_xorg',
+ source = sources,
+)
+Export('st_xorg')
diff --git a/src/gallium/state_trackers/xorg/xorg_driver.c b/src/gallium/state_trackers/xorg/xorg_driver.c
index 1ec772df172..1ee79ae177e 100644
--- a/src/gallium/state_trackers/xorg/xorg_driver.c
+++ b/src/gallium/state_trackers/xorg/xorg_driver.c
@@ -447,7 +447,7 @@ drv_pre_init(ScrnInfoPtr pScrn, int flags)
if (!drv_init_resource_management(pScrn)) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Could not init "
- "Gallium3D or libKMS.");
+ "Gallium3D or libKMS.\n");
return FALSE;
}