It adds a _EGL_PLATFORM_TIZEN enum value to _EGLPlatformType for tizen platform.
It adds a detecting routine of tizen platform to _eglNativePlatformDetectNativeDisplay() and _eglGetNativePlatform(). - As tizen platform internally distinguishes native displays of drm/gbm and wayland client, when EGL_PLATFORM_WAYLAND_EXT or EGL_PLATFORM_GBM_MESA come from eglGetPlatformDisplayEXT(), it have call _eglGetTizenDisplay(). - If tizen platform is enabled at the configuration, _eglGetNativePlatform() always detects _EGL_PLATFORM_TIZEN as a detected_platform. Signed-off-by: Mun Gwan-gyeong <elong...@gmail.com> --- src/egl/main/eglapi.c | 12 ++++++++++++ src/egl/main/egldisplay.c | 30 ++++++++++++++++++++++++++++++ src/egl/main/egldisplay.h | 7 +++++++ 3 files changed, 49 insertions(+) diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c index e3f10fcbe2..12e867ca72 100644 --- a/src/egl/main/eglapi.c +++ b/src/egl/main/eglapi.c @@ -404,6 +404,18 @@ _eglGetPlatformDisplayCommon(EGLenum platform, void *native_display, dpy = _eglGetSurfacelessDisplay(native_display, attrib_list); break; #endif +#ifdef HAVE_TIZEN_PLATFORM +#ifndef HAVE_DRM_PLATFORM + case EGL_PLATFORM_GBM_MESA: + dpy = _eglGetTizenDisplay(native_display, attrib_list); + break; +#endif /* not HAVE_DRM_PLATFORM */ +#ifndef HAVE_WAYLAND_PLATFORM + case EGL_PLATFORM_WAYLAND_EXT: + dpy = _eglGetTizenDisplay(native_display, attrib_list); + break; +#endif /* not HAVE_WAYLAND_PLATFORM */ +#endif /* HAVE_TIZEN_PLATFORM */ default: RETURN_EGL_ERROR(NULL, EGL_BAD_PARAMETER, NULL); } diff --git a/src/egl/main/egldisplay.c b/src/egl/main/egldisplay.c index 690728d2f7..b55d243015 100644 --- a/src/egl/main/egldisplay.c +++ b/src/egl/main/egldisplay.c @@ -70,6 +70,7 @@ static const struct { { _EGL_PLATFORM_ANDROID, "android" }, { _EGL_PLATFORM_HAIKU, "haiku" }, { _EGL_PLATFORM_SURFACELESS, "surfaceless" }, + { _EGL_PLATFORM_TIZEN, "tizen" }, }; @@ -115,6 +116,13 @@ _eglNativePlatformDetectNativeDisplay(void *nativeDisplay) (void) first_pointer; /* silence unused var warning */ +#ifdef HAVE_TIZEN_PLATFORM + /* In Tizen Platform, _EGL_PLATFORM_TIZEN treats together DRM(gbm) platform + * and wayland egl platform. + */ + return _EGL_PLATFORM_TIZEN; +#endif + #ifdef HAVE_WAYLAND_PLATFORM /* wl_display is a wl_proxy, which is a wl_object. * wl_object's first element points to the interfacetype. */ @@ -157,6 +165,13 @@ _eglGetNativePlatform(void *nativeDisplay) detected_platform = _eglGetNativePlatformFromEnv(); detection_method = "environment overwrite"; +#ifdef HAVE_TIZEN_PLATFORM + if (detected_platform != _EGL_PLATFORM_TIZEN) { + detected_platform = _EGL_PLATFORM_TIZEN; + detection_method = "build-time configuration"; + } +#endif + if (detected_platform == _EGL_INVALID_PLATFORM) { detected_platform = _eglNativePlatformDetectNativeDisplay(nativeDisplay); detection_method = "autodetected"; @@ -541,3 +556,18 @@ _eglGetSurfacelessDisplay(void *native_display, return _eglFindDisplay(_EGL_PLATFORM_SURFACELESS, native_display); } #endif /* HAVE_SURFACELESS_PLATFORM */ + +#ifdef HAVE_TIZEN_PLATFORM +_EGLDisplay* +_eglGetTizenDisplay(void *native_display, + const EGLint *attrib_list) +{ + /* EGL_EXT_platform_wayland recognizes no attributes. */ + if (attrib_list != NULL && attrib_list[0] != EGL_NONE) { + _eglError(EGL_BAD_ATTRIBUTE, "eglGetPlatformDisplay"); + return NULL; + } + + return _eglFindDisplay(_EGL_PLATFORM_TIZEN, native_display); +} +#endif /* HAVE_TIZEN_PLATFORM */ diff --git a/src/egl/main/egldisplay.h b/src/egl/main/egldisplay.h index 9a0b9b672a..c009462b82 100644 --- a/src/egl/main/egldisplay.h +++ b/src/egl/main/egldisplay.h @@ -50,6 +50,7 @@ enum _egl_platform_type { _EGL_PLATFORM_ANDROID, _EGL_PLATFORM_HAIKU, _EGL_PLATFORM_SURFACELESS, + _EGL_PLATFORM_TIZEN, _EGL_NUM_PLATFORMS, _EGL_INVALID_PLATFORM = -1 @@ -285,6 +286,12 @@ _eglGetSurfacelessDisplay(void *native_display, const EGLint *attrib_list); #endif +#ifdef HAVE_TIZEN_PLATFORM +_EGLDisplay* +_eglGetTizenDisplay(void *native_display, + const EGLint *attrib_list); +#endif + #ifdef __cplusplus } #endif -- 2.14.1 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev