summaryrefslogtreecommitdiffstats
path: root/ui/ozone/platform/drm/gpu/drm_gpu_display_manager.h
diff options
context:
space:
mode:
authordnicoara <dnicoara@chromium.org>2015-03-05 12:46:18 -0800
committerCommit bot <commit-bot@chromium.org>2015-03-05 20:47:08 +0000
commit171d8c892da1b2e38f90c17b62896ba82f0719e3 (patch)
tree9fe2810948b2d8dfd73cd7a5afa002dcf79c0547 /ui/ozone/platform/drm/gpu/drm_gpu_display_manager.h
parentf36607f2398cb4aa9b50449b1221bbc72e3f3453 (diff)
downloadchromium_src-171d8c892da1b2e38f90c17b62896ba82f0719e3.zip
chromium_src-171d8c892da1b2e38f90c17b62896ba82f0719e3.tar.gz
chromium_src-171d8c892da1b2e38f90c17b62896ba82f0719e3.tar.bz2
[Ozone] Rename and split the DRI platform for clarity
This CL does the following: - Moves the files in ui/ozone/platform/dri to ui/ozone/platform/drm since the platform name should really be DRM rather than DRI. Note, that the platform is still refered to as "dri" in GYP/GN since CrOS builds are still using the 'dri' name. - Rename all files with a "_dri*" suffix to a "drm_" prefix. Also rename all files with a "dri_" prefix to a "drm_" prefix. - Rename NativeDisplayDelegateDri to DrmDisplayDelegateManager since it is no longer dependent on the NativeDisplayDelegate interface and the new name better describes its intent. - Split the files in the platform into 2 sub-folders ("host" and "gpu"). Depending on the intended use place of the objects (Browser (host) process or GPU process) the files in the platform are split accordingly in the 2 sub-folders. BUG=none TBR=jam@chromium.org Review URL: https://codereview.chromium.org/975063002 Cr-Commit-Position: refs/heads/master@{#319320}
Diffstat (limited to 'ui/ozone/platform/drm/gpu/drm_gpu_display_manager.h')
-rw-r--r--ui/ozone/platform/drm/gpu/drm_gpu_display_manager.h91
1 files changed, 91 insertions, 0 deletions
diff --git a/ui/ozone/platform/drm/gpu/drm_gpu_display_manager.h b/ui/ozone/platform/drm/gpu/drm_gpu_display_manager.h
new file mode 100644
index 0000000..bbfa508
--- /dev/null
+++ b/ui/ozone/platform/drm/gpu/drm_gpu_display_manager.h
@@ -0,0 +1,91 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef UI_OZONE_PLATFORM_DRM_GPU_DRM_GPU_DISPLAY_MANAGER_H_
+#define UI_OZONE_PLATFORM_DRM_GPU_DRM_GPU_DISPLAY_MANAGER_H_
+
+#include "base/memory/ref_counted.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/memory/scoped_vector.h"
+#include "ui/ozone/common/gpu/ozone_gpu_message_params.h"
+
+namespace base {
+class FilePath;
+class SingleThreadTaskRunner;
+struct FileDescriptor;
+}
+
+namespace ui {
+
+class DeviceManager;
+class DisplayMode;
+class DrmDevice;
+class DrmDeviceGenerator;
+class DrmDisplaySnapshot;
+class DrmDisplayMode;
+class ScreenManager;
+
+class DrmGpuDisplayManager {
+ public:
+ DrmGpuDisplayManager(ScreenManager* screen_manager,
+ const scoped_refptr<DrmDevice>& primary_device,
+ scoped_ptr<DrmDeviceGenerator> device_generator);
+ ~DrmGpuDisplayManager();
+
+ void InitializeIOTaskRunner(
+ const scoped_refptr<base::SingleThreadTaskRunner>& task_runner);
+
+ // Returns a list of the connected displays. When this is called the list of
+ // displays is refreshed.
+ std::vector<DisplaySnapshot_Params> GetDisplays();
+
+ bool ConfigureDisplay(int64_t id,
+ const DisplayMode_Params& mode,
+ const gfx::Point& origin);
+ bool DisableDisplay(int64_t id);
+
+ // Takes/releases the control of the DRM devices.
+ bool TakeDisplayControl();
+ bool RelinquishDisplayControl();
+
+ // Called on DRM hotplug events to add/remove a DRM device.
+ void AddGraphicsDevice(const base::FilePath& path,
+ const base::FileDescriptor& fd);
+ void RemoveGraphicsDevice(const base::FilePath& path);
+
+ private:
+ DrmDisplaySnapshot* FindDisplaySnapshot(int64_t id);
+ const DrmDisplayMode* FindDisplayMode(const gfx::Size& size,
+ bool is_interlaced,
+ float refresh_rate);
+
+ void RefreshDisplayList();
+ bool Configure(const DrmDisplaySnapshot& output,
+ const DrmDisplayMode* mode,
+ const gfx::Point& origin);
+
+ bool GetHDCPState(const DrmDisplaySnapshot& output, HDCPState* state);
+ bool SetHDCPState(const DrmDisplaySnapshot& output, HDCPState state);
+
+ // Notify ScreenManager of all the displays that were present before the
+ // update but are gone after the update.
+ void NotifyScreenManager(
+ const std::vector<DrmDisplaySnapshot*>& new_displays,
+ const std::vector<DrmDisplaySnapshot*>& old_displays) const;
+
+ ScreenManager* screen_manager_; // Not owned.
+ scoped_ptr<DrmDeviceGenerator> drm_device_generator_;
+ scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_;
+ std::vector<scoped_refptr<DrmDevice>> devices_;
+ // Modes can be shared between different displays, so we need to keep track
+ // of them independently for cleanup.
+ ScopedVector<const DisplayMode> cached_modes_;
+ ScopedVector<DrmDisplaySnapshot> cached_displays_;
+
+ DISALLOW_COPY_AND_ASSIGN(DrmGpuDisplayManager);
+};
+
+} // namespace ui
+
+#endif // UI_OZONE_PLATFORM_DRM_GPU_DRM_GPU_DISPLAY_MANAGER_H_