Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(92)

Side by Side Diff: ui/gl/gl_surface_egl.cc

Issue 1788713003: Fix EGL configs with ozone and surfaceless surfaces. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2661
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/gl/gl_surface_egl.h ('k') | ui/gl/gl_surface_ozone.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/gl/gl_surface_egl.h" 5 #include "ui/gl/gl_surface_egl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <map> 10 #include <map>
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( 276 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
277 switches::kWindowDepth); 277 switches::kWindowDepth);
278 278
279 bool succeed = base::StringToInt(depth, &buffer_size); 279 bool succeed = base::StringToInt(depth, &buffer_size);
280 DCHECK(succeed); 280 DCHECK(succeed);
281 281
282 alpha_size = buffer_size == 32 ? 8 : 0; 282 alpha_size = buffer_size == 32 ? 8 : 0;
283 } 283 }
284 #endif 284 #endif
285 285
286 EGLint surface_type = (format == GLSurface::SURFACE_SURFACELESS)
287 ? EGL_DONT_CARE
288 : EGL_WINDOW_BIT | EGL_PBUFFER_BIT;
289
286 EGLint config_attribs_8888[] = { 290 EGLint config_attribs_8888[] = {
287 EGL_BUFFER_SIZE, buffer_size, 291 EGL_BUFFER_SIZE, buffer_size,
288 EGL_ALPHA_SIZE, alpha_size, 292 EGL_ALPHA_SIZE, alpha_size,
289 EGL_BLUE_SIZE, 8, 293 EGL_BLUE_SIZE, 8,
290 EGL_GREEN_SIZE, 8, 294 EGL_GREEN_SIZE, 8,
291 EGL_RED_SIZE, 8, 295 EGL_RED_SIZE, 8,
292 EGL_RENDERABLE_TYPE, renderable_type, 296 EGL_RENDERABLE_TYPE, renderable_type,
293 EGL_SURFACE_TYPE, EGL_WINDOW_BIT | EGL_PBUFFER_BIT, 297 EGL_SURFACE_TYPE, surface_type,
294 EGL_NONE 298 EGL_NONE
295 }; 299 };
296 300
297 EGLint* choose_attributes = config_attribs_8888; 301 EGLint* choose_attributes = config_attribs_8888;
298 EGLint config_attribs_565[] = { 302 EGLint config_attribs_565[] = {
299 EGL_BUFFER_SIZE, 16, 303 EGL_BUFFER_SIZE, 16,
300 EGL_BLUE_SIZE, 5, 304 EGL_BLUE_SIZE, 5,
301 EGL_GREEN_SIZE, 6, 305 EGL_GREEN_SIZE, 6,
302 EGL_RED_SIZE, 5, 306 EGL_RED_SIZE, 5,
303 EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, 307 EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
304 EGL_SURFACE_TYPE, EGL_WINDOW_BIT | EGL_PBUFFER_BIT, 308 EGL_SURFACE_TYPE, surface_type,
305 EGL_NONE 309 EGL_NONE
306 }; 310 };
307 if (format == GLSurface::SURFACE_RGB565) { 311 if (format == GLSurface::SURFACE_RGB565) {
308 choose_attributes = config_attribs_565; 312 choose_attributes = config_attribs_565;
309 } 313 }
310 314
311 EGLint num_configs; 315 EGLint num_configs;
312 EGLint config_size = 1; 316 EGLint config_size = 1;
313 EGLConfig config = nullptr; 317 EGLConfig config = nullptr;
314 EGLConfig* config_data = &config; 318 EGLConfig* config_data = &config;
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 } 433 }
430 } 434 }
431 435
432 // If no displays are available due to missing angle extensions or invalid 436 // If no displays are available due to missing angle extensions or invalid
433 // flags, request the default display. 437 // flags, request the default display.
434 if (init_displays->empty()) { 438 if (init_displays->empty()) {
435 init_displays->push_back(DEFAULT); 439 init_displays->push_back(DEFAULT);
436 } 440 }
437 } 441 }
438 442
439 GLSurfaceEGL::GLSurfaceEGL() : 443 GLSurfaceEGL::GLSurfaceEGL() {}
440 config_(nullptr) {}
441 444
442 bool GLSurfaceEGL::InitializeOneOff() { 445 bool GLSurfaceEGL::InitializeOneOff() {
443 static bool initialized = false; 446 static bool initialized = false;
444 if (initialized) 447 if (initialized)
445 return true; 448 return true;
446 449
447 InitializeDisplay(); 450 InitializeDisplay();
448 if (g_display == EGL_NO_DISPLAY) 451 if (g_display == EGL_NO_DISPLAY)
449 return false; 452 return false;
450 453
(...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after
1065 return handle; 1068 return handle;
1066 #endif 1069 #endif
1067 } 1070 }
1068 1071
1069 PbufferGLSurfaceEGL::~PbufferGLSurfaceEGL() { 1072 PbufferGLSurfaceEGL::~PbufferGLSurfaceEGL() {
1070 Destroy(); 1073 Destroy();
1071 } 1074 }
1072 1075
1073 SurfacelessEGL::SurfacelessEGL(const gfx::Size& size) 1076 SurfacelessEGL::SurfacelessEGL(const gfx::Size& size)
1074 : size_(size) { 1077 : size_(size) {
1078 format_ = GLSurface::SURFACE_SURFACELESS;
1079 }
1080
1081 bool SurfacelessEGL::Initialize() {
1082 return Initialize(SURFACE_SURFACELESS);
1075 } 1083 }
1076 1084
1077 bool SurfacelessEGL::Initialize(GLSurface::Format format) { 1085 bool SurfacelessEGL::Initialize(GLSurface::Format format) {
1078 format_ = format; 1086 format_ = format;
1079 return true; 1087 return true;
1080 } 1088 }
1081 1089
1082 void SurfacelessEGL::Destroy() { 1090 void SurfacelessEGL::Destroy() {
1083 } 1091 }
1084 1092
(...skipping 26 matching lines...) Expand all
1111 } 1119 }
1112 1120
1113 void* SurfacelessEGL::GetShareHandle() { 1121 void* SurfacelessEGL::GetShareHandle() {
1114 return NULL; 1122 return NULL;
1115 } 1123 }
1116 1124
1117 SurfacelessEGL::~SurfacelessEGL() { 1125 SurfacelessEGL::~SurfacelessEGL() {
1118 } 1126 }
1119 1127
1120 } // namespace gfx 1128 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gl/gl_surface_egl.h ('k') | ui/gl/gl_surface_ozone.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698