File indexing completed on 2025-03-16 08:15:00
0001 /* 0002 KWin - the KDE window manager 0003 This file is part of the KDE project. 0004 0005 SPDX-FileCopyrightText: 2019 Vlad Zahorodnii <vlad.zahorodnii@kde.org> 0006 0007 SPDX-License-Identifier: GPL-2.0-or-later 0008 */ 0009 0010 #pragma once 0011 0012 #include "core/colorspace.h" 0013 #include "kwin_export.h" 0014 0015 #include <QByteArray> 0016 #include <QList> 0017 #include <QSize> 0018 #include <QVector2D> 0019 0020 namespace KWin 0021 { 0022 0023 /** 0024 * Helper class that can be used for parsing EDID blobs. 0025 * 0026 * http://read.pudn.com/downloads110/ebook/456020/E-EDID%20Standard.pdf 0027 */ 0028 class KWIN_EXPORT Edid 0029 { 0030 public: 0031 Edid(); 0032 Edid(const void *data, uint32_t size); 0033 0034 /** 0035 * Whether this instance of EDID is valid. 0036 */ 0037 bool isValid() const; 0038 0039 /** 0040 * Returns physical dimensions of the monitor, in millimeters. 0041 */ 0042 QSize physicalSize() const; 0043 0044 /** 0045 * Returns EISA ID of the manufacturer of the monitor. 0046 */ 0047 QByteArray eisaId() const; 0048 0049 /** 0050 * Returns the product name of the monitor. 0051 */ 0052 QByteArray monitorName() const; 0053 0054 /** 0055 * Returns the serial number of the monitor. 0056 */ 0057 QByteArray serialNumber() const; 0058 0059 /** 0060 * Returns the name of the vendor. 0061 */ 0062 QByteArray vendor() const; 0063 0064 /** 0065 * Returns the raw edid 0066 */ 0067 QByteArray raw() const; 0068 0069 /** 0070 * returns the vendor if included, the EISA ID if not 0071 */ 0072 QString manufacturerString() const; 0073 0074 /** 0075 * returns a string representing the monitor name 0076 * Can be a serial number or "unknown" if the name is empty 0077 */ 0078 QString nameString() const; 0079 0080 QString hash() const; 0081 0082 std::optional<Colorimetry> colorimetry() const; 0083 0084 double desiredMinLuminance() const; 0085 std::optional<double> desiredMaxFrameAverageLuminance() const; 0086 std::optional<double> desiredMaxLuminance() const; 0087 bool supportsPQ() const; 0088 bool supportsBT2020() const; 0089 0090 /** 0091 * @returns a string that is intended to identify the monitor uniquely. 0092 * Note that multiple monitors can have the same EDID, so this is not always actually unique 0093 */ 0094 QByteArray identifier() const; 0095 0096 private: 0097 QSize m_physicalSize; 0098 QByteArray m_vendor; 0099 QByteArray m_eisaId; 0100 QByteArray m_monitorName; 0101 QByteArray m_serialNumber; 0102 QString m_hash; 0103 std::optional<Colorimetry> m_colorimetry; 0104 struct HDRMetadata 0105 { 0106 double desiredContentMinLuminance; 0107 std::optional<double> desiredContentMaxLuminance; 0108 std::optional<double> desiredMaxFrameAverageLuminance; 0109 bool supportsPQ; 0110 bool supportsBT2020; 0111 }; 0112 std::optional<HDRMetadata> m_hdrMetadata; 0113 0114 QByteArray m_identifier; 0115 0116 QByteArray m_raw; 0117 bool m_isValid = false; 0118 }; 0119 0120 } // namespace KWin