| OLD | NEW |
| 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 "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/scoped_vector.h" | 9 #include "base/memory/scoped_vector.h" |
| 10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 | 22 |
| 23 class DriWrapper; | 23 class DriWrapper; |
| 24 class ScanoutBufferGenerator; | 24 class ScanoutBufferGenerator; |
| 25 | 25 |
| 26 // Responsible for keeping track of active displays and configuring them. | 26 // Responsible for keeping track of active displays and configuring them. |
| 27 class ScreenManager { | 27 class ScreenManager { |
| 28 public: | 28 public: |
| 29 ScreenManager(DriWrapper* dri, ScanoutBufferGenerator* surface_generator); | 29 ScreenManager(DriWrapper* dri, ScanoutBufferGenerator* surface_generator); |
| 30 virtual ~ScreenManager(); | 30 virtual ~ScreenManager(); |
| 31 | 31 |
| 32 // Register a display controller. This must be called before trying to |
| 33 // configure it. |
| 34 void AddDisplayController(uint32_t crtc, uint32_t connector); |
| 35 |
| 32 // Remove a display controller from the list of active controllers. The | 36 // Remove a display controller from the list of active controllers. The |
| 33 // controller is removed since it was disconnected. | 37 // controller is removed since it was disconnected. |
| 34 void RemoveDisplayController(uint32_t crtc); | 38 void RemoveDisplayController(uint32_t crtc); |
| 35 | 39 |
| 36 // Configure (and add if not present) a display controller. The display | 40 // Configure a display controller. The display controller is identified by |
| 37 // controller is identified by (|crtc|, |connector|) and the controller is | 41 // (|crtc|, |connector|) and the controller is modeset using |mode|. |
| 38 // modeset using |mode|. | |
| 39 bool ConfigureDisplayController(uint32_t crtc, | 42 bool ConfigureDisplayController(uint32_t crtc, |
| 40 uint32_t connector, | 43 uint32_t connector, |
| 41 const gfx::Point& origin, | 44 const gfx::Point& origin, |
| 42 const drmModeModeInfo& mode); | 45 const drmModeModeInfo& mode); |
| 43 | 46 |
| 44 // Disable the display controller identified by |crtc|. Note, the controller | 47 // Disable the display controller identified by |crtc|. Note, the controller |
| 45 // may still be connected, so this does not remove the controller. | 48 // may still be connected, so this does not remove the controller. |
| 46 bool DisableDisplayController(uint32_t crtc); | 49 bool DisableDisplayController(uint32_t crtc); |
| 47 | 50 |
| 48 // Returns a reference to the display controller configured to display within | 51 // Returns a reference to the display controller configured to display within |
| (...skipping 10 matching lines...) Expand all Loading... |
| 59 | 62 |
| 60 // Returns an iterator into |controllers_| for the controller identified by | 63 // Returns an iterator into |controllers_| for the controller identified by |
| 61 // (|crtc|, |connector|). | 64 // (|crtc|, |connector|). |
| 62 HardwareDisplayControllers::iterator FindDisplayController(uint32_t crtc); | 65 HardwareDisplayControllers::iterator FindDisplayController(uint32_t crtc); |
| 63 | 66 |
| 64 // Returns an iterator into |controllers_| for the controller located at | 67 // Returns an iterator into |controllers_| for the controller located at |
| 65 // |origin|. | 68 // |origin|. |
| 66 HardwareDisplayControllers::iterator FindActiveDisplayControllerByLocation( | 69 HardwareDisplayControllers::iterator FindActiveDisplayControllerByLocation( |
| 67 const gfx::Rect& bounds); | 70 const gfx::Rect& bounds); |
| 68 | 71 |
| 72 // Returns an iterator to the first controller located at |origin|. The |
| 73 // controller may be disabled. |
| 74 HardwareDisplayControllers::iterator FindDisplayControllerByLocation( |
| 75 const gfx::Rect& bounds); |
| 76 |
| 69 // Perform modesetting in |controller| using |origin| and |mode|. | 77 // Perform modesetting in |controller| using |origin| and |mode|. |
| 70 bool ModesetDisplayController(HardwareDisplayController* controller, | 78 bool ModesetDisplayController(HardwareDisplayController* controller, |
| 71 const gfx::Point& origin, | 79 const gfx::Point& origin, |
| 72 const drmModeModeInfo& mode); | 80 const drmModeModeInfo& mode); |
| 73 | 81 |
| 74 // Tries to set the controller identified by (|crtc|, |connector|) to mirror | 82 // Tries to set the controller identified by (|crtc|, |connector|) to mirror |
| 75 // those in |mirror|. |original| is an iterator to the HDC where the | 83 // those in |mirror|. |original| is an iterator to the HDC where the |
| 76 // controller is currently present. | 84 // controller is currently present. |
| 77 bool HandleMirrorMode(HardwareDisplayControllers::iterator original, | 85 bool HandleMirrorMode(HardwareDisplayControllers::iterator original, |
| 78 HardwareDisplayControllers::iterator mirror, | 86 HardwareDisplayControllers::iterator mirror, |
| 79 uint32_t crtc, | 87 uint32_t crtc, |
| 80 uint32_t connector); | 88 uint32_t connector); |
| 81 | 89 |
| 82 // On non CrOS builds there is no display configurator to look-up available | 90 // On non CrOS builds there is no display configurator to look-up available |
| 83 // displays and initialize the HDCs. In such cases this is called internally | 91 // displays and initialize the HDCs. In such cases this is called internally |
| 84 // to initialize a display. | 92 // to initialize a display. |
| 85 virtual void ForceInitializationOfPrimaryDisplay(); | 93 virtual void ForceInitializationOfPrimaryDisplay(); |
| 86 | 94 |
| 87 DriWrapper* dri_; // Not owned. | 95 DriWrapper* dri_; // Not owned. |
| 88 ScanoutBufferGenerator* buffer_generator_; // Not owned. | 96 ScanoutBufferGenerator* buffer_generator_; // Not owned. |
| 89 // List of display controllers (active and disabled). | 97 // List of display controllers (active and disabled). |
| 90 HardwareDisplayControllers controllers_; | 98 HardwareDisplayControllers controllers_; |
| 91 | 99 |
| 92 DISALLOW_COPY_AND_ASSIGN(ScreenManager); | 100 DISALLOW_COPY_AND_ASSIGN(ScreenManager); |
| 93 }; | 101 }; |
| 94 | 102 |
| 95 } // namespace ui | 103 } // namespace ui |
| 96 | 104 |
| 97 #endif // UI_OZONE_PLATFORM_DRI_SCREEN_MANAGER_H_ | 105 #endif // UI_OZONE_PLATFORM_DRI_SCREEN_MANAGER_H_ |
| OLD | NEW |