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

Unified Diff: chromeos/display/output_configurator.h

Issue 22605008: chromeos: Make OutputConfigurator save latest config. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix interpretation of XRRSetCrtcConfig return value Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chromeos/display/output_configurator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos/display/output_configurator.h
diff --git a/chromeos/display/output_configurator.h b/chromeos/display/output_configurator.h
index a308a45478833113de3c9b4f98221c87a845ab78..fbc7804b217a4b4abcb11560c5c38c5f4a913473 100644
--- a/chromeos/display/output_configurator.h
+++ b/chromeos/display/output_configurator.h
@@ -42,23 +42,41 @@ class CHROMEOS_EXPORT OutputConfigurator
: public base::MessageLoop::Dispatcher,
public base::MessagePumpObserver {
public:
+ struct CoordinateTransformation {
+ // Initialized to the identity transformation.
+ CoordinateTransformation();
+
+ float x_scale;
+ float x_offset;
+ float y_scale;
+ float y_offset;
+ };
+
// Information about an output's current state.
struct OutputSnapshot {
OutputSnapshot();
RROutput output;
- // CRTC that should be used for this output. Not necessarily the CRTC
+ // CRTC that should be used for this output. Not necessarily the CRTC
// that XRandR reports is currently being used.
RRCrtc crtc;
+ // Mode currently being used by the output.
RRMode current_mode;
+
+ // "Best" mode supported by the output.
RRMode native_mode;
+
+ // Mode used when displaying the same desktop on multiple outputs.
RRMode mirror_mode;
+
+ // User-selected mode for the output.
RRMode selected_mode;
+ // Output's origin on the framebuffer.
+ int x;
int y;
- int height;
bool is_internal;
bool is_aspect_preserving_scaling;
@@ -66,33 +84,14 @@ class CHROMEOS_EXPORT OutputConfigurator
// XInput device ID or 0 if this output isn't a touchscreen.
int touch_device_id;
+ CoordinateTransformation transform;
+
// Display id for this output.
int64 display_id;
bool has_display_id;
};
- struct CoordinateTransformation {
- // Initialized to the identity transformation.
- CoordinateTransformation();
-
- float x_scale;
- float x_offset;
- float y_scale;
- float y_offset;
- };
-
- struct CrtcConfig {
- CrtcConfig();
- CrtcConfig(RRCrtc crtc, int x, int y, RRMode mode, RROutput output);
-
- RRCrtc crtc;
- int x;
- int y;
- RRMode mode;
- RROutput output;
- };
-
class Observer {
public:
virtual ~Observer() {}
@@ -176,16 +175,20 @@ class CHROMEOS_EXPORT OutputConfigurator
int* height,
bool* interlaced) = 0;
- // Calls XRRSetCrtcConfig() with the given options but some of our
- // default output count and rotation arguments.
- virtual void ConfigureCrtc(CrtcConfig* config) = 0;
+ // Calls XRRSetCrtcConfig() with the given options but some of our default
+ // output count and rotation arguments. Returns true on success.
+ virtual bool ConfigureCrtc(RRCrtc crtc,
+ RRMode mode,
+ RROutput output,
+ int x,
+ int y) = 0;
// Called to set the frame buffer (underlying XRR "screen") size. Has
// a side-effect of disabling all CRTCs.
virtual void CreateFrameBuffer(
int width,
int height,
- const std::vector<OutputConfigurator::CrtcConfig>& configs) = 0;
+ const std::vector<OutputConfigurator::OutputSnapshot>& outputs) = 0;
// Configures XInput's Coordinate Transformation Matrix property.
// |touch_device_id| the ID of the touchscreen device to configure.
@@ -325,15 +328,17 @@ class CHROMEOS_EXPORT OutputConfigurator
// Switches to the state specified in |output_state| and |power_state|.
// If the hardware mirroring failed and |mirroring_controller_| is set,
// it switches to |STATE_DUAL_EXTENDED| and calls |SetSoftwareMirroring()|
- // to enable software based mirroing.
- // On success, updates |output_state_| and |power_state_| and returns true.
+ // to enable software based mirroring.
+ // On success, updates |output_state_|, |power_state_|, and |cached_outputs_|
+ // and returns true.
bool EnterStateOrFallBackToSoftwareMirroring(
OutputState output_state,
DisplayPowerState power_state,
const std::vector<OutputSnapshot>& outputs);
// Switches to the state specified in |output_state| and |power_state|.
- // On success, updates |output_state_| and |power_state_| and returns true.
+ // On success, updates |output_state_|, |power_state_|, and
+ // |cached_outputs_| and returns true.
bool EnterState(OutputState output_state,
DisplayPowerState power_state,
const std::vector<OutputSnapshot>& outputs);
@@ -383,6 +388,10 @@ class CHROMEOS_EXPORT OutputConfigurator
// The current power state.
DisplayPowerState power_state_;
+ // Most-recently-used output configuration. Note that the actual
+ // configuration changes asynchronously.
+ std::vector<OutputSnapshot> cached_outputs_;
+
ObserverList<Observer> observers_;
// The timer to delay configuring outputs. See also the comments in
« no previous file with comments | « no previous file | chromeos/display/output_configurator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698