| 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/ozone/platform/dri/gbm_surface.h" | 5 #include "ui/ozone/platform/dri/gbm_surface.h" |
| 6 | 6 |
| 7 #include <gbm.h> | 7 #include <gbm.h> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 } | 125 } |
| 126 | 126 |
| 127 bool GbmSurface::ResizeNativeWindow(const gfx::Size& viewport_size) { | 127 bool GbmSurface::ResizeNativeWindow(const gfx::Size& viewport_size) { |
| 128 if (size_ == viewport_size) | 128 if (size_ == viewport_size) |
| 129 return true; | 129 return true; |
| 130 | 130 |
| 131 return false; | 131 return false; |
| 132 } | 132 } |
| 133 | 133 |
| 134 bool GbmSurface::OnSwapBuffers() { | 134 bool GbmSurface::OnSwapBuffers() { |
| 135 NOTREACHED(); | 135 return OnSwapBuffersAsync(base::Bind(&base::DoNothing)); |
| 136 return false; | |
| 137 } | 136 } |
| 138 | 137 |
| 139 bool GbmSurface::OnSwapBuffersAsync(const SwapCompletionCallback& callback) { | 138 bool GbmSurface::OnSwapBuffersAsync(const SwapCompletionCallback& callback) { |
| 140 DCHECK(native_surface_); | 139 DCHECK(native_surface_); |
| 141 | 140 |
| 142 gbm_bo* pending_buffer = gbm_surface_lock_front_buffer(native_surface_); | 141 gbm_bo* pending_buffer = gbm_surface_lock_front_buffer(native_surface_); |
| 143 scoped_refptr<GbmSurfaceBuffer> primary = | 142 scoped_refptr<GbmSurfaceBuffer> primary = |
| 144 GbmSurfaceBuffer::GetBuffer(pending_buffer); | 143 GbmSurfaceBuffer::GetBuffer(pending_buffer); |
| 145 if (!primary.get()) { | 144 if (!primary.get()) { |
| 146 primary = GbmSurfaceBuffer::CreateBuffer(dri_, pending_buffer); | 145 primary = GbmSurfaceBuffer::CreateBuffer(dri_, pending_buffer); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 169 gbm_bo* pending_buffer) { | 168 gbm_bo* pending_buffer) { |
| 170 // If there was a frontbuffer, it is no longer active. Release it back to GBM. | 169 // If there was a frontbuffer, it is no longer active. Release it back to GBM. |
| 171 if (current_buffer_) | 170 if (current_buffer_) |
| 172 gbm_surface_release_buffer(native_surface_, current_buffer_); | 171 gbm_surface_release_buffer(native_surface_, current_buffer_); |
| 173 | 172 |
| 174 current_buffer_ = pending_buffer; | 173 current_buffer_ = pending_buffer; |
| 175 callback.Run(); | 174 callback.Run(); |
| 176 } | 175 } |
| 177 | 176 |
| 178 } // namespace ui | 177 } // namespace ui |
| OLD | NEW |