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> |
11 | 12 |
| 13 #include "base/macros.h" |
12 #include "ui/display/types/display_constants.h" | 14 #include "ui/display/types/display_constants.h" |
13 #include "ui/display/util/display_util_export.h" | 15 #include "ui/display/util/display_util_export.h" |
14 | 16 |
15 typedef unsigned long XID; | 17 typedef unsigned long XID; |
16 typedef XID RROutput; | 18 typedef XID RROutput; |
17 | 19 |
18 // Xrandr utility functions to help get EDID information. | 20 // Xrandr utility functions to help get EDID information. |
19 | 21 |
20 namespace ui { | 22 namespace ui { |
21 | 23 |
22 // Gets the EDID data from |output| and generates the display id through | 24 // Xrandr utility class to help get EDID information. |
23 // |GetDisplayIdFromEDID|. | 25 class DISPLAY_UTIL_EXPORT EDIDParserX11 { |
24 DISPLAY_UTIL_EXPORT bool GetDisplayId(XID output, | 26 public: |
25 uint8_t index, | 27 EDIDParserX11(XID output_id); |
26 int64_t* display_id_out); | 28 ~EDIDParserX11(); |
27 | 29 |
28 // Generate the human readable string from EDID obtained from |output|. | 30 // Sets |out_display_id| to the display ID from the EDID of this output. |
29 DISPLAY_UTIL_EXPORT std::string GetDisplayName(RROutput output); | 31 // Returns true if successful, false otherwise. |
| 32 bool GetDisplayId(uint8_t index, int64_t* out_display_id) const; |
30 | 33 |
31 // Gets the overscan flag from |output| and stores to |flag|. Returns true if | 34 // Generate the human readable string from EDID obtained from |output|. |
32 // the flag is found. Otherwise returns false and doesn't touch |flag|. The | 35 // Returns an empty string upon error. |
33 // output will produce overscan if |flag| is set to true, but the output may | 36 std::string GetDisplayName() const; |
34 // still produce overscan even though it returns true and |flag| is set to | 37 |
35 // false. | 38 // Gets the overscan flag and stores to |out_flag|. Returns true if the flag |
36 DISPLAY_UTIL_EXPORT bool GetOutputOverscanFlag(RROutput output, bool* flag); | 39 // is found. Otherwise returns false and doesn't touch |out_flag|. The output |
| 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 }; |
37 | 57 |
38 } // namespace ui | 58 } // namespace ui |
39 | 59 |
40 #endif // UI_DISPLAY_UTIL_X11_EDID_PARSER_X11_H_ | 60 #endif // UI_DISPLAY_UTIL_X11_EDID_PARSER_X11_H_ |
OLD | NEW |