| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/gfx/ozone/dri/dri_surface.h" | 5 #include "ui/gfx/ozone/dri/dri_surface.h" |
| 6 | 6 |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 #include <sys/mman.h> | 8 #include <sys/mman.h> |
| 9 #include <sys/types.h> | 9 #include <sys/types.h> |
| 10 #include <xf86drm.h> | 10 #include <xf86drm.h> |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 skia_canvas_ = skia::AdoptRef(new SkCanvas(skia_device_.get())); | 70 skia_canvas_ = skia::AdoptRef(new SkCanvas(skia_device_.get())); |
| 71 | 71 |
| 72 return true; | 72 return true; |
| 73 } | 73 } |
| 74 | 74 |
| 75 uint32_t DriSurface::GetFramebufferId() const { | 75 uint32_t DriSurface::GetFramebufferId() const { |
| 76 CHECK(bitmaps_[0].get() && bitmaps_[1].get()); | 76 CHECK(bitmaps_[0].get() && bitmaps_[1].get()); |
| 77 return bitmaps_[front_buffer_ ^ 1]->get_framebuffer(); | 77 return bitmaps_[front_buffer_ ^ 1]->get_framebuffer(); |
| 78 } | 78 } |
| 79 | 79 |
| 80 uint32_t DriSurface::GetHandle() const { | 80 uint32_t DriSurface::GetFrontBufferHandle() const { |
| 81 CHECK(bitmaps_[0].get() && bitmaps_[1].get()); | 81 CHECK(bitmaps_[0].get() && bitmaps_[1].get()); |
| 82 return bitmaps_[front_buffer_ ^ 1]->get_handle(); | 82 return bitmaps_[front_buffer_]->get_handle(); |
| 83 } | 83 } |
| 84 | 84 |
| 85 // This call is made after the hardware just started displaying our back buffer. | 85 // This call is made after the hardware just started displaying our back buffer. |
| 86 // We need to update our pointer reference and synchronize the two buffers. | 86 // We need to update our pointer reference and synchronize the two buffers. |
| 87 void DriSurface::SwapBuffers() { | 87 void DriSurface::SwapBuffers() { |
| 88 CHECK(bitmaps_[0].get() && bitmaps_[1].get()); | 88 CHECK(bitmaps_[0].get() && bitmaps_[1].get()); |
| 89 | 89 |
| 90 // Update our front buffer pointer. | 90 // Update our front buffer pointer. |
| 91 front_buffer_ ^= 1; | 91 front_buffer_ ^= 1; |
| 92 | 92 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 110 | 110 |
| 111 SkCanvas* DriSurface::GetDrawableForWidget() { | 111 SkCanvas* DriSurface::GetDrawableForWidget() { |
| 112 return skia_canvas_.get(); | 112 return skia_canvas_.get(); |
| 113 } | 113 } |
| 114 | 114 |
| 115 DriSkBitmap* DriSurface::CreateBuffer() { | 115 DriSkBitmap* DriSurface::CreateBuffer() { |
| 116 return new DriSkBitmap(dri_->get_fd()); | 116 return new DriSkBitmap(dri_->get_fd()); |
| 117 } | 117 } |
| 118 | 118 |
| 119 } // namespace gfx | 119 } // namespace gfx |
| OLD | NEW |