summaryrefslogtreecommitdiff
path: root/src/gallium/state_trackers
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/state_trackers')
-rw-r--r--src/gallium/state_trackers/dri/drm/Makefile1
-rw-r--r--src/gallium/state_trackers/dri/drm/SConscript1
-rw-r--r--src/gallium/state_trackers/dri/sw/Makefile1
-rw-r--r--src/gallium/state_trackers/dri/sw/SConscript1
-rw-r--r--src/gallium/state_trackers/egl/Makefile1
-rw-r--r--src/gallium/state_trackers/egl/common/egl_g3d.c9
-rw-r--r--src/gallium/state_trackers/egl/common/egl_g3d_st.c180
-rw-r--r--src/gallium/state_trackers/egl/common/egl_g3d_st.h7
-rw-r--r--src/gallium/state_trackers/es/Makefile84
-rw-r--r--src/gallium/state_trackers/es/st_es1.c7
-rw-r--r--src/gallium/state_trackers/es/st_es2.c8
-rw-r--r--src/gallium/state_trackers/glx/xlib/Makefile1
-rw-r--r--src/gallium/state_trackers/glx/xlib/SConscript1
-rw-r--r--src/gallium/state_trackers/glx/xlib/glx_getproc.c1
-rw-r--r--src/gallium/state_trackers/python/st_device.c3
-rw-r--r--src/gallium/state_trackers/vega/Makefile67
-rw-r--r--src/gallium/state_trackers/vega/api.c88
-rw-r--r--src/gallium/state_trackers/vega/api.h51
-rw-r--r--src/gallium/state_trackers/vega/api_context.c7
-rw-r--r--src/gallium/state_trackers/vega/api_filters.c69
-rw-r--r--src/gallium/state_trackers/vega/api_images.c91
-rw-r--r--src/gallium/state_trackers/vega/api_masks.c38
-rw-r--r--src/gallium/state_trackers/vega/api_misc.c7
-rw-r--r--src/gallium/state_trackers/vega/api_paint.c15
-rw-r--r--src/gallium/state_trackers/vega/api_params.c83
-rw-r--r--src/gallium/state_trackers/vega/api_path.c93
-rw-r--r--src/gallium/state_trackers/vega/api_text.c53
-rw-r--r--src/gallium/state_trackers/vega/api_transform.c17
-rw-r--r--src/gallium/state_trackers/vega/polygon.c8
-rw-r--r--src/gallium/state_trackers/vega/vg_api.h37
-rw-r--r--src/gallium/state_trackers/vega/vg_context.c6
-rw-r--r--src/gallium/state_trackers/vega/vg_context.h2
-rw-r--r--src/gallium/state_trackers/vega/vg_manager.c14
-rw-r--r--src/gallium/state_trackers/wgl/SConscript1
-rw-r--r--src/gallium/state_trackers/xorg/SConscript4
-rw-r--r--src/gallium/state_trackers/xorg/xorg_crtc.c7
-rw-r--r--src/gallium/state_trackers/xorg/xorg_dri2.c2
-rw-r--r--src/gallium/state_trackers/xorg/xorg_driver.c70
-rw-r--r--src/gallium/state_trackers/xorg/xorg_exa.c2
-rw-r--r--src/gallium/state_trackers/xorg/xorg_output.c59
-rw-r--r--src/gallium/state_trackers/xorg/xorg_renderer.c1
-rw-r--r--src/gallium/state_trackers/xorg/xorg_tracker.h5
42 files changed, 696 insertions, 507 deletions
diff --git a/src/gallium/state_trackers/dri/drm/Makefile b/src/gallium/state_trackers/dri/drm/Makefile
index d9a973e3c3..6c9d03fc5d 100644
--- a/src/gallium/state_trackers/dri/drm/Makefile
+++ b/src/gallium/state_trackers/dri/drm/Makefile
@@ -5,6 +5,7 @@ LIBNAME = dridrm
LIBRARY_INCLUDES = \
-I$(TOP)/include \
+ -I$(TOP)/src/mapi \
-I$(TOP)/src/mesa \
-I$(TOP)/src/gallium/state_trackers/dri/common \
-I$(TOP)/src/mesa/drivers/dri/common \
diff --git a/src/gallium/state_trackers/dri/drm/SConscript b/src/gallium/state_trackers/dri/drm/SConscript
index 8800b65534..965dc95760 100644
--- a/src/gallium/state_trackers/dri/drm/SConscript
+++ b/src/gallium/state_trackers/dri/drm/SConscript
@@ -10,6 +10,7 @@ if env['dri']:
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',
diff --git a/src/gallium/state_trackers/dri/sw/Makefile b/src/gallium/state_trackers/dri/sw/Makefile
index c0ae71451b..a1dadeba5e 100644
--- a/src/gallium/state_trackers/dri/sw/Makefile
+++ b/src/gallium/state_trackers/dri/sw/Makefile
@@ -8,6 +8,7 @@ LIBRARY_DEFINES = -D__NOT_HAVE_DRM_H
LIBRARY_INCLUDES = \
-I../dri \
-I$(TOP)/include \
+ -I$(TOP)/src/mapi \
-I$(TOP)/src/mesa \
-I$(TOP)/src/gallium/state_trackers/dri/common \
-I$(TOP)/src/mesa/drivers/dri/common \
diff --git a/src/gallium/state_trackers/dri/sw/SConscript b/src/gallium/state_trackers/dri/sw/SConscript
index 6bb282d1a4..0c5194d6ed 100644
--- a/src/gallium/state_trackers/dri/sw/SConscript
+++ b/src/gallium/state_trackers/dri/sw/SConscript
@@ -8,6 +8,7 @@ if env['dri']:
env = env.Clone()
env.Append(CPPPATH = [
+ '#/src/mapi',
'#/src/mesa',
'#/src/gallium/state_trackers/dri/common',
'#/src/mesa/drivers/dri/common',
diff --git a/src/gallium/state_trackers/egl/Makefile b/src/gallium/state_trackers/egl/Makefile
index 1768241352..a3c1bb4346 100644
--- a/src/gallium/state_trackers/egl/Makefile
+++ b/src/gallium/state_trackers/egl/Makefile
@@ -15,6 +15,7 @@ common_OBJECTS = $(common_SOURCES:.c=.o)
x11_INCLUDES = \
-I$(TOP)/src/gallium/drivers \
-I$(TOP)/src/glx \
+ -I$(TOP)/src/mapi \
-I$(TOP)/src/mesa \
$(X11_CFLAGS) \
$(shell pkg-config --cflags-only-I libdrm)
diff --git a/src/gallium/state_trackers/egl/common/egl_g3d.c b/src/gallium/state_trackers/egl/common/egl_g3d.c
index 871c33267a..d63b81a1c5 100644
--- a/src/gallium/state_trackers/egl/common/egl_g3d.c
+++ b/src/gallium/state_trackers/egl/common/egl_g3d.c
@@ -50,8 +50,8 @@ egl_g3d_init_st(_EGLDriver *drv)
if (gdrv->api_mask)
return;
+ egl_g3d_init_st_apis(gdrv->stapis);
for (i = 0; i < ST_API_COUNT; i++) {
- gdrv->stapis[i] = egl_g3d_create_st_api(i);
if (gdrv->stapis[i])
gdrv->api_mask |= egl_g3d_st_api_bit(i);
}
@@ -581,13 +581,8 @@ static void
egl_g3d_unload(_EGLDriver *drv)
{
struct egl_g3d_driver *gdrv = egl_g3d_driver(drv);
- EGLint i;
-
- for (i = 0; i < ST_API_COUNT; i++) {
- if (gdrv->stapis[i])
- gdrv->stapis[i]->destroy(gdrv->stapis[i]);
- }
+ egl_g3d_destroy_st_apis();
egl_g3d_destroy_probe(drv, NULL);
FREE(gdrv);
}
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 9744547868..1df57d0777 100644
--- a/src/gallium/state_trackers/egl/common/egl_g3d_st.c
+++ b/src/gallium/state_trackers/egl/common/egl_g3d_st.c
@@ -27,8 +27,10 @@
*/
#include "util/u_memory.h"
+#include "util/u_string.h"
#include "util/u_inlines.h"
#include "util/u_dl.h"
+#include "egldriver.h"
#include "eglimage.h"
#include "eglmutex.h"
@@ -46,42 +48,160 @@ egl_g3d_st_manager(struct st_manager *smapi)
return (struct egl_g3d_st_manager *) smapi;
}
-struct st_api *
-egl_g3d_create_st_api(enum st_api_type api)
-{
+static struct egl_g3d_st_module {
+ const char *filename;
struct util_dl_library *lib;
- const char *proc_name;
- struct st_api * (*proc)(void) = NULL;
-
- switch (api) {
- case ST_API_OPENGL:
- proc_name = ST_CREATE_OPENGL_SYMBOL;
- break;
- case ST_API_OPENGL_ES1:
- proc_name = ST_CREATE_OPENGL_ES1_SYMBOL;
- break;
- case ST_API_OPENGL_ES2:
- proc_name = ST_CREATE_OPENGL_ES2_SYMBOL;
- break;
- case ST_API_OPENVG:
- proc_name = ST_CREATE_OPENVG_SYMBOL;
- break;
- default:
- assert(!"Unknown API Type\n");
- return NULL;
+ struct st_api *stapi;
+} egl_g3d_st_modules[ST_API_COUNT];
+
+static EGLBoolean
+egl_g3d_search_path_callback(const char *dir, size_t len, void *callback_data)
+{
+ struct egl_g3d_st_module *stmod =
+ (struct egl_g3d_st_module *) callback_data;
+ char path[1024];
+ int ret;
+
+ ret = util_snprintf(path, sizeof(path),
+ "%.*s/%s", len, dir, stmod->filename);
+ if (ret > 0 && ret < sizeof(path))
+ stmod->lib = util_dl_open(path);
+
+ return !(stmod->lib);
+}
+
+static boolean
+egl_g3d_load_st_module(struct egl_g3d_st_module *stmod,
+ const char *filename, const char *procname)
+{
+ struct st_api *(*create_api)(void);
+
+ stmod->filename = filename;
+ if (stmod->filename)
+ _eglSearchPathForEach(egl_g3d_search_path_callback, (void *) stmod);
+ else
+ stmod->lib = util_dl_open(NULL);
+
+ if (stmod->lib) {
+ create_api = (struct st_api *(*)(void))
+ util_dl_get_proc_address(stmod->lib, procname);
+ if (create_api)
+ stmod->stapi = create_api();
+
+ if (!stmod->stapi) {
+ util_dl_close(stmod->lib);
+ stmod->lib = NULL;
+ }
}
- lib = util_dl_open(NULL);
- if (lib) {
- proc = util_dl_get_proc_address(lib, proc_name);
- debug_printf("%s: %s %p\n", __func__, proc_name, proc);
- util_dl_close(lib);
+ if (stmod->stapi) {
+ return TRUE;
}
+ else {
+ stmod->filename = NULL;
+ return FALSE;
+ }
+}
- if (!proc)
- return NULL;
+void
+egl_g3d_init_st_apis(struct st_api *stapis[ST_API_COUNT])
+{
+ const char *skip_checks[ST_API_COUNT], *symbols[ST_API_COUNT];
+ const char *filenames[ST_API_COUNT][4];
+ struct util_dl_library *self;
+ int num_needed = 0, api;
+
+ self = util_dl_open(NULL);
+
+ /* collect the necessary data for loading modules */
+ for (api = 0; api < ST_API_COUNT; api++) {
+ int count = 0;
+
+ switch (api) {
+ case ST_API_OPENGL:
+ skip_checks[api] = "glColor4d";
+ symbols[api] = ST_CREATE_OPENGL_SYMBOL;
+ filenames[api][count++] = "api_GL.so";
+ break;
+ case ST_API_OPENGL_ES1:
+ skip_checks[api] = "glColor4x";
+ symbols[api] = ST_CREATE_OPENGL_ES1_SYMBOL;
+ filenames[api][count++] = "api_GLESv1_CM.so";
+ filenames[api][count++] = "api_GL.so";
+ break;
+ case ST_API_OPENGL_ES2:
+ skip_checks[api] = "glShaderBinary";
+ symbols[api] = ST_CREATE_OPENGL_ES2_SYMBOL;
+ filenames[api][count++] = "api_GLESv2.so";
+ filenames[api][count++] = "api_GL.so";
+ break;
+ case ST_API_OPENVG:
+ skip_checks[api] = "vgClear";
+ symbols[api] = ST_CREATE_OPENVG_SYMBOL;
+ filenames[api][count++]= "api_OpenVG.so";
+ break;
+ default:
+ assert(!"Unknown API Type\n");
+ skip_checks[api] = NULL;
+ symbols[api] = NULL;
+ break;
+ }
+ filenames[api][count++]= NULL;
+ assert(count < Elements(filenames[api]));
+
+ /* heuristicically decide if the module is needed */
+ if (!self || !skip_checks[api] ||
+ util_dl_get_proc_address(self, skip_checks[api])) {
+ /* unset so the module is not skipped */
+ skip_checks[api] = NULL;
+ num_needed++;
+ }
+ }
+ /* mark all moudles needed if we wrongly decided that none is needed */
+ if (!num_needed)
+ memset(skip_checks, 0, sizeof(skip_checks));
+
+ if (self)
+ util_dl_close(self);
+
+ for (api = 0; api < ST_API_COUNT; api++) {
+ struct egl_g3d_st_module *stmod = &egl_g3d_st_modules[api];
+ const char **p;
+
+ /* skip the module */
+ if (skip_checks[api])
+ continue;
+
+ /* try all filenames, including NULL */
+ for (p = filenames[api]; *p; p++) {
+ if (egl_g3d_load_st_module(stmod, *p, symbols[api]))
+ break;
+ }
+ if (!stmod->stapi)
+ egl_g3d_load_st_module(stmod, NULL, symbols[api]);
- return proc();
+ stapis[api] = stmod->stapi;
+ }
+}
+
+void
+egl_g3d_destroy_st_apis(void)
+{
+ int api;
+
+ for (api = 0; api < ST_API_COUNT; api++) {
+ struct egl_g3d_st_module *stmod = &egl_g3d_st_modules[api];
+
+ if (stmod->stapi) {
+ stmod->stapi->destroy(stmod->stapi);
+ stmod->stapi = NULL;
+ }
+ if (stmod->lib) {
+ util_dl_close(stmod->lib);
+ stmod->lib = NULL;
+ }
+ stmod->filename = NULL;
+ }
}
static boolean
diff --git a/src/gallium/state_trackers/egl/common/egl_g3d_st.h b/src/gallium/state_trackers/egl/common/egl_g3d_st.h
index c82681a22d..ee53799b02 100644
--- a/src/gallium/state_trackers/egl/common/egl_g3d_st.h
+++ b/src/gallium/state_trackers/egl/common/egl_g3d_st.h
@@ -33,8 +33,11 @@
#include "state_tracker/st_api.h"
#include "egltypedefs.h"
-struct st_api *
-egl_g3d_create_st_api(enum st_api_type api);
+void
+egl_g3d_init_st_apis(struct st_api *stapis[ST_API_COUNT]);
+
+void
+egl_g3d_destroy_st_apis(void);
struct st_manager *
egl_g3d_create_st_manager(_EGLDisplay *dpy);
diff --git a/src/gallium/state_trackers/es/Makefile b/src/gallium/state_trackers/es/Makefile
deleted file mode 100644
index 7370634ea2..0000000000
--- a/src/gallium/state_trackers/es/Makefile
+++ /dev/null
@@ -1,84 +0,0 @@
-# src/gallium/state_trackers/es/Makefile
-
-# Build the ES 1/2 state tracker libraries
-# This consists of core Mesa ES, plus GL/gallium state tracker.
-
-TOP = ../../../..
-include $(TOP)/configs/current
-
-GLES_1_VERSION_MAJOR = 1
-GLES_1_VERSION_MINOR = 1
-GLES_1_VERSION_PATCH = 0
-
-GLES_2_VERSION_MAJOR = 2
-GLES_2_VERSION_MINOR = 0
-GLES_2_VERSION_PATCH = 0
-
-
-# Maybe move these into configs/default:
-GLES_1_LIB = GLESv1_CM
-GLES_1_LIB_NAME = lib$(GLES_1_LIB).so
-GLES_2_LIB = GLESv2
-GLES_2_LIB_NAME = lib$(GLES_2_LIB).so
-
-
-# These two objects indirectly reference all public functions thanks to the use
-# of _glapi_get_proc_address.
-ES1_OBJECTS = st_es1.o
-ES2_OBJECTS = st_es2.o
-
-
-ES1_LIBS = \
- $(TOP)/src/mesa/es/libes1gallium.a \
- $(TOP)/src/mesa/es/libes1api.a
-
-ES2_LIBS = \
- $(TOP)/src/mesa/es/libes2gallium.a \
- $(TOP)/src/mesa/es/libes2api.a
-
-SYS_LIBS = -lm -pthread
-
-
-INCLUDE_DIRS = \
- -I$(TOP)/include \
- -I$(TOP)/src/mesa \
- -I$(TOP)/src/gallium/include
-
-.c.o:
- $(CC) -c $(INCLUDE_DIRS) $(DEFINES) $(CFLAGS) $< -o $@
-
-
-# Default: make both GL ES 1.1 and GL ES 2.0 libraries
-default: $(TOP)/$(LIB_DIR)/$(GLES_1_LIB_NAME) $(TOP)/$(LIB_DIR)/$(GLES_2_LIB_NAME)
-
-# Make the shared libs
-$(TOP)/$(LIB_DIR)/$(GLES_1_LIB_NAME): $(ES1_OBJECTS) $(ES1_LIBS) $(GALLIUM_AUXILIARIES)
- $(MKLIB) -o $(GLES_1_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \
- -major $(GLES_1_VERSION_MAJOR) \
- -minor $(GLES_1_VERSION_MINOR) \
- -patch $(GLES_1_VERSION_PATCH) \
- -install $(TOP)/$(LIB_DIR) $(MKLIB_OPTIONS) \
- $(ES1_OBJECTS) $(ES1_LIBS) $(GALLIUM_AUXILIARIES) $(SYS_LIBS)
-
-$(TOP)/$(LIB_DIR)/$(GLES_2_LIB_NAME): $(ES2_OBJECTS) $(ES1_LIBS) $(GALLIUM_AUXILIARIES)
- $(MKLIB) -o $(GLES_2_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \
- -major $(GLES_2_VERSION_MAJOR) \
- -minor $(GLES_2_VERSION_MINOR) \
- -patch $(GLES_2_VERSION_PATCH) \
- -install $(TOP)/$(LIB_DIR) $(MKLIB_OPTIONS) \
- $(ES2_OBJECTS) $(ES2_LIBS) $(GALLIUM_AUXILIARIES) $(SYS_LIBS)
-
-install: default
- $(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/include/GLES
- $(INSTALL) -m 644 $(TOP)/include/GLES/*.h $(DESTDIR)$(INSTALL_DIR)/include/GLES
- $(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/include/GLES2
- $(INSTALL) -m 644 $(TOP)/include/GLES2/*.h $(DESTDIR)$(INSTALL_DIR)/include/GLES2
- $(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)
- $(MINSTALL) $(TOP)/$(LIB_DIR)/libGLESv1* $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)
- $(MINSTALL) $(TOP)/$(LIB_DIR)/libGLESv2* $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)
-
-clean:
- -rm -f *.o *~
- -rm -f $(TOP)/$(LIB_DIR)/$(GLES_1_LIB_NAME)* $(TOP)/$(LIB_DIR)/$(GLES_2_LIB_NAME)*
-
-depend:
diff --git a/src/gallium/state_trackers/es/st_es1.c b/src/gallium/state_trackers/es/st_es1.c
deleted file mode 100644
index 825fdac215..0000000000
--- a/src/gallium/state_trackers/es/st_es1.c
+++ /dev/null
@@ -1,7 +0,0 @@
-#include "state_tracker/st_gl_api.h"
-
-PUBLIC struct st_api *
-st_api_create_OpenGL_ES1()
-{
- return st_gl_api_create();
-}
diff --git a/src/gallium/state_trackers/es/st_es2.c b/src/gallium/state_trackers/es/st_es2.c
deleted file mode 100644
index 5c773aaf93..0000000000
--- a/src/gallium/state_trackers/es/st_es2.c
+++ /dev/null
@@ -1,8 +0,0 @@
-#include "state_tracker/st_gl_api.h"
-
-PUBLIC struct st_api *
-st_api_create_OpenGL_ES2()
-{
- /* linker magic creates different versions */
- return st_gl_api_create();
-}
diff --git a/src/gallium/state_trackers/glx/xlib/Makefile b/src/gallium/state_trackers/glx/xlib/Makefile
index 35509fd708..84cb36ec36 100644
--- a/src/gallium/state_trackers/glx/xlib/Makefile
+++ b/src/gallium/state_trackers/glx/xlib/Makefile
@@ -5,6 +5,7 @@ LIBNAME = xlib
LIBRARY_INCLUDES = \
-I$(TOP)/include \
+ -I$(TOP)/src/mapi \
-I$(TOP)/src/mesa \
$(X11_CFLAGS)
diff --git a/src/gallium/state_trackers/glx/xlib/SConscript b/src/gallium/state_trackers/glx/xlib/SConscript
index d6c16ad2f5..9df351a276 100644
--- a/src/gallium/state_trackers/glx/xlib/SConscript
+++ b/src/gallium/state_trackers/glx/xlib/SConscript
@@ -9,6 +9,7 @@ if env['platform'] == 'linux' \
env = env.Clone()
env.Append(CPPPATH = [
+ '#/src/mapi',
'#/src/mesa',
'#/src/mesa/main',
])
diff --git a/src/gallium/state_trackers/glx/xlib/glx_getproc.c b/src/gallium/state_trackers/glx/xlib/glx_getproc.c
index bd4a85caa0..26fcae78ec 100644
--- a/src/gallium/state_trackers/glx/xlib/glx_getproc.c
+++ b/src/gallium/state_trackers/glx/xlib/glx_getproc.c
@@ -34,7 +34,6 @@
#include <string.h>
#include "GL/glx.h"
#include "glapi/glapi.h"
-#include "pipe/p_compiler.h"
struct name_address_pair {
diff --git a/src/gallium/state_trackers/python/st_device.c b/src/gallium/state_trackers/python/st_device.c
index aac28cacfd..dce24bc17d 100644
--- a/src/gallium/state_trackers/python/st_device.c
+++ b/src/gallium/state_trackers/python/st_device.c
@@ -184,8 +184,7 @@ st_context_create(struct st_device *st_dev)
{
struct pipe_rasterizer_state rasterizer;
memset(&rasterizer, 0, sizeof(rasterizer));
- rasterizer.front_winding = PIPE_WINDING_CW;
- rasterizer.cull_mode = PIPE_WINDING_NONE;
+ rasterizer.cull_face = PIPE_FACE_NONE;
cso_set_rasterizer(st_ctx->cso, &rasterizer);
}
diff --git a/src/gallium/state_trackers/vega/Makefile b/src/gallium/state_trackers/vega/Makefile
index b871990cd9..e0a87151c4 100644
--- a/src/gallium/state_trackers/vega/Makefile
+++ b/src/gallium/state_trackers/vega/Makefile
@@ -3,16 +3,14 @@
TOP = ../../../..
include $(TOP)/configs/current
-VG_LIB = OpenVG
-VG_LIB_NAME = lib$(VG_LIB).so
+LIBNAME = vega
-VG_MAJOR = 1
-VG_MINOR = 0
-VG_TINY = 0
-
-### Lists of source files, included by Makefiles
+LIBRARY_INCLUDES = \
+ -I$(TOP)/include \
+ -I$(TOP)/src/mapi
-VG_SOURCES = \
+C_SOURCES = \
+ api.c \
api_context.c \
api_filters.c \
api_images.c \
@@ -40,55 +38,4 @@ VG_SOURCES = \
shader.c \
shaders_cache.c
-VG_OBJECTS = $(VG_SOURCES:.c=.o)
-
-VG_LIBS = $(GALLIUM_AUXILIARIES)
-VG_LIB_DEPS = $(EXTRA_LIB_PATH) -lm
-
-### Include directories
-
-INCLUDE_DIRS = \
- -I$(TOP)/include \
- -I$(TOP)/src/gallium/include \
- -I$(TOP)/src/gallium/auxiliary
-
-
-.c.o:
- $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@
-
-default: depend $(TOP)/$(LIB_DIR)/$(VG_LIB_NAME)
-
-# Make the OpenVG library
-$(TOP)/$(LIB_DIR)/$(VG_LIB_NAME): $(VG_OBJECTS) $(VG_LIBS)
- $(MKLIB) -o $(VG_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \
- -major $(VG_MAJOR) \
- -minor $(VG_MINOR) \
- -patch $(VG_TINY) \
- -install $(TOP)/$(LIB_DIR) \
- $(VG_OBJECTS) $(VG_LIBS) $(VG_LIB_DEPS)
-
-######################################################################
-# Generic stuff
-
-depend: $(VG_SOURCES)
- @ echo "running $(MKDEP)"
- @ rm -f depend # workaround oops on gutsy?!?
- @ touch depend
- @ $(MKDEP) $(MKDEP_OPTIONS) $(DEFINES) $(INCLUDE_DIRS) $(VG_SOURCES) \
- > /dev/null 2>/dev/null
-
-install: default
- $(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/include/VG
- $(INSTALL) -m 644 $(TOP)/include/VG/*.h $(DESTDIR)$(INSTALL_DIR)/include/VG
- $(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)
- $(MINSTALL) $(TOP)/$(LIB_DIR)/libOpenVG* $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)
-
-# Emacs tags
-tags:
- etags `find . -name \*.[ch]` $(TOP)/include/VG/*.h
-
-clean:
- rm -f $(VG_OBJECTS)
- rm -f depend depend.bak
-
-sinclude depend
+include ../../Makefile.template
diff --git a/src/gallium/state_trackers/vega/api.c b/src/gallium/state_trackers/vega/api.c
new file mode 100644
index 0000000000..bf1d37493a
--- /dev/null
+++ b/src/gallium/state_trackers/vega/api.c
@@ -0,0 +1,88 @@
+/*
+ * 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 <olv@lunarg.com>
+ */
+
+#include "mapi/mapi.h"
+
+#include "api.h"
+
+static const char vega_spec[] =
+ "1"
+#define MAPI_ABI_ENTRY(ret, name, params) \
+ "\0" #name "\0"
+#define MAPI_ALIAS_ENTRY(alias, ret, name, params) \
+ #name "\0"
+#include "vgapi/vgapi_tmp.h"
+ "\0";
+
+static const mapi_proc vega_procs[] = {
+#define MAPI_ABI_ENTRY(ret, name, params) \
+ (mapi_proc) vega ## name,
+#include "vgapi/vgapi_tmp.h"
+};
+
+static void api_init(void)
+{
+ static boolean initialized = FALSE;
+ if (!initialized) {
+ mapi_init(vega_spec);
+ initialized = TRUE;
+ }
+}
+
+struct mapi_table *api_create_dispatch(void)
+{
+ struct mapi_table *tbl;
+
+ api_init();
+
+ tbl = mapi_table_create();
+ if (tbl)
+ mapi_table_fill(tbl, vega_procs);
+
+ return tbl;
+}
+
+void api_destroy_dispatch(struct mapi_table *tbl)
+{
+ mapi_table_destroy(tbl);
+}
+
+void api_make_dispatch_current(const struct mapi_table *tbl)
+{
+ mapi_table_make_current(tbl);
+}
+
+mapi_proc api_get_proc_address(const char *proc_name)
+{
+ if (!proc_name || proc_name[0] != 'v' || proc_name[1] != 'g')
+ return NULL;
+ proc_name += 2;
+
+ api_init();
+ return mapi_get_proc_address(proc_name);
+}
diff --git a/src/gallium/state_trackers/vega/api.h b/src/gallium/state_trackers/vega/api.h
new file mode 100644
index 0000000000..955508dae9
--- /dev/null
+++ b/src/gallium/state_trackers/vega/api.h
@@ -0,0 +1,51 @@
+/*
+ * 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 <olv@lunarg.com>
+ */
+
+#ifndef API_H
+#define API_H
+
+#include "VG/openvg.h"
+#include "VG/vgext.h"
+#include "vg_manager.h"
+
+/* declare the prototypes */
+#define MAPI_ABI_ENTRY(ret, name, params) \
+ ret VG_API_ENTRY vega ## name params;
+#include "vgapi/vgapi_tmp.h"
+
+struct mapi_table;
+
+struct mapi_table *api_create_dispatch(void);
+
+void api_destroy_dispatch(struct mapi_table *tbl);
+
+void api_make_dispatch_current(const struct mapi_table *tbl);
+
+st_proc_t api_get_proc_address(const char *proc_name);
+
+#endif /* API_H */
diff --git a/src/gallium/state_trackers/vega/api_context.c b/src/gallium/state_trackers/vega/api_context.c
index eb2fbe26e7..0d04d8e871 100644
--- a/src/gallium/state_trackers/vega/api_context.c
+++ b/src/gallium/state_trackers/vega/api_context.c
@@ -28,11 +28,12 @@
#include "vg_manager.h"
#include "vg_context.h"
+#include "api.h"
#include "pipe/p_context.h"
#include "pipe/p_screen.h"
-VGErrorCode vgGetError(void)
+VGErrorCode vegaGetError(void)
{
struct vg_context *ctx = vg_current_context();
VGErrorCode error = VG_NO_CONTEXT_ERROR;
@@ -46,7 +47,7 @@ VGErrorCode vgGetError(void)
return error;
}
-void vgFlush(void)
+void vegaFlush(void)
{
struct vg_context *ctx = vg_current_context();
struct pipe_context *pipe;
@@ -60,7 +61,7 @@ void vgFlush(void)
vg_manager_flush_frontbuffer(ctx);
}
-void vgFinish(void)
+void vegaFinish(void)
{
struct vg_context *ctx = vg_current_context();
struct pipe_fence_handle *fence = NULL;
diff --git a/src/gallium/state_trackers/vega/api_filters.c b/src/gallium/state_trackers/vega/api_filters.c
index b1c08af938..144fb8f323 100644
--- a/src/gallium/state_trackers/vega/api_filters.c
+++ b/src/gallium/state_trackers/vega/api_filters.c
@@ -28,6 +28,7 @@
#include "vg_context.h"
#include "image.h"
+#include "api.h"
#include "renderer.h"
#include "shaders_cache.h"
#include "st_inlines.h"
@@ -361,8 +362,8 @@ static void execute_filter(struct vg_context *ctx,
pipe_surface_reference(&dst_surf, NULL);
}
-void vgColorMatrix(VGImage dst, VGImage src,
- const VGfloat * matrix)
+void vegaColorMatrix(VGImage dst, VGImage src,
+ const VGfloat * matrix)
{
struct vg_context *ctx = vg_current_context();
struct vg_image *d, *s;
@@ -403,13 +404,13 @@ static VGfloat texture_offset(VGfloat width, VGint kernelSize, VGint current, VG
return diff / width;
}
-void vgConvolve(VGImage dst, VGImage src,
- VGint kernelWidth, VGint kernelHeight,
- VGint shiftX, VGint shiftY,
- const VGshort * kernel,
- VGfloat scale,
- VGfloat bias,
- VGTilingMode tilingMode)
+void vegaConvolve(VGImage dst, VGImage src,
+ VGint kernelWidth, VGint kernelHeight,
+ VGint shiftX, VGint shiftY,
+ const VGshort * kernel,
+ VGfloat scale,
+ VGfloat bias,
+ VGTilingMode tilingMode)
{
struct vg_context *ctx = vg_current_context();
VGfloat *buffer;
@@ -508,15 +509,15 @@ void vgConvolve(VGImage dst, VGImage src,
free(buffer);
}
-void vgSeparableConvolve(VGImage dst, VGImage src,
- VGint kernelWidth,
- VGint kernelHeight,
- VGint shiftX, VGint shiftY,
- const VGshort * kernelX,
- const VGshort * kernelY,
- VGfloat scale,
- VGfloat bias,
- VGTilingMode tilingMode)
+void vegaSeparableConvolve(VGImage dst, VGImage src,
+ VGint kernelWidth,
+ VGint kernelHeight,
+ VGint shiftX, VGint shiftY,
+ const VGshort * kernelX,
+ const VGshort * kernelY,
+ VGfloat scale,
+ VGfloat bias,
+ VGTilingMode tilingMode)
{
struct vg_context *ctx = vg_current_context();
VGshort *kernel;
@@ -600,10 +601,10 @@ static void compute_gaussian_kernel(VGfloat *kernel,
}
}
-void vgGaussianBlur(VGImage dst, VGImage src,
- VGfloat stdDeviationX,
- VGfloat stdDeviationY,
- VGTilingMode tilingMode)
+void vegaGaussianBlur(VGImage dst, VGImage src,
+ VGfloat stdDeviationX,
+ VGfloat stdDeviationY,
+ VGTilingMode tilingMode)
{
struct vg_context *ctx = vg_current_context();
struct vg_image *d, *s;
@@ -699,13 +700,13 @@ void vgGaussianBlur(VGImage dst, VGImage src,
free(kernel);
}
-void vgLookup(VGImage dst, VGImage src,
- const VGubyte * redLUT,
- const VGubyte * greenLUT,
- const VGubyte * blueLUT,
- const VGubyte * alphaLUT,
- VGboolean outputLinear,
- VGboolean outputPremultiplied)
+void vegaLookup(VGImage dst, VGImage src,
+ const VGubyte * redLUT,
+ const VGubyte * greenLUT,
+ const VGubyte * blueLUT,
+ const VGubyte * alphaLUT,
+ VGboolean outputLinear,
+ VGboolean outputPremultiplied)
{
struct vg_context *ctx = vg_current_context();
struct vg_image *d, *s;
@@ -758,11 +759,11 @@ void vgLookup(VGImage dst, VGImage src,
pipe_sampler_view_reference(&lut_texture_view, NULL);
}
-void vgLookupSingle(VGImage dst, VGImage src,
- const VGuint * lookupTable,
- VGImageChannel sourceChannel,
- VGboolean outputLinear,
- VGboolean outputPremultiplied)
+void vegaLookupSingle(VGImage dst, VGImage src,
+ const VGuint * lookupTable,
+ VGImageChannel sourceChannel,
+ VGboolean outputLinear,
+ VGboolean outputPremultiplied)
{
struct vg_context *ctx = vg_current_context();
struct vg_image *d, *s;
diff --git a/src/gallium/state_trackers/vega/api_images.c b/src/gallium/state_trackers/vega/api_images.c
index 6c7fd3b346..547508f815 100644
--- a/src/gallium/state_trackers/vega/api_images.c
+++ b/src/gallium/state_trackers/vega/api_images.c
@@ -32,6 +32,7 @@
#include "vg_translate.h"
#include "api_consts.h"
#include "image.h"
+#include "api.h"
#include "pipe/p_context.h"
#include "pipe/p_screen.h"
@@ -92,9 +93,9 @@ static INLINE VGboolean supported_image_format(VGImageFormat format)
return VG_FALSE;
}
-VGImage vgCreateImage(VGImageFormat format,
- VGint width, VGint height,
- VGbitfield allowedQuality)
+VGImage vegaCreateImage(VGImageFormat format,
+ VGint width, VGint height,
+ VGbitfield allowedQuality)
{
struct vg_context *ctx = vg_current_context();
@@ -126,7 +127,7 @@ VGImage vgCreateImage(VGImageFormat format,
return (VGImage)image_create(format, width, height);
}
-void vgDestroyImage(VGImage image)
+void vegaDestroyImage(VGImage image)
{
struct vg_context *ctx = vg_current_context();
struct vg_image *img = (struct vg_image *)image;
@@ -142,9 +143,9 @@ void vgDestroyImage(VGImage image)
image_destroy(img);
}
-void vgClearImage(VGImage image,
- VGint x, VGint y,
- VGint width, VGint height)
+void vegaClearImage(VGImage image,
+ VGint x, VGint y,
+ VGint width, VGint height)
{
struct vg_context *ctx = vg_current_context();
struct vg_image *img;
@@ -167,12 +168,12 @@ void vgClearImage(VGImage image,
}
-void vgImageSubData(VGImage image,
- const void * data,
- VGint dataStride,
- VGImageFormat dataFormat,
- VGint x, VGint y,
- VGint width, VGint height)
+void vegaImageSubData(VGImage image,
+ const void * data,
+ VGint dataStride,
+ VGImageFormat dataFormat,
+ VGint x, VGint y,
+ VGint width, VGint height)
{
struct vg_context *ctx = vg_current_context();
struct vg_image *img;
@@ -195,12 +196,12 @@ void vgImageSubData(VGImage image,
x, y, width, height);
}
-void vgGetImageSubData(VGImage image,
- void * data,
- VGint dataStride,
- VGImageFormat dataFormat,
- VGint x, VGint y,
- VGint width, VGint height)
+void vegaGetImageSubData(VGImage image,
+ void * data,
+ VGint dataStride,
+ VGImageFormat dataFormat,
+ VGint x, VGint y,
+ VGint width, VGint height)
{
struct vg_context *ctx = vg_current_context();
struct vg_image *img;
@@ -222,9 +223,9 @@ void vgGetImageSubData(VGImage image,
x, y, width, height);
}
-VGImage vgChildImage(VGImage parent,
- VGint x, VGint y,
- VGint width, VGint height)
+VGImage vegaChildImage(VGImage parent,
+ VGint x, VGint y,
+ VGint width, VGint height)
{
struct vg_context *ctx = vg_current_context();
struct vg_image *p;
@@ -252,7 +253,7 @@ VGImage vgChildImage(VGImage parent,
return (VGImage)image_child_image(p, x, y, width, height);
}
-VGImage vgGetParent(VGImage image)
+VGImage vegaGetParent(VGImage image)
{
struct vg_context *ctx = vg_current_context();
struct vg_image *img;
@@ -269,10 +270,10 @@ VGImage vgGetParent(VGImage image)
return image;
}
-void vgCopyImage(VGImage dst, VGint dx, VGint dy,
- VGImage src, VGint sx, VGint sy,
- VGint width, VGint height,
- VGboolean dither)
+void vegaCopyImage(VGImage dst, VGint dx, VGint dy,
+ VGImage src, VGint sx, VGint sy,
+ VGint width, VGint height,
+ VGboolean dither)
{
struct vg_context *ctx = vg_current_context();
@@ -291,7 +292,7 @@ void vgCopyImage(VGImage dst, VGint dx, VGint dy,
width, height, dither);
}
-void vgDrawImage(VGImage image)
+void vegaDrawImage(VGImage image)
{
struct vg_context *ctx = vg_current_context();
@@ -307,9 +308,9 @@ void vgDrawImage(VGImage image)
image_draw((struct vg_image*)image);
}
-void vgSetPixels(VGint dx, VGint dy,
- VGImage src, VGint sx, VGint sy,
- VGint width, VGint height)
+void vegaSetPixels(VGint dx, VGint dy,
+ VGImage src, VGint sx, VGint sy,
+ VGint width, VGint height)
{
struct vg_context *ctx = vg_current_context();
@@ -327,9 +328,9 @@ void vgSetPixels(VGint dx, VGint dy,
height);
}
-void vgGetPixels(VGImage dst, VGint dx, VGint dy,
- VGint sx, VGint sy,
- VGint width, VGint height)
+void vegaGetPixels(VGImage dst, VGint dx, VGint dy,
+ VGint sx, VGint sy,
+ VGint width, VGint height)
{
struct vg_context *ctx = vg_current_context();
struct vg_image *img;
@@ -349,10 +350,10 @@ void vgGetPixels(VGImage dst, VGint dx, VGint dy,
sx, sy, width, height);
}
-void vgWritePixels(const void * data, VGint dataStride,
- VGImageFormat dataFormat,
- VGint dx, VGint dy,
- VGint width, VGint height)
+void vegaWritePixels(const void * data, VGint dataStride,
+ VGImageFormat dataFormat,
+ VGint dx, VGint dy,
+ VGint width, VGint height)
{
struct vg_context *ctx = vg_current_context();
struct pipe_context *pipe = ctx->pipe;
@@ -390,10 +391,10 @@ void vgWritePixels(const void * data, VGint dataStride,
pipe->flush(pipe, PIPE_FLUSH_RENDER_CACHE, NULL);
}
-void vgReadPixels(void * data, VGint dataStride,
- VGImageFormat dataFormat,
- VGint sx, VGint sy,
- VGint width, VGint height)
+void vegaReadPixels(void * data, VGint dataStride,
+ VGImageFormat dataFormat,
+ VGint sx, VGint sy,
+ VGint width, VGint height)
{
struct vg_context *ctx = vg_current_context();
struct pipe_context *pipe = ctx->pipe;
@@ -461,9 +462,9 @@ void vgReadPixels(void * data, VGint dataStride,
}
}
-void vgCopyPixels(VGint dx, VGint dy,
- VGint sx, VGint sy,
- VGint width, VGint height)
+void vegaCopyPixels(VGint dx, VGint dy,
+ VGint sx, VGint sy,
+ VGint width, VGint height)
{
struct vg_context *ctx = vg_current_context();
struct pipe_framebuffer_state *fb = &ctx->state.g3d.fb;
diff --git a/src/gallium/state_trackers/vega/api_masks.c b/src/gallium/state_trackers/vega/api_masks.c
index 7c28ea5c87..94c1ff5375 100644
--- a/src/gallium/state_trackers/vega/api_masks.c
+++ b/src/gallium/state_trackers/vega/api_masks.c
@@ -28,6 +28,7 @@
#include "mask.h"
#include "renderer.h"
+#include "api.h"
#include "vg_context.h"
#include "pipe/p_context.h"
@@ -37,7 +38,6 @@
#include "util/u_draw_quad.h"
#include "util/u_memory.h"
-
#define DISABLE_1_1_MASKING 1
/**
@@ -151,9 +151,9 @@ clear_with_quad(struct vg_context *st, float x0, float y0,
}
-void vgMask(VGHandle mask, VGMaskOperation operation,
- VGint x, VGint y,
- VGint width, VGint height)
+void vegaMask(VGHandle mask, VGMaskOperation operation,
+ VGint x, VGint y,
+ VGint width, VGint height)
{
struct vg_context *ctx = vg_current_context();
@@ -189,8 +189,8 @@ void vgMask(VGHandle mask, VGMaskOperation operation,
}
}
-void vgClear(VGint x, VGint y,
- VGint width, VGint height)
+void vegaClear(VGint x, VGint y,
+ VGint width, VGint height)
{
struct vg_context *ctx = vg_current_context();
struct pipe_framebuffer_state *fb;
@@ -225,9 +225,9 @@ void vgClear(VGint x, VGint y,
#ifdef OPENVG_VERSION_1_1
-void vgRenderToMask(VGPath path,
- VGbitfield paintModes,
- VGMaskOperation operation)
+void vegaRenderToMask(VGPath path,
+ VGbitfield paintModes,
+ VGMaskOperation operation)
{
struct vg_context *ctx = vg_current_context();
@@ -258,7 +258,7 @@ void vgRenderToMask(VGPath path,
mask_render_to((struct path *)path, paintModes, operation);
}
-VGMaskLayer vgCreateMaskLayer(VGint width, VGint height)
+VGMaskLayer vegaCreateMaskLayer(VGint width, VGint height)
{
struct vg_context *ctx = vg_current_context();
@@ -272,7 +272,7 @@ VGMaskLayer vgCreateMaskLayer(VGint width, VGint height)
return (VGMaskLayer)mask_layer_create(width, height);
}
-void vgDestroyMaskLayer(VGMaskLayer maskLayer)
+void vegaDestroyMaskLayer(VGMaskLayer maskLayer)
{
struct vg_mask_layer *mask = 0;
struct vg_context *ctx = vg_current_context();
@@ -290,10 +290,10 @@ void vgDestroyMaskLayer(VGMaskLayer maskLayer)
mask_layer_destroy(mask);
}
-void vgFillMaskLayer(VGMaskLayer maskLayer,
- VGint x, VGint y,
- VGint width, VGint height,
- VGfloat value)
+void vegaFillMaskLayer(VGMaskLayer maskLayer,
+ VGint x, VGint y,
+ VGint width, VGint height,
+ VGfloat value)
{
struct vg_mask_layer *mask = 0;
struct vg_context *ctx = vg_current_context();
@@ -336,10 +336,10 @@ void vgFillMaskLayer(VGMaskLayer maskLayer,
mask_layer_fill(mask, x, y, width, height, value);
}
-void vgCopyMask(VGMaskLayer maskLayer,
- VGint sx, VGint sy,
- VGint dx, VGint dy,
- VGint width, VGint height)
+void vegaCopyMask(VGMaskLayer maskLayer,
+ VGint sx, VGint sy,
+ VGint dx, VGint dy,
+ VGint width, VGint height)
{
struct vg_context *ctx = vg_current_context();
struct vg_mask_layer *mask = 0;
diff --git a/src/gallium/state_trackers/vega/api_misc.c b/src/gallium/state_trackers/vega/api_misc.c
index 78ba0bc110..e648549745 100644
--- a/src/gallium/state_trackers/vega/api_misc.c
+++ b/src/gallium/state_trackers/vega/api_misc.c
@@ -27,10 +27,11 @@
#include "VG/openvg.h"
#include "vg_context.h"
+#include "api.h"
/* Hardware Queries */
-VGHardwareQueryResult vgHardwareQuery(VGHardwareQueryType key,
- VGint setting)
+VGHardwareQueryResult vegaHardwareQuery(VGHardwareQueryType key,
+ VGint setting)
{
struct vg_context *ctx = vg_current_context();
@@ -58,7 +59,7 @@ VGHardwareQueryResult vgHardwareQuery(VGHardwareQueryType key,
}
/* Renderer and Extension Information */
-const VGubyte *vgGetString(VGStringID name)
+const VGubyte *vegaGetString(VGStringID name)
{
struct vg_context *ctx = vg_current_context();
static const VGubyte *vendor = (VGubyte *)"Tungsten Graphics, Inc";
diff --git a/src/gallium/state_trackers/vega/api_paint.c b/src/gallium/state_trackers/vega/api_paint.c
index dd3ac5bdb0..d88341b04f 100644
--- a/src/gallium/state_trackers/vega/api_paint.c
+++ b/src/gallium/state_trackers/vega/api_paint.c
@@ -29,13 +29,14 @@
#include "vg_context.h"
#include "paint.h"
#include "image.h"
+#include "api.h"
-VGPaint vgCreatePaint(void)
+VGPaint vegaCreatePaint(void)
{
return (VGPaint) paint_create(vg_current_context());
}
-void vgDestroyPaint(VGPaint p)
+void vegaDestroyPaint(VGPaint p)
{
struct vg_context *ctx = vg_current_context();
struct vg_paint *paint;
@@ -49,7 +50,7 @@ void vgDestroyPaint(VGPaint p)
paint_destroy(paint);
}
-void vgSetPaint(VGPaint paint, VGbitfield paintModes)
+void vegaSetPaint(VGPaint paint, VGbitfield paintModes)
{
struct vg_context *ctx = vg_current_context();
@@ -74,7 +75,7 @@ void vgSetPaint(VGPaint paint, VGbitfield paintModes)
}
}
-VGPaint vgGetPaint(VGPaintMode paintMode)
+VGPaint vegaGetPaint(VGPaintMode paintMode)
{
struct vg_context *ctx = vg_current_context();
VGPaint paint = VG_INVALID_HANDLE;
@@ -95,7 +96,7 @@ VGPaint vgGetPaint(VGPaintMode paintMode)
return paint;
}
-void vgSetColor(VGPaint paint, VGuint rgba)
+void vegaSetColor(VGPaint paint, VGuint rgba)
{
struct vg_context *ctx = vg_current_context();
@@ -114,7 +115,7 @@ void vgSetColor(VGPaint paint, VGuint rgba)
}
}
-VGuint vgGetColor(VGPaint paint)
+VGuint vegaGetColor(VGPaint paint)
{
struct vg_context *ctx = vg_current_context();
struct vg_paint *p;
@@ -134,7 +135,7 @@ VGuint vgGetColor(VGPaint paint)
return paint_colori(p);
}
-void vgPaintPattern(VGPaint paint, VGImage pattern)
+void vegaPaintPattern(VGPaint paint, VGImage pattern)
{
struct vg_context *ctx = vg_current_context();
diff --git a/src/gallium/state_trackers/vega/api_params.c b/src/gallium/state_trackers/vega/api_params.c
index db77fd9cb0..a10b009e63 100644
--- a/src/gallium/state_trackers/vega/api_params.c
+++ b/src/gallium/state_trackers/vega/api_params.c
@@ -32,6 +32,7 @@
#include "image.h"
#include "matrix.h"
#include "api_consts.h"
+#include "api.h"
#include "pipe/p_compiler.h"
#include "util/u_pointer.h"
@@ -63,7 +64,7 @@ static INLINE VGboolean count_in_bounds(VGParamType type, VGint count)
}
}
-void vgSetf (VGParamType type, VGfloat value)
+void vegaSetf (VGParamType type, VGfloat value)
{
struct vg_context *ctx = vg_current_context();
struct vg_state *state = current_state();
@@ -123,7 +124,7 @@ void vgSetf (VGParamType type, VGfloat value)
vg_set_error(ctx, error);
}
-void vgSeti (VGParamType type, VGint value)
+void vegaSeti (VGParamType type, VGint value)
{
struct vg_context *ctx = vg_current_context();
struct vg_state *state = current_state();
@@ -254,8 +255,8 @@ void vgSeti (VGParamType type, VGint value)
vg_set_error(ctx, error);
}
-void vgSetfv(VGParamType type, VGint count,
- const VGfloat * values)
+void vegaSetfv(VGParamType type, VGint count,
+ const VGfloat * values)
{
struct vg_context *ctx = vg_current_context();
struct vg_state *state = current_state();
@@ -382,8 +383,8 @@ void vgSetfv(VGParamType type, VGint count,
vg_set_error(ctx, error);
}
-void vgSetiv(VGParamType type, VGint count,
- const VGint * values)
+void vegaSetiv(VGParamType type, VGint count,
+ const VGint * values)
{
struct vg_context *ctx = vg_current_context();
struct vg_state *state = current_state();
@@ -506,7 +507,7 @@ void vgSetiv(VGParamType type, VGint count,
}
}
-VGfloat vgGetf(VGParamType type)
+VGfloat vegaGetf(VGParamType type)
{
struct vg_context *ctx = vg_current_context();
const struct vg_state *state = current_state();
@@ -568,7 +569,7 @@ VGfloat vgGetf(VGParamType type)
return value;
}
-VGint vgGeti(VGParamType type)
+VGint vegaGeti(VGParamType type)
{
const struct vg_state *state = current_state();
struct vg_context *ctx = vg_current_context();
@@ -683,7 +684,7 @@ VGint vgGeti(VGParamType type)
return value;
}
-VGint vgGetVectorSize(VGParamType type)
+VGint vegaGetVectorSize(VGParamType type)
{
struct vg_context *ctx = vg_current_context();
const struct vg_state *state = current_state();
@@ -757,8 +758,8 @@ VGint vgGetVectorSize(VGParamType type)
}
}
-void vgGetfv(VGParamType type, VGint count,
- VGfloat * values)
+void vegaGetfv(VGParamType type, VGint count,
+ VGfloat * values)
{
const struct vg_state *state = current_state();
struct vg_context *ctx = vg_current_context();
@@ -858,8 +859,8 @@ void vgGetfv(VGParamType type, VGint count,
}
}
-void vgGetiv(VGParamType type, VGint count,
- VGint * values)
+void vegaGetiv(VGParamType type, VGint count,
+ VGint * values)
{
const struct vg_state *state = current_state();
struct vg_context *ctx = vg_current_context();
@@ -964,9 +965,9 @@ void vgGetiv(VGParamType type, VGint count,
}
}
-void vgSetParameterf(VGHandle object,
- VGint paramType,
- VGfloat value)
+void vegaSetParameterf(VGHandle object,
+ VGint paramType,
+ VGfloat value)
{
struct vg_context *ctx = vg_current_context();
void *ptr = (void*)object;
@@ -1018,9 +1019,9 @@ void vgSetParameterf(VGHandle object,
}
}
-void vgSetParameteri(VGHandle object,
- VGint paramType,
- VGint value)
+void vegaSetParameteri(VGHandle object,
+ VGint paramType,
+ VGint value)
{
struct vg_context *ctx = vg_current_context();
void *ptr = (void*)object;
@@ -1093,10 +1094,10 @@ void vgSetParameteri(VGHandle object,
}
}
-void vgSetParameterfv(VGHandle object,
- VGint paramType,
- VGint count,
- const VGfloat * values)
+void vegaSetParameterfv(VGHandle object,
+ VGint paramType,
+ VGint count,
+ const VGfloat * values)
{
struct vg_context *ctx = vg_current_context();
void *ptr = (void*)object;
@@ -1206,10 +1207,10 @@ void vgSetParameterfv(VGHandle object,
}
}
-void vgSetParameteriv(VGHandle object,
- VGint paramType,
- VGint count,
- const VGint * values)
+void vegaSetParameteriv(VGHandle object,
+ VGint paramType,
+ VGint count,
+ const VGint * values)
{
struct vg_context *ctx = vg_current_context();
void *ptr = (void*)object;
@@ -1311,8 +1312,8 @@ void vgSetParameteriv(VGHandle object,
}
}
-VGint vgGetParameterVectorSize(VGHandle object,
- VGint paramType)
+VGint vegaGetParameterVectorSize(VGHandle object,
+ VGint paramType)
{
struct vg_context *ctx = vg_current_context();
void *ptr = (void*)object;
@@ -1367,8 +1368,8 @@ VGint vgGetParameterVectorSize(VGHandle object,
}
-VGfloat vgGetParameterf(VGHandle object,
- VGint paramType)
+VGfloat vegaGetParameterf(VGHandle object,
+ VGint paramType)
{
struct vg_context *ctx = vg_current_context();
void *ptr = (void*)object;
@@ -1424,8 +1425,8 @@ VGfloat vgGetParameterf(VGHandle object,
return 0;
}
-VGint vgGetParameteri(VGHandle object,
- VGint paramType)
+VGint vegaGetParameteri(VGHandle object,
+ VGint paramType)
{
struct vg_context *ctx = vg_current_context();
void *ptr = (void*)object;
@@ -1511,10 +1512,10 @@ VGint vgGetParameteri(VGHandle object,
return 0;
}
-void vgGetParameterfv(VGHandle object,
- VGint paramType,
- VGint count,
- VGfloat * values)
+void vegaGetParameterfv(VGHandle object,
+ VGint paramType,
+ VGint count,
+ VGfloat * values)
{
struct vg_context *ctx = vg_current_context();
void *ptr = (void*)object;
@@ -1598,10 +1599,10 @@ void vgGetParameterfv(VGHandle object,
}
}
-void vgGetParameteriv(VGHandle object,
- VGint paramType,
- VGint count,
- VGint * values)
+void vegaGetParameteriv(VGHandle object,
+ VGint paramType,
+ VGint count,
+ VGint * values)
{
struct vg_context *ctx = vg_current_context();
void *ptr = (void*)object;
diff --git a/src/gallium/state_trackers/vega/api_path.c b/src/gallium/state_trackers/vega/api_path.c
index 58ebb3b60e..6c9a2e8d65 100644
--- a/src/gallium/state_trackers/vega/api_path.c
+++ b/src/gallium/state_trackers/vega/api_path.c
@@ -30,17 +30,18 @@
#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 vgCreatePath(VGint pathFormat,
- VGPathDatatype datatype,
- VGfloat scale, VGfloat bias,
- VGint segmentCapacityHint,
- VGint coordCapacityHint,
- VGbitfield capabilities)
+VGPath vegaCreatePath(VGint pathFormat,
+ VGPathDatatype datatype,
+ VGfloat scale, VGfloat bias,
+ VGint segmentCapacityHint,
+ VGint coordCapacityHint,
+ VGbitfield capabilities)
{
struct vg_context *ctx = vg_current_context();
@@ -63,7 +64,7 @@ VGPath vgCreatePath(VGint pathFormat,
capabilities);
}
-void vgClearPath(VGPath path, VGbitfield capabilities)
+void vegaClearPath(VGPath path, VGbitfield capabilities)
{
struct vg_context *ctx = vg_current_context();
struct path *p = 0;
@@ -77,7 +78,7 @@ void vgClearPath(VGPath path, VGbitfield capabilities)
path_clear(p, capabilities);
}
-void vgDestroyPath(VGPath p)
+void vegaDestroyPath(VGPath p)
{
struct path *path = 0;
struct vg_context *ctx = vg_current_context();
@@ -91,8 +92,8 @@ void vgDestroyPath(VGPath p)
path_destroy(path);
}
-void vgRemovePathCapabilities(VGPath path,
- VGbitfield capabilities)
+void vegaRemovePathCapabilities(VGPath path,
+ VGbitfield capabilities)
{
struct vg_context *ctx = vg_current_context();
VGbitfield current;
@@ -109,7 +110,7 @@ void vgRemovePathCapabilities(VGPath path,
(~(capabilities & VG_PATH_CAPABILITY_ALL))));
}
-VGbitfield vgGetPathCapabilities(VGPath path)
+VGbitfield vegaGetPathCapabilities(VGPath path)
{
struct vg_context *ctx = vg_current_context();
struct path *p = 0;
@@ -122,7 +123,7 @@ VGbitfield vgGetPathCapabilities(VGPath path)
return path_capabilities(p);
}
-void vgAppendPath(VGPath dstPath, VGPath srcPath)
+void vegaAppendPath(VGPath dstPath, VGPath srcPath)
{
struct vg_context *ctx = vg_current_context();
struct path *src, *dst;
@@ -142,10 +143,10 @@ void vgAppendPath(VGPath dstPath, VGPath srcPath)
path_append_path(dst, src);
}
-void vgAppendPathData(VGPath dstPath,
- VGint numSegments,
- const VGubyte * pathSegments,
- const void * pathData)
+void vegaAppendPathData(VGPath dstPath,
+ VGint numSegments,
+ const VGubyte * pathSegments,
+ const void * pathData)
{
struct vg_context *ctx = vg_current_context();
struct path *p = 0;
@@ -185,10 +186,10 @@ void vgAppendPathData(VGPath dstPath,
path_append_data(p, numSegments, pathSegments, pathData);
}
-void vgModifyPathCoords(VGPath dstPath,
- VGint startIndex,
- VGint numSegments,
- const void * pathData)
+void vegaModifyPathCoords(VGPath dstPath,
+ VGint startIndex,
+ VGint numSegments,
+ const void * pathData)
{
struct vg_context *ctx = vg_current_context();
struct path *p = 0;
@@ -220,7 +221,7 @@ void vgModifyPathCoords(VGPath dstPath,
path_modify_coords(p, startIndex, numSegments, pathData);
}
-void vgTransformPath(VGPath dstPath, VGPath srcPath)
+void vegaTransformPath(VGPath dstPath, VGPath srcPath)
{
struct vg_context *ctx = vg_current_context();
struct path *src = 0, *dst = 0;
@@ -240,10 +241,10 @@ void vgTransformPath(VGPath dstPath, VGPath srcPath)
path_transform(dst, src);
}
-VGboolean vgInterpolatePath(VGPath dstPath,
- VGPath startPath,
- VGPath endPath,
- VGfloat amount)
+VGboolean vegaInterpolatePath(VGPath dstPath,
+ VGPath startPath,
+ VGPath endPath,
+ VGfloat amount)
{
struct vg_context *ctx = vg_current_context();
struct path *start = 0, *dst = 0, *end = 0;
@@ -269,9 +270,9 @@ VGboolean vgInterpolatePath(VGPath dstPath,
start, end, amount);
}
-VGfloat vgPathLength(VGPath path,
- VGint startSegment,
- VGint numSegments)
+VGfloat vegaPathLength(VGPath path,
+ VGint startSegment,
+ VGint numSegments)
{
struct vg_context *ctx = vg_current_context();
struct path *p = 0;
@@ -302,13 +303,13 @@ VGfloat vgPathLength(VGPath path,
return path_length(p, startSegment, numSegments);
}
-void vgPointAlongPath(VGPath path,
- VGint startSegment,
- VGint numSegments,
- VGfloat distance,
- VGfloat * x, VGfloat * y,
- VGfloat * tangentX,
- VGfloat * tangentY)
+void vegaPointAlongPath(VGPath path,
+ VGint startSegment,
+ VGint numSegments,
+ VGfloat distance,
+ VGfloat * x, VGfloat * y,
+ VGfloat * tangentX,
+ VGfloat * tangentY)
{
struct vg_context *ctx = vg_current_context();
struct path *p = 0;
@@ -362,11 +363,11 @@ void vgPointAlongPath(VGPath path,
}
}
-void vgPathBounds(VGPath path,
- VGfloat * minX,
- VGfloat * minY,
- VGfloat * width,
- VGfloat * height)
+void vegaPathBounds(VGPath path,
+ VGfloat * minX,
+ VGfloat * minY,
+ VGfloat * width,
+ VGfloat * height)
{
struct vg_context *ctx = vg_current_context();
struct path *p = 0;
@@ -399,11 +400,11 @@ void vgPathBounds(VGPath path,
path_bounding_rect(p, minX, minY, width, height);
}
-void vgPathTransformedBounds(VGPath path,
- VGfloat * minX,
- VGfloat * minY,
- VGfloat * width,
- VGfloat * height)
+void vegaPathTransformedBounds(VGPath path,
+ VGfloat * minX,
+ VGfloat * minY,
+ VGfloat * width,
+ VGfloat * height)
{
struct vg_context *ctx = vg_current_context();
struct path *p = 0;
@@ -466,7 +467,7 @@ void vgPathTransformedBounds(VGPath path,
}
-void vgDrawPath(VGPath path, VGbitfield paintModes)
+void vegaDrawPath(VGPath path, VGbitfield paintModes)
{
struct vg_context *ctx = vg_current_context();
diff --git a/src/gallium/state_trackers/vega/api_text.c b/src/gallium/state_trackers/vega/api_text.c
index d8411cf3e8..b35f3be90a 100644
--- a/src/gallium/state_trackers/vega/api_text.c
+++ b/src/gallium/state_trackers/vega/api_text.c
@@ -27,6 +27,7 @@
#include "VG/openvg.h"
#include "vg_context.h"
+#include "api.h"
#include "util/u_memory.h"
@@ -39,7 +40,7 @@ struct vg_font {
VGint num_glyphs;
};
-VGFont vgCreateFont(VGint glyphCapacityHint)
+VGFont vegaCreateFont(VGint glyphCapacityHint)
{
struct vg_font *font = 0;
struct vg_context *ctx = vg_current_context();
@@ -55,7 +56,7 @@ VGFont vgCreateFont(VGint glyphCapacityHint)
return (VGFont)font;
}
-void vgDestroyFont(VGFont f)
+void vegaDestroyFont(VGFont f)
{
struct vg_font *font = (struct vg_font *)f;
struct vg_context *ctx = vg_current_context();
@@ -69,12 +70,12 @@ void vgDestroyFont(VGFont f)
/*free(font);*/
}
-void vgSetGlyphToPath(VGFont font,
- VGuint glyphIndex,
- VGPath path,
- VGboolean isHinted,
- VGfloat glyphOrigin [2],
- VGfloat escapement[2])
+void vegaSetGlyphToPath(VGFont font,
+ VGuint glyphIndex,
+ VGPath path,
+ VGboolean isHinted,
+ VGfloat glyphOrigin [2],
+ VGfloat escapement[2])
{
struct vg_context *ctx = vg_current_context();
struct vg_object *pathObj;
@@ -106,11 +107,11 @@ void vgSetGlyphToPath(VGFont font,
++f->num_glyphs;
}
-void vgSetGlyphToImage(VGFont font,
- VGuint glyphIndex,
- VGImage image,
- VGfloat glyphOrigin [2],
- VGfloat escapement[2])
+void vegaSetGlyphToImage(VGFont font,
+ VGuint glyphIndex,
+ VGImage image,
+ VGfloat glyphOrigin [2],
+ VGfloat escapement[2])
{
struct vg_context *ctx = vg_current_context();
struct vg_object *img_obj;
@@ -153,8 +154,8 @@ static INLINE VGboolean font_contains_glyph(struct vg_font *font,
return VG_FALSE;
}
-void vgClearGlyph(VGFont font,
- VGuint glyphIndex)
+void vegaClearGlyph(VGFont font,
+ VGuint glyphIndex)
{
struct vg_context *ctx = vg_current_context();
struct vg_font *f;
@@ -184,10 +185,10 @@ void vgClearGlyph(VGFont font,
}
}
-void vgDrawGlyph(VGFont font,
- VGuint glyphIndex,
- VGbitfield paintModes,
- VGboolean allowAutoHinting)
+void vegaDrawGlyph(VGFont font,
+ VGuint glyphIndex,
+ VGbitfield paintModes,
+ VGboolean allowAutoHinting)
{
struct vg_context *ctx = vg_current_context();
struct vg_font *f;
@@ -211,13 +212,13 @@ void vgDrawGlyph(VGFont font,
}
}
-void vgDrawGlyphs(VGFont font,
- VGint glyphCount,
- VGuint *glyphIndices,
- VGfloat *adjustments_x,
- VGfloat *adjustments_y,
- VGbitfield paintModes,
- VGboolean allowAutoHinting)
+void vegaDrawGlyphs(VGFont font,
+ VGint glyphCount,
+ VGuint *glyphIndices,
+ VGfloat *adjustments_x,
+ VGfloat *adjustments_y,
+ VGbitfield paintModes,
+ VGboolean allowAutoHinting)
{
struct vg_context *ctx = vg_current_context();
VGint i;
diff --git a/src/gallium/state_trackers/vega/api_transform.c b/src/gallium/state_trackers/vega/api_transform.c
index 763a5ec415..0a40fc69b9 100644
--- a/src/gallium/state_trackers/vega/api_transform.c
+++ b/src/gallium/state_trackers/vega/api_transform.c
@@ -29,15 +29,16 @@
#include "vg_context.h"
#include "matrix.h"
+#include "api.h"
-void vgLoadIdentity(void)
+void vegaLoadIdentity(void)
{
struct vg_context *ctx = vg_current_context();
struct matrix *mat = vg_state_matrix(&ctx->state.vg);
matrix_load_identity(mat);
}
-void vgLoadMatrix(const VGfloat * m)
+void vegaLoadMatrix(const VGfloat * m)
{
struct vg_context *ctx = vg_current_context();
struct matrix *mat;
@@ -59,7 +60,7 @@ void vgLoadMatrix(const VGfloat * m)
}
}
-void vgGetMatrix(VGfloat * m)
+void vegaGetMatrix(VGfloat * m)
{
struct vg_context *ctx = vg_current_context();
struct matrix *mat;
@@ -76,7 +77,7 @@ void vgGetMatrix(VGfloat * m)
memcpy(m, mat->m, sizeof(VGfloat)*9);
}
-void vgMultMatrix(const VGfloat * m)
+void vegaMultMatrix(const VGfloat * m)
{
struct vg_context *ctx = vg_current_context();
struct matrix *dst, src;
@@ -99,28 +100,28 @@ void vgMultMatrix(const VGfloat * m)
}
-void vgTranslate(VGfloat tx, VGfloat ty)
+void vegaTranslate(VGfloat tx, VGfloat ty)
{
struct vg_context *ctx = vg_current_context();
struct matrix *dst = vg_state_matrix(&ctx->state.vg);
matrix_translate(dst, tx, ty);
}
-void vgScale(VGfloat sx, VGfloat sy)
+void vegaScale(VGfloat sx, VGfloat sy)
{
struct vg_context *ctx = vg_current_context();
struct matrix *dst = vg_state_matrix(&ctx->state.vg);
matrix_scale(dst, sx, sy);
}
-void vgShear(VGfloat shx, VGfloat shy)
+void vegaShear(VGfloat shx, VGfloat shy)
{
struct vg_context *ctx = vg_current_context();
struct matrix *dst = vg_state_matrix(&ctx->state.vg);
matrix_shear(dst, shx, shy);
}
-void vgRotate(VGfloat angle)
+void vegaRotate(VGfloat angle)
{
struct vg_context *ctx = vg_current_context();
struct matrix *dst = vg_state_matrix(&ctx->state.vg);
diff --git a/src/gallium/state_trackers/vega/polygon.c b/src/gallium/state_trackers/vega/polygon.c
index d2b7e48912..e9c8f03137 100644
--- a/src/gallium/state_trackers/vega/polygon.c
+++ b/src/gallium/state_trackers/vega/polygon.c
@@ -379,7 +379,7 @@ void polygon_fill(struct polygon *poly, struct vg_context *ctx)
dsa.stencil[0].func = PIPE_FUNC_ALWAYS;
dsa.stencil[0].valuemask = ~0;
- raster.cull_mode = raster.front_winding ^ PIPE_WINDING_BOTH;
+ raster.cull_face = PIPE_FACE_BACK;
dsa.stencil[0].fail_op = PIPE_STENCIL_OP_KEEP;
dsa.stencil[0].zfail_op = PIPE_STENCIL_OP_KEEP;
dsa.stencil[0].zpass_op = PIPE_STENCIL_OP_INCR_WRAP;
@@ -389,7 +389,7 @@ void polygon_fill(struct polygon *poly, struct vg_context *ctx)
cso_set_rasterizer(ctx->cso_context, &raster);
draw_polygon(ctx, poly);
- raster.cull_mode = raster.front_winding;
+ raster.cull_face = PIPE_FACE_FRONT;
dsa.stencil[0].fail_op = PIPE_STENCIL_OP_KEEP;
dsa.stencil[0].zfail_op = PIPE_STENCIL_OP_KEEP;
dsa.stencil[0].zpass_op = PIPE_STENCIL_OP_DECR_WRAP;
@@ -501,7 +501,7 @@ void polygon_array_fill(struct polygon_array *polyarray, struct vg_context *ctx)
dsa.stencil[0].func = PIPE_FUNC_ALWAYS;
dsa.stencil[0].valuemask = ~0;
- raster.cull_mode = raster.front_winding ^ PIPE_WINDING_BOTH;
+ raster.cull_face = PIPE_FACE_BACK;
dsa.stencil[0].fail_op = PIPE_STENCIL_OP_KEEP;
dsa.stencil[0].zfail_op = PIPE_STENCIL_OP_KEEP;
dsa.stencil[0].zpass_op = PIPE_STENCIL_OP_INCR_WRAP;
@@ -514,7 +514,7 @@ void polygon_array_fill(struct polygon_array *polyarray, struct vg_context *ctx)
draw_polygon(ctx, poly);
}
- raster.cull_mode = raster.front_winding;
+ raster.cull_face = PIPE_FACE_FRONT;
dsa.stencil[0].fail_op = PIPE_STENCIL_OP_KEEP;
dsa.stencil[0].zfail_op = PIPE_STENCIL_OP_KEEP;
dsa.stencil[0].zpass_op = PIPE_STENCIL_OP_DECR_WRAP;
diff --git a/src/gallium/state_trackers/vega/vg_api.h b/src/gallium/state_trackers/vega/vg_api.h
new file mode 100644
index 0000000000..ce2a0d6bb4
--- /dev/null
+++ b/src/gallium/state_trackers/vega/vg_api.h
@@ -0,0 +1,37 @@
+/*
+ * 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 <olv@lunarg.com>
+ */
+
+#ifndef VG_API_H
+#define VG_API_H
+
+struct st_api;
+
+const struct st_api *
+vg_api_get(void);
+
+#endif /* VG_API_H */
diff --git a/src/gallium/state_trackers/vega/vg_context.c b/src/gallium/state_trackers/vega/vg_context.c
index b55a2b57be..f02db8949d 100644
--- a/src/gallium/state_trackers/vega/vg_context.c
+++ b/src/gallium/state_trackers/vega/vg_context.c
@@ -33,6 +33,7 @@
#include "asm_util.h"
#include "st_inlines.h"
#include "vg_manager.h"
+#include "api.h"
#include "pipe/p_context.h"
#include "util/u_inlines.h"
@@ -67,6 +68,7 @@ static void init_clear(struct vg_context *st)
void vg_set_current_context(struct vg_context *ctx)
{
_vg_context = ctx;
+ api_make_dispatch_current((ctx) ? ctx->dispatch : NULL);
}
struct vg_context * vg_create_context(struct pipe_context *pipe,
@@ -80,6 +82,8 @@ struct vg_context * vg_create_context(struct pipe_context *pipe,
ctx->pipe = pipe;
+ ctx->dispatch = api_create_dispatch();
+
vg_init_state(&ctx->state.vg);
ctx->state.dirty = ALL_DIRTY;
@@ -185,6 +189,8 @@ void vg_destroy_context(struct vg_context *ctx)
cso_hash_delete(ctx->owned_objects[VG_OBJECT_FONT]);
cso_hash_delete(ctx->owned_objects[VG_OBJECT_PATH]);
+ api_destroy_dispatch(ctx->dispatch);
+
free(ctx);
}
diff --git a/src/gallium/state_trackers/vega/vg_context.h b/src/gallium/state_trackers/vega/vg_context.h
index dac67192a5..7b59ad512a 100644
--- a/src/gallium/state_trackers/vega/vg_context.h
+++ b/src/gallium/state_trackers/vega/vg_context.h
@@ -42,6 +42,7 @@ struct renderer;
struct shaders_cache;
struct shader;
struct vg_shader;
+struct mapi_table;
struct st_renderbuffer {
enum pipe_format format;
@@ -90,6 +91,7 @@ enum dirty_state {
struct vg_context
{
struct st_context_iface iface;
+ struct mapi_table *dispatch;
struct pipe_context *pipe;
diff --git a/src/gallium/state_trackers/vega/vg_manager.c b/src/gallium/state_trackers/vega/vg_manager.c
index 8a62a19120..3b04816df0 100644
--- a/src/gallium/state_trackers/vega/vg_manager.c
+++ b/src/gallium/state_trackers/vega/vg_manager.c
@@ -36,10 +36,12 @@
#include "util/u_format.h"
#include "util/u_sampler.h"
+#include "vg_api.h"
#include "vg_manager.h"
#include "vg_context.h"
#include "image.h"
#include "mask.h"
+#include "api.h"
static struct pipe_resource *
create_texture(struct pipe_context *pipe, enum pipe_format format,
@@ -526,17 +528,15 @@ vg_api_is_visual_supported(struct st_api *stapi,
static st_proc_t
vg_api_get_proc_address(struct st_api *stapi, const char *procname)
{
- /* TODO */
- return (st_proc_t) NULL;
+ return api_get_proc_address(procname);
}
static void
vg_api_destroy(struct st_api *stapi)
{
- free(stapi);
}
-struct st_api st_vg_api = {
+static const struct st_api vg_api = {
vg_api_destroy,
vg_api_get_proc_address,
vg_api_is_visual_supported,
@@ -545,8 +545,8 @@ struct st_api st_vg_api = {
vg_api_get_current,
};
-struct st_api *
-st_api_create_OpenVG(void)
+const struct st_api *
+vg_api_get(void)
{
- return &st_vg_api;
+ return &vg_api;
}
diff --git a/src/gallium/state_trackers/wgl/SConscript b/src/gallium/state_trackers/wgl/SConscript
index f59f3a9638..0f580b859c 100644
--- a/src/gallium/state_trackers/wgl/SConscript
+++ b/src/gallium/state_trackers/wgl/SConscript
@@ -7,6 +7,7 @@ if env['platform'] in ['windows']:
env = env.Clone()
env.Append(CPPPATH = [
+ '#src/mapi',
'#src/mesa',
'.',
])
diff --git a/src/gallium/state_trackers/xorg/SConscript b/src/gallium/state_trackers/xorg/SConscript
index 5d0b6613ac..0b598dab6e 100644
--- a/src/gallium/state_trackers/xorg/SConscript
+++ b/src/gallium/state_trackers/xorg/SConscript
@@ -11,13 +11,15 @@ if 'xorg' in env['statetrackers']:
'#/src/mesa',
])
- env.ParseConfig('pkg-config --cflags --libs xorg-server')
+ env.ParseConfig('pkg-config --cflags --libs libdrm xorg-server')
conf = env.Configure()
if conf.CheckHeader('X11/extensions/dpmsconst.h'):
env.Append(CPPDEFINES = [('HAVE_XEXTPROTO_71', '1')])
+ conf.Finish()
+
st_xorg = env.ConvenienceLibrary(
target = 'st_xorg',
source = [ 'xorg_composite.c',
diff --git a/src/gallium/state_trackers/xorg/xorg_crtc.c b/src/gallium/state_trackers/xorg/xorg_crtc.c
index 669bd9edcf..f9022a9f93 100644
--- a/src/gallium/state_trackers/xorg/xorg_crtc.c
+++ b/src/gallium/state_trackers/xorg/xorg_crtc.c
@@ -90,11 +90,10 @@ crtc_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(crtc->scrn);
modesettingPtr ms = modesettingPTR(crtc->scrn);
xf86OutputPtr output = NULL;
- drmModeConnectorPtr drm_connector;
struct crtc_private *crtcp = crtc->driver_private;
drmModeCrtcPtr drm_crtc = crtcp->drm_crtc;
drmModeModeInfo drm_mode;
- int i, ret;
+ int i, ret, connector_id;
for (i = 0; i < config->num_output; output = NULL, i++) {
output = config->output[i];
@@ -106,7 +105,7 @@ crtc_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,
if (!output)
return FALSE;
- drm_connector = output->driver_private;
+ connector_id = xorg_output_get_id(output);
drm_mode.clock = mode->Clock;
drm_mode.hdisplay = mode->HDisplay;
@@ -127,7 +126,7 @@ crtc_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,
drm_mode.name[DRM_DISPLAY_MODE_LEN - 1] = '\0';
ret = drmModeSetCrtc(ms->fd, drm_crtc->crtc_id, ms->fb_id, x, y,
- &drm_connector->connector_id, 1, &drm_mode);
+ &connector_id, 1, &drm_mode);
if (ret)
return FALSE;
diff --git a/src/gallium/state_trackers/xorg/xorg_dri2.c b/src/gallium/state_trackers/xorg/xorg_dri2.c
index 35741f8684..e719644d34 100644
--- a/src/gallium/state_trackers/xorg/xorg_dri2.c
+++ b/src/gallium/state_trackers/xorg/xorg_dri2.c
@@ -403,7 +403,7 @@ xorg_dri2_init(ScreenPtr pScreen)
}
#endif
- dri2info.version = DRI2INFOREC_VERSION;
+ dri2info.version = min(DRI2INFOREC_VERSION, 3);
dri2info.fd = ms->fd;
dri2info.driverName = pScrn->driverName;
diff --git a/src/gallium/state_trackers/xorg/xorg_driver.c b/src/gallium/state_trackers/xorg/xorg_driver.c
index 3687ee0db4..44520b81b6 100644
--- a/src/gallium/state_trackers/xorg/xorg_driver.c
+++ b/src/gallium/state_trackers/xorg/xorg_driver.c
@@ -141,8 +141,6 @@ xorg_tracker_have_modesetting(ScrnInfoPtr pScrn, struct pci_device *device)
static Bool drv_init_front_buffer_functions(ScrnInfoPtr pScrn);
static Bool drv_close_screen(int scrnIndex, ScreenPtr pScreen);
-static Bool drv_save_hw_state(ScrnInfoPtr pScrn);
-static Bool drv_restore_hw_state(ScrnInfoPtr pScrn);
/*
@@ -336,17 +334,9 @@ static Bool
drv_close_resource_management(ScrnInfoPtr pScrn)
{
modesettingPtr ms = modesettingPTR(pScrn);
- int i;
if (ms->screen) {
assert(ms->ctx == NULL);
-
- for (i = 0; i < XORG_NR_FENCES; i++) {
- if (ms->fence[i]) {
- ms->screen->fence_finish(ms->screen, ms->fence[i], 0);
- ms->screen->fence_reference(ms->screen, &ms->fence[i], NULL);
- }
- }
ms->screen->destroy(ms->screen);
}
ms->screen = NULL;
@@ -359,6 +349,22 @@ drv_close_resource_management(ScrnInfoPtr pScrn)
return TRUE;
}
+static void
+drv_cleanup_fences(ScrnInfoPtr pScrn)
+{
+ modesettingPtr ms = modesettingPTR(pScrn);
+ int i;
+
+ assert(ms->screen);
+
+ for (i = 0; i < XORG_NR_FENCES; i++) {
+ if (ms->fence[i]) {
+ ms->screen->fence_finish(ms->screen, ms->fence[i], 0);
+ ms->screen->fence_reference(ms->screen, &ms->fence[i], NULL);
+ }
+ }
+}
+
static Bool
drv_pre_init(ScrnInfoPtr pScrn, int flags)
{
@@ -388,7 +394,6 @@ drv_pre_init(ScrnInfoPtr pScrn, int flags)
return FALSE;
ms = modesettingPTR(pScrn);
- ms->SaveGeneration = -1;
ms->pEnt = pEnt;
ms->cust = cust;
@@ -471,19 +476,14 @@ drv_pre_init(ScrnInfoPtr pScrn, int flags)
ms->SWCursor = TRUE;
}
- drv_save_hw_state(pScrn);
-
xorg_crtc_init(pScrn);
xorg_output_init(pScrn);
if (!xf86InitialConfiguration(pScrn, TRUE)) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No valid modes.\n");
- drv_restore_hw_state(pScrn);
return FALSE;
}
- drv_restore_hw_state(pScrn);
-
/*
* If the driver can do gamma correction, it should call xf86SetGamma() here.
*/
@@ -521,22 +521,6 @@ drv_pre_init(ScrnInfoPtr pScrn, int flags)
return TRUE;
}
-static Bool
-drv_save_hw_state(ScrnInfoPtr pScrn)
-{
- /*xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);*/
-
- return TRUE;
-}
-
-static Bool
-drv_restore_hw_state(ScrnInfoPtr pScrn)
-{
- /*xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);*/
-
- return TRUE;
-}
-
static void drv_block_handler(int i, pointer blockData, pointer pTimeout,
pointer pReadmask)
{
@@ -848,7 +832,9 @@ drv_leave_vt(int scrnIndex, int flags)
drmModeRmFB(ms->fd, ms->fb_id);
ms->fb_id = -1;
- drv_restore_hw_state(pScrn);
+ /* idle hardware */
+ if (!ms->kms)
+ drv_cleanup_fences(pScrn);
if (drmDropMaster(ms->fd))
xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
@@ -878,15 +864,6 @@ drv_enter_vt(int scrnIndex, int flags)
}
}
- /*
- * Only save state once per server generation since that's what most
- * drivers do. Could change this to save state at each VT enter.
- */
- if (ms->SaveGeneration != serverGeneration) {
- ms->SaveGeneration = serverGeneration;
- drv_save_hw_state(pScrn);
- }
-
if (!ms->create_front_buffer(pScrn))
return FALSE;
@@ -917,10 +894,6 @@ drv_close_screen(int scrnIndex, ScreenPtr pScreen)
modesettingPtr ms = modesettingPTR(pScrn);
CustomizerPtr cust = ms->cust;
- if (pScrn->vtSema) {
- drv_leave_vt(scrnIndex, 0);
- }
-
if (ms->cursor) {
FreeCursor(ms->cursor, None);
ms->cursor = NULL;
@@ -952,6 +925,11 @@ drv_close_screen(int scrnIndex, ScreenPtr pScreen)
xorg_exa_close(pScrn);
ms->exa = NULL;
+ /* calls drop master make sure we don't talk to 3D HW after that */
+ if (pScrn->vtSema) {
+ drv_leave_vt(scrnIndex, 0);
+ }
+
drv_close_resource_management(pScrn);
drv_close_drm(pScrn);
diff --git a/src/gallium/state_trackers/xorg/xorg_exa.c b/src/gallium/state_trackers/xorg/xorg_exa.c
index 6657f7391b..ee40bc8ccb 100644
--- a/src/gallium/state_trackers/xorg/xorg_exa.c
+++ b/src/gallium/state_trackers/xorg/xorg_exa.c
@@ -968,6 +968,8 @@ xorg_exa_close(ScrnInfoPtr pScrn)
renderer_destroy(exa->renderer);
+ xorg_exa_finish(exa);
+
if (exa->pipe)
exa->pipe->destroy(exa->pipe);
exa->pipe = NULL;
diff --git a/src/gallium/state_trackers/xorg/xorg_output.c b/src/gallium/state_trackers/xorg/xorg_output.c
index 13c3fb97e3..056098f76b 100644
--- a/src/gallium/state_trackers/xorg/xorg_output.c
+++ b/src/gallium/state_trackers/xorg/xorg_output.c
@@ -51,6 +51,13 @@
#include "xorg_tracker.h"
+struct output_private
+{
+ drmModeConnectorPtr drm_connector;
+
+ int c;
+};
+
static char *output_enum_list[] = {
"Unknown",
"VGA",
@@ -82,22 +89,38 @@ output_dpms(xf86OutputPtr output, int mode)
static xf86OutputStatus
output_detect(xf86OutputPtr output)
{
- drmModeConnectorPtr drm_connector = output->driver_private;
+ modesettingPtr ms = modesettingPTR(output->scrn);
+ struct output_private *priv = output->driver_private;
+ drmModeConnectorPtr drm_connector;
+ xf86OutputStatus status;
+
+ drm_connector = drmModeGetConnector(ms->fd, priv->drm_connector->connector_id);
+ if (drm_connector) {
+ drmModeFreeConnector(priv->drm_connector);
+ priv->drm_connector = drm_connector;
+ } else {
+ drm_connector = priv->drm_connector;
+ }
switch (drm_connector->connection) {
case DRM_MODE_CONNECTED:
- return XF86OutputStatusConnected;
+ status = XF86OutputStatusConnected;
+ break;
case DRM_MODE_DISCONNECTED:
- return XF86OutputStatusDisconnected;
+ status = XF86OutputStatusDisconnected;
+ break;
default:
- return XF86OutputStatusUnknown;
+ status = XF86OutputStatusUnknown;
}
+
+ return status;
}
static DisplayModePtr
output_get_modes(xf86OutputPtr output)
{
- drmModeConnectorPtr drm_connector = output->driver_private;
+ struct output_private *priv = output->driver_private;
+ drmModeConnectorPtr drm_connector = priv->drm_connector;
drmModeModeInfoPtr drm_mode = NULL;
DisplayModePtr modes = NULL, mode = NULL;
int i;
@@ -161,7 +184,10 @@ output_get_property(xf86OutputPtr output, Atom property)
static void
output_destroy(xf86OutputPtr output)
{
- drmModeFreeConnector(output->driver_private);
+ struct output_private *priv = output->driver_private;
+ drmModeFreeConnector(priv->drm_connector);
+ xfree(priv);
+ output->driver_private = NULL;
}
static const xf86OutputFuncsRec output_funcs = {
@@ -188,6 +214,7 @@ xorg_output_init(ScrnInfoPtr pScrn)
drmModeResPtr res;
drmModeConnectorPtr drm_connector = NULL;
drmModeEncoderPtr drm_encoder = NULL;
+ struct output_private *priv;
char name[32];
int c, v, p;
@@ -226,9 +253,16 @@ xorg_output_init(ScrnInfoPtr pScrn)
drm_connector->connector_type_id);
+ priv = xcalloc(sizeof(*priv), 1);
+ if (!priv) {
+ continue;
+ }
+
output = xf86OutputCreate(pScrn, &output_funcs, name);
- if (!output)
+ if (!output) {
+ xfree(priv);
continue;
+ }
drm_encoder = drmModeGetEncoder(ms->fd, drm_connector->encoders[0]);
if (drm_encoder) {
@@ -238,7 +272,9 @@ xorg_output_init(ScrnInfoPtr pScrn)
output->possible_crtcs = 0;
output->possible_clones = 0;
}
- output->driver_private = drm_connector;
+ priv->c = c;
+ priv->drm_connector = drm_connector;
+ output->driver_private = priv;
output->subpixel_order = SubPixelHorizontalRGB;
output->interlaceAllowed = FALSE;
output->doubleScanAllowed = FALSE;
@@ -248,4 +284,11 @@ xorg_output_init(ScrnInfoPtr pScrn)
drmModeFreeResources(res);
}
+unsigned
+xorg_output_get_id(xf86OutputPtr output)
+{
+ struct output_private *priv = output->driver_private;
+ return priv->drm_connector->connector_id;
+}
+
/* vim: set sw=4 ts=8 sts=4: */
diff --git a/src/gallium/state_trackers/xorg/xorg_renderer.c b/src/gallium/state_trackers/xorg/xorg_renderer.c
index 1576e5ea01..e5def3e2ed 100644
--- a/src/gallium/state_trackers/xorg/xorg_renderer.c
+++ b/src/gallium/state_trackers/xorg/xorg_renderer.c
@@ -7,7 +7,6 @@
#include "util/u_draw_quad.h"
#include "util/u_math.h"
#include "util/u_memory.h"
-#include "util/u_rect.h"
#include "util/u_sampler.h"
#include "util/u_surface.h"
diff --git a/src/gallium/state_trackers/xorg/xorg_tracker.h b/src/gallium/state_trackers/xorg/xorg_tracker.h
index cb6773424a..65fbc3234b 100644
--- a/src/gallium/state_trackers/xorg/xorg_tracker.h
+++ b/src/gallium/state_trackers/xorg/xorg_tracker.h
@@ -96,8 +96,6 @@ typedef struct _modesettingRec
/* Broken-out options. */
OptionInfoPtr Options;
- unsigned int SaveGeneration;
-
void (*blockHandler)(int, pointer, pointer, pointer);
struct pipe_fence_handle *fence[XORG_NR_FENCES];
@@ -192,6 +190,9 @@ xorg_crtc_cursor_destroy(xf86CrtcPtr crtc);
void
xorg_output_init(ScrnInfoPtr pScrn);
+unsigned
+xorg_output_get_id(xf86OutputPtr output);
+
/***********************************************************************
* xorg_xv.c