[Mesa-dev] [PATCH 2/3] gallium/egl: st_profiles are build time decision, treat them as such
Chia-I Wu
olvaffe at gmail.com
Mon May 12 18:57:13 PDT 2014
On Sat, May 10, 2014 at 10:41 AM, Emil Velikov <emil.l.velikov at gmail.com> wrote:
> The profiles are present depending on the defines at build time.
> Drop the extra functions and feed the defines directly into the
> state-tracker at build time.
Do you have other changes planned that require this one? The current
code deals with st/vega and st/mesa entirely in targets/egl-static,
which is good separation IMHO, but can also be viewed as unnecessary
as this patch demonstrates.
> Cc: Chia-I Wu <olvaffe at gmail.com>
> Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>
> ---
> src/gallium/state_trackers/egl/Android.mk | 5 +++-
> src/gallium/state_trackers/egl/SConscript | 12 +++++++++
> src/gallium/state_trackers/egl/common/egl_g3d.c | 20 +++++++++------
> .../state_trackers/egl/common/egl_g3d_loader.h | 1 -
> src/gallium/targets/egl-static/Android.mk | 2 --
> src/gallium/targets/egl-static/SConscript | 6 -----
> src/gallium/targets/egl-static/egl.c | 3 ---
> src/gallium/targets/egl-static/egl_st.c | 29 ----------------------
> src/gallium/targets/egl-static/egl_st.h | 3 ---
> 9 files changed, 28 insertions(+), 53 deletions(-)
>
> diff --git a/src/gallium/state_trackers/egl/Android.mk b/src/gallium/state_trackers/egl/Android.mk
> index b27e14b..7c4c936 100644
> --- a/src/gallium/state_trackers/egl/Android.mk
> +++ b/src/gallium/state_trackers/egl/Android.mk
> @@ -32,7 +32,10 @@ LOCAL_SRC_FILES := \
> $(common_FILES) \
> $(android_FILES)
>
> -LOCAL_CFLAGS := -DHAVE_ANDROID_BACKEND
> +LOCAL_CFLAGS := \
> + -DFEATURE_ES1=1 \
> + -DFEATURE_ES2=1 \
> + -DHAVE_ANDROID_BACKEND
>
> LOCAL_C_INCLUDES := \
> $(GALLIUM_TOP)/state_trackers/egl \
> diff --git a/src/gallium/state_trackers/egl/SConscript b/src/gallium/state_trackers/egl/SConscript
> index 3ddf0bc..3727fb2 100644
> --- a/src/gallium/state_trackers/egl/SConscript
> +++ b/src/gallium/state_trackers/egl/SConscript
> @@ -14,6 +14,18 @@ env.Append(CPPPATH = [
>
> sources = env.ParseSourceList('Makefile.sources', 'common_FILES')
>
> +# OpenGL ES and OpenGL
> +if env['gles']:
> + env.Append(CPPDEFINES = [
> + 'FEATURE_GL=1',
> + 'FEATURE_ES1=1',
> + 'FEATURE_ES2=1'
> + ])
> +
> +# OpenVG
> +if True:
> + env.Append(CPPDEFINES = ['FEATURE_VG=1'])
> +
> if env['platform'] == 'windows':
> env.Append(CPPDEFINES = ['HAVE_GDI_BACKEND'])
> sources.append(env.ParseSourceList('Makefile.sources', 'gdi_FILES'))
> diff --git a/src/gallium/state_trackers/egl/common/egl_g3d.c b/src/gallium/state_trackers/egl/common/egl_g3d.c
> index 7cc4e8f..d3f5e92 100644
> --- a/src/gallium/state_trackers/egl/common/egl_g3d.c
> +++ b/src/gallium/state_trackers/egl/common/egl_g3d.c
> @@ -548,14 +548,18 @@ egl_g3d_initialize(_EGLDriver *drv, _EGLDisplay *dpy)
> goto fail;
> }
>
> - if (gdpy->loader->profile_masks[ST_API_OPENGL] & ST_PROFILE_DEFAULT_MASK)
> - dpy->ClientAPIs |= EGL_OPENGL_BIT;
> - if (gdpy->loader->profile_masks[ST_API_OPENGL] & ST_PROFILE_OPENGL_ES1_MASK)
> - dpy->ClientAPIs |= EGL_OPENGL_ES_BIT;
> - if (gdpy->loader->profile_masks[ST_API_OPENGL] & ST_PROFILE_OPENGL_ES2_MASK)
> - dpy->ClientAPIs |= EGL_OPENGL_ES2_BIT;
> - if (gdpy->loader->profile_masks[ST_API_OPENVG] & ST_PROFILE_DEFAULT_MASK)
> - dpy->ClientAPIs |= EGL_OPENVG_BIT;
> +#if FEATURE_GL
> + dpy->ClientAPIs |= EGL_OPENGL_BIT;
> +#endif
> +#if FEATURE_ES1
> + dpy->ClientAPIs |= EGL_OPENGL_ES_BIT;
> +#endif
> +#if FEATURE_ES2
> + dpy->ClientAPIs |= EGL_OPENGL_ES2_BIT;
> +#endif
> +#if FEATURE_VG
> + dpy->ClientAPIs |= EGL_OPENVG_BIT;
> +#endif
>
> gdpy->smapi = egl_g3d_create_st_manager(dpy);
> if (!gdpy->smapi) {
> 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 51b4d19..03db153 100644
> --- a/src/gallium/state_trackers/egl/common/egl_g3d_loader.h
> +++ b/src/gallium/state_trackers/egl/common/egl_g3d_loader.h
> @@ -36,7 +36,6 @@ struct pipe_screen;
> struct sw_winsys;
>
> struct egl_g3d_loader {
> - uint profile_masks[ST_API_COUNT];
> struct st_api *(*get_st_api)(enum st_api_type api);
>
> struct pipe_screen *(*create_drm_screen)(const char *name, int fd);
> diff --git a/src/gallium/targets/egl-static/Android.mk b/src/gallium/targets/egl-static/Android.mk
> index 37244b5..01408a7 100644
> --- a/src/gallium/targets/egl-static/Android.mk
> +++ b/src/gallium/targets/egl-static/Android.mk
> @@ -31,8 +31,6 @@ LOCAL_SRC_FILES := \
> egl_st.c
>
> LOCAL_CFLAGS := \
> - -DFEATURE_ES1=1 \
> - -DFEATURE_ES2=1 \
> -D_EGL_MAIN=_eglBuiltInDriverGALLIUM
>
> LOCAL_C_INCLUDES := \
> diff --git a/src/gallium/targets/egl-static/SConscript b/src/gallium/targets/egl-static/SConscript
> index 83937fe..f879cc3 100644
> --- a/src/gallium/targets/egl-static/SConscript
> +++ b/src/gallium/targets/egl-static/SConscript
> @@ -63,11 +63,6 @@ if env['platform'] == 'windows':
>
> # OpenGL ES and OpenGL
> if env['gles']:
> - env.Append(CPPDEFINES = [
> - 'FEATURE_GL=1',
> - 'FEATURE_ES1=1',
> - 'FEATURE_ES2=1'
> - ])
> env.Prepend(LIBPATH = [shared_glapi.dir])
> # manually add LIBPREFIX on windows
> glapi_name = 'glapi' if env['platform'] != 'windows' else 'libglapi'
> @@ -75,7 +70,6 @@ if env['gles']:
>
> # OpenVG
> if True:
> - env.Append(CPPDEFINES = ['FEATURE_VG=1'])
> env.Prepend(LIBPATH = [openvg.dir])
> # manually add LIBPREFIX on windows
> openvg_name = 'OpenVG' if env['platform'] != 'windows' else 'libOpenVG'
> diff --git a/src/gallium/targets/egl-static/egl.c b/src/gallium/targets/egl-static/egl.c
> index f19f024..ff71042 100644
> --- a/src/gallium/targets/egl-static/egl.c
> +++ b/src/gallium/targets/egl-static/egl.c
> @@ -89,9 +89,6 @@ loader_init(void)
> {
> int i;
>
> - for (i = 0; i < ST_API_COUNT; i++)
> - egl_g3d_loader.profile_masks[i] = egl_st_get_profile_mask(i);
> -
> egl_g3d_loader.get_st_api = get_st_api;
> egl_g3d_loader.create_drm_screen = create_drm_screen;
> egl_g3d_loader.create_sw_screen = create_sw_screen;
> diff --git a/src/gallium/targets/egl-static/egl_st.c b/src/gallium/targets/egl-static/egl_st.c
> index da0cd5b..656135b 100644
> --- a/src/gallium/targets/egl-static/egl_st.c
> +++ b/src/gallium/targets/egl-static/egl_st.c
> @@ -165,32 +165,3 @@ egl_st_destroy_api(struct st_api *stapi)
> stapi->destroy(stapi);
> #endif
> }
> -
> -uint
> -egl_st_get_profile_mask(enum st_api_type api)
> -{
> - uint mask = 0x0;
> -
> - switch (api) {
> - case ST_API_OPENGL:
> -#if FEATURE_GL
> - mask |= ST_PROFILE_DEFAULT_MASK;
> -#endif
> -#if FEATURE_ES1
> - mask |= ST_PROFILE_OPENGL_ES1_MASK;
> -#endif
> -#if FEATURE_ES2
> - mask |= ST_PROFILE_OPENGL_ES2_MASK;
> -#endif
> - break;
> - case ST_API_OPENVG:
> -#if FEATURE_VG
> - mask |= ST_PROFILE_DEFAULT_MASK;
> -#endif
> - break;
> - default:
> - break;
> - }
> -
> - return mask;
> -}
> diff --git a/src/gallium/targets/egl-static/egl_st.h b/src/gallium/targets/egl-static/egl_st.h
> index f17e85b..1d947b2 100644
> --- a/src/gallium/targets/egl-static/egl_st.h
> +++ b/src/gallium/targets/egl-static/egl_st.h
> @@ -36,7 +36,4 @@ egl_st_create_api(enum st_api_type api);
> void
> egl_st_destroy_api(struct st_api *stapi);
>
> -uint
> -egl_st_get_profile_mask(enum st_api_type api);
> -
> #endif /* _EGL_ST_H_ */
> --
> 1.9.2
>
--
olv at LunarG.com
More information about the mesa-dev
mailing list