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
;
19 // Gets the EDID data from |output| and generates the display id through
20 // |GetDisplayIdFromEDID|.
21 CHROMEOS_EXPORT
bool GetDisplayId(XID output
, size_t index
,
22 int64
* display_id_out
);
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
,
30 int64
* display_id_out
);
32 // Generates the human readable string from EDID obtained for |output|.
33 CHROMEOS_EXPORT
std::string
GetDisplayName(XID output
);
35 // Gets the overscan flag from |output| and stores to |flag|. Returns true if
36 // the flag is found. Otherwise returns false and doesn't touch |flag|. The
37 // output will produce overscan if |flag| is set to true, but the output may
38 // still produce overscan even though it returns true and |flag| is set to
40 CHROMEOS_EXPORT
bool GetOutputOverscanFlag(XID output
, bool* flag
);
42 // Parses |prop| as EDID data and stores extracted data into |manufacturer_id|
43 // and |human_readable_name| and returns true. NULL can be passed for unwanted
44 // output parameters. Some devices (especially internal displays) may not have
45 // the field for |human_readable_name|, and it will return true in that case.
46 CHROMEOS_EXPORT
bool ParseOutputDeviceData(const unsigned char* prop
,
48 uint16
* manufacturer_id
,
49 std::string
* human_readable_name
);
51 // Parses |prop| as EDID data and stores the overscan flag to |flag|. Returns
52 // true if the flag is found. This is exported for x11_util_unittest.cc.
53 CHROMEOS_EXPORT
bool ParseOutputOverscanFlag(const unsigned char* prop
,
57 // Returns true if an output named |name| is an internal display.
58 CHROMEOS_EXPORT
bool IsInternalOutputName(const std::string
& name
);
60 } // namespace chromeos
62 #endif // CHROMEOS_DISPLAY_OUTPUT_UTIL_H_