OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 UI_DISPLAY_UTIL_X11_EDID_PARSER_X11_H_ | 5 #ifndef UI_DISPLAY_UTIL_X11_EDID_PARSER_X11_H_ |
6 #define UI_DISPLAY_UTIL_X11_EDID_PARSER_X11_H_ | 6 #define UI_DISPLAY_UTIL_X11_EDID_PARSER_X11_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
11 #include <vector> | |
12 | 11 |
13 #include "base/macros.h" | |
14 #include "ui/display/types/display_constants.h" | 12 #include "ui/display/types/display_constants.h" |
15 #include "ui/display/util/display_util_export.h" | 13 #include "ui/display/util/display_util_export.h" |
16 | 14 |
17 typedef unsigned long XID; | 15 typedef unsigned long XID; |
18 typedef XID RROutput; | 16 typedef XID RROutput; |
19 | 17 |
20 // Xrandr utility functions to help get EDID information. | 18 // Xrandr utility functions to help get EDID information. |
21 | 19 |
22 namespace ui { | 20 namespace ui { |
23 | 21 |
24 // Xrandr utility class to help get EDID information. | 22 // Gets the EDID data from |output| and generates the display id through |
25 class DISPLAY_UTIL_EXPORT EDIDParserX11 { | 23 // |GetDisplayIdFromEDID|. |
26 public: | 24 DISPLAY_UTIL_EXPORT bool GetDisplayId(XID output, |
27 EDIDParserX11(XID output_id); | 25 uint8_t index, |
28 ~EDIDParserX11(); | 26 int64_t* display_id_out); |
29 | 27 |
30 // Sets |out_display_id| to the display ID from the EDID of this output. | 28 // Generate the human readable string from EDID obtained from |output|. |
31 // Returns true if successful, false otherwise. | 29 DISPLAY_UTIL_EXPORT std::string GetDisplayName(RROutput output); |
32 bool GetDisplayId(uint8_t index, int64_t* out_display_id) const; | |
33 | 30 |
34 // Generate the human readable string from EDID obtained from |output|. | 31 // Gets the overscan flag from |output| and stores to |flag|. Returns true if |
35 // Returns an empty string upon error. | 32 // the flag is found. Otherwise returns false and doesn't touch |flag|. The |
36 std::string GetDisplayName() const; | 33 // output will produce overscan if |flag| is set to true, but the output may |
37 | 34 // still produce overscan even though it returns true and |flag| is set to |
38 // Gets the overscan flag and stores to |out_flag|. Returns true if the flag | 35 // false. |
39 // is found. Otherwise returns false and doesn't touch |out_flag|. The output | 36 DISPLAY_UTIL_EXPORT bool GetOutputOverscanFlag(RROutput output, bool* flag); |
40 // will produce overscan if |out_flag| is set to true, but the output may | |
41 // still produce overscan even though it returns true and |out_flag| is set to | |
42 // false. | |
43 bool GetOutputOverscanFlag(bool* out_flag) const; | |
44 | |
45 XID output_id() const { return output_id_; } | |
46 const std::vector<uint8_t>& edid() const { return edid_; } | |
47 | |
48 private: | |
49 XID output_id_; | |
50 | |
51 // This will be an empty vector upon failure to get the EDID from the | |
52 // |output_id_|. | |
53 std::vector<uint8_t> edid_; | |
54 | |
55 DISALLOW_COPY_AND_ASSIGN(EDIDParserX11); | |
56 }; | |
57 | 37 |
58 } // namespace ui | 38 } // namespace ui |
59 | 39 |
60 #endif // UI_DISPLAY_UTIL_X11_EDID_PARSER_X11_H_ | 40 #endif // UI_DISPLAY_UTIL_X11_EDID_PARSER_X11_H_ |
OLD | NEW |