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

Side by Side Diff: ui/ozone/platform/dri/drm_device_manager.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
« no previous file with comments | « ui/ozone/platform/dri/drm_device_manager.h ('k') | ui/ozone/platform/dri/gbm.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/drm_device_manager.h" 5 #include "ui/ozone/platform/dri/drm_device_manager.h"
6 6
7 #include "ui/ozone/platform/dri/dri_wrapper.h" 7 #include "ui/ozone/platform/dri/drm_device.h"
8 8
9 namespace ui { 9 namespace ui {
10 10
11 DrmDeviceManager::DrmDeviceManager( 11 DrmDeviceManager::DrmDeviceManager(
12 const scoped_refptr<DriWrapper>& primary_device) 12 const scoped_refptr<DrmDevice>& primary_device)
13 : primary_device_(primary_device) { 13 : primary_device_(primary_device) {
14 } 14 }
15 15
16 DrmDeviceManager::~DrmDeviceManager() { 16 DrmDeviceManager::~DrmDeviceManager() {
17 DCHECK(drm_device_map_.empty()); 17 DCHECK(drm_device_map_.empty());
18 } 18 }
19 19
20 void DrmDeviceManager::UpdateDrmDevice( 20 void DrmDeviceManager::UpdateDrmDevice(gfx::AcceleratedWidget widget,
21 gfx::AcceleratedWidget widget, 21 const scoped_refptr<DrmDevice>& device) {
22 const scoped_refptr<DriWrapper>& device) {
23 base::AutoLock lock(lock_); 22 base::AutoLock lock(lock_);
24 drm_device_map_[widget] = device; 23 drm_device_map_[widget] = device;
25 } 24 }
26 25
27 void DrmDeviceManager::RemoveDrmDevice(gfx::AcceleratedWidget widget) { 26 void DrmDeviceManager::RemoveDrmDevice(gfx::AcceleratedWidget widget) {
28 base::AutoLock lock(lock_); 27 base::AutoLock lock(lock_);
29 auto it = drm_device_map_.find(widget); 28 auto it = drm_device_map_.find(widget);
30 if (it != drm_device_map_.end()) 29 if (it != drm_device_map_.end())
31 drm_device_map_.erase(it); 30 drm_device_map_.erase(it);
32 } 31 }
33 32
34 scoped_refptr<DriWrapper> DrmDeviceManager::GetDrmDevice( 33 scoped_refptr<DrmDevice> DrmDeviceManager::GetDrmDevice(
35 gfx::AcceleratedWidget widget) { 34 gfx::AcceleratedWidget widget) {
36 base::AutoLock lock(lock_); 35 base::AutoLock lock(lock_);
37 if (widget == gfx::kNullAcceleratedWidget) 36 if (widget == gfx::kNullAcceleratedWidget)
38 return primary_device_; 37 return primary_device_;
39 38
40 auto it = drm_device_map_.find(widget); 39 auto it = drm_device_map_.find(widget);
41 DCHECK(it != drm_device_map_.end()) 40 DCHECK(it != drm_device_map_.end())
42 << "Attempting to get device for unknown widget " << widget; 41 << "Attempting to get device for unknown widget " << widget;
43 // If the widget isn't associated with a display (headless mode) we can 42 // If the widget isn't associated with a display (headless mode) we can
44 // allocate buffers from any controller since they will never be scanned out. 43 // allocate buffers from any controller since they will never be scanned out.
45 // Use the primary DRM device as a fallback when allocating these buffers. 44 // Use the primary DRM device as a fallback when allocating these buffers.
46 if (!it->second) 45 if (!it->second)
47 return primary_device_; 46 return primary_device_;
48 47
49 return it->second; 48 return it->second;
50 } 49 }
51 50
52 } // namespace ui 51 } // namespace ui
OLDNEW
« no previous file with comments | « ui/ozone/platform/dri/drm_device_manager.h ('k') | ui/ozone/platform/dri/gbm.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698