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

Side by Side Diff: ui/ozone/platform/drm/gpu/screen_manager.h

Issue 1285183008: Ozone integration. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: add missing license header Created 5 years, 4 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/drm/gpu/scanout_buffer.h ('k') | ui/ozone/platform/drm/gpu/screen_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef UI_OZONE_PLATFORM_DRM_GPU_SCREEN_MANAGER_H_
6 #define UI_OZONE_PLATFORM_DRM_GPU_SCREEN_MANAGER_H_
7
8 #include "base/containers/scoped_ptr_hash_map.h"
9 #include "base/macros.h"
10 #include "base/memory/scoped_vector.h"
11 #include "base/observer_list.h"
12 #include "ui/gfx/native_widget_types.h"
13 #include "ui/ozone/ozone_export.h"
14 #include "ui/ozone/platform/drm/gpu/hardware_display_controller.h"
15
16 typedef struct _drmModeModeInfo drmModeModeInfo;
17
18 namespace gfx {
19 class Point;
20 class Rect;
21 class Size;
22 } // namespace gfx
23
24 namespace ui {
25
26 class DrmDevice;
27 class DrmWindow;
28 class ScanoutBufferGenerator;
29
30 // Responsible for keeping track of active displays and configuring them.
31 class OZONE_EXPORT ScreenManager {
32 public:
33 ScreenManager(ScanoutBufferGenerator* surface_generator);
34 virtual ~ScreenManager();
35
36 // Register a display controller. This must be called before trying to
37 // configure it.
38 void AddDisplayController(const scoped_refptr<DrmDevice>& drm,
39 uint32_t crtc,
40 uint32_t connector);
41
42 // Remove a display controller from the list of active controllers. The
43 // controller is removed since it was disconnected.
44 void RemoveDisplayController(const scoped_refptr<DrmDevice>& drm,
45 uint32_t crtc);
46
47 // Configure a display controller. The display controller is identified by
48 // (|crtc|, |connector|) and the controller is modeset using |mode|.
49 bool ConfigureDisplayController(const scoped_refptr<DrmDevice>& drm,
50 uint32_t crtc,
51 uint32_t connector,
52 const gfx::Point& origin,
53 const drmModeModeInfo& mode);
54
55 // Disable the display controller identified by |crtc|. Note, the controller
56 // may still be connected, so this does not remove the controller.
57 bool DisableDisplayController(const scoped_refptr<DrmDevice>& drm,
58 uint32_t crtc);
59
60 // Returns a reference to the display controller configured to display within
61 // |bounds|. If the caller caches the controller it must also register as an
62 // observer to be notified when the controller goes out of scope.
63 HardwareDisplayController* GetDisplayController(const gfx::Rect& bounds);
64
65 // Adds a window for |widget|. Note: |widget| should not be associated with a
66 // window when calling this function.
67 void AddWindow(gfx::AcceleratedWidget widget, scoped_ptr<DrmWindow> window);
68
69 // Removes the window for |widget|. Note: |widget| must have a window
70 // associated with it when calling this function.
71 scoped_ptr<DrmWindow> RemoveWindow(gfx::AcceleratedWidget widget);
72
73 // Returns the window associated with |widget|. Note: This function should be
74 // called only if a valid window has been associated with |widget|.
75 DrmWindow* GetWindow(gfx::AcceleratedWidget widget);
76
77 // Updates the mapping between display controllers and windows such that a
78 // controller will be associated with at most one window.
79 void UpdateControllerToWindowMapping();
80
81 private:
82 typedef ScopedVector<HardwareDisplayController> HardwareDisplayControllers;
83
84 typedef base::ScopedPtrHashMap<gfx::AcceleratedWidget, scoped_ptr<DrmWindow>>
85 WidgetToWindowMap;
86
87 // Returns an iterator into |controllers_| for the controller identified by
88 // (|crtc|, |connector|).
89 HardwareDisplayControllers::iterator FindDisplayController(
90 const scoped_refptr<DrmDevice>& drm,
91 uint32_t crtc);
92
93 bool ActualConfigureDisplayController(const scoped_refptr<DrmDevice>& drm,
94 uint32_t crtc,
95 uint32_t connector,
96 const gfx::Point& origin,
97 const drmModeModeInfo& mode);
98
99 // Returns an iterator into |controllers_| for the controller located at
100 // |origin|.
101 HardwareDisplayControllers::iterator FindActiveDisplayControllerByLocation(
102 const gfx::Rect& bounds);
103
104 // Tries to set the controller identified by (|crtc|, |connector|) to mirror
105 // those in |mirror|. |original| is an iterator to the HDC where the
106 // controller is currently present.
107 bool HandleMirrorMode(HardwareDisplayControllers::iterator original,
108 HardwareDisplayControllers::iterator mirror,
109 const scoped_refptr<DrmDevice>& drm,
110 uint32_t crtc,
111 uint32_t connector);
112
113 // Modeset the |controller| using |origin| and |mode|. If there is a window at
114 // the controller location, then we'll re-use the current buffer.
115 bool EnableController(HardwareDisplayController* controller,
116 const gfx::Point& origin,
117 const drmModeModeInfo& mode);
118
119 DrmWindow* FindWindowAt(const gfx::Rect& bounds) const;
120
121 ScanoutBufferGenerator* buffer_generator_; // Not owned.
122 // List of display controllers (active and disabled).
123 HardwareDisplayControllers controllers_;
124
125 WidgetToWindowMap window_map_;
126
127 DISALLOW_COPY_AND_ASSIGN(ScreenManager);
128 };
129
130 } // namespace ui
131
132 #endif // UI_OZONE_PLATFORM_DRM_GPU_SCREEN_MANAGER_H_
OLDNEW
« no previous file with comments | « ui/ozone/platform/drm/gpu/scanout_buffer.h ('k') | ui/ozone/platform/drm/gpu/screen_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698