summaryrefslogtreecommitdiff
path: root/src/gallium/state_trackers/egl/common
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/state_trackers/egl/common')
-rw-r--r--src/gallium/state_trackers/egl/common/egl_g3d.c256
-rw-r--r--src/gallium/state_trackers/egl/common/egl_g3d.h8
-rw-r--r--src/gallium/state_trackers/egl/common/egl_g3d_api.c11
-rw-r--r--src/gallium/state_trackers/egl/common/egl_g3d_image.c2
-rw-r--r--src/gallium/state_trackers/egl/common/egl_g3d_loader.h (renamed from src/gallium/state_trackers/egl/common/native_probe.h)60
-rw-r--r--src/gallium/state_trackers/egl/common/egl_g3d_st.c167
-rw-r--r--src/gallium/state_trackers/egl/common/egl_g3d_st.h6
-rw-r--r--src/gallium/state_trackers/egl/common/native.h30
-rw-r--r--src/gallium/state_trackers/egl/common/native_helper.c18
-rw-r--r--src/gallium/state_trackers/egl/common/native_helper.h3
10 files changed, 176 insertions, 385 deletions
diff --git a/src/gallium/state_trackers/egl/common/egl_g3d.c b/src/gallium/state_trackers/egl/common/egl_g3d.c
index 361cc7960b..b6321e6b43 100644
--- a/src/gallium/state_trackers/egl/common/egl_g3d.c
+++ b/src/gallium/state_trackers/egl/common/egl_g3d.c
@@ -35,71 +35,57 @@
#include "egl_g3d.h"
#include "egl_g3d_api.h"
#include "egl_g3d_st.h"
+#include "egl_g3d_loader.h"
#include "native.h"
/**
- * Initialize the state trackers.
+ * Get the native platform.
*/
-static void
-egl_g3d_init_st(_EGLDriver *drv)
+static const struct native_platform *
+egl_g3d_get_platform(_EGLDriver *drv, _EGLPlatformType plat)
{
struct egl_g3d_driver *gdrv = egl_g3d_driver(drv);
- EGLint i;
- /* already initialized */
- if (gdrv->api_mask)
- return;
+ if (!gdrv->platforms[plat]) {
+ const char *plat_name = NULL;
+ const struct native_platform *nplat = NULL;
- egl_g3d_init_st_apis(gdrv->stapis);
- for (i = 0; i < ST_API_COUNT; i++) {
- if (gdrv->stapis[i])
- gdrv->api_mask |= egl_g3d_st_api_bit(i);
- }
+ switch (plat) {
+ case _EGL_PLATFORM_WINDOWS:
+ plat_name = "Windows";
+#ifdef HAVE_GDI_BACKEND
+ nplat = native_get_gdi_platform();
+#endif
+ break;
+ case _EGL_PLATFORM_X11:
+ plat_name = "X11";
+#ifdef HAVE_X11_BACKEND
+ nplat = native_get_x11_platform();
+#endif
+ break;
+ case _EGL_PLATFORM_DRM:
+ plat_name = "DRM";
+#ifdef HAVE_KMS_BACKEND
+ nplat = native_get_kms_platform();
+#endif
+ break;
+ case _EGL_PLATFORM_FBDEV:
+ plat_name = "FBDEV";
+#ifdef HAVE_FBDEV_BACKEND
+ nplat = native_get_fbdev_platform();
+#endif
+ break;
+ default:
+ break;
+ }
- if (gdrv->api_mask)
- _eglLog(_EGL_DEBUG, "Driver API mask: 0x%x", gdrv->api_mask);
- else
- _eglLog(_EGL_WARNING, "No supported client API");
-}
+ if (!nplat)
+ _eglLog(_EGL_WARNING, "unsupported platform %s", plat_name);
-/**
- * Get the probe object of the display.
- *
- * Note that this function may be called before the display is initialized.
- */
-static struct native_probe *
-egl_g3d_get_probe(_EGLDriver *drv, _EGLDisplay *dpy)
-{
- struct egl_g3d_driver *gdrv = egl_g3d_driver(drv);
- struct native_probe *nprobe;
-
- nprobe = (struct native_probe *) _eglGetProbeCache(gdrv->probe_key);
- if (!nprobe || nprobe->display != dpy->NativeDisplay) {
- if (nprobe)
- nprobe->destroy(nprobe);
- nprobe = native_create_probe(dpy->NativeDisplay);
- _eglSetProbeCache(gdrv->probe_key, (void *) nprobe);
+ gdrv->platforms[plat] = nplat;
}
- return nprobe;
-}
-
-/**
- * Destroy the probe object of the display. The display may be NULL.
- *
- * Note that this function may be called before the display is initialized.
- */
-static void
-egl_g3d_destroy_probe(_EGLDriver *drv, _EGLDisplay *dpy)
-{
- struct egl_g3d_driver *gdrv = egl_g3d_driver(drv);
- struct native_probe *nprobe;
-
- nprobe = (struct native_probe *) _eglGetProbeCache(gdrv->probe_key);
- if (nprobe && (!dpy || nprobe->display == dpy->NativeDisplay)) {
- nprobe->destroy(nprobe);
- _eglSetProbeCache(gdrv->probe_key, NULL);
- }
+ return gdrv->platforms[plat];
}
#ifdef EGL_MESA_screen_surface
@@ -268,11 +254,9 @@ egl_g3d_init_config(_EGLDriver *drv, _EGLDisplay *dpy,
_EGLConfig *conf, const struct native_config *nconf,
enum pipe_format depth_stencil_format)
{
- struct egl_g3d_driver *gdrv = egl_g3d_driver(drv);
struct egl_g3d_config *gconf = egl_g3d_config(conf);
EGLint buffer_mask, api_mask;
EGLBoolean valid;
- EGLint i;
buffer_mask = 0x0;
if (nconf->buffer_mask & (1 << NATIVE_ATTACHMENT_FRONT_LEFT))
@@ -293,14 +277,7 @@ egl_g3d_init_config(_EGLDriver *drv, _EGLDisplay *dpy,
gconf->stvis.render_buffer = (buffer_mask & ST_ATTACHMENT_BACK_LEFT_MASK) ?
ST_ATTACHMENT_BACK_LEFT : ST_ATTACHMENT_FRONT_LEFT;
- api_mask = 0;
- for (i = 0; i < ST_API_COUNT; i++) {
- struct st_api *stapi = gdrv->stapis[i];
- if (stapi) {
- if (stapi->is_visual_supported(stapi, &gconf->stvis))
- api_mask |= egl_g3d_st_api_bit(i);
- }
- }
+ api_mask = dpy->ClientAPIsMask;
/* this is required by EGL, not by OpenGL ES */
if (nconf->window_bit &&
gconf->stvis.render_buffer != ST_ATTACHMENT_BACK_LEFT)
@@ -425,31 +402,64 @@ egl_g3d_invalid_surface(struct native_display *ndpy,
gctx->stctxi->notify_invalid_framebuffer(gctx->stctxi, gsurf->stfbi);
}
+static struct pipe_screen *
+egl_g3d_new_drm_screen(struct native_display *ndpy, const char *name, int fd)
+{
+ _EGLDisplay *dpy = (_EGLDisplay *) ndpy->user_data;
+ struct egl_g3d_display *gdpy = egl_g3d_display(dpy);
+ return gdpy->loader->create_drm_screen(name, fd);
+}
+
+static struct pipe_screen *
+egl_g3d_new_sw_screen(struct native_display *ndpy, struct sw_winsys *ws)
+{
+ _EGLDisplay *dpy = (_EGLDisplay *) ndpy->user_data;
+ struct egl_g3d_display *gdpy = egl_g3d_display(dpy);
+ return gdpy->loader->create_sw_screen(ws);
+}
+
static struct native_event_handler egl_g3d_native_event_handler = {
- egl_g3d_invalid_surface
+ egl_g3d_invalid_surface,
+ egl_g3d_new_drm_screen,
+ egl_g3d_new_sw_screen
};
+static void
+egl_g3d_free_config(void *conf)
+{
+ struct egl_g3d_config *gconf = egl_g3d_config((_EGLConfig *) conf);
+ FREE(gconf);
+}
+
+static void
+egl_g3d_free_screen(void *scr)
+{
+ struct egl_g3d_screen *gscr = egl_g3d_screen((_EGLScreen *) scr);
+ FREE(gscr->native_modes);
+ FREE(gscr);
+}
+
static EGLBoolean
egl_g3d_terminate(_EGLDriver *drv, _EGLDisplay *dpy)
{
struct egl_g3d_display *gdpy = egl_g3d_display(dpy);
- EGLint i;
_eglReleaseDisplayResources(drv, dpy);
- _eglCleanupDisplay(dpy);
if (gdpy->pipe)
gdpy->pipe->destroy(gdpy->pipe);
+ if (dpy->Configs) {
+ _eglDestroyArray(dpy->Configs, egl_g3d_free_config);
+ dpy->Configs = NULL;
+ }
if (dpy->Screens) {
- for (i = 0; i < dpy->NumScreens; i++) {
- struct egl_g3d_screen *gscr = egl_g3d_screen(dpy->Screens[i]);
- FREE(gscr->native_modes);
- FREE(gscr);
- }
- FREE(dpy->Screens);
+ _eglDestroyArray(dpy->Screens, egl_g3d_free_screen);
+ dpy->Screens = NULL;
}
+ _eglCleanupDisplay(dpy);
+
if (gdpy->smapi)
egl_g3d_destroy_st_manager(gdpy->smapi);
@@ -468,28 +478,36 @@ egl_g3d_initialize(_EGLDriver *drv, _EGLDisplay *dpy,
{
struct egl_g3d_driver *gdrv = egl_g3d_driver(drv);
struct egl_g3d_display *gdpy;
+ const struct native_platform *nplat;
- /* the probe object is unlikely to be needed again */
- egl_g3d_destroy_probe(drv, dpy);
+ nplat = egl_g3d_get_platform(drv, dpy->Platform);
+ if (!nplat)
+ return EGL_FALSE;
gdpy = CALLOC_STRUCT(egl_g3d_display);
if (!gdpy) {
_eglError(EGL_BAD_ALLOC, "eglInitialize");
goto fail;
}
+ gdpy->loader = gdrv->loader;
dpy->DriverData = gdpy;
- gdpy->native = native_create_display(dpy->NativeDisplay,
- &egl_g3d_native_event_handler);
+ _eglLog(_EGL_INFO, "use %s for display %p", nplat->name, dpy->PlatformDisplay);
+ gdpy->native = nplat->create_display(dpy->PlatformDisplay,
+ &egl_g3d_native_event_handler, (void *) dpy);
if (!gdpy->native) {
_eglError(EGL_NOT_INITIALIZED, "eglInitialize(no usable display)");
goto fail;
}
- gdpy->native->user_data = (void *) dpy;
-
- egl_g3d_init_st(&gdrv->base);
- dpy->ClientAPIsMask = gdrv->api_mask;
+ if (gdpy->loader->api_mask & (1 << ST_API_OPENGL))
+ dpy->ClientAPIsMask |= EGL_OPENGL_BIT;
+ if (gdpy->loader->api_mask & (1 << ST_API_OPENGL_ES1))
+ dpy->ClientAPIsMask |= EGL_OPENGL_ES_BIT;
+ if (gdpy->loader->api_mask & (1 << ST_API_OPENGL_ES2))
+ dpy->ClientAPIsMask |= EGL_OPENGL_ES2_BIT;
+ if (gdpy->loader->api_mask & (1 << ST_API_OPENVG))
+ dpy->ClientAPIsMask |= EGL_OPENVG_BIT;
gdpy->smapi = egl_g3d_create_st_manager(dpy);
if (!gdpy->smapi) {
@@ -530,87 +548,51 @@ static _EGLProc
egl_g3d_get_proc_address(_EGLDriver *drv, const char *procname)
{
struct egl_g3d_driver *gdrv = egl_g3d_driver(drv);
- _EGLProc proc;
- EGLint i;
-
- /* in case this is called before a display is initialized */
- egl_g3d_init_st(&gdrv->base);
+ struct st_api *stapi = NULL;
- for (i = 0; i < ST_API_COUNT; i++) {
- struct st_api *stapi = gdrv->stapis[i];
- if (stapi) {
- proc = (_EGLProc) stapi->get_proc_address(stapi, procname);
- if (proc)
- return proc;
- }
- }
+ if (procname && procname[0] == 'v' && procname[1] == 'g')
+ stapi = gdrv->loader->get_st_api(ST_API_OPENVG);
+ else if (procname && procname[0] == 'g' && procname[1] == 'l')
+ stapi = gdrv->loader->guess_gl_api();
- return (_EGLProc) NULL;
+ return (_EGLProc) ((stapi) ?
+ stapi->get_proc_address(stapi, procname) : NULL);
}
static EGLint
egl_g3d_probe(_EGLDriver *drv, _EGLDisplay *dpy)
{
- struct native_probe *nprobe;
- enum native_probe_result res;
- EGLint score;
-
- nprobe = egl_g3d_get_probe(drv, dpy);
- res = native_get_probe_result(nprobe);
-
- switch (res) {
- case NATIVE_PROBE_UNKNOWN:
- default:
- score = 0;
- break;
- case NATIVE_PROBE_FALLBACK:
- score = 40;
- break;
- case NATIVE_PROBE_SUPPORTED:
- score = 50;
- break;
- case NATIVE_PROBE_EXACT:
- score = 100;
- break;
- }
-
- return score;
-}
-
-static void
-egl_g3d_unload(_EGLDriver *drv)
-{
- struct egl_g3d_driver *gdrv = egl_g3d_driver(drv);
-
- egl_g3d_destroy_st_apis();
- egl_g3d_destroy_probe(drv, NULL);
- FREE(gdrv);
+ return (egl_g3d_get_platform(drv, dpy->Platform)) ? 90 : 0;
}
_EGLDriver *
-_eglMain(const char *args)
+egl_g3d_create_driver(const struct egl_g3d_loader *loader)
{
- static char driver_name[64];
struct egl_g3d_driver *gdrv;
- util_snprintf(driver_name, sizeof(driver_name),
- "Gallium/%s", native_get_name());
-
gdrv = CALLOC_STRUCT(egl_g3d_driver);
if (!gdrv)
return NULL;
+ gdrv->loader = loader;
+
egl_g3d_init_driver_api(&gdrv->base);
gdrv->base.API.Initialize = egl_g3d_initialize;
gdrv->base.API.Terminate = egl_g3d_terminate;
gdrv->base.API.GetProcAddress = egl_g3d_get_proc_address;
- gdrv->base.Name = driver_name;
gdrv->base.Probe = egl_g3d_probe;
- gdrv->base.Unload = egl_g3d_unload;
- /* the key is " EGL G3D" */
- gdrv->probe_key = 0x0E61063D;
+ /* to be filled by the caller */
+ gdrv->base.Name = NULL;
+ gdrv->base.Unload = NULL;
return &gdrv->base;
}
+
+void
+egl_g3d_destroy_driver(_EGLDriver *drv)
+{
+ struct egl_g3d_driver *gdrv = egl_g3d_driver(drv);
+ FREE(gdrv);
+}
diff --git a/src/gallium/state_trackers/egl/common/egl_g3d.h b/src/gallium/state_trackers/egl/common/egl_g3d.h
index d516d8fe03..ed2b0409bb 100644
--- a/src/gallium/state_trackers/egl/common/egl_g3d.h
+++ b/src/gallium/state_trackers/egl/common/egl_g3d.h
@@ -41,18 +41,18 @@
#include "native.h"
#include "egl_g3d_st.h"
+#include "egl_g3d_loader.h"
struct egl_g3d_driver {
_EGLDriver base;
- struct st_api *stapis[ST_API_COUNT];
- EGLint api_mask;
-
- EGLint probe_key;
+ const struct egl_g3d_loader *loader;
+ const struct native_platform *platforms[_EGL_NUM_PLATFORMS];
};
struct egl_g3d_display {
struct native_display *native;
+ const struct egl_g3d_loader *loader;
struct st_manager *smapi;
struct pipe_context *pipe;
};
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 255a1fb730..edac72a822 100644
--- a/src/gallium/state_trackers/egl/common/egl_g3d_api.c
+++ b/src/gallium/state_trackers/egl/common/egl_g3d_api.c
@@ -35,6 +35,7 @@
#include "egl_g3d_api.h"
#include "egl_g3d_image.h"
#include "egl_g3d_st.h"
+#include "egl_g3d_loader.h"
#include "native.h"
/**
@@ -44,7 +45,6 @@ static struct st_api *
egl_g3d_choose_st(_EGLDriver *drv, _EGLContext *ctx)
{
struct egl_g3d_driver *gdrv = egl_g3d_driver(drv);
- struct st_api *stapi;
EGLint idx = -1;
switch (ctx->ClientAPI) {
@@ -73,8 +73,7 @@ egl_g3d_choose_st(_EGLDriver *drv, _EGLContext *ctx)
break;
}
- stapi = (idx >= 0) ? gdrv->stapis[idx] : NULL;
- return stapi;
+ return (idx >= 0) ? gdrv->loader->get_st_api(idx) : NULL;
}
static _EGLContext *
@@ -774,13 +773,13 @@ egl_g3d_find_pixmap_config(_EGLDisplay *dpy, EGLNativePixmapType pix)
struct egl_g3d_config *gconf;
EGLint i;
- for (i = 0; i < dpy->NumConfigs; i++) {
- gconf = egl_g3d_config(dpy->Configs[i]);
+ for (i = 0; i < dpy->Configs->Size; i++) {
+ gconf = egl_g3d_config((_EGLConfig *) dpy->Configs->Elements[i]);
if (gdpy->native->is_pixmap_supported(gdpy->native, pix, gconf->native))
break;
}
- return (i < dpy->NumConfigs) ? &gconf->base : NULL;
+ return (i < dpy->Configs->Size) ? &gconf->base : NULL;
}
void
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 b1fe30a776..1e13cfcf7e 100644
--- a/src/gallium/state_trackers/egl/common/egl_g3d_image.c
+++ b/src/gallium/state_trackers/egl/common/egl_g3d_image.c
@@ -78,7 +78,7 @@ egl_g3d_create_image(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *ctx,
gimg = CALLOC_STRUCT(egl_g3d_image);
if (!gimg) {
- _eglError(EGL_BAD_ALLOC, "eglCreatePbufferSurface");
+ _eglError(EGL_BAD_ALLOC, "eglCreateEGLImageKHR");
return NULL;
}
diff --git a/src/gallium/state_trackers/egl/common/native_probe.h b/src/gallium/state_trackers/egl/common/egl_g3d_loader.h
index aeed9f85dd..c9141f8ad4 100644
--- a/src/gallium/state_trackers/egl/common/native_probe.h
+++ b/src/gallium/state_trackers/egl/common/egl_g3d_loader.h
@@ -1,8 +1,8 @@
/*
* Mesa 3-D graphics library
- * Version: 7.8
+ * Version: 7.9
*
- * Copyright (C) 2009-2010 Chia-I Wu <olv@0xlab.org>
+ * 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"),
@@ -21,48 +21,34 @@
* 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 _NATIVE_PROBE_H_
-#define _NATIVE_PROBE_H_
+#ifndef _EGL_G3D_LOADER_H_
+#define _EGL_G3D_LOADER_H_
-#include "EGL/egl.h" /* for EGL native types */
+#include "pipe/p_compiler.h"
+#include "state_tracker/st_api.h"
+#include "egltypedefs.h"
-/**
- * Enumerations for probe results.
- */
-enum native_probe_result {
- NATIVE_PROBE_UNKNOWN,
- NATIVE_PROBE_FALLBACK,
- NATIVE_PROBE_SUPPORTED,
- NATIVE_PROBE_EXACT,
-};
+struct pipe_screen;
+struct sw_winsys;
-/**
- * A probe object for display probe.
- */
-struct native_probe {
- int magic;
- EGLNativeDisplayType display;
- void *data;
+struct egl_g3d_loader {
+ uint api_mask;
+ struct st_api *(*get_st_api)(enum st_api_type api);
+ struct st_api *(*guess_gl_api)(void);
- void (*destroy)(struct native_probe *nprobe);
+ struct pipe_screen *(*create_drm_screen)(const char *name, int fd);
+ struct pipe_screen *(*create_sw_screen)(struct sw_winsys *ws);
};
-/**
- * Return a probe object for the given display.
- *
- * Note that the returned object may be cached and used by different native
- * display modules. It allows fast probing when multiple modules probe the
- * same display.
- */
-struct native_probe *
-native_create_probe(EGLNativeDisplayType dpy);
+_EGLDriver *
+egl_g3d_create_driver(const struct egl_g3d_loader *loader);
-/**
- * Probe the probe object.
- */
-enum native_probe_result
-native_get_probe_result(struct native_probe *nprobe);
+void
+egl_g3d_destroy_driver(_EGLDriver *drv);
-#endif /* _NATIVE_PROBE_H_ */
+#endif /* _EGL_G3D_LOADER_H_ */
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 683b74f62b..05cdb0d421 100644
--- a/src/gallium/state_trackers/egl/common/egl_g3d_st.c
+++ b/src/gallium/state_trackers/egl/common/egl_g3d_st.c
@@ -49,173 +49,6 @@ egl_g3d_st_manager(struct st_manager *smapi)
return (struct egl_g3d_st_manager *) smapi;
}
-static struct egl_g3d_st_module {
- const char *filename;
- struct util_dl_library *lib;
- 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;
-
- if (!len) {
- stmod->lib = util_dl_open(stmod->filename);
- return !(stmod->lib);
- }
-
- 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;
- }
- }
-
- if (stmod->stapi) {
- return TRUE;
- }
- else {
- stmod->filename = NULL;
- return FALSE;
- }
-}
-
-#ifdef PIPE_OS_WINDOWS
-#define ST_MODULE_SUFFIX ".dll"
-#else
-#define ST_MODULE_SUFFIX ".so"
-#endif
-
-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" ST_MODULE_SUFFIX;
- break;
- case ST_API_OPENGL_ES1:
- skip_checks[api] = "glColor4x";
- symbols[api] = ST_CREATE_OPENGL_ES1_SYMBOL;
- filenames[api][count++] = "api_GLESv1_CM" ST_MODULE_SUFFIX;
- filenames[api][count++] = "api_GL" ST_MODULE_SUFFIX;
- break;
- case ST_API_OPENGL_ES2:
- skip_checks[api] = "glShaderBinary";
- symbols[api] = ST_CREATE_OPENGL_ES2_SYMBOL;
- filenames[api][count++] = "api_GLESv2" ST_MODULE_SUFFIX;
- filenames[api][count++] = "api_GL" ST_MODULE_SUFFIX;
- break;
- case ST_API_OPENVG:
- skip_checks[api] = "vgClear";
- symbols[api] = ST_CREATE_OPENVG_SYMBOL;
- filenames[api][count++]= "api_OpenVG" ST_MODULE_SUFFIX;
- 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]);
-
- 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
egl_g3d_st_manager_get_egl_image(struct st_manager *smapi,
struct st_context_iface *stctx,
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 ee53799b02..aa25cc042d 100644
--- a/src/gallium/state_trackers/egl/common/egl_g3d_st.h
+++ b/src/gallium/state_trackers/egl/common/egl_g3d_st.h
@@ -33,12 +33,6 @@
#include "state_tracker/st_api.h"
#include "egltypedefs.h"
-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/egl/common/native.h b/src/gallium/state_trackers/egl/common/native.h
index 3f60348c48..9f34c517ef 100644
--- a/src/gallium/state_trackers/egl/common/native.h
+++ b/src/gallium/state_trackers/egl/common/native.h
@@ -32,8 +32,8 @@
#include "pipe/p_screen.h"
#include "pipe/p_context.h"
#include "pipe/p_state.h"
+#include "state_tracker/sw_winsys.h"
-#include "native_probe.h"
#include "native_modeset.h"
/**
@@ -196,6 +196,11 @@ struct native_event_handler {
void (*invalid_surface)(struct native_display *ndpy,
struct native_surface *nsurf,
unsigned int seq_num);
+
+ struct pipe_screen *(*new_drm_screen)(struct native_display *ndpy,
+ const char *name, int fd);
+ struct pipe_screen *(*new_sw_screen)(struct native_display *ndpy,
+ struct sw_winsys *ws);
};
/**
@@ -207,11 +212,24 @@ native_attachment_mask_test(uint mask, enum native_attachment att)
return !!(mask & (1 << att));
}
-const char *
-native_get_name(void);
+struct native_platform {
+ const char *name;
+
+ struct native_display *(*create_display)(void *dpy,
+ struct native_event_handler *handler,
+ void *user_data);
+};
+
+const struct native_platform *
+native_get_gdi_platform(void);
+
+const struct native_platform *
+native_get_x11_platform(void);
+
+const struct native_platform *
+native_get_kms_platform(void);
-struct native_display *
-native_create_display(EGLNativeDisplayType dpy,
- struct native_event_handler *handler);
+const struct native_platform *
+native_get_fbdev_platform(void);
#endif /* _NATIVE_H_ */
diff --git a/src/gallium/state_trackers/egl/common/native_helper.c b/src/gallium/state_trackers/egl/common/native_helper.c
index 206817ed66..7832b2b693 100644
--- a/src/gallium/state_trackers/egl/common/native_helper.c
+++ b/src/gallium/state_trackers/egl/common/native_helper.c
@@ -31,9 +31,6 @@
#include "pipe/p_screen.h"
#include "pipe/p_context.h"
#include "pipe/p_state.h"
-#include "softpipe/sp_public.h"
-#include "llvmpipe/lp_public.h"
-#include "target-helpers/wrap_screen.h"
#include "native_helper.h"
@@ -236,18 +233,3 @@ resource_surface_present(struct resource_surface *rsurf,
return TRUE;
}
-
-struct pipe_screen *
-native_create_sw_screen(struct sw_winsys *ws)
-{
- struct pipe_screen *screen = NULL;
-
-#if defined(GALLIUM_LLVMPIPE)
- if (!screen && !debug_get_bool_option("GALLIUM_NO_LLVM", FALSE))
- screen = llvmpipe_create_screen(ws);
-#endif
- if (!screen)
- screen = softpipe_create_screen(ws);
-
- return (screen) ? gallium_wrap_screen(screen) : NULL;
-}
diff --git a/src/gallium/state_trackers/egl/common/native_helper.h b/src/gallium/state_trackers/egl/common/native_helper.h
index bdb9629466..d1569ac3ea 100644
--- a/src/gallium/state_trackers/egl/common/native_helper.h
+++ b/src/gallium/state_trackers/egl/common/native_helper.h
@@ -69,6 +69,3 @@ boolean
resource_surface_present(struct resource_surface *rsurf,
enum native_attachment which,
void *winsys_drawable_handle);
-
-struct pipe_screen *
-native_create_sw_screen(struct sw_winsys *ws);