Commit 41072825 authored by Sunny Sachanandani's avatar Sunny Sachanandani Committed by Commit Bot

Use flexible surface compatibility extension for default pbuffer surface

EGL_ANGLE_flexible_surface_compatibility allows contexts to be able to
bind to surfaces with different formats e.g. with or without alpha.

With DirectComposition, we have a real surface inside a Begin/EndDraw
pair, and use a default 1x1 pbuffer surface outside of that.  That
surface must be created with flexible surface compatibility so that we
can MakeCurrent outside of Begin/EndDraw.

Noticed this while working on a related change.  There were some crashes
in MakeCurrent in SetSwapInterval which was fixed in a different way by
removing SetSwapInterval, but it's possible the root cause was this.

Bug: 800950
Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel;luci.chromium.try:linux_optional_gpu_tests_rel;luci.chromium.try:mac_optional_gpu_tests_rel;luci.chromium.try:win_optional_gpu_tests_rel
Change-Id: I05aa1a61bfa0d1445778bbd9599d3f630dddbe8c
Reviewed-on: https://chromium-review.googlesource.com/c/1237535Reviewed-by: default avatarZhenyao Mo <zmo@chromium.org>
Commit-Queue: Sunny Sachanandani <sunnyps@chromium.org>
Cr-Commit-Position: refs/heads/master@{#599049}
parent b49966db
......@@ -64,15 +64,18 @@ bool DirectCompositionChildSurfaceWin::Initialize(gl::GLSurfaceFormat format) {
EGLDisplay display = GetDisplay();
std::vector<EGLint> pbuffer_attribs;
pbuffer_attribs.push_back(EGL_WIDTH);
pbuffer_attribs.push_back(1);
pbuffer_attribs.push_back(EGL_HEIGHT);
pbuffer_attribs.push_back(1);
EGLint pbuffer_attribs[] = {
EGL_WIDTH,
1,
EGL_HEIGHT,
1,
EGL_FLEXIBLE_SURFACE_COMPATIBILITY_SUPPORTED_ANGLE,
EGL_TRUE,
EGL_NONE,
};
pbuffer_attribs.push_back(EGL_NONE);
default_surface_ =
eglCreatePbufferSurface(display, GetConfig(), &pbuffer_attribs[0]);
eglCreatePbufferSurface(display, GetConfig(), pbuffer_attribs);
if (!default_surface_) {
DLOG(ERROR) << "eglCreatePbufferSurface failed with error "
<< ui::GetLastEGLErrorString();
......@@ -327,20 +330,21 @@ bool DirectCompositionChildSurfaceWin::SetDrawRectangle(
g_current_surface = dcomp_surface_.Get();
std::vector<EGLint> pbuffer_attribs{
EGLint pbuffer_attribs[] = {
EGL_WIDTH,
size_.width(),
EGL_HEIGHT,
size_.height(),
EGL_FLEXIBLE_SURFACE_COMPATIBILITY_SUPPORTED_ANGLE,
EGL_TRUE,
EGL_NONE};
EGL_NONE,
};
EGLClientBuffer buffer =
reinterpret_cast<EGLClientBuffer>(draw_texture_.Get());
real_surface_ = eglCreatePbufferFromClientBuffer(
GetDisplay(), EGL_D3D_TEXTURE_ANGLE, buffer, GetConfig(),
&pbuffer_attribs[0]);
real_surface_ =
eglCreatePbufferFromClientBuffer(GetDisplay(), EGL_D3D_TEXTURE_ANGLE,
buffer, GetConfig(), pbuffer_attribs);
if (!real_surface_) {
DLOG(ERROR) << "eglCreatePbufferFromClientBuffer failed with error "
<< ui::GetLastEGLErrorString();
......
......@@ -1601,15 +1601,18 @@ bool DirectCompositionSurfaceWin::Initialize(gl::GLSurfaceFormat format) {
if (!layer_tree_->Initialize(window_))
return false;
std::vector<EGLint> pbuffer_attribs;
pbuffer_attribs.push_back(EGL_WIDTH);
pbuffer_attribs.push_back(1);
pbuffer_attribs.push_back(EGL_HEIGHT);
pbuffer_attribs.push_back(1);
EGLint pbuffer_attribs[] = {
EGL_WIDTH,
1,
EGL_HEIGHT,
1,
EGL_FLEXIBLE_SURFACE_COMPATIBILITY_SUPPORTED_ANGLE,
EGL_TRUE,
EGL_NONE,
};
pbuffer_attribs.push_back(EGL_NONE);
default_surface_ =
eglCreatePbufferSurface(display, GetConfig(), &pbuffer_attribs[0]);
eglCreatePbufferSurface(display, GetConfig(), pbuffer_attribs);
if (!default_surface_) {
DLOG(ERROR) << "eglCreatePbufferSurface failed with error "
<< ui::GetLastEGLErrorString();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment