| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 | 50 |
| 51 // Returns a reference to the display controller configured to display within | 51 // Returns a reference to the display controller configured to display within |
| 52 // |bounds|. | 52 // |bounds|. |
| 53 // This returns a weak reference since the display controller may be destroyed | 53 // This returns a weak reference since the display controller may be destroyed |
| 54 // at any point in time, but the changes are propagated to the compositor much | 54 // at any point in time, but the changes are propagated to the compositor much |
| 55 // later (Compositor owns SurfaceOzone*, which is responsible for updating the | 55 // later (Compositor owns SurfaceOzone*, which is responsible for updating the |
| 56 // display surface). | 56 // display surface). |
| 57 base::WeakPtr<HardwareDisplayController> GetDisplayController( | 57 base::WeakPtr<HardwareDisplayController> GetDisplayController( |
| 58 const gfx::Rect& bounds); | 58 const gfx::Rect& bounds); |
| 59 | 59 |
| 60 // On non CrOS builds there is no display configurator to look-up available |
| 61 // displays and initialize the HDCs. In such cases this is called internally |
| 62 // to initialize a display. |
| 63 virtual void ForceInitializationOfPrimaryDisplay(); |
| 64 |
| 60 private: | 65 private: |
| 61 typedef ScopedVector<HardwareDisplayController> HardwareDisplayControllers; | 66 typedef ScopedVector<HardwareDisplayController> HardwareDisplayControllers; |
| 62 | 67 |
| 63 // Returns an iterator into |controllers_| for the controller identified by | 68 // Returns an iterator into |controllers_| for the controller identified by |
| 64 // (|crtc|, |connector|). | 69 // (|crtc|, |connector|). |
| 65 HardwareDisplayControllers::iterator FindDisplayController(uint32_t crtc); | 70 HardwareDisplayControllers::iterator FindDisplayController(uint32_t crtc); |
| 66 | 71 |
| 67 // Returns an iterator into |controllers_| for the controller located at | 72 // Returns an iterator into |controllers_| for the controller located at |
| 68 // |origin|. | 73 // |origin|. |
| 69 HardwareDisplayControllers::iterator FindActiveDisplayControllerByLocation( | 74 HardwareDisplayControllers::iterator FindActiveDisplayControllerByLocation( |
| 70 const gfx::Rect& bounds); | 75 const gfx::Rect& bounds); |
| 71 | 76 |
| 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 | |
| 77 // Perform modesetting in |controller| using |origin| and |mode|. | 77 // Perform modesetting in |controller| using |origin| and |mode|. |
| 78 bool ModesetDisplayController(HardwareDisplayController* controller, | 78 bool ModesetDisplayController(HardwareDisplayController* controller, |
| 79 const gfx::Point& origin, | 79 const gfx::Point& origin, |
| 80 const drmModeModeInfo& mode); | 80 const drmModeModeInfo& mode); |
| 81 | 81 |
| 82 // Tries to set the controller identified by (|crtc|, |connector|) to mirror | 82 // Tries to set the controller identified by (|crtc|, |connector|) to mirror |
| 83 // 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 |
| 84 // controller is currently present. | 84 // controller is currently present. |
| 85 bool HandleMirrorMode(HardwareDisplayControllers::iterator original, | 85 bool HandleMirrorMode(HardwareDisplayControllers::iterator original, |
| 86 HardwareDisplayControllers::iterator mirror, | 86 HardwareDisplayControllers::iterator mirror, |
| 87 uint32_t crtc, | 87 uint32_t crtc, |
| 88 uint32_t connector); | 88 uint32_t connector); |
| 89 | 89 |
| 90 // On non CrOS builds there is no display configurator to look-up available | |
| 91 // displays and initialize the HDCs. In such cases this is called internally | |
| 92 // to initialize a display. | |
| 93 virtual void ForceInitializationOfPrimaryDisplay(); | |
| 94 | |
| 95 DriWrapper* dri_; // Not owned. | 90 DriWrapper* dri_; // Not owned. |
| 96 ScanoutBufferGenerator* buffer_generator_; // Not owned. | 91 ScanoutBufferGenerator* buffer_generator_; // Not owned. |
| 97 // List of display controllers (active and disabled). | 92 // List of display controllers (active and disabled). |
| 98 HardwareDisplayControllers controllers_; | 93 HardwareDisplayControllers controllers_; |
| 99 | 94 |
| 100 DISALLOW_COPY_AND_ASSIGN(ScreenManager); | 95 DISALLOW_COPY_AND_ASSIGN(ScreenManager); |
| 101 }; | 96 }; |
| 102 | 97 |
| 103 } // namespace ui | 98 } // namespace ui |
| 104 | 99 |
| 105 #endif // UI_OZONE_PLATFORM_DRI_SCREEN_MANAGER_H_ | 100 #endif // UI_OZONE_PLATFORM_DRI_SCREEN_MANAGER_H_ |
| OLD | NEW |