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

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

Issue 1738973004: Fix EGL configs with GLSurfaceOzoneSurfaceless. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added format SURFACE_SURFACELESS. 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 610 matching lines...) Expand 10 before | Expand all | Expand 10 after
1061 return handle; 1064 return handle;
1062 #endif 1065 #endif
1063 } 1066 }
1064 1067
1065 PbufferGLSurfaceEGL::~PbufferGLSurfaceEGL() { 1068 PbufferGLSurfaceEGL::~PbufferGLSurfaceEGL() {
1066 Destroy(); 1069 Destroy();
1067 } 1070 }
1068 1071
1069 SurfacelessEGL::SurfacelessEGL(const gfx::Size& size) 1072 SurfacelessEGL::SurfacelessEGL(const gfx::Size& size)
1070 : size_(size) { 1073 : size_(size) {
1074 format_ = GLSurface::SURFACE_SURFACELESS;
1075 }
1076
1077 bool SurfacelessEGL::Initialize() {
1078 return Initialize(SURFACE_SURFACELESS);
1071 } 1079 }
1072 1080
1073 bool SurfacelessEGL::Initialize(GLSurface::Format format) { 1081 bool SurfacelessEGL::Initialize(GLSurface::Format format) {
1074 format_ = format; 1082 format_ = format;
1075 return true; 1083 return true;
1076 } 1084 }
1077 1085
1078 void SurfacelessEGL::Destroy() { 1086 void SurfacelessEGL::Destroy() {
1079 } 1087 }
1080 1088
(...skipping 26 matching lines...) Expand all
1107 } 1115 }
1108 1116
1109 void* SurfacelessEGL::GetShareHandle() { 1117 void* SurfacelessEGL::GetShareHandle() {
1110 return NULL; 1118 return NULL;
1111 } 1119 }
1112 1120
1113 SurfacelessEGL::~SurfacelessEGL() { 1121 SurfacelessEGL::~SurfacelessEGL() {
1114 } 1122 }
1115 1123
1116 } // namespace gfx 1124 } // 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