| 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/impl/hardware_display_controller_ozone.h" | 5 #include "ui/gfx/ozone/impl/hardware_display_controller_ozone.h" |
| 6 | 6 |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 #include <string.h> | 8 #include <string.h> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 // Unregister the buffers. | 49 // Unregister the buffers. |
| 50 for (int i = 0; i < 2; ++i) { | 50 for (int i = 0; i < 2; ++i) { |
| 51 if (!drm_->RemoveFramebuffer(surface_->bitmaps_[i]->get_framebuffer())) | 51 if (!drm_->RemoveFramebuffer(surface_->bitmaps_[i]->get_framebuffer())) |
| 52 DLOG(ERROR) << "Failed to remove FB: " << strerror(errno); | 52 DLOG(ERROR) << "Failed to remove FB: " << strerror(errno); |
| 53 } | 53 } |
| 54 } | 54 } |
| 55 } | 55 } |
| 56 | 56 |
| 57 bool | 57 bool |
| 58 HardwareDisplayControllerOzone::BindSurfaceToController( | 58 HardwareDisplayControllerOzone::BindSurfaceToController( |
| 59 SoftwareSurfaceOzone* surface) { | 59 scoped_ptr<SoftwareSurfaceOzone> surface) { |
| 60 CHECK(state_ == UNINITIALIZED); | 60 CHECK(state_ == UNINITIALIZED); |
| 61 | 61 |
| 62 // Register the buffers. | 62 // Register the buffers. |
| 63 for (int i = 0; i < 2; ++i) { | 63 for (int i = 0; i < 2; ++i) { |
| 64 uint32_t fb_id; | 64 uint32_t fb_id; |
| 65 if (!drm_->AddFramebuffer(mode_, | 65 if (!drm_->AddFramebuffer(mode_, |
| 66 surface->bitmaps_[i]->GetColorDepth(), | 66 surface->bitmaps_[i]->GetColorDepth(), |
| 67 surface->bitmaps_[i]->bytesPerPixel() << 3, | 67 surface->bitmaps_[i]->bytesPerPixel() << 3, |
| 68 surface->bitmaps_[i]->rowBytes(), | 68 surface->bitmaps_[i]->rowBytes(), |
| 69 surface->bitmaps_[i]->get_handle(), | 69 surface->bitmaps_[i]->get_handle(), |
| 70 &fb_id)) { | 70 &fb_id)) { |
| 71 DLOG(ERROR) << "Failed to register framebuffer: " << strerror(errno); | 71 DLOG(ERROR) << "Failed to register framebuffer: " << strerror(errno); |
| 72 state_ = FAILED; | 72 state_ = FAILED; |
| 73 return false; | 73 return false; |
| 74 } | 74 } |
| 75 surface->bitmaps_[i]->set_framebuffer(fb_id); | 75 surface->bitmaps_[i]->set_framebuffer(fb_id); |
| 76 } | 76 } |
| 77 | 77 |
| 78 surface_.reset(surface); | 78 surface_.reset(surface.release()); |
| 79 state_ = SURFACE_INITIALIZED; | 79 state_ = SURFACE_INITIALIZED; |
| 80 return true; | 80 return true; |
| 81 } | 81 } |
| 82 | 82 |
| 83 bool HardwareDisplayControllerOzone::SchedulePageFlip() { | 83 bool HardwareDisplayControllerOzone::SchedulePageFlip() { |
| 84 CHECK(state_ == SURFACE_INITIALIZED || state_ == INITIALIZED); | 84 CHECK(state_ == SURFACE_INITIALIZED || state_ == INITIALIZED); |
| 85 | 85 |
| 86 if (state_ == SURFACE_INITIALIZED) { | 86 if (state_ == SURFACE_INITIALIZED) { |
| 87 // Perform the initial modeset. | 87 // Perform the initial modeset. |
| 88 if (!drm_->SetCrtc(crtc_id_, | 88 if (!drm_->SetCrtc(crtc_id_, |
| (...skipping 12 matching lines...) Expand all Loading... |
| 101 surface_->GetFramebufferId(), | 101 surface_->GetFramebufferId(), |
| 102 this)) { | 102 this)) { |
| 103 state_ = FAILED; | 103 state_ = FAILED; |
| 104 LOG(ERROR) << "Cannot page flip: " << strerror(errno); | 104 LOG(ERROR) << "Cannot page flip: " << strerror(errno); |
| 105 return false; | 105 return false; |
| 106 } | 106 } |
| 107 return true; | 107 return true; |
| 108 } | 108 } |
| 109 | 109 |
| 110 } // namespace gfx | 110 } // namespace gfx |
| OLD | NEW |