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/drm/gpu/drm_window.h" | 5 #include "ui/ozone/platform/drm/gpu/drm_window.h" |
6 | 6 |
7 #include "base/trace_event/trace_event.h" | 7 #include "base/trace_event/trace_event.h" |
8 #include "third_party/skia/include/core/SkBitmap.h" | 8 #include "third_party/skia/include/core/SkBitmap.h" |
9 #include "third_party/skia/include/core/SkDevice.h" | 9 #include "third_party/skia/include/core/SkDevice.h" |
10 #include "third_party/skia/include/core/SkSurface.h" | 10 #include "third_party/skia/include/core/SkSurface.h" |
11 #include "ui/ozone/platform/drm/gpu/drm_buffer.h" | 11 #include "ui/ozone/platform/drm/gpu/drm_buffer.h" |
12 #include "ui/ozone/platform/drm/gpu/drm_device.h" | 12 #include "ui/ozone/platform/drm/gpu/drm_device.h" |
13 #include "ui/ozone/platform/drm/gpu/drm_device_manager.h" | 13 #include "ui/ozone/platform/drm/gpu/drm_device_manager.h" |
14 #include "ui/ozone/platform/drm/gpu/screen_manager.h" | 14 #include "ui/ozone/platform/drm/gpu/screen_manager.h" |
15 | 15 |
16 namespace ui { | 16 namespace ui { |
17 | 17 |
18 namespace { | 18 namespace { |
19 | 19 |
20 #ifndef DRM_CAP_CURSOR_WIDTH | 20 #ifndef DRM_CAP_CURSOR_WIDTH |
21 #define DRM_CAP_CURSOR_WIDTH 0x8 | 21 #define DRM_CAP_CURSOR_WIDTH 0x8 |
22 #endif | 22 #endif |
23 | 23 |
24 #ifndef DRM_CAP_CURSOR_HEIGHT | 24 #ifndef DRM_CAP_CURSOR_HEIGHT |
25 #define DRM_CAP_CURSOR_HEIGHT 0x9 | 25 #define DRM_CAP_CURSOR_HEIGHT 0x9 |
26 #endif | 26 #endif |
27 | 27 |
28 void EmptyFlipCallback(gfx::SwapResult) { | |
29 } | |
30 | |
28 void UpdateCursorImage(DrmBuffer* cursor, const SkBitmap& image) { | 31 void UpdateCursorImage(DrmBuffer* cursor, const SkBitmap& image) { |
29 SkRect damage; | 32 SkRect damage; |
30 image.getBounds(&damage); | 33 image.getBounds(&damage); |
31 | 34 |
32 // Clear to transparent in case |image| is smaller than the canvas. | 35 // Clear to transparent in case |image| is smaller than the canvas. |
33 SkCanvas* canvas = cursor->GetCanvas(); | 36 SkCanvas* canvas = cursor->GetCanvas(); |
34 canvas->clear(SK_ColorTRANSPARENT); | 37 canvas->clear(SK_ColorTRANSPARENT); |
35 | 38 |
36 SkRect clip; | 39 SkRect clip; |
37 clip.set(0, 0, canvas->getDeviceSize().width(), | 40 clip.set(0, 0, canvas->getDeviceSize().width(), |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
132 | 135 |
133 if (controller_) { | 136 if (controller_) { |
134 return controller_->SchedulePageFlip(last_submitted_planes_, is_sync, false, | 137 return controller_->SchedulePageFlip(last_submitted_planes_, is_sync, false, |
135 callback); | 138 callback); |
136 } | 139 } |
137 | 140 |
138 callback.Run(gfx::SwapResult::SWAP_ACK); | 141 callback.Run(gfx::SwapResult::SWAP_ACK); |
139 return true; | 142 return true; |
140 } | 143 } |
141 | 144 |
145 bool DrmWindow::TestPageFlip(const OverlayPlaneList& planes) { | |
146 return controller_ && | |
spang
2015/06/01 19:47:39
Shouldn't it be
if (!controller_)
return true;
achaulk
2015/06/01 20:43:08
Sure? It doesn't really matter what we return
| |
147 controller_->SchedulePageFlip(last_submitted_planes_, true, true, | |
148 base::Bind(&EmptyFlipCallback)); | |
149 } | |
150 | |
142 const OverlayPlane* DrmWindow::GetLastModesetBuffer() { | 151 const OverlayPlane* DrmWindow::GetLastModesetBuffer() { |
143 return OverlayPlane::GetPrimaryPlane(last_submitted_planes_); | 152 return OverlayPlane::GetPrimaryPlane(last_submitted_planes_); |
144 } | 153 } |
145 | 154 |
146 void DrmWindow::ResetCursor(bool bitmap_only) { | 155 void DrmWindow::ResetCursor(bool bitmap_only) { |
147 if (!controller_) | 156 if (!controller_) |
148 return; | 157 return; |
149 | 158 |
150 if (cursor_bitmaps_.size()) { | 159 if (cursor_bitmaps_.size()) { |
151 // Draw new cursor into backbuffer. | 160 // Draw new cursor into backbuffer. |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
205 if (!cursor_buffers_[i]->Initialize( | 214 if (!cursor_buffers_[i]->Initialize( |
206 info, false /* should_register_framebuffer */)) { | 215 info, false /* should_register_framebuffer */)) { |
207 LOG(FATAL) << "Failed to initialize cursor buffer"; | 216 LOG(FATAL) << "Failed to initialize cursor buffer"; |
208 return; | 217 return; |
209 } | 218 } |
210 } | 219 } |
211 } | 220 } |
212 } | 221 } |
213 | 222 |
214 } // namespace ui | 223 } // namespace ui |
OLD | NEW |