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

Side by Side Diff: ui/ozone/platform/dri/screen_manager.h

Issue 469343003: [Ozone-GBM] Pumb DriWindowDelegate throughout the platform (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef UI_OZONE_PLATFORM_DRI_SCREEN_MANAGER_H_ 5 #ifndef UI_OZONE_PLATFORM_DRI_SCREEN_MANAGER_H_
6 #define UI_OZONE_PLATFORM_DRI_SCREEN_MANAGER_H_ 6 #define UI_OZONE_PLATFORM_DRI_SCREEN_MANAGER_H_
7 7
8 #include <map>
9
10 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/memory/scoped_vector.h"
11 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
12 #include "ui/gfx/native_widget_types.h"
13 #include "ui/ozone/platform/dri/hardware_display_controller.h" 11 #include "ui/ozone/platform/dri/hardware_display_controller.h"
14 12
15 typedef struct _drmModeModeInfo drmModeModeInfo; 13 typedef struct _drmModeModeInfo drmModeModeInfo;
16 14
17 namespace gfx { 15 namespace gfx {
18 class Point; 16 class Point;
19 class Rect; 17 class Rect;
20 class Size; 18 class Size;
21 } // namespace gfx 19 } // namespace gfx
22 20
(...skipping 17 matching lines...) Expand all
40 // modeset using |mode|. 38 // modeset using |mode|.
41 bool ConfigureDisplayController(uint32_t crtc, 39 bool ConfigureDisplayController(uint32_t crtc,
42 uint32_t connector, 40 uint32_t connector,
43 const gfx::Point& origin, 41 const gfx::Point& origin,
44 const drmModeModeInfo& mode); 42 const drmModeModeInfo& mode);
45 43
46 // Disable the display controller identified by |crtc|. Note, the controller 44 // Disable the display controller identified by |crtc|. Note, the controller
47 // may still be connected, so this does not remove the controller. 45 // may still be connected, so this does not remove the controller.
48 bool DisableDisplayController(uint32_t crtc); 46 bool DisableDisplayController(uint32_t crtc);
49 47
50 // Returns a reference to the display controller associated with |widget|.
51 // This returns a weak reference since the display controller may be destroyed
52 // at any point in time, but the changes are propagated to the compositor much
53 // later (Compositor owns SurfaceOzone*, which is responsible for updating the
54 // display surface).
55 base::WeakPtr<HardwareDisplayController> GetDisplayController(
56 gfx::AcceleratedWidget widget);
57
58 // Returns a reference to the display controller configured to display within 48 // Returns a reference to the display controller configured to display within
59 // |bounds|. 49 // |bounds|.
60 // This returns a weak reference since the display controller may be destroyed 50 // This returns a weak reference since the display controller may be destroyed
61 // at any point in time, but the changes are propagated to the compositor much 51 // at any point in time, but the changes are propagated to the compositor much
62 // later (Compositor owns SurfaceOzone*, which is responsible for updating the 52 // later (Compositor owns SurfaceOzone*, which is responsible for updating the
63 // display surface). 53 // display surface).
64 base::WeakPtr<HardwareDisplayController> GetDisplayController( 54 base::WeakPtr<HardwareDisplayController> GetDisplayController(
65 const gfx::Rect& bounds); 55 const gfx::Rect& bounds);
66 56
67 private: 57 private:
68 typedef std::map<gfx::AcceleratedWidget, HardwareDisplayController*> 58 typedef ScopedVector<HardwareDisplayController> HardwareDisplayControllers;
69 HardwareDisplayControllerMap;
70 59
71 // Returns an iterator into |controllers_| for the controller identified by 60 // Returns an iterator into |controllers_| for the controller identified by
72 // (|crtc|, |connector|). 61 // (|crtc|, |connector|).
73 HardwareDisplayControllerMap::iterator FindDisplayController( 62 HardwareDisplayControllers::iterator FindDisplayController(uint32_t crtc);
74 uint32_t crtc);
75 63
76 // Returns an iterator into |controllers_| for the controller located at 64 // Returns an iterator into |controllers_| for the controller located at
77 // |origin|. 65 // |origin|.
78 HardwareDisplayControllerMap::iterator FindDisplayControllerByOrigin( 66 HardwareDisplayControllers::iterator FindActiveDisplayControllerByLocation(
79 const gfx::Point& origin);
80
81 // Returns an iterator into |controllers_| for the controller located within
82 // |bounds|.
83 HardwareDisplayControllerMap::iterator FindActiveDisplayControllerByLocation(
84 const gfx::Rect& bounds); 67 const gfx::Rect& bounds);
85 68
86 // Perform modesetting in |controller| using |origin| and |mode|. 69 // Perform modesetting in |controller| using |origin| and |mode|.
87 bool ModesetDisplayController(HardwareDisplayController* controller, 70 bool ModesetDisplayController(HardwareDisplayController* controller,
88 const gfx::Point& origin, 71 const gfx::Point& origin,
89 const drmModeModeInfo& mode); 72 const drmModeModeInfo& mode);
90 73
91 // Tries to set the controller identified by (|crtc|, |connector|) to mirror 74 // Tries to set the controller identified by (|crtc|, |connector|) to mirror
92 // those in |mirror|. |original| is an iterator to the HDC where the 75 // those in |mirror|. |original| is an iterator to the HDC where the
93 // controller is currently present. 76 // controller is currently present.
94 bool HandleMirrorMode( 77 bool HandleMirrorMode(HardwareDisplayControllers::iterator original,
95 HardwareDisplayControllerMap::iterator original, 78 HardwareDisplayControllers::iterator mirror,
96 HardwareDisplayControllerMap::iterator mirror, 79 uint32_t crtc,
97 uint32_t crtc, 80 uint32_t connector);
98 uint32_t connector);
99 81
100 // On non CrOS builds there is no display configurator to look-up available 82 // On non CrOS builds there is no display configurator to look-up available
101 // displays and initialize the HDCs. In such cases this is called internally 83 // displays and initialize the HDCs. In such cases this is called internally
102 // to initialize a display. 84 // to initialize a display.
103 virtual void ForceInitializationOfPrimaryDisplay(); 85 virtual void ForceInitializationOfPrimaryDisplay();
104 86
105 DriWrapper* dri_; // Not owned. 87 DriWrapper* dri_; // Not owned.
106 ScanoutBufferGenerator* buffer_generator_; // Not owned. 88 ScanoutBufferGenerator* buffer_generator_; // Not owned.
107 // Mapping between an accelerated widget and an active display. 89 // List of display controllers (active and disabled).
108 HardwareDisplayControllerMap controllers_; 90 HardwareDisplayControllers controllers_;
109 gfx::AcceleratedWidget last_added_widget_;
110 91
111 DISALLOW_COPY_AND_ASSIGN(ScreenManager); 92 DISALLOW_COPY_AND_ASSIGN(ScreenManager);
112 }; 93 };
113 94
114 } // namespace ui 95 } // namespace ui
115 96
116 #endif // UI_OZONE_PLATFORM_DRI_SCREEN_MANAGER_H_ 97 #endif // UI_OZONE_PLATFORM_DRI_SCREEN_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698