OLD | NEW |
---|---|
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 CHROMEOS_DISPLAY_REAL_OUTPUT_CONFIGURATOR_DELEGATE_H_ | 5 #ifndef CHROMEOS_DISPLAY_REAL_OUTPUT_CONFIGURATOR_DELEGATE_H_ |
6 #define CHROMEOS_DISPLAY_REAL_OUTPUT_CONFIGURATOR_DELEGATE_H_ | 6 #define CHROMEOS_DISPLAY_REAL_OUTPUT_CONFIGURATOR_DELEGATE_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 10 matching lines...) Expand all Loading... | |
21 typedef _XRRScreenResources XRRScreenResources; | 21 typedef _XRRScreenResources XRRScreenResources; |
22 | 22 |
23 namespace chromeos { | 23 namespace chromeos { |
24 | 24 |
25 class RealOutputConfiguratorDelegate : public OutputConfigurator::Delegate { | 25 class RealOutputConfiguratorDelegate : public OutputConfigurator::Delegate { |
26 public: | 26 public: |
27 RealOutputConfiguratorDelegate(); | 27 RealOutputConfiguratorDelegate(); |
28 virtual ~RealOutputConfiguratorDelegate(); | 28 virtual ~RealOutputConfiguratorDelegate(); |
29 | 29 |
30 // OutputConfigurator::Delegate overrides: | 30 // OutputConfigurator::Delegate overrides: |
31 virtual void SetPanelFittingEnabled(bool enabled) OVERRIDE; | |
32 virtual void InitXRandRExtension(int* event_base) OVERRIDE; | 31 virtual void InitXRandRExtension(int* event_base) OVERRIDE; |
33 virtual void UpdateXRandRConfiguration( | 32 virtual void UpdateXRandRConfiguration( |
34 const base::NativeEvent& event) OVERRIDE; | 33 const base::NativeEvent& event) OVERRIDE; |
35 virtual void GrabServer() OVERRIDE; | 34 virtual void GrabServer() OVERRIDE; |
36 virtual void UngrabServer() OVERRIDE; | 35 virtual void UngrabServer() OVERRIDE; |
37 virtual void SyncWithServer() OVERRIDE; | 36 virtual void SyncWithServer() OVERRIDE; |
38 virtual void SetBackgroundColor(uint32 color_argb) OVERRIDE; | 37 virtual void SetBackgroundColor(uint32 color_argb) OVERRIDE; |
39 virtual void ForceDPMSOn() OVERRIDE; | 38 virtual void ForceDPMSOn() OVERRIDE; |
40 virtual std::vector<OutputConfigurator::OutputSnapshot> GetOutputs( | 39 virtual std::vector<OutputConfigurator::OutputSnapshot> GetOutputs() OVERRIDE; |
41 const OutputConfigurator::StateController* state_controller) OVERRIDE; | 40 virtual void AddOutputMode(RROutput output, RRMode mode) OVERRIDE; |
42 virtual bool ConfigureCrtc( | 41 virtual bool ConfigureCrtc( |
43 RRCrtc crtc, | 42 RRCrtc crtc, |
44 RRMode mode, | 43 RRMode mode, |
45 RROutput output, | 44 RROutput output, |
46 int x, | 45 int x, |
47 int y) OVERRIDE; | 46 int y) OVERRIDE; |
48 virtual void CreateFrameBuffer( | 47 virtual void CreateFrameBuffer( |
49 int width, | 48 int width, |
50 int height, | 49 int height, |
51 const std::vector<OutputConfigurator::OutputSnapshot>& outputs) OVERRIDE; | 50 const std::vector<OutputConfigurator::OutputSnapshot>& outputs) OVERRIDE; |
52 virtual void ConfigureCTM( | 51 virtual void ConfigureCTM( |
53 int touch_device_id, | 52 int touch_device_id, |
54 const OutputConfigurator::CoordinateTransformation& ctm) OVERRIDE; | 53 const OutputConfigurator::CoordinateTransformation& ctm) OVERRIDE; |
55 virtual void SendProjectingStateToPowerManager(bool projecting) OVERRIDE; | 54 virtual void SendProjectingStateToPowerManager(bool projecting) OVERRIDE; |
56 | 55 |
57 private: | 56 private: |
58 // Gets details corresponding to |mode|. Parameters may be NULL. Returns | 57 // Gets details corresponding to |mode|. Parameters may be NULL. Returns |
59 // true on success. | 58 // true on success. |
60 bool GetModeDetails(RRMode mode, int* width, int* height, bool* interlaced); | 59 bool GetModeDetails(RRMode mode, |
60 int* width, | |
61 int* height, | |
62 bool* interlaced, | |
63 float* refresh_rate); | |
oshima
2013/09/17 15:22:14
Maybe this should pass ModeInfo* instead?
Daniel Erat
2013/09/17 15:53:27
Done.
| |
61 | 64 |
62 // Helper method for GetOutputs() that returns an OutputSnapshot struct based | 65 // Helper method for GetOutputs() that returns an OutputSnapshot struct based |
63 // on the passed-in information. Further initialization is required (e.g. | 66 // on the passed-in information. Further initialization is required (e.g. |
64 // |selected_mode|, |mirror_mode|, and |touch_device_id|). | 67 // |selected_mode|, |mirror_mode|, and |touch_device_id|). |
65 OutputConfigurator::OutputSnapshot InitOutputSnapshot( | 68 OutputConfigurator::OutputSnapshot InitOutputSnapshot( |
66 RROutput id, | 69 RROutput id, |
67 XRROutputInfo* info, | 70 XRROutputInfo* info, |
68 RRCrtc* last_used_crtc, | 71 RRCrtc* last_used_crtc, |
69 int index); | 72 int index); |
70 | 73 |
71 // Destroys unused CRTCs and parks used CRTCs in a way which allows a | 74 // Destroys unused CRTCs and parks used CRTCs in a way which allows a |
72 // framebuffer resize. This is faster than turning them off, resizing, | 75 // framebuffer resize. This is faster than turning them off, resizing, |
73 // then turning them back on. | 76 // then turning them back on. |
74 void DestroyUnusedCrtcs( | 77 void DestroyUnusedCrtcs( |
75 const std::vector<OutputConfigurator::OutputSnapshot>& outputs); | 78 const std::vector<OutputConfigurator::OutputSnapshot>& outputs); |
76 | 79 |
77 // Returns whether |id| is configured to preserve aspect when scaling. | 80 // Returns whether |id| is configured to preserve aspect when scaling. |
78 bool IsOutputAspectPreservingScaling(RROutput id); | 81 bool IsOutputAspectPreservingScaling(RROutput id); |
79 | 82 |
80 // Looks for a mode on internal and external outputs having same | |
81 // resolution. |internal_info| and |external_info| are used to search | |
82 // for the modes. |internal_output_id| is used to create a new mode, if | |
83 // applicable. |try_creating|=true will enable creating panel-fitting | |
84 // mode on the |internal_info| output instead of only searching for a | |
85 // matching mode. Note: it may lead to a crash, if |internal_info| is | |
86 // not capable of panel fitting. |preserve_aspect|=true will limit the | |
87 // search / creation only to the modes having the native aspect ratio of | |
88 // |external_info|. |internal_mirror_mode| and |external_mirror_mode| | |
89 // are the out-parameters for the modes on the two outputs which will | |
90 // have the same resolution. Returns false if no mode appropriate for | |
91 // mirroring has been found/created. | |
92 bool FindOrCreateMirrorMode(XRROutputInfo* internal_info, | |
93 XRROutputInfo* external_info, | |
94 RROutput internal_output_id, | |
95 bool try_creating, | |
96 bool preserve_aspect, | |
97 RRMode* internal_mirror_mode, | |
98 RRMode* external_mirror_mode); | |
99 | |
100 // Searches for touchscreens among input devices, | 83 // Searches for touchscreens among input devices, |
101 // and tries to match them up to screens in |outputs|. | 84 // and tries to match them up to screens in |outputs|. |
102 // |outputs| is an array of detected screens. | 85 // |outputs| is an array of detected screens. |
103 // If a touchscreen with same resolution as an output's native mode | 86 // If a touchscreen with same resolution as an output's native mode |
104 // is detected, its id will be stored in this output. | 87 // is detected, its id will be stored in this output. |
105 void GetTouchscreens( | 88 void GetTouchscreens( |
106 std::vector<OutputConfigurator::OutputSnapshot>* outputs); | 89 std::vector<OutputConfigurator::OutputSnapshot>* outputs); |
107 | 90 |
108 Display* display_; | 91 Display* display_; |
109 Window window_; | 92 Window window_; |
110 | 93 |
111 // Initialized when the server is grabbed and freed when it's ungrabbed. | 94 // Initialized when the server is grabbed and freed when it's ungrabbed. |
112 XRRScreenResources* screen_; | 95 XRRScreenResources* screen_; |
113 | 96 |
114 // Used to enable modes which rely on panel fitting. | |
115 bool is_panel_fitting_enabled_; | |
116 | |
117 DISALLOW_COPY_AND_ASSIGN(RealOutputConfiguratorDelegate); | 97 DISALLOW_COPY_AND_ASSIGN(RealOutputConfiguratorDelegate); |
118 }; | 98 }; |
119 | 99 |
120 } // namespace chromeos | 100 } // namespace chromeos |
121 | 101 |
122 #endif // CHROMEOS_DISPLAY_REAL_OUTPUT_CONFIGURATOR_DELEGATE_H_ | 102 #endif // CHROMEOS_DISPLAY_REAL_OUTPUT_CONFIGURATOR_DELEGATE_H_ |
OLD | NEW |