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 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
381 } | 381 } |
382 | 382 |
383 void GLSurfaceOzoneSurfaceless::SubmitFrame() { | 383 void GLSurfaceOzoneSurfaceless::SubmitFrame() { |
384 DCHECK(!unsubmitted_frames_.empty()); | 384 DCHECK(!unsubmitted_frames_.empty()); |
385 | 385 |
386 if (unsubmitted_frames_.front()->ready && !swap_buffers_pending_) { | 386 if (unsubmitted_frames_.front()->ready && !swap_buffers_pending_) { |
387 scoped_ptr<PendingFrame> frame(unsubmitted_frames_.front()); | 387 scoped_ptr<PendingFrame> frame(unsubmitted_frames_.front()); |
388 unsubmitted_frames_.weak_erase(unsubmitted_frames_.begin()); | 388 unsubmitted_frames_.weak_erase(unsubmitted_frames_.begin()); |
389 swap_buffers_pending_ = true; | 389 swap_buffers_pending_ = true; |
390 | 390 |
391 last_swap_buffers_result_ = | 391 last_swap_buffers_result_ = frame->ScheduleOverlayPlanes(widget_); |
spang
2015/11/11 20:58:40
Shouldn't this be
if (!frame->ScheduleOverlayPlan
dnicoara
2015/11/11 21:07:08
I was thinking about this, but if some overlays ha
dnicoara
2015/11/11 21:33:56
Done.
| |
392 frame->ScheduleOverlayPlanes(widget_) && | 392 ozone_surface_->OnSwapBuffersAsync(frame->callback); |
393 ozone_surface_->OnSwapBuffersAsync(frame->callback); | |
394 } | 393 } |
395 } | 394 } |
396 | 395 |
397 EGLSyncKHR GLSurfaceOzoneSurfaceless::InsertFence() { | 396 EGLSyncKHR GLSurfaceOzoneSurfaceless::InsertFence() { |
398 const EGLint attrib_list[] = {EGL_SYNC_CONDITION_KHR, | 397 const EGLint attrib_list[] = {EGL_SYNC_CONDITION_KHR, |
399 EGL_SYNC_PRIOR_COMMANDS_IMPLICIT_EXTERNAL_ARM, | 398 EGL_SYNC_PRIOR_COMMANDS_IMPLICIT_EXTERNAL_ARM, |
400 EGL_NONE}; | 399 EGL_NONE}; |
401 return eglCreateSyncKHR(GetDisplay(), EGL_SYNC_FENCE_KHR, attrib_list); | 400 return eglCreateSyncKHR(GetDisplay(), EGL_SYNC_FENCE_KHR, attrib_list); |
402 } | 401 } |
403 | 402 |
404 void GLSurfaceOzoneSurfaceless::FenceRetired(EGLSyncKHR fence, | 403 void GLSurfaceOzoneSurfaceless::FenceRetired(EGLSyncKHR fence, |
405 PendingFrame* frame) { | 404 PendingFrame* frame) { |
406 eglDestroySyncKHR(GetDisplay(), fence); | 405 eglDestroySyncKHR(GetDisplay(), fence); |
407 frame->ready = true; | 406 frame->ready = true; |
408 SubmitFrame(); | 407 SubmitFrame(); |
409 } | 408 } |
410 | 409 |
411 void GLSurfaceOzoneSurfaceless::SwapCompleted( | 410 void GLSurfaceOzoneSurfaceless::SwapCompleted( |
412 const SwapCompletionCallback& callback, | 411 const SwapCompletionCallback& callback, |
413 gfx::SwapResult result) { | 412 gfx::SwapResult result) { |
414 callback.Run(result); | 413 callback.Run(result); |
415 swap_buffers_pending_ = false; | 414 swap_buffers_pending_ = false; |
415 last_swap_buffers_result_ &= result != gfx::SwapResult::SWAP_FAILED; | |
spang
2015/11/11 20:58:40
There's no reason to &, just assign.
if (result =
dnicoara
2015/11/11 21:33:56
Done.
| |
416 | 416 |
417 SubmitFrame(); | 417 SubmitFrame(); |
418 } | 418 } |
419 | 419 |
420 // This provides surface-like semantics implemented through surfaceless. | 420 // This provides surface-like semantics implemented through surfaceless. |
421 // A framebuffer is bound automatically. | 421 // A framebuffer is bound automatically. |
422 class GL_EXPORT GLSurfaceOzoneSurfacelessSurfaceImpl | 422 class GL_EXPORT GLSurfaceOzoneSurfacelessSurfaceImpl |
423 : public GLSurfaceOzoneSurfaceless { | 423 : public GLSurfaceOzoneSurfaceless { |
424 public: | 424 public: |
425 GLSurfaceOzoneSurfacelessSurfaceImpl( | 425 GLSurfaceOzoneSurfacelessSurfaceImpl( |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
714 } | 714 } |
715 } | 715 } |
716 | 716 |
717 EGLNativeDisplayType GetPlatformDefaultEGLNativeDisplay() { | 717 EGLNativeDisplayType GetPlatformDefaultEGLNativeDisplay() { |
718 return ui::OzonePlatform::GetInstance() | 718 return ui::OzonePlatform::GetInstance() |
719 ->GetSurfaceFactoryOzone() | 719 ->GetSurfaceFactoryOzone() |
720 ->GetNativeDisplay(); | 720 ->GetNativeDisplay(); |
721 } | 721 } |
722 | 722 |
723 } // namespace gfx | 723 } // namespace gfx |
OLD | NEW |