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 | 16 |
17 namespace chromeos { | 17 namespace chromeos { |
18 | 18 |
19 // Generates the display id for the pair of |output| and |index| and store | 19 // Gets the EDID data from |output| and generates the display id through |
20 // in |display_id_out|. Returns true if the display id is successfully | 20 // |GetDisplayIdFromEDID|. |
21 // generated, or false otherwise. | |
22 CHROMEOS_EXPORT bool GetDisplayId(XID output, size_t index, | 21 CHROMEOS_EXPORT bool GetDisplayId(XID output, size_t index, |
23 int64* display_id_out); | 22 int64* display_id_out); |
24 | 23 |
| 24 // Generates the display id for the pair of |prop| with |nitems| length and |
| 25 // |index|, and store in |display_id_out|. Returns true if the display id is |
| 26 // successfully generated, or false otherwise. |
| 27 CHROMEOS_EXPORT bool GetDisplayIdFromEDID(const unsigned char* prop, |
| 28 unsigned long nitems, |
| 29 size_t index, |
| 30 int64* display_id_out); |
| 31 |
25 // Generates the human readable string from EDID obtained for |output|. | 32 // Generates the human readable string from EDID obtained for |output|. |
26 CHROMEOS_EXPORT std::string GetDisplayName(XID output); | 33 CHROMEOS_EXPORT std::string GetDisplayName(XID output); |
27 | 34 |
28 // Gets the overscan flag from |output| and stores to |flag|. Returns true if | 35 // Gets the overscan flag from |output| and stores to |flag|. Returns true if |
29 // the flag is found. Otherwise returns false and doesn't touch |flag|. The | 36 // the flag is found. Otherwise returns false and doesn't touch |flag|. The |
30 // output will produce overscan if |flag| is set to true, but the output may | 37 // output will produce overscan if |flag| is set to true, but the output may |
31 // still produce overscan even though it returns true and |flag| is set to | 38 // still produce overscan even though it returns true and |flag| is set to |
32 // false. | 39 // false. |
33 CHROMEOS_EXPORT bool GetOutputOverscanFlag(XID output, bool* flag); | 40 CHROMEOS_EXPORT bool GetOutputOverscanFlag(XID output, bool* flag); |
34 | 41 |
35 // Parses |prop| as EDID data and stores extracted data into |manufacturer_id|, | 42 // Parses |prop| as EDID data and stores extracted data into |manufacturer_id| |
36 // |product_code|, and |human_readable_name| and returns true. NULL can be | 43 // and |human_readable_name| and returns true. NULL can be |
37 // passed for unwanted output parameters. This is exported for | 44 // passed for unwanted output parameters. This is exported for |
38 // x11_util_unittest.cc. | 45 // x11_util_unittest.cc. |
39 CHROMEOS_EXPORT bool ParseOutputDeviceData(const unsigned char* prop, | 46 CHROMEOS_EXPORT bool ParseOutputDeviceData(const unsigned char* prop, |
40 unsigned long nitems, | 47 unsigned long nitems, |
41 uint16* manufacturer_id, | 48 uint16* manufacturer_id, |
42 uint16* product_code, | |
43 std::string* human_readable_name); | 49 std::string* human_readable_name); |
44 | 50 |
45 // Parses |prop| as EDID data and stores the overscan flag to |flag|. Returns | 51 // Parses |prop| as EDID data and stores the overscan flag to |flag|. Returns |
46 // true if the flag is found. This is exported for x11_util_unittest.cc. | 52 // true if the flag is found. This is exported for x11_util_unittest.cc. |
47 CHROMEOS_EXPORT bool ParseOutputOverscanFlag(const unsigned char* prop, | 53 CHROMEOS_EXPORT bool ParseOutputOverscanFlag(const unsigned char* prop, |
48 unsigned long nitems, | 54 unsigned long nitems, |
49 bool* flag); | 55 bool* flag); |
50 | 56 |
51 // Returns true if an output named |name| is an internal display. | 57 // Returns true if an output named |name| is an internal display. |
52 CHROMEOS_EXPORT bool IsInternalOutputName(const std::string& name); | 58 CHROMEOS_EXPORT bool IsInternalOutputName(const std::string& name); |
53 | 59 |
54 } // namespace chromeos | 60 } // namespace chromeos |
55 | 61 |
56 #endif // CHROMEOS_DISPLAY_OUTPUT_UTIL_H_ | 62 #endif // CHROMEOS_DISPLAY_OUTPUT_UTIL_H_ |
OLD | NEW |