OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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.h" | 5 #include "ui/gl/gl_surface.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/location.h" | 9 #include "base/location.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
244 for (const auto& overlay : overlays) | 244 for (const auto& overlay : overlays) |
245 if (!overlay.ScheduleOverlayPlane(widget)) | 245 if (!overlay.ScheduleOverlayPlane(widget)) |
246 return false; | 246 return false; |
247 return true; | 247 return true; |
248 } | 248 } |
249 | 249 |
250 GLSurfaceOzoneSurfaceless::GLSurfaceOzoneSurfaceless( | 250 GLSurfaceOzoneSurfaceless::GLSurfaceOzoneSurfaceless( |
251 scoped_ptr<ui::SurfaceOzoneEGL> ozone_surface, | 251 scoped_ptr<ui::SurfaceOzoneEGL> ozone_surface, |
252 AcceleratedWidget widget, | 252 AcceleratedWidget widget, |
253 const gfx::SurfaceConfiguration& requested_configuration) | 253 const gfx::SurfaceConfiguration& requested_configuration) |
254 : SurfacelessEGL(gfx::Size(), requested_configuration), | 254 : SurfacelessEGL(gfx::Size(1, 1), // passing zero size causes a failure |
jamesr
2015/08/25 00:30:28
:(. is the failure in something we control?
cdotstout
2015/08/27 19:10:21
No, it's gbm/mesa. Could move the workaround down
| |
255 requested_configuration), | |
255 ozone_surface_(ozone_surface.Pass()), | 256 ozone_surface_(ozone_surface.Pass()), |
256 widget_(widget), | 257 widget_(widget), |
257 has_implicit_external_sync_( | 258 has_implicit_external_sync_( |
258 HasEGLExtension("EGL_ARM_implicit_external_sync")), | 259 HasEGLExtension("EGL_ARM_implicit_external_sync")), |
259 last_swap_buffers_result_(true), | 260 last_swap_buffers_result_(true), |
260 swap_buffers_pending_(false), | 261 swap_buffers_pending_(false), |
261 weak_factory_(this) { | 262 weak_factory_(this) { |
262 unsubmitted_frames_.push_back(new PendingFrame()); | 263 unsubmitted_frames_.push_back(new PendingFrame()); |
263 } | 264 } |
264 | 265 |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
426 const gfx::SurfaceConfiguration& requested_configuration); | 427 const gfx::SurfaceConfiguration& requested_configuration); |
427 | 428 |
428 // GLSurface: | 429 // GLSurface: |
429 unsigned int GetBackingFrameBufferObject() override; | 430 unsigned int GetBackingFrameBufferObject() override; |
430 bool OnMakeCurrent(GLContext* context) override; | 431 bool OnMakeCurrent(GLContext* context) override; |
431 bool Resize(const gfx::Size& size) override; | 432 bool Resize(const gfx::Size& size) override; |
432 bool SupportsPostSubBuffer() override; | 433 bool SupportsPostSubBuffer() override; |
433 gfx::SwapResult SwapBuffers() override; | 434 gfx::SwapResult SwapBuffers() override; |
434 bool SwapBuffersAsync(const SwapCompletionCallback& callback) override; | 435 bool SwapBuffersAsync(const SwapCompletionCallback& callback) override; |
435 void Destroy() override; | 436 void Destroy() override; |
437 bool IsSurfaceless() const override { return false; } | |
436 | 438 |
437 private: | 439 private: |
438 class SurfaceImage : public GLImageLinuxDMABuffer { | 440 class SurfaceImage : public GLImageLinuxDMABuffer { |
439 public: | 441 public: |
440 SurfaceImage(const gfx::Size& size, unsigned internalformat); | 442 SurfaceImage(const gfx::Size& size, unsigned internalformat); |
441 | 443 |
442 bool Initialize(scoped_refptr<ui::NativePixmap> pixmap, | 444 bool Initialize(scoped_refptr<ui::NativePixmap> pixmap, |
443 gfx::GpuMemoryBuffer::Format format); | 445 gfx::GpuMemoryBuffer::Format format); |
444 bool ScheduleOverlayPlane(gfx::AcceleratedWidget widget, | 446 bool ScheduleOverlayPlane(gfx::AcceleratedWidget widget, |
445 int z_order, | 447 int z_order, |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
599 ->GetSurfaceFactoryOzone() | 601 ->GetSurfaceFactoryOzone() |
600 ->CreateNativePixmap(widget_, GetSize(), | 602 ->CreateNativePixmap(widget_, GetSize(), |
601 ui::SurfaceFactoryOzone::BGRA_8888, | 603 ui::SurfaceFactoryOzone::BGRA_8888, |
602 ui::SurfaceFactoryOzone::SCANOUT); | 604 ui::SurfaceFactoryOzone::SCANOUT); |
603 if (!pixmap) | 605 if (!pixmap) |
604 return false; | 606 return false; |
605 scoped_refptr<SurfaceImage> image = | 607 scoped_refptr<SurfaceImage> image = |
606 new SurfaceImage(GetSize(), GL_BGRA_EXT); | 608 new SurfaceImage(GetSize(), GL_BGRA_EXT); |
607 if (!image->Initialize(pixmap, gfx::GpuMemoryBuffer::Format::BGRA_8888)) | 609 if (!image->Initialize(pixmap, gfx::GpuMemoryBuffer::Format::BGRA_8888)) |
608 return false; | 610 return false; |
611 if (images_[i]) | |
612 images_[i]->Destroy(true); | |
609 images_[i] = image; | 613 images_[i] = image; |
610 // Bind image to texture. | 614 // Bind image to texture. |
611 ScopedTextureBinder binder(GL_TEXTURE_2D, textures_[i]); | 615 ScopedTextureBinder binder(GL_TEXTURE_2D, textures_[i]); |
616 | |
612 if (!images_[i]->BindTexImage(GL_TEXTURE_2D)) | 617 if (!images_[i]->BindTexImage(GL_TEXTURE_2D)) |
613 return false; | 618 return false; |
614 } | 619 } |
615 return true; | 620 return true; |
616 } | 621 } |
617 | 622 |
618 } // namespace | 623 } // namespace |
619 | 624 |
620 // static | 625 // static |
621 bool GLSurface::InitializeOneOffInternal() { | 626 bool GLSurface::InitializeOneOffInternal() { |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
744 } | 749 } |
745 } | 750 } |
746 | 751 |
747 EGLNativeDisplayType GetPlatformDefaultEGLNativeDisplay() { | 752 EGLNativeDisplayType GetPlatformDefaultEGLNativeDisplay() { |
748 return ui::OzonePlatform::GetInstance() | 753 return ui::OzonePlatform::GetInstance() |
749 ->GetSurfaceFactoryOzone() | 754 ->GetSurfaceFactoryOzone() |
750 ->GetNativeDisplay(); | 755 ->GetNativeDisplay(); |
751 } | 756 } |
752 | 757 |
753 } // namespace gfx | 758 } // namespace gfx |
OLD | NEW |