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

Unified Diff: ui/ozone/platform/drm/gpu/drm_device_manager.cc

Issue 1124063003: drm: GPU process manages VGEM fd. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: ui/ozone/platform/drm/gpu/drm_device_manager.cc
diff --git a/ui/ozone/platform/drm/gpu/drm_device_manager.cc b/ui/ozone/platform/drm/gpu/drm_device_manager.cc
index b01664abb706586b1332aee3d22d82fa6f87a5f0..5c8ce8dd6e86455604e509f1544ef72fa6874683 100644
--- a/ui/ozone/platform/drm/gpu/drm_device_manager.cc
+++ b/ui/ozone/platform/drm/gpu/drm_device_manager.cc
@@ -38,8 +38,17 @@ DrmDeviceManager::~DrmDeviceManager() {
}
bool DrmDeviceManager::AddDrmDevice(const base::FilePath& path,
- const base::FileDescriptor& fd) {
+ const base::FileDescriptor& fd,
+ bool is_vgem) {
DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK(fd.auto_close);
+
+ if (is_vgem) {
+ vgem_device_.reset(fd.fd);
+ vgem_path_ = path;
+ return true;
+ }
+
base::File file(fd.fd);
auto it =
std::find_if(devices_.begin(), devices_.end(), FindByDevicePath(path));
@@ -67,6 +76,12 @@ bool DrmDeviceManager::AddDrmDevice(const base::FilePath& path,
void DrmDeviceManager::RemoveDrmDevice(const base::FilePath& path) {
DCHECK(thread_checker_.CalledOnValidThread());
+ if (vgem_path_ == path) {
+ vgem_device_.reset();
+ vgem_path_ = base::FilePath();
+ return;
+ }
+
auto it =
std::find_if(devices_.begin(), devices_.end(), FindByDevicePath(path));
if (it == devices_.end()) {
@@ -123,4 +138,9 @@ const DrmDeviceVector& DrmDeviceManager::GetDrmDevices() const {
return devices_;
}
+int DrmDeviceManager::GetVgemDevice() const {
+ DCHECK(thread_checker_.CalledOnValidThread());
+ return vgem_device_.get();
+}
+
} // namespace ui

Powered by Google App Engine
This is Rietveld 408576698