summaryrefslogtreecommitdiff
path: root/src/gallium/state_trackers/egl
diff options
context:
space:
mode:
authorChia-I Wu <olv@lunarg.com>2010-09-10 12:59:43 +0800
committerChia-I Wu <olv@lunarg.com>2010-09-10 15:44:11 +0800
commit948e3fa27ca9112b903a180d1a18c61cfb2928dc (patch)
tree80b9a684a2f12ed60a65757860203d2bff825fad /src/gallium/state_trackers/egl
parent0cd480f07639ec9ee01424aaa3e0c900b2204d4f (diff)
st/egl: Use profiles to create OpenGL ES contexts.
Replace all uses of ST_API_OPENGL_ES{1,2} by profiles. Having 3 st_api's to provide OpenGL, OpenGL ES 1.1, and OpenGL ES 2.0 is not a sane abstraction, since all of them share glapi for current context/dispatch management.
Diffstat (limited to 'src/gallium/state_trackers/egl')
-rw-r--r--src/gallium/state_trackers/egl/common/egl_g3d.c10
-rw-r--r--src/gallium/state_trackers/egl/common/egl_g3d_api.c31
-rw-r--r--src/gallium/state_trackers/egl/common/egl_g3d_loader.h4
-rw-r--r--src/gallium/state_trackers/egl/common/egl_g3d_st.h29
4 files changed, 26 insertions, 48 deletions
diff --git a/src/gallium/state_trackers/egl/common/egl_g3d.c b/src/gallium/state_trackers/egl/common/egl_g3d.c
index 4e653bdf3b..33a838fb79 100644
--- a/src/gallium/state_trackers/egl/common/egl_g3d.c
+++ b/src/gallium/state_trackers/egl/common/egl_g3d.c
@@ -502,13 +502,13 @@ egl_g3d_initialize(_EGLDriver *drv, _EGLDisplay *dpy,
goto fail;
}
- if (gdpy->loader->api_mask & (1 << ST_API_OPENGL))
+ if (gdpy->loader->profile_masks[ST_API_OPENGL] & ST_PROFILE_DEFAULT_MASK)
dpy->ClientAPIsMask |= EGL_OPENGL_BIT;
- if (gdpy->loader->api_mask & (1 << ST_API_OPENGL_ES1))
+ if (gdpy->loader->profile_masks[ST_API_OPENGL] & ST_PROFILE_OPENGL_ES1_MASK)
dpy->ClientAPIsMask |= EGL_OPENGL_ES_BIT;
- if (gdpy->loader->api_mask & (1 << ST_API_OPENGL_ES2))
+ if (gdpy->loader->profile_masks[ST_API_OPENGL] & ST_PROFILE_OPENGL_ES2_MASK)
dpy->ClientAPIsMask |= EGL_OPENGL_ES2_BIT;
- if (gdpy->loader->api_mask & (1 << ST_API_OPENVG))
+ if (gdpy->loader->profile_masks[ST_API_OPENVG] & ST_PROFILE_DEFAULT_MASK)
dpy->ClientAPIsMask |= EGL_OPENVG_BIT;
gdpy->smapi = egl_g3d_create_st_manager(dpy);
@@ -567,7 +567,7 @@ egl_g3d_get_proc_address(_EGLDriver *drv, const char *procname)
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();
+ stapi = gdrv->loader->get_st_api(ST_API_OPENGL);
return (_EGLProc) ((stapi) ?
stapi->get_proc_address(stapi, procname) : NULL);
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 cda46b8c30..c0164daf9c 100644
--- a/src/gallium/state_trackers/egl/common/egl_g3d_api.c
+++ b/src/gallium/state_trackers/egl/common/egl_g3d_api.c
@@ -47,16 +47,21 @@ egl_g3d_choose_st(_EGLDriver *drv, _EGLContext *ctx,
enum st_profile_type *profile)
{
struct egl_g3d_driver *gdrv = egl_g3d_driver(drv);
- EGLint idx = -1;
+ struct st_api *stapi;
+ EGLint api = -1;
+
+ *profile = ST_PROFILE_DEFAULT;
switch (ctx->ClientAPI) {
case EGL_OPENGL_ES_API:
switch (ctx->ClientVersion) {
case 1:
- idx = ST_API_OPENGL_ES1;
+ api = ST_API_OPENGL;
+ *profile = ST_PROFILE_OPENGL_ES1;
break;
case 2:
- idx = ST_API_OPENGL_ES2;
+ api = ST_API_OPENGL;
+ *profile = ST_PROFILE_OPENGL_ES2;
break;
default:
_eglLog(_EGL_WARNING, "unknown client version %d",
@@ -65,29 +70,31 @@ egl_g3d_choose_st(_EGLDriver *drv, _EGLContext *ctx,
}
break;
case EGL_OPENVG_API:
- idx = ST_API_OPENVG;
+ api = ST_API_OPENVG;
break;
case EGL_OPENGL_API:
- idx = ST_API_OPENGL;
+ api = ST_API_OPENGL;
break;
default:
_eglLog(_EGL_WARNING, "unknown client API 0x%04x", ctx->ClientAPI);
break;
}
- switch (idx) {
- case ST_API_OPENGL_ES1:
- *profile = ST_PROFILE_OPENGL_ES1;
+ switch (api) {
+ case ST_API_OPENGL:
+ stapi = gdrv->loader->guess_gl_api(*profile);
break;
- case ST_API_OPENGL_ES2:
- *profile = ST_PROFILE_OPENGL_ES2;
+ case ST_API_OPENVG:
+ stapi = gdrv->loader->get_st_api(api);
break;
default:
- *profile = ST_PROFILE_DEFAULT;
+ stapi = NULL;
break;
}
+ if (stapi && !(stapi->profile_mask & (1 << *profile)))
+ stapi = NULL;
- return (idx >= 0) ? gdrv->loader->get_st_api(idx) : NULL;
+ return stapi;
}
static _EGLContext *
diff --git a/src/gallium/state_trackers/egl/common/egl_g3d_loader.h b/src/gallium/state_trackers/egl/common/egl_g3d_loader.h
index c9141f8ad4..78bfe2131e 100644
--- a/src/gallium/state_trackers/egl/common/egl_g3d_loader.h
+++ b/src/gallium/state_trackers/egl/common/egl_g3d_loader.h
@@ -37,9 +37,9 @@ struct pipe_screen;
struct sw_winsys;
struct egl_g3d_loader {
- uint api_mask;
+ uint profile_masks[ST_API_COUNT];
struct st_api *(*get_st_api)(enum st_api_type api);
- struct st_api *(*guess_gl_api)(void);
+ struct st_api *(*guess_gl_api)(enum st_profile_type profile);
struct pipe_screen *(*create_drm_screen)(const char *name, int fd);
struct pipe_screen *(*create_sw_screen)(struct sw_winsys *ws);
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 aa25cc042d..1f9f07895b 100644
--- a/src/gallium/state_trackers/egl/common/egl_g3d_st.h
+++ b/src/gallium/state_trackers/egl/common/egl_g3d_st.h
@@ -45,33 +45,4 @@ egl_g3d_create_st_framebuffer(_EGLSurface *surf);
void
egl_g3d_destroy_st_framebuffer(struct st_framebuffer_iface *stfbi);
-/**
- * Return the EGL_<api>_BIT of the st api.
- */
-static INLINE int
-egl_g3d_st_api_bit(enum st_api_type api)
-{
- int bit;
-
- switch (api) {
- case ST_API_OPENGL:
- bit = EGL_OPENGL_BIT;
- break;
- case ST_API_OPENGL_ES1:
- bit = EGL_OPENGL_ES_BIT;
- break;
- case ST_API_OPENGL_ES2:
- bit = EGL_OPENGL_ES2_BIT;
- break;
- case ST_API_OPENVG:
- bit = EGL_OPENVG_BIT;
- break;
- default:
- bit = 0;
- break;
- }
-
- return bit;
-}
-
#endif /* _EGL_G3D_ST_H_ */