Index: ui/gfx/ozone/dri/hardware_display_controller.cc |
diff --git a/ui/gfx/ozone/dri/hardware_display_controller.cc b/ui/gfx/ozone/dri/hardware_display_controller.cc |
index 6accfc00d536c278c60bc2e7b8007421de0d6adf..39ba9bc20070b9238ff88794458cdab6d2845497 100644 |
--- a/ui/gfx/ozone/dri/hardware_display_controller.cc |
+++ b/ui/gfx/ozone/dri/hardware_display_controller.cc |
@@ -11,8 +11,8 @@ |
#include "base/logging.h" |
#include "base/time/time.h" |
#include "ui/gfx/ozone/dri/dri_skbitmap.h" |
-#include "ui/gfx/ozone/dri/dri_surface.h" |
#include "ui/gfx/ozone/dri/dri_wrapper.h" |
+#include "ui/gfx/ozone/dri/scanout_surface.h" |
namespace gfx { |
@@ -47,42 +47,48 @@ HardwareDisplayController::~HardwareDisplayController() { |
DLOG(ERROR) << "Failed to restore CRTC state: " << strerror(errno); |
drm_->FreeCrtc(saved_crtc_); |
} |
- |
- if (surface_.get()) { |
- // Unregister the buffers. |
- for (int i = 0; i < 2; ++i) { |
- if (!drm_->RemoveFramebuffer(surface_->bitmaps_[i]->get_framebuffer())) |
- DLOG(ERROR) << "Failed to remove FB: " << strerror(errno); |
- } |
- } |
} |
bool |
HardwareDisplayController::BindSurfaceToController( |
- scoped_ptr<DriSurface> surface) { |
+ scoped_ptr<ScanoutSurface> surface) { |
CHECK(state_ == UNINITIALIZED); |
- // Register the buffers. |
- for (int i = 0; i < 2; ++i) { |
- uint32_t fb_id; |
- if (!drm_->AddFramebuffer(mode_, |
- surface->bitmaps_[i]->GetColorDepth(), |
- surface->bitmaps_[i]->bytesPerPixel() << 3, |
- surface->bitmaps_[i]->rowBytes(), |
- surface->bitmaps_[i]->get_handle(), |
- &fb_id)) { |
- DLOG(ERROR) << "Failed to register framebuffer: " << strerror(errno); |
- state_ = FAILED; |
- return false; |
- } |
- surface->bitmaps_[i]->set_framebuffer(fb_id); |
- } |
- |
surface_.reset(surface.release()); |
state_ = SURFACE_INITIALIZED; |
return true; |
} |
+bool HardwareDisplayController::AddFramebuffer( |
+ uint8_t depth, |
+ uint8_t bpp, |
+ uint32_t stride, |
+ uint32_t handle, |
+ uint32_t* framebuffer_id) { |
+ CHECK(state_ != UNASSOCIATED && state_ != FAILED); |
+ if (!drm_->AddFramebuffer(mode_, |
+ depth, |
+ bpp, |
+ stride, |
+ handle, |
+ framebuffer_id)){ |
+ DLOG(ERROR) << "Failed to register framebuffer: " << strerror(errno); |
+ state_ = FAILED; |
+ return false; |
+ } |
+ return true; |
+} |
+ |
+bool HardwareDisplayController::RemoveFramebuffer( |
+ uint32_t framebuffer_id) { |
+ CHECK(state_ != UNASSOCIATED); |
+ if (!drm_->RemoveFramebuffer(framebuffer_id)) { |
+ DLOG(ERROR) << "Failed to remove FB: " << strerror(errno); |
+ return false; |
+ } |
+ return true; |
+} |
+ |
bool HardwareDisplayController::SchedulePageFlip() { |
CHECK(state_ == SURFACE_INITIALIZED || state_ == INITIALIZED); |