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

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

Issue 1100973002: [2/4]Allow hotplugging of primary DRM device (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@fix-hotplug
Patch Set: unittests Created 5 years, 8 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
« no previous file with comments | « ui/ozone/platform/drm/gpu/drm_device.cc ('k') | ui/ozone/platform/drm/gpu/drm_device_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/ozone/platform/drm/gpu/drm_device_manager.h
diff --git a/ui/ozone/platform/drm/gpu/drm_device_manager.h b/ui/ozone/platform/drm/gpu/drm_device_manager.h
index 4d0a97ba43472508802c669f1e127815170ee139..34fe61335d62cb1bb9165d8ef3d7ea0467130f68 100644
--- a/ui/ozone/platform/drm/gpu/drm_device_manager.h
+++ b/ui/ozone/platform/drm/gpu/drm_device_manager.h
@@ -6,23 +6,44 @@
#define UI_OZONE_PLATFORM_DRM_GPU_DRM_DEVICE_MANAGER_H_
#include <map>
+#include <vector>
#include "base/memory/ref_counted.h"
+#include "base/memory/scoped_ptr.h"
#include "base/synchronization/lock.h"
+#include "base/threading/thread_checker.h"
#include "ui/gfx/native_widget_types.h"
#include "ui/ozone/ozone_export.h"
+namespace base {
+class FilePath;
+struct FileDescriptor;
+class SingleThreadTaskRunner;
+}
+
namespace ui {
class DrmDevice;
+class DrmDeviceGenerator;
+
+typedef std::vector<scoped_refptr<DrmDevice>> DrmDeviceVector;
// Tracks the mapping between widgets and the DRM devices used to allocate
// buffers for the window represented by the widget.
+// Note: All calls are protected by a lock since
+// GetDrmDevice(gfx::AcceleratedWidget) may be called on the IO thread.
class OZONE_EXPORT DrmDeviceManager {
public:
- DrmDeviceManager(const scoped_refptr<DrmDevice>& primary_device);
+ DrmDeviceManager(scoped_ptr<DrmDeviceGenerator> drm_device_generator);
~DrmDeviceManager();
+ // The first device registered is assumed to be the primary device.
+ bool AddDrmDevice(const base::FilePath& path, const base::FileDescriptor& fd);
+ void RemoveDrmDevice(const base::FilePath& path);
+
+ void InitializeIOTaskRunner(
+ const scoped_refptr<base::SingleThreadTaskRunner>& task_runner);
+
// Updates the device associated with |widget|.
void UpdateDrmDevice(gfx::AcceleratedWidget widget,
const scoped_refptr<DrmDevice>& device);
@@ -34,7 +55,19 @@ class OZONE_EXPORT DrmDeviceManager {
// returns |primary_device_|.
scoped_refptr<DrmDevice> GetDrmDevice(gfx::AcceleratedWidget widget);
+ const DrmDeviceVector& GetDrmDevices() const;
+
private:
+ // With the exception of GetDrmDevice() all functions must be called on GPU
+ // main.
+ base::ThreadChecker thread_checker_;
+
+ scoped_ptr<DrmDeviceGenerator> drm_device_generator_;
+
+ scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_;
+
+ DrmDeviceVector devices_;
+
std::map<gfx::AcceleratedWidget, scoped_refptr<DrmDevice>> drm_device_map_;
// This device represents the primary graphics device and is used when:
« no previous file with comments | « ui/ozone/platform/drm/gpu/drm_device.cc ('k') | ui/ozone/platform/drm/gpu/drm_device_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698