#include "config.h"
#include "EGLConfigSelector.h"
-#if USE(EGL)
+#if USE(EGL) || ENABLE(TIZEN_CANVAS_GRAPHICS_SURFACE)
#include "EGLHelper.h"
return 0;
EGLint numConfigs;
-
eglGetConfigs(m_sharedDisplay, 0, 0, &numConfigs);
if (!numConfigs) {
static bool isVendorMesa = EGLHelper::isVendor("mesa");
static bool isVendorArm = EGLHelper::isVendor("arm");
+ if (isVendorMesa) {
+ // Force depth if stencil is true or depth if stencil is true.
+ if ((m_attributes & GLPlatformSurface::SupportStencil) || (m_attributes & GLPlatformSurface::SupportDepth)) {
+ m_attributes &= GLPlatformSurface::SupportStencil;
+ m_attributes &= GLPlatformSurface::SupportDepth;
+ }
+
+ expectedDepthSize = m_attributes & GLPlatformSurface::SupportDepth ? 24 : 0;
+ expectedStencilSize = m_attributes & GLPlatformSurface::SupportStencil ? 8 : 0;
+ // Doesn't support EGLConfig with no alpha.
+ expectedAlpha = 8;
+ }
+
if (!expectedAlpha && isVendorImagination)
expectedConfigAttribute = EGL_NON_CONFORMANT_CONFIG;
for (int i = 0; i < numConfigs; i++) {
EGLConfig tempConfig = configs[i];
eglGetConfigAttrib(m_sharedDisplay, tempConfig, EGL_RENDERABLE_TYPE, &renderType);
-
if (!(renderType & expectedRenderType))
continue;
if (expectedConfigAttribute != EGL_NONE) {
eglGetConfigAttrib(m_sharedDisplay, tempConfig, EGL_CONFIG_CAVEAT, &configAttribute);
- if (expectedConfigAttribute != configAttribute)
+ if (expectedConfigAttribute != configAttribute) {
+ LOG_ERROR("Expected config attribute didnt match. Checking next EGLConfig.");
continue;
+ }
}
if (expectedMatchFormat != EGL_NONE) {
eglGetConfigAttrib(m_sharedDisplay, tempConfig, EGL_MATCH_FORMAT_KHR, &matchFormat);
- if (expectedMatchFormat != matchFormat)
+ if (expectedMatchFormat != matchFormat) {
+ LOG_ERROR("ExpectedMatchFormat didnt match. Checking next EGLConfig.");
continue;
+ }
}
eglGetConfigAttrib(m_sharedDisplay, tempConfig, EGL_ALPHA_SIZE, &alpha);
- if (alpha != expectedAlpha)
+ if (alpha != expectedAlpha) {
+ LOG_ERROR("Failed to match %s Attribute Value. Retrieved %d, Expected: %d. Checking next EGLConfig.", "alpha", alpha, expectedAlpha);
continue;
+ }
eglGetConfigAttrib(m_sharedDisplay, tempConfig, EGL_RED_SIZE, &red);
- if (red != expectedRed)
+ if (red != expectedRed) {
+ LOG_ERROR("Failed to match %s Attribute Value. Retrieved %d, Expected: %d. Checking next EGLConfig.", "red", red, expectedRed);
continue;
+ }
eglGetConfigAttrib(m_sharedDisplay, tempConfig, EGL_GREEN_SIZE, &green);
- if (green != expectedGreen)
+ if (green != expectedGreen) {
+ LOG_ERROR("Failed to match %s Attribute Value. Retrieved %d, Expected: %d. Checking next EGLConfig.", "Green", green, expectedGreen);
continue;
+ }
eglGetConfigAttrib(m_sharedDisplay, tempConfig, EGL_BLUE_SIZE, &blue);
- if (blue != expectedBlue)
+ if (blue != expectedBlue) {
+ LOG_ERROR("Failed to match %s Attribute Value. Retrieved %d, Expected: %d. Checking next EGLConfig.", "Blue", blue, expectedBlue);
continue;
+ }
- if (!isVendorMesa) {
- eglGetConfigAttrib(m_sharedDisplay, tempConfig, EGL_STENCIL_SIZE, &stencil);
+ eglGetConfigAttrib(m_sharedDisplay, tempConfig, EGL_STENCIL_SIZE, &stencil);
- if (stencil != expectedStencilSize)
- continue;
+ if (stencil != expectedStencilSize) {
+ LOG_ERROR("Failed to match %s Attribute Value. Retrieved %d, Expected: %d. Checking next EGLConfig.", "Stencil", stencil, expectedStencilSize);
+ continue;
+ }
- eglGetConfigAttrib(m_sharedDisplay, tempConfig, EGL_DEPTH_SIZE, &depth);
+ eglGetConfigAttrib(m_sharedDisplay, tempConfig, EGL_DEPTH_SIZE, &depth);
- if (depth != expectedDepthSize)
- continue;
+ if (depth != expectedDepthSize) {
+ LOG_ERROR("Failed to match %s Attribute Value. Retrieved %d, Expected: %d. Checking next EGLConfig.", "Depth", depth, expectedDepthSize);
+ continue;
+ }
- eglGetConfigAttrib(m_sharedDisplay, tempConfig, EGL_SAMPLES, &samples);
+ eglGetConfigAttrib(m_sharedDisplay, tempConfig, EGL_SAMPLES, &samples);
- if (samples != expectedSamples)
- continue;
+ if (samples != expectedSamples) {
+ LOG_ERROR("Failed to match %s Attribute Value. Retrieved %d, Expected: %d. Checking next EGLConfig.", "Samples", samples, expectedSamples);
+ continue;
}
eglGetConfigAttrib(m_sharedDisplay, tempConfig, EGL_SURFACE_TYPE, &surface);