| From 5ecd39911b5ffb7e3aac09a073dde687b53389d0 Mon Sep 17 00:00:00 2001 |
| From: renchenglei <chenglei.ren@intel.com> |
| Date: Fri, 28 Jun 2019 15:21:08 +0800 |
| Subject: [PATCH] BACKPORT: egl: Enable eglGetPlatformDisplay on Android |
| Platform |
| |
| This helps to add eglGetPlatformDisplay support on Android |
| Platform. |
| Reviewed-by: Eric Engestrom <eric.engestrom@intel.com> |
| |
| (cherry picked from commit 500b45a98a6183ff8ab7bae77e0a750a3cd45adc) |
| Resolved backport conflicts: |
| src/egl/main/eglapi.c(changed variable disp to dpy) |
| src/egl/main/egldisplay.c(Drop attrib_list from _eglFindDisplay) |
| src/egl/main/egldisplay.h |
| |
| Change-Id: I9eab42034aace7d6ac9896a070305557812669db |
| --- |
| src/egl/main/eglapi.c | 5 +++++ |
| src/egl/main/egldisplay.c | 16 ++++++++++++++++ |
| src/egl/main/egldisplay.h | 6 ++++++ |
| 3 files changed, 27 insertions(+) |
| |
| diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c |
| index dd9b5b989cb..780633ae3cb 100644 |
| --- a/src/egl/main/eglapi.c |
| +++ b/src/egl/main/eglapi.c |
| @@ -405,6 +405,11 @@ _eglGetPlatformDisplayCommon(EGLenum platform, void *native_display, |
| case EGL_PLATFORM_SURFACELESS_MESA: |
| dpy = _eglGetSurfacelessDisplay(native_display, attrib_list); |
| break; |
| +#endif |
| +#ifdef HAVE_ANDROID_PLATFORM |
| + case EGL_PLATFORM_ANDROID_KHR: |
| + dpy = _eglGetAndroidDisplay(native_display, attrib_list); |
| + break; |
| #endif |
| default: |
| RETURN_EGL_ERROR(NULL, EGL_BAD_PARAMETER, NULL); |
| diff --git a/src/egl/main/egldisplay.c b/src/egl/main/egldisplay.c |
| index 387df6a66d0..3d3ee8860d7 100644 |
| --- a/src/egl/main/egldisplay.c |
| +++ b/src/egl/main/egldisplay.c |
| @@ -542,3 +542,19 @@ _eglGetSurfacelessDisplay(void *native_display, |
| return _eglFindDisplay(_EGL_PLATFORM_SURFACELESS, native_display); |
| } |
| #endif /* HAVE_SURFACELESS_PLATFORM */ |
| + |
| +#ifdef HAVE_ANDROID_PLATFORM |
| +_EGLDisplay* |
| +_eglGetAndroidDisplay(void *native_display, |
| + const EGLAttrib *attrib_list) |
| +{ |
| + |
| + /* This platform recognizes no display attributes. */ |
| + if (attrib_list != NULL && attrib_list[0] != EGL_NONE) { |
| + _eglError(EGL_BAD_ATTRIBUTE, "eglGetPlatformDisplay"); |
| + return NULL; |
| + } |
| + |
| + return _eglFindDisplay(_EGL_PLATFORM_ANDROID, native_display); |
| +} |
| +#endif /* HAVE_ANDROID_PLATFORM */ |
| diff --git a/src/egl/main/egldisplay.h b/src/egl/main/egldisplay.h |
| index 5cc503734bc..cb1fd80688f 100644 |
| --- a/src/egl/main/egldisplay.h |
| +++ b/src/egl/main/egldisplay.h |
| @@ -301,6 +301,12 @@ _eglGetSurfacelessDisplay(void *native_display, |
| const EGLAttrib *attrib_list); |
| #endif |
| |
| +#ifdef HAVE_ANDROID_PLATFORM |
| +_EGLDisplay* |
| +_eglGetAndroidDisplay(void *native_display, |
| + const EGLAttrib *attrib_list); |
| +#endif |
| + |
| #ifdef __cplusplus |
| } |
| #endif |
| -- |
| 2.20.1 |
| |