Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(140)

Side by Side Diff: ui/gfx/ozone/impl/hardware_display_controller.cc

Issue 49303002: [Ozone] Rename software implementation files to use Dri prefix (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix ifdef Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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.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"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "ui/gfx/ozone/impl/drm_skbitmap_ozone.h" 12 #include "ui/gfx/ozone/impl/dri_skbitmap.h"
13 #include "ui/gfx/ozone/impl/drm_wrapper_ozone.h" 13 #include "ui/gfx/ozone/impl/dri_surface.h"
14 #include "ui/gfx/ozone/impl/software_surface_ozone.h" 14 #include "ui/gfx/ozone/impl/dri_wrapper.h"
15 15
16 namespace gfx { 16 namespace gfx {
17 17
18 HardwareDisplayControllerOzone::HardwareDisplayControllerOzone() 18 HardwareDisplayController::HardwareDisplayController()
19 : drm_(NULL), 19 : drm_(NULL),
20 connector_id_(0), 20 connector_id_(0),
21 crtc_id_(0), 21 crtc_id_(0),
22 mode_(), 22 mode_(),
23 saved_crtc_(NULL), 23 saved_crtc_(NULL),
24 state_(UNASSOCIATED), 24 state_(UNASSOCIATED),
25 surface_() { 25 surface_() {
26 } 26 }
27 27
28 void HardwareDisplayControllerOzone::SetControllerInfo( 28 void HardwareDisplayController::SetControllerInfo(
29 DrmWrapperOzone* drm, 29 DriWrapper* drm,
30 uint32_t connector_id, 30 uint32_t connector_id,
31 uint32_t crtc_id, 31 uint32_t crtc_id,
32 uint32_t dpms_property_id, 32 uint32_t dpms_property_id,
33 drmModeModeInfo mode) { 33 drmModeModeInfo mode) {
34 drm_ = drm; 34 drm_ = drm;
35 connector_id_ = connector_id; 35 connector_id_ = connector_id;
36 crtc_id_ = crtc_id; 36 crtc_id_ = crtc_id;
37 dpms_property_id_ = dpms_property_id; 37 dpms_property_id_ = dpms_property_id;
38 mode_ = mode; 38 mode_ = mode;
39 saved_crtc_ = drm_->GetCrtc(crtc_id_); 39 saved_crtc_ = drm_->GetCrtc(crtc_id_);
40 state_ = UNINITIALIZED; 40 state_ = UNINITIALIZED;
41 } 41 }
42 42
43 HardwareDisplayControllerOzone::~HardwareDisplayControllerOzone() { 43 HardwareDisplayController::~HardwareDisplayController() {
44 if (saved_crtc_) { 44 if (saved_crtc_) {
45 if (!drm_->SetCrtc(saved_crtc_, &connector_id_)) 45 if (!drm_->SetCrtc(saved_crtc_, &connector_id_))
46 DLOG(ERROR) << "Failed to restore CRTC state: " << strerror(errno); 46 DLOG(ERROR) << "Failed to restore CRTC state: " << strerror(errno);
47 drm_->FreeCrtc(saved_crtc_); 47 drm_->FreeCrtc(saved_crtc_);
48 } 48 }
49 49
50 if (surface_.get()) { 50 if (surface_.get()) {
51 // Unregister the buffers. 51 // Unregister the buffers.
52 for (int i = 0; i < 2; ++i) { 52 for (int i = 0; i < 2; ++i) {
53 if (!drm_->RemoveFramebuffer(surface_->bitmaps_[i]->get_framebuffer())) 53 if (!drm_->RemoveFramebuffer(surface_->bitmaps_[i]->get_framebuffer()))
54 DLOG(ERROR) << "Failed to remove FB: " << strerror(errno); 54 DLOG(ERROR) << "Failed to remove FB: " << strerror(errno);
55 } 55 }
56 } 56 }
57 } 57 }
58 58
59 bool 59 bool
60 HardwareDisplayControllerOzone::BindSurfaceToController( 60 HardwareDisplayController::BindSurfaceToController(
61 scoped_ptr<SoftwareSurfaceOzone> surface) { 61 scoped_ptr<DriSurface> surface) {
62 CHECK(state_ == UNINITIALIZED); 62 CHECK(state_ == UNINITIALIZED);
63 63
64 // Register the buffers. 64 // Register the buffers.
65 for (int i = 0; i < 2; ++i) { 65 for (int i = 0; i < 2; ++i) {
66 uint32_t fb_id; 66 uint32_t fb_id;
67 if (!drm_->AddFramebuffer(mode_, 67 if (!drm_->AddFramebuffer(mode_,
68 surface->bitmaps_[i]->GetColorDepth(), 68 surface->bitmaps_[i]->GetColorDepth(),
69 surface->bitmaps_[i]->bytesPerPixel() << 3, 69 surface->bitmaps_[i]->bytesPerPixel() << 3,
70 surface->bitmaps_[i]->rowBytes(), 70 surface->bitmaps_[i]->rowBytes(),
71 surface->bitmaps_[i]->get_handle(), 71 surface->bitmaps_[i]->get_handle(),
72 &fb_id)) { 72 &fb_id)) {
73 DLOG(ERROR) << "Failed to register framebuffer: " << strerror(errno); 73 DLOG(ERROR) << "Failed to register framebuffer: " << strerror(errno);
74 state_ = FAILED; 74 state_ = FAILED;
75 return false; 75 return false;
76 } 76 }
77 surface->bitmaps_[i]->set_framebuffer(fb_id); 77 surface->bitmaps_[i]->set_framebuffer(fb_id);
78 } 78 }
79 79
80 surface_.reset(surface.release()); 80 surface_.reset(surface.release());
81 state_ = SURFACE_INITIALIZED; 81 state_ = SURFACE_INITIALIZED;
82 return true; 82 return true;
83 } 83 }
84 84
85 bool HardwareDisplayControllerOzone::SchedulePageFlip() { 85 bool HardwareDisplayController::SchedulePageFlip() {
86 CHECK(state_ == SURFACE_INITIALIZED || state_ == INITIALIZED); 86 CHECK(state_ == SURFACE_INITIALIZED || state_ == INITIALIZED);
87 87
88 if (state_ == SURFACE_INITIALIZED) { 88 if (state_ == SURFACE_INITIALIZED) {
89 // Perform the initial modeset. 89 // Perform the initial modeset.
90 if (!drm_->SetCrtc(crtc_id_, 90 if (!drm_->SetCrtc(crtc_id_,
91 surface_->GetFramebufferId(), 91 surface_->GetFramebufferId(),
92 &connector_id_, 92 &connector_id_,
93 &mode_)) { 93 &mode_)) {
94 DLOG(ERROR) << "Cannot set CRTC: " << strerror(errno); 94 DLOG(ERROR) << "Cannot set CRTC: " << strerror(errno);
95 state_ = FAILED; 95 state_ = FAILED;
(...skipping 13 matching lines...) Expand all
109 this)) { 109 this)) {
110 state_ = FAILED; 110 state_ = FAILED;
111 LOG(ERROR) << "Cannot page flip: " << strerror(errno); 111 LOG(ERROR) << "Cannot page flip: " << strerror(errno);
112 return false; 112 return false;
113 } 113 }
114 114
115 return true; 115 return true;
116 } 116 }
117 117
118 } // namespace gfx 118 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/ozone/impl/hardware_display_controller.h ('k') | ui/gfx/ozone/impl/hardware_display_controller_ozone.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698