OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #if defined(ENABLE_GPU) | 5 #if defined(ENABLE_GPU) |
6 | 6 |
7 #include "content/common/gpu/image_transport_surface.h" | 7 #include "content/common/gpu/image_transport_surface.h" |
8 | 8 |
9 // This conflicts with the defines in Xlib.h and must come first. | 9 // This conflicts with the defines in Xlib.h and must come first. |
10 #include "content/common/gpu/gpu_messages.h" | 10 #include "content/common/gpu/gpu_messages.h" |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 bool EGLImageTransportSurface::IsOffscreen() { | 256 bool EGLImageTransportSurface::IsOffscreen() { |
257 return false; | 257 return false; |
258 } | 258 } |
259 | 259 |
260 bool EGLImageTransportSurface::OnMakeCurrent(gfx::GLContext* context) { | 260 bool EGLImageTransportSurface::OnMakeCurrent(gfx::GLContext* context) { |
261 if (made_current_) | 261 if (made_current_) |
262 return true; | 262 return true; |
263 | 263 |
264 if (!context->HasExtension("EGL_KHR_image") && | 264 if (!context->HasExtension("EGL_KHR_image") && |
265 !context->HasExtension("EGL_KHR_image_pixmap")) { | 265 !context->HasExtension("EGL_KHR_image_pixmap")) { |
266 LOG(ERROR) << "EGLImage from X11 pixmap not supported"; | 266 DLOG(ERROR) << "EGLImage from X11 pixmap not supported"; |
267 return false; | 267 return false; |
268 } | 268 } |
269 | 269 |
270 glGenFramebuffersEXT(1, &fbo_id_); | 270 glGenFramebuffersEXT(1, &fbo_id_); |
271 glBindFramebufferEXT(GL_FRAMEBUFFER, fbo_id_); | 271 glBindFramebufferEXT(GL_FRAMEBUFFER, fbo_id_); |
272 OnResize(gfx::Size(1, 1)); | 272 OnResize(gfx::Size(1, 1)); |
273 | 273 |
274 GLenum status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER); | 274 GLenum status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER); |
275 if (status != GL_FRAMEBUFFER_COMPLETE) { | 275 if (status != GL_FRAMEBUFFER_COMPLETE) { |
276 LOG(ERROR) << "Framebuffer incomplete."; | 276 DLOG(ERROR) << "Framebuffer incomplete."; |
277 return false; | 277 return false; |
278 } | 278 } |
279 | 279 |
280 made_current_ = true; | 280 made_current_ = true; |
281 return true; | 281 return true; |
282 } | 282 } |
283 | 283 |
284 unsigned int EGLImageTransportSurface::GetBackingFrameBufferObject() { | 284 unsigned int EGLImageTransportSurface::GetBackingFrameBufferObject() { |
285 return fbo_id_; | 285 return fbo_id_; |
286 } | 286 } |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
495 if (made_current_) | 495 if (made_current_) |
496 return true; | 496 return true; |
497 | 497 |
498 // Check for driver support. | 498 // Check for driver support. |
499 Display* dpy = static_cast<Display*>(GetDisplay()); | 499 Display* dpy = static_cast<Display*>(GetDisplay()); |
500 int event_base, error_base; | 500 int event_base, error_base; |
501 if (XCompositeQueryExtension(dpy, &event_base, &error_base)) { | 501 if (XCompositeQueryExtension(dpy, &event_base, &error_base)) { |
502 int major = 0, minor = 2; | 502 int major = 0, minor = 2; |
503 XCompositeQueryVersion(dpy, &major, &minor); | 503 XCompositeQueryVersion(dpy, &major, &minor); |
504 if (major == 0 && minor < 2) { | 504 if (major == 0 && minor < 2) { |
505 LOG(ERROR) << "Pixmap from window not supported."; | 505 DLOG(ERROR) << "Pixmap from window not supported."; |
506 return false; | 506 return false; |
507 } | 507 } |
508 } | 508 } |
509 | 509 |
510 context->SetSwapInterval(0); | 510 context->SetSwapInterval(0); |
511 | 511 |
512 made_current_ = true; | 512 made_current_ = true; |
513 return true; | 513 return true; |
514 } | 514 } |
515 | 515 |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
658 NOTREACHED(); | 658 NOTREACHED(); |
659 return NULL; | 659 return NULL; |
660 } | 660 } |
661 if (surface->Initialize()) | 661 if (surface->Initialize()) |
662 return surface; | 662 return surface; |
663 else | 663 else |
664 return NULL; | 664 return NULL; |
665 } | 665 } |
666 | 666 |
667 #endif // defined(USE_GPU) | 667 #endif // defined(USE_GPU) |
OLD | NEW |