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_OUTPUT_UTIL_H_
6 #define CHROMEOS_DISPLAY_OUTPUT_UTIL_H_
10 #include "base/basictypes.h"
11 #include "chromeos/chromeos_export.h"
13 // Forward declarations for Xlib and Xrandr.
14 // This is so unused X definitions don't pollute the namespace.
15 typedef unsigned long XID
;
18 typedef _XRRModeInfo XRRModeInfo
;
19 struct _XRRScreenResources
;
20 typedef _XRRScreenResources XRRScreenResources
;
21 struct _XRROutputInfo
;
22 typedef _XRROutputInfo XRROutputInfo
;
26 // Generates the human readable string from EDID obtained for |output|.
27 CHROMEOS_EXPORT
std::string
GetDisplayName(XID output
);
29 // Gets the overscan flag from |output| and stores to |flag|. Returns true if
30 // the flag is found. Otherwise returns false and doesn't touch |flag|. The
31 // output will produce overscan if |flag| is set to true, but the output may
32 // still produce overscan even though it returns true and |flag| is set to
34 CHROMEOS_EXPORT
bool GetOutputOverscanFlag(XID output
, bool* flag
);
36 // Parses |prop| as EDID data and stores the overscan flag to |flag|. Returns
37 // true if the flag is found. This is exported for x11_util_unittest.cc.
38 CHROMEOS_EXPORT
bool ParseOutputOverscanFlag(const unsigned char* prop
,
42 // Returns true if an output named |name| is an internal display.
43 CHROMEOS_EXPORT
bool IsInternalOutputName(const std::string
& name
);
45 // Find a XRRModeInfo that matches |mode|.
46 CHROMEOS_EXPORT
const XRRModeInfo
* FindXRRModeInfo(
47 const XRRScreenResources
* screen_resources
,
50 // Find a mode that matches the given size with highest refresh
51 // rate. Non-interlaced mode takes precedence, so non-interlaced mode
52 // with a lower refresh rate will be used even if there is an interlaced
53 // mode with a higher refresh rate.
54 CHROMEOS_EXPORT RRMode
FindOutputModeMatchingSize(
55 const XRRScreenResources
* screen_resources
,
56 const XRROutputInfo
* output_info
,
62 // Creates XRRModeInfo for unit tests.
63 CHROMEOS_EXPORT XRRModeInfo
CreateModeInfo(int id
,
71 } // namespace chromeos
73 #endif // CHROMEOS_DISPLAY_OUTPUT_UTIL_H_