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_OUTPUT_UTIL_H_ | 5 #ifndef CHROMEOS_DISPLAY_OUTPUT_UTIL_H_ |
6 #define CHROMEOS_DISPLAY_OUTPUT_UTIL_H_ | 6 #define CHROMEOS_DISPLAY_OUTPUT_UTIL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "chromeos/chromeos_export.h" | 11 #include "chromeos/chromeos_export.h" |
12 | 12 |
13 // Forward declarations for Xlib and Xrandr. | 13 // Forward declarations for Xlib and Xrandr. |
14 // This is so unused X definitions don't pollute the namespace. | 14 // This is so unused X definitions don't pollute the namespace. |
15 typedef unsigned long XID; | 15 typedef unsigned long XID; |
16 typedef XID RRMode; | 16 typedef XID RRMode; |
17 struct _XRRModeInfo; | 17 struct _XRRModeInfo; |
18 typedef _XRRModeInfo XRRModeInfo; | 18 typedef _XRRModeInfo XRRModeInfo; |
19 struct _XRRScreenResources; | 19 struct _XRRScreenResources; |
20 typedef _XRRScreenResources XRRScreenResources; | 20 typedef _XRRScreenResources XRRScreenResources; |
21 struct _XRROutputInfo; | 21 struct _XRROutputInfo; |
22 typedef _XRROutputInfo XRROutputInfo; | 22 typedef _XRROutputInfo XRROutputInfo; |
23 | 23 |
24 namespace chromeos { | 24 namespace chromeos { |
25 | 25 |
26 // Gets the EDID data from |output| and generates the display id through | |
27 // |GetDisplayIdFromEDID|. | |
28 CHROMEOS_EXPORT bool GetDisplayId(XID output, size_t index, | |
29 int64* display_id_out); | |
30 | |
31 // Generates the display id for the pair of |prop| with |nitems| length and | |
32 // |index|, and store in |display_id_out|. Returns true if the display id is | |
33 // successfully generated, or false otherwise. | |
34 CHROMEOS_EXPORT bool GetDisplayIdFromEDID(const unsigned char* prop, | |
35 unsigned long nitems, | |
36 size_t index, | |
37 int64* display_id_out); | |
38 | |
39 // Generates the human readable string from EDID obtained for |output|. | 26 // Generates the human readable string from EDID obtained for |output|. |
40 CHROMEOS_EXPORT std::string GetDisplayName(XID output); | 27 CHROMEOS_EXPORT std::string GetDisplayName(XID output); |
41 | 28 |
42 // Gets the overscan flag from |output| and stores to |flag|. Returns true if | 29 // Gets the overscan flag from |output| and stores to |flag|. Returns true if |
43 // the flag is found. Otherwise returns false and doesn't touch |flag|. The | 30 // the flag is found. Otherwise returns false and doesn't touch |flag|. The |
44 // output will produce overscan if |flag| is set to true, but the output may | 31 // output will produce overscan if |flag| is set to true, but the output may |
45 // still produce overscan even though it returns true and |flag| is set to | 32 // still produce overscan even though it returns true and |flag| is set to |
46 // false. | 33 // false. |
47 CHROMEOS_EXPORT bool GetOutputOverscanFlag(XID output, bool* flag); | 34 CHROMEOS_EXPORT bool GetOutputOverscanFlag(XID output, bool* flag); |
48 | 35 |
49 // Parses |prop| as EDID data and stores extracted data into |manufacturer_id| | |
50 // and |human_readable_name| and returns true. NULL can be passed for unwanted | |
51 // output parameters. Some devices (especially internal displays) may not have | |
52 // the field for |human_readable_name|, and it will return true in that case. | |
53 CHROMEOS_EXPORT bool ParseOutputDeviceData(const unsigned char* prop, | |
54 unsigned long nitems, | |
55 uint16* manufacturer_id, | |
56 std::string* human_readable_name); | |
57 | |
58 // Parses |prop| as EDID data and stores the overscan flag to |flag|. Returns | 36 // Parses |prop| as EDID data and stores the overscan flag to |flag|. Returns |
59 // true if the flag is found. This is exported for x11_util_unittest.cc. | 37 // true if the flag is found. This is exported for x11_util_unittest.cc. |
60 CHROMEOS_EXPORT bool ParseOutputOverscanFlag(const unsigned char* prop, | 38 CHROMEOS_EXPORT bool ParseOutputOverscanFlag(const unsigned char* prop, |
61 unsigned long nitems, | 39 unsigned long nitems, |
62 bool* flag); | 40 bool* flag); |
63 | 41 |
64 // Returns true if an output named |name| is an internal display. | 42 // Returns true if an output named |name| is an internal display. |
65 CHROMEOS_EXPORT bool IsInternalOutputName(const std::string& name); | 43 CHROMEOS_EXPORT bool IsInternalOutputName(const std::string& name); |
66 | 44 |
67 // Find a XRRModeInfo that matches |mode|. | 45 // Find a XRRModeInfo that matches |mode|. |
(...skipping 18 matching lines...) Expand all Loading... |
86 int width, | 64 int width, |
87 int height, | 65 int height, |
88 bool interlaced, | 66 bool interlaced, |
89 float refresh_rate); | 67 float refresh_rate); |
90 | 68 |
91 } // namespace test | 69 } // namespace test |
92 | 70 |
93 } // namespace chromeos | 71 } // namespace chromeos |
94 | 72 |
95 #endif // CHROMEOS_DISPLAY_OUTPUT_UTIL_H_ | 73 #endif // CHROMEOS_DISPLAY_OUTPUT_UTIL_H_ |
OLD | NEW |