Index: ui/ozone/platform/drm/gpu/drm_device.h |
diff --git a/ui/ozone/platform/drm/gpu/drm_device.h b/ui/ozone/platform/drm/gpu/drm_device.h |
index 2af2d8dcc70a5074a5aa376444caea6088ab21ef..d5ba3fe6d507ffa1b7e8ce04736b1108a305d985 100644 |
--- a/ui/ozone/platform/drm/gpu/drm_device.h |
+++ b/ui/ozone/platform/drm/gpu/drm_device.h |
@@ -5,14 +5,8 @@ |
#ifndef UI_OZONE_PLATFORM_DRM_GPU_DRM_DEVICE_H_ |
#define UI_OZONE_PLATFORM_DRM_GPU_DRM_DEVICE_H_ |
-#include <stdint.h> |
- |
-#include <vector> |
- |
#include "base/callback.h" |
#include "base/files/file.h" |
-#include "base/files/file_path.h" |
-#include "base/macros.h" |
#include "base/memory/ref_counted.h" |
#include "base/memory/scoped_vector.h" |
#include "ui/gfx/geometry/rect.h" |
@@ -36,25 +30,54 @@ namespace ui { |
class HardwareDisplayPlaneManager; |
struct GammaRampRGBEntry; |
+// Wraps /dev/dri/cardX device. |
+class OZONE_EXPORT DrmDeviceBase |
+ : public base::RefCountedThreadSafe<DrmDeviceBase> { |
+ public: |
+ // |task_runner| will be used to asynchronously page flip. |
+ virtual void InitializeTaskRunner( |
+ const scoped_refptr<base::SingleThreadTaskRunner>& task_runner) = 0; |
+ |
+ enum Type { DRM, VGEM }; |
+ virtual Type GetType() const = 0; |
+ |
+ int get_fd() const { return file_.GetPlatformFile(); } |
+ base::FilePath device_path() const { return device_path_; } |
+ |
+ protected: |
+ friend class base::RefCountedThreadSafe<DrmDeviceBase>; |
+ DrmDeviceBase(const base::FilePath& device_path, base::File file); |
+ virtual ~DrmDeviceBase(); |
+ |
+ // Path to GEM device. |
+ const base::FilePath device_path_; |
+ |
+ // GEM device. |
+ base::File file_; |
+ |
+ private: |
+ DISALLOW_COPY_AND_ASSIGN(DrmDeviceBase); |
+}; |
+ |
// Wraps DRM calls into a nice interface. Used to provide different |
// implementations of the DRM calls. For the actual implementation the DRM API |
// would be called. In unit tests this interface would be stubbed. |
-class OZONE_EXPORT DrmDevice : public base::RefCountedThreadSafe<DrmDevice> { |
+class OZONE_EXPORT DrmDevice : public DrmDeviceBase { |
public: |
typedef base::Callback<void(unsigned int /* frame */, |
unsigned int /* seconds */, |
unsigned int /* useconds */)> PageFlipCallback; |
- DrmDevice(const base::FilePath& device_path); |
DrmDevice(const base::FilePath& device_path, base::File file); |
+ // GemDevice implementation: |
+ void InitializeTaskRunner( |
+ const scoped_refptr<base::SingleThreadTaskRunner>& task_runner) override; |
+ Type GetType() const override; |
+ |
// Open device. |
virtual bool Initialize(); |
- // |task_runner| will be used to asynchronously page flip. |
- virtual void InitializeTaskRunner( |
- const scoped_refptr<base::SingleThreadTaskRunner>& task_runner); |
- |
// Get the CRTC state. This is generally used to save state before using the |
// CRTC. When the user finishes using the CRTC, the user should restore the |
// CRTC to it's initial state. Use |SetCrtc| to restore the state. |
@@ -172,16 +195,10 @@ class OZONE_EXPORT DrmDevice : public base::RefCountedThreadSafe<DrmDevice> { |
virtual bool SetMaster(); |
virtual bool DropMaster(); |
- int get_fd() const { return file_.GetPlatformFile(); } |
- |
- base::FilePath device_path() const { return device_path_; } |
- |
HardwareDisplayPlaneManager* plane_manager() { return plane_manager_.get(); } |
protected: |
- friend class base::RefCountedThreadSafe<DrmDevice>; |
- |
- virtual ~DrmDevice(); |
+ ~DrmDevice() override; |
scoped_ptr<HardwareDisplayPlaneManager> plane_manager_; |
@@ -189,12 +206,6 @@ class OZONE_EXPORT DrmDevice : public base::RefCountedThreadSafe<DrmDevice> { |
class IOWatcher; |
class PageFlipManager; |
- // Path to DRM device. |
- const base::FilePath device_path_; |
- |
- // DRM device. |
- base::File file_; |
- |
// Helper thread to perform IO listener operations. |
scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |