| 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/observer_list.h" |
| 11 #include "ui/ozone/platform/dri/display_change_observer.h" |
| 11 #include "ui/ozone/platform/dri/hardware_display_controller.h" | 12 #include "ui/ozone/platform/dri/hardware_display_controller.h" |
| 12 | 13 |
| 13 typedef struct _drmModeModeInfo drmModeModeInfo; | 14 typedef struct _drmModeModeInfo drmModeModeInfo; |
| 14 | 15 |
| 15 namespace gfx { | 16 namespace gfx { |
| 16 class Point; | 17 class Point; |
| 17 class Rect; | 18 class Rect; |
| 18 class Size; | 19 class Size; |
| 19 } // namespace gfx | 20 } // namespace gfx |
| 20 | 21 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 42 bool ConfigureDisplayController(uint32_t crtc, | 43 bool ConfigureDisplayController(uint32_t crtc, |
| 43 uint32_t connector, | 44 uint32_t connector, |
| 44 const gfx::Point& origin, | 45 const gfx::Point& origin, |
| 45 const drmModeModeInfo& mode); | 46 const drmModeModeInfo& mode); |
| 46 | 47 |
| 47 // Disable the display controller identified by |crtc|. Note, the controller | 48 // Disable the display controller identified by |crtc|. Note, the controller |
| 48 // may still be connected, so this does not remove the controller. | 49 // may still be connected, so this does not remove the controller. |
| 49 bool DisableDisplayController(uint32_t crtc); | 50 bool DisableDisplayController(uint32_t crtc); |
| 50 | 51 |
| 51 // Returns a reference to the display controller configured to display within | 52 // Returns a reference to the display controller configured to display within |
| 52 // |bounds|. | 53 // |bounds|. If the caller caches the controller it must also register as an |
| 53 // This returns a weak reference since the display controller may be destroyed | 54 // observer to be notified when the controller goes out of scope. |
| 54 // at any point in time, but the changes are propagated to the compositor much | 55 HardwareDisplayController* GetDisplayController(const gfx::Rect& bounds); |
| 55 // later (Compositor owns SurfaceOzone*, which is responsible for updating the | 56 |
| 56 // display surface). | 57 void AddObserver(DisplayChangeObserver* observer); |
| 57 base::WeakPtr<HardwareDisplayController> GetDisplayController( | 58 void RemoveObserver(DisplayChangeObserver* observer); |
| 58 const gfx::Rect& bounds); | |
| 59 | 59 |
| 60 // On non CrOS builds there is no display configurator to look-up available | 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 | 61 // displays and initialize the HDCs. In such cases this is called internally |
| 62 // to initialize a display. | 62 // to initialize a display. |
| 63 virtual void ForceInitializationOfPrimaryDisplay(); | 63 virtual void ForceInitializationOfPrimaryDisplay(); |
| 64 | 64 |
| 65 private: | 65 private: |
| 66 typedef ScopedVector<HardwareDisplayController> HardwareDisplayControllers; | 66 typedef ScopedVector<HardwareDisplayController> HardwareDisplayControllers; |
| 67 | 67 |
| 68 // Returns an iterator into |controllers_| for the controller identified by | 68 // Returns an iterator into |controllers_| for the controller identified by |
| (...skipping 16 matching lines...) Expand all Loading... |
| 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 DriWrapper* dri_; // Not owned. | 90 DriWrapper* dri_; // Not owned. |
| 91 ScanoutBufferGenerator* buffer_generator_; // Not owned. | 91 ScanoutBufferGenerator* buffer_generator_; // Not owned. |
| 92 // List of display controllers (active and disabled). | 92 // List of display controllers (active and disabled). |
| 93 HardwareDisplayControllers controllers_; | 93 HardwareDisplayControllers controllers_; |
| 94 | 94 |
| 95 ObserverList<DisplayChangeObserver> observers_; |
| 96 |
| 95 DISALLOW_COPY_AND_ASSIGN(ScreenManager); | 97 DISALLOW_COPY_AND_ASSIGN(ScreenManager); |
| 96 }; | 98 }; |
| 97 | 99 |
| 98 } // namespace ui | 100 } // namespace ui |
| 99 | 101 |
| 100 #endif // UI_OZONE_PLATFORM_DRI_SCREEN_MANAGER_H_ | 102 #endif // UI_OZONE_PLATFORM_DRI_SCREEN_MANAGER_H_ |
| OLD | NEW |