#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "ui/display/util/edid_parser.h"
#include <stddef.h>
#include <algorithm>
#include <bitset>
#include "base/check.h"
#include "base/containers/span.h"
#include "base/hash/hash.h"
#include "base/hash/md5.h"
#include "base/logging.h"
#include "base/metrics/histogram_functions.h"
#include "base/numerics/byte_conversions.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "third_party/abseil-cpp/absl/strings/ascii.h"
#include "third_party/skia/include/core/SkColorSpace.h"
#include "ui/display/util/display_util.h"
#include "ui/gfx/geometry/size.h"
namespace display {
namespace {
constexpr char kParseEdidFailureMetric[] = …;
constexpr char kParseExternalDisplayEdidOptionalsMetric[] = …;
constexpr char kBlockZeroSerialNumberTypeMetric[] = …;
constexpr char kNumOfSerialNumbersProvidedByExternalDisplay[] = …;
constexpr uint8_t kMaxSerialNumberCount = …;
constexpr uint8_t kDisplayIdExtensionTag = …;
enum class ParseEdidFailure { … };
enum class ParseEdidOptionals { … };
enum class BlockZeroSerialNumberType { … };
BlockZeroSerialNumberType GetSerialNumberType(
base::span<const uint8_t, 4u> serial_number) { … }
}
EdidParser::EdidParser(std::vector<uint8_t>&& edid_blob, bool is_external)
: … { … }
EdidParser::EdidParser(EdidParser&& other) = default;
EdidParser& EdidParser::operator=(EdidParser&& other) = default;
EdidParser::~EdidParser() = default;
uint32_t EdidParser::GetProductCode() const { … }
int64_t EdidParser::GetIndexBasedDisplayId(uint8_t output_index) const { … }
int64_t EdidParser::GetEdidBasedDisplayId() const { … }
void EdidParser::SplitProductCodeInManufacturerIdAndProductId(
int64_t product_code,
uint16_t* manufacturer_id,
uint16_t* product_id) { … }
std::string EdidParser::ManufacturerIdToString(uint16_t manufacturer_id) { … }
std::string EdidParser::ProductIdToString(uint16_t product_id) { … }
bool EdidParser::TileCanScaleToFit() const { … }
void EdidParser::ParseEdid(const std::vector<uint8_t>& edid) { … }
void EdidParser::ParseDisplayIdExtension(const std::vector<uint8_t>& edid,
size_t extension_offset) { … }
void EdidParser::ParseTiledDisplayBlock(const std::vector<uint8_t>& edid,
size_t block_offset) { … }
void EdidParser::ReportEdidOptionalsForExternalDisplay() const { … }
}