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
3 // found in the LICENSE file.
5 #ifndef CHROMEOS_DISPLAY_NATIVE_DISPLAY_DELEGATE_X11_H_
6 #define CHROMEOS_DISPLAY_NATIVE_DISPLAY_DELEGATE_X11_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 NativeDisplayDelegateX11
26 : public OutputConfigurator::NativeDisplayDelegate {
28 NativeDisplayDelegateX11();
29 virtual ~NativeDisplayDelegateX11();
31 // OutputConfigurator::Delegate overrides:
32 virtual void InitXRandRExtension(int* event_base) OVERRIDE;
33 virtual void UpdateXRandRConfiguration(const base::NativeEvent& event)
35 virtual void GrabServer() OVERRIDE;
36 virtual void UngrabServer() OVERRIDE;
37 virtual void SyncWithServer() OVERRIDE;
38 virtual void SetBackgroundColor(uint32 color_argb) OVERRIDE;
39 virtual void ForceDPMSOn() OVERRIDE;
40 virtual std::vector<OutputConfigurator::OutputSnapshot> GetOutputs() OVERRIDE;
41 virtual void AddOutputMode(RROutput output, RRMode mode) OVERRIDE;
42 virtual bool ConfigureCrtc(RRCrtc crtc,
47 virtual void CreateFrameBuffer(
50 const std::vector<OutputConfigurator::OutputSnapshot>& outputs) OVERRIDE;
51 virtual bool GetHDCPState(RROutput id, ui::HDCPState* state) OVERRIDE;
52 virtual bool SetHDCPState(RROutput id, ui::HDCPState state) OVERRIDE;
55 // Initializes |mode_info| to contain details corresponding to |mode|. Returns
57 bool InitModeInfo(RRMode mode, OutputConfigurator::ModeInfo* mode_info);
59 // Helper method for GetOutputs() that returns an OutputSnapshot struct based
60 // on the passed-in information. Further initialization is required (e.g.
61 // |selected_mode|, |mirror_mode|, and |touch_device_id|).
62 OutputConfigurator::OutputSnapshot InitOutputSnapshot(RROutput id,
64 RRCrtc* last_used_crtc,
67 // Destroys unused CRTCs and parks used CRTCs in a way which allows a
68 // framebuffer resize. This is faster than turning them off, resizing,
69 // then turning them back on.
70 void DestroyUnusedCrtcs(
71 const std::vector<OutputConfigurator::OutputSnapshot>& outputs);
73 // Returns whether |id| is configured to preserve aspect when scaling.
74 bool IsOutputAspectPreservingScaling(RROutput id);
79 // Initialized when the server is grabbed and freed when it's ungrabbed.
80 XRRScreenResources* screen_;
82 DISALLOW_COPY_AND_ASSIGN(NativeDisplayDelegateX11);
85 } // namespace chromeos
87 #endif // CHROMEOS_DISPLAY_NATIVE_DISPLAY_DELEGATE_X11_H_