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/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" |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 device_manager_->GetDrmDevice(gfx::kNullAcceleratedWidget); | 67 device_manager_->GetDrmDevice(gfx::kNullAcceleratedWidget); |
68 | 68 |
69 uint64_t cursor_width = 64; | 69 uint64_t cursor_width = 64; |
70 uint64_t cursor_height = 64; | 70 uint64_t cursor_height = 64; |
71 drm->GetCapability(DRM_CAP_CURSOR_WIDTH, &cursor_width); | 71 drm->GetCapability(DRM_CAP_CURSOR_WIDTH, &cursor_width); |
72 drm->GetCapability(DRM_CAP_CURSOR_HEIGHT, &cursor_height); | 72 drm->GetCapability(DRM_CAP_CURSOR_HEIGHT, &cursor_height); |
73 | 73 |
74 SkImageInfo info = SkImageInfo::MakeN32Premul(cursor_width, cursor_height); | 74 SkImageInfo info = SkImageInfo::MakeN32Premul(cursor_width, cursor_height); |
75 for (size_t i = 0; i < arraysize(cursor_buffers_); ++i) { | 75 for (size_t i = 0; i < arraysize(cursor_buffers_); ++i) { |
76 cursor_buffers_[i] = new DriBuffer(drm); | 76 cursor_buffers_[i] = new DriBuffer(drm); |
77 if (!cursor_buffers_[i]->Initialize(info)) { | 77 // Don't register a framebuffer for cursors since they are special (they |
| 78 // aren't modesetting buffers and drivers may fail to register them due to |
| 79 // their small sizes). |
| 80 if (!cursor_buffers_[i]->Initialize( |
| 81 info, false /* should_register_framebuffer */)) { |
78 LOG(ERROR) << "Failed to initialize cursor buffer"; | 82 LOG(ERROR) << "Failed to initialize cursor buffer"; |
79 return; | 83 return; |
80 } | 84 } |
81 } | 85 } |
82 } | 86 } |
83 | 87 |
84 void DriWindowDelegateImpl::Shutdown() { | 88 void DriWindowDelegateImpl::Shutdown() { |
85 TRACE_EVENT1("dri", "DriWindowDelegateImpl::Shutdown", "widget", widget_); | 89 TRACE_EVENT1("dri", "DriWindowDelegateImpl::Shutdown", "widget", widget_); |
86 screen_manager_->RemoveObserver(this); | 90 screen_manager_->RemoveObserver(this); |
87 device_manager_->RemoveDrmDevice(widget_); | 91 device_manager_->RemoveDrmDevice(widget_); |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 | 196 |
193 void DriWindowDelegateImpl::UpdateWidgetToDrmDeviceMapping() { | 197 void DriWindowDelegateImpl::UpdateWidgetToDrmDeviceMapping() { |
194 scoped_refptr<DriWrapper> drm = nullptr; | 198 scoped_refptr<DriWrapper> drm = nullptr; |
195 if (controller_) | 199 if (controller_) |
196 drm = controller_->GetAllocationDriWrapper(); | 200 drm = controller_->GetAllocationDriWrapper(); |
197 | 201 |
198 device_manager_->UpdateDrmDevice(widget_, drm); | 202 device_manager_->UpdateDrmDevice(widget_, drm); |
199 } | 203 } |
200 | 204 |
201 } // namespace ui | 205 } // namespace ui |
OLD | NEW |