Skip to content

Commit

Permalink
Refactor DisplayGbm::generateConfigs
Browse files Browse the repository at this point in the history
Bug: angleproject:4809
Change-Id: I5f352f737bbd53c78d9e01055c17eabd17d5fb8a
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2278667
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Commit-Queue: Jiajia Qin <jiajia.qin@intel.com>
  • Loading branch information
qjia7 authored and Commit Bot committed Jul 13, 2020
1 parent 120e1d6 commit 7d82d29
Showing 1 changed file with 30 additions and 18 deletions.
48 changes: 30 additions & 18 deletions src/libANGLE/renderer/gl/egl/gbm/DisplayGbm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -924,24 +924,36 @@ egl::Error DisplayGbm::makeCurrent(egl::Surface *drawSurface,

egl::ConfigSet DisplayGbm::generateConfigs()
{
egl::ConfigSet configs;

egl::Config config;
config.bufferSize = 32;
config.redSize = 8;
config.greenSize = 8;
config.blueSize = 8;
config.alphaSize = 8;
config.depthSize = 24;
config.stencilSize = 8;
config.bindToTextureRGBA = EGL_TRUE;
config.renderableType = EGL_OPENGL_ES2_BIT;
config.surfaceType = EGL_WINDOW_BIT | EGL_PBUFFER_BIT;
config.renderTargetFormat = GL_RGBA8;
config.depthStencilFormat = GL_DEPTH24_STENCIL8;

configs.add(config);
return configs;

gl::Version eglVersion(mEGL->majorVersion, mEGL->minorVersion);
ASSERT(eglVersion >= gl::Version(1, 4));

bool supportES3 =
(eglVersion >= gl::Version(1, 5) || mEGL->hasExtension("EGL_KHR_create_context")) &&
(mRenderer->getMaxSupportedESVersion() >= gl::Version(3, 0));
EGLint renderType = EGL_OPENGL_ES2_BIT | (supportES3 ? EGL_OPENGL_ES3_BIT : 0);

// clang-format off
std::vector<EGLint> configAttribs8888 =
{
EGL_COLOR_BUFFER_TYPE, EGL_RGB_BUFFER,
// CrOS doesn't support window and pixmaps?
EGL_SURFACE_TYPE, EGL_PBUFFER_BIT,
EGL_CONFIG_CAVEAT, EGL_NONE,
EGL_CONFORMANT, renderType,
EGL_RENDERABLE_TYPE, renderType,
EGL_RED_SIZE, 8,
EGL_GREEN_SIZE, 8,
EGL_BLUE_SIZE, 8,
EGL_ALPHA_SIZE, 8,
EGL_BUFFER_SIZE, 32,
EGL_DEPTH_SIZE, 24,
EGL_NONE
};
// clang-format on

mConfigAttribList = configAttribs8888;
return DisplayEGL::generateConfigs();
}

bool DisplayGbm::isValidNativeWindow(EGLNativeWindowType window) const
Expand Down

0 comments on commit 7d82d29

Please sign in to comment.