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
3 // found in the LICENSE file.
5 #ifndef CHROMEOS_DISPLAY_REAL_OUTPUT_CONFIGURATOR_DELEGATE_H_
6 #define CHROMEOS_DISPLAY_REAL_OUTPUT_CONFIGURATOR_DELEGATE_H_
10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h"
12 #include "chromeos/display/output_configurator.h"
17 typedef struct _XDisplay Display;
18 struct _XRROutputInfo;
19 typedef _XRROutputInfo XRROutputInfo;
20 struct _XRRScreenResources;
21 typedef _XRRScreenResources XRRScreenResources;
25 class RealOutputConfiguratorDelegate : public OutputConfigurator::Delegate {
27 RealOutputConfiguratorDelegate();
28 virtual ~RealOutputConfiguratorDelegate();
30 // OutputConfigurator::Delegate overrides:
31 virtual void InitXRandRExtension(int* event_base) OVERRIDE;
32 virtual void UpdateXRandRConfiguration(
33 const base::NativeEvent& event) OVERRIDE;
34 virtual void GrabServer() OVERRIDE;
35 virtual void UngrabServer() OVERRIDE;
36 virtual void SyncWithServer() OVERRIDE;
37 virtual void SetBackgroundColor(uint32 color_argb) OVERRIDE;
38 virtual void ForceDPMSOn() OVERRIDE;
39 virtual std::vector<OutputConfigurator::OutputSnapshot> GetOutputs() OVERRIDE;
40 virtual void AddOutputMode(RROutput output, RRMode mode) OVERRIDE;
41 virtual bool ConfigureCrtc(
47 virtual void CreateFrameBuffer(
50 const std::vector<OutputConfigurator::OutputSnapshot>& outputs) OVERRIDE;
51 virtual void ConfigureCTM(
53 const OutputConfigurator::CoordinateTransformation& ctm) OVERRIDE;
54 virtual void SendProjectingStateToPowerManager(bool projecting) OVERRIDE;
55 virtual bool GetHDCPState(RROutput id, HDCPState* state) OVERRIDE;
56 virtual bool SetHDCPState(RROutput id, HDCPState state) OVERRIDE;
59 // Initializes |mode_info| to contain details corresponding to |mode|. Returns
61 bool InitModeInfo(RRMode mode, OutputConfigurator::ModeInfo* mode_info);
63 // Helper method for GetOutputs() that returns an OutputSnapshot struct based
64 // on the passed-in information. Further initialization is required (e.g.
65 // |selected_mode|, |mirror_mode|, and |touch_device_id|).
66 OutputConfigurator::OutputSnapshot InitOutputSnapshot(
69 RRCrtc* last_used_crtc,
72 // Destroys unused CRTCs and parks used CRTCs in a way which allows a
73 // framebuffer resize. This is faster than turning them off, resizing,
74 // then turning them back on.
75 void DestroyUnusedCrtcs(
76 const std::vector<OutputConfigurator::OutputSnapshot>& outputs);
78 // Returns whether |id| is configured to preserve aspect when scaling.
79 bool IsOutputAspectPreservingScaling(RROutput id);
81 // Searches for touchscreens among input devices,
82 // and tries to match them up to screens in |outputs|.
83 // |outputs| is an array of detected screens.
84 // If a touchscreen with same resolution as an output's native mode
85 // is detected, its id will be stored in this output.
87 std::vector<OutputConfigurator::OutputSnapshot>* outputs);
92 // Initialized when the server is grabbed and freed when it's ungrabbed.
93 XRRScreenResources* screen_;
95 DISALLOW_COPY_AND_ASSIGN(RealOutputConfiguratorDelegate);
98 } // namespace chromeos
100 #endif // CHROMEOS_DISPLAY_REAL_OUTPUT_CONFIGURATOR_DELEGATE_H_