From: Richard Huang Date: Fri, 26 Jun 2020 10:52:29 +0000 (+0100) Subject: Try to get default EGL display connection if it fails to get native display connection X-Git-Tag: dali_1.5.19~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F56%2F238156%2F1;p=platform%2Fcore%2Fuifw%2Fdali-adaptor-legacy.git Try to get default EGL display connection if it fails to get native display connection Change-Id: I1a633fd2244fdafb793eb761caad1887ebca32ae --- diff --git a/dali/internal/graphics/gles/egl-implementation.cpp b/dali/internal/graphics/gles/egl-implementation.cpp index 3710dd1..f8149c4 100755 --- a/dali/internal/graphics/gles/egl-implementation.cpp +++ b/dali/internal/graphics/gles/egl-implementation.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -104,12 +104,18 @@ bool EglImplementation::InitializeGles( EGLNativeDisplayType display, bool isOwn { mEglNativeDisplay = display; - //@todo see if we can just EGL_DEFAULT_DISPLAY instead - mEglDisplay = eglGetDisplay(mEglNativeDisplay); - EGLint error = eglGetError(); + // Try to get the display connection for the native display first + mEglDisplay = eglGetDisplay( mEglNativeDisplay ); + + if( mEglDisplay == EGL_NO_DISPLAY ) + { + // If failed, try to get the default display connection + mEglDisplay = eglGetDisplay( EGL_DEFAULT_DISPLAY ); + } - if( mEglDisplay == NULL && error != EGL_SUCCESS ) + if( mEglDisplay == EGL_NO_DISPLAY ) { + // Still failed to get a display connection throw Dali::DaliException( "", "OpenGL ES is not supported"); }