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

Side by Side Diff: ui/ozone/platform/dri/dri_window_delegate_impl.cc

Issue 908993003: [Ozone-Dri] Rename DriWrapper to DrmDevice (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@udl3-pass-drm-fd
Patch Set: rebased Created 5 years, 9 months 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
OLDNEW
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/dri/dri_window_delegate_impl.h" 5 #include "ui/ozone/platform/dri/dri_window_delegate_impl.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/dri/dri_buffer.h" 11 #include "ui/ozone/platform/dri/dri_buffer.h"
12 #include "ui/ozone/platform/dri/dri_wrapper.h" 12 #include "ui/ozone/platform/dri/drm_device.h"
13 #include "ui/ozone/platform/dri/drm_device_manager.h" 13 #include "ui/ozone/platform/dri/drm_device_manager.h"
14 #include "ui/ozone/platform/dri/screen_manager.h" 14 #include "ui/ozone/platform/dri/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
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 } 174 }
175 175
176 void DriWindowDelegateImpl::OnCursorAnimationTimeout() { 176 void DriWindowDelegateImpl::OnCursorAnimationTimeout() {
177 cursor_frame_++; 177 cursor_frame_++;
178 cursor_frame_ %= cursor_bitmaps_.size(); 178 cursor_frame_ %= cursor_bitmaps_.size();
179 179
180 ResetCursor(true); 180 ResetCursor(true);
181 } 181 }
182 182
183 void DriWindowDelegateImpl::UpdateWidgetToDrmDeviceMapping() { 183 void DriWindowDelegateImpl::UpdateWidgetToDrmDeviceMapping() {
184 scoped_refptr<DriWrapper> drm = nullptr; 184 scoped_refptr<DrmDevice> drm = nullptr;
185 if (controller_) 185 if (controller_)
186 drm = controller_->GetAllocationDriWrapper(); 186 drm = controller_->GetAllocationDrmDevice();
187 187
188 device_manager_->UpdateDrmDevice(widget_, drm); 188 device_manager_->UpdateDrmDevice(widget_, drm);
189 } 189 }
190 190
191 void DriWindowDelegateImpl::UpdateCursorBuffers() { 191 void DriWindowDelegateImpl::UpdateCursorBuffers() {
192 if (!controller_) { 192 if (!controller_) {
193 for (size_t i = 0; i < arraysize(cursor_buffers_); ++i) { 193 for (size_t i = 0; i < arraysize(cursor_buffers_); ++i) {
194 cursor_buffers_[i] = nullptr; 194 cursor_buffers_[i] = nullptr;
195 } 195 }
196 } else { 196 } else {
197 scoped_refptr<DriWrapper> drm = controller_->GetAllocationDriWrapper(); 197 scoped_refptr<DrmDevice> drm = controller_->GetAllocationDrmDevice();
198 198
199 uint64_t cursor_width = 64; 199 uint64_t cursor_width = 64;
200 uint64_t cursor_height = 64; 200 uint64_t cursor_height = 64;
201 drm->GetCapability(DRM_CAP_CURSOR_WIDTH, &cursor_width); 201 drm->GetCapability(DRM_CAP_CURSOR_WIDTH, &cursor_width);
202 drm->GetCapability(DRM_CAP_CURSOR_HEIGHT, &cursor_height); 202 drm->GetCapability(DRM_CAP_CURSOR_HEIGHT, &cursor_height);
203 203
204 SkImageInfo info = SkImageInfo::MakeN32Premul(cursor_width, cursor_height); 204 SkImageInfo info = SkImageInfo::MakeN32Premul(cursor_width, cursor_height);
205 for (size_t i = 0; i < arraysize(cursor_buffers_); ++i) { 205 for (size_t i = 0; i < arraysize(cursor_buffers_); ++i) {
206 cursor_buffers_[i] = new DriBuffer(drm); 206 cursor_buffers_[i] = new DriBuffer(drm);
207 // Don't register a framebuffer for cursors since they are special (they 207 // Don't register a framebuffer for cursors since they are special (they
208 // aren't modesetting buffers and drivers may fail to register them due to 208 // aren't modesetting buffers and drivers may fail to register them due to
209 // their small sizes). 209 // their small sizes).
210 if (!cursor_buffers_[i]->Initialize( 210 if (!cursor_buffers_[i]->Initialize(
211 info, false /* should_register_framebuffer */)) { 211 info, false /* should_register_framebuffer */)) {
212 LOG(FATAL) << "Failed to initialize cursor buffer"; 212 LOG(FATAL) << "Failed to initialize cursor buffer";
213 return; 213 return;
214 } 214 }
215 } 215 }
216 } 216 }
217 } 217 }
218 218
219 } // namespace ui 219 } // namespace ui
OLDNEW
« no previous file with comments | « ui/ozone/platform/dri/dri_util.cc ('k') | ui/ozone/platform/dri/dri_window_delegate_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698