// Copyright 2014 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef UI_DISPLAY_TYPES_DISPLAY_CONSTANTS_H_ #define UI_DISPLAY_TYPES_DISPLAY_CONSTANTS_H_ #include <stdint.h> #include <array> #include "base/containers/enum_set.h" #include "base/containers/flat_map.h" #include "ui/display/types/display_types_export.h" #include "ui/gfx/geometry/size_conversions.h" namespace display { // 1 inch in mm. constexpr float kInchInMm = …; // Display ID that represents an invalid display. Often used as a default value // before display IDs are known. constexpr int64_t kInvalidDisplayId = …; // Display ID that represents a valid display to be used when there's no actual // display connected. constexpr int64_t kDefaultDisplayId = …; // Display ID for a virtual display assigned to a unified desktop. constexpr int64_t kUnifiedDisplayId = …; // Invalid year of manufacture of the display. constexpr int32_t kInvalidYearOfManufacture = …; // Used to determine if the two scale factor values are considered the same. // TODO(crbug.com/40255259): Remove this when the scale factor precision issue // in lacros is fixed. constexpr float kDeviceScaleFactorErrorTolerance = …; // The minimum HDR headroom for an HDR capable display. On macOS, when a // display's brightness is set to maximum, it can report that there is no // HDR headroom via maximumExtendedDynamicRangeColorComponentValue being 1. // On Windows, when the SDR slider is at its maximum, it is possible for the // reported SDR white level to be brighter than the maximum brightness of the // display. These situations can create appearance that a display is rapidly // fluctuating between being HDR capable and HDR incapable. To avoid this // confusion, set this as the minimum maximum relative luminance for HDR // capable displays. constexpr float kMinHDRCapableMaxLuminanceRelative = …; // Set SDR content to 75% of display brightness so SDR colors look good // and there is no perceived brightness change during SDR-HDR. constexpr float kSDRJoint = …; // Set the HDR level multiplier to 4x so that the bright areas of the videos // are not overexposed, and maintain local contrast. constexpr float kHDRLevel = …; // Used to describe the state of a multi-display configuration. enum MultipleDisplayState { … }; // Video output types. enum DisplayConnectionType { … }; // Content protection methods applied on video output. enum ContentProtectionMethod { … }; // Bitmask of all the different HDCP types. constexpr uint32_t kContentProtectionMethodHdcpAll = …; // HDCP protection state. enum HDCPState { … }; // The orientation of the panel in respect to the natural device orientation. enum PanelOrientation { … }; // The existence, or lack thereof, and state of an ePrivacy screen. enum PrivacyScreenState { … }; // Whether a configuration should be seamless or full. Full configuration may // result in visible artifacts such as blanking to achieve the specified // configuration. Seamless configuration requests will fail if the system cannot // achieve it without visible artifacts. enum ConfigurationType { … }; // A flag to allow ui/display and ozone to adjust the behavior of display // configurations. enum class ModesetFlag { … }; // A bitmask of flags as defined in display::ModesetFlag. ModesetFlags; // Enum of possible states for variable refresh rates pertaining to a display. enum class VariableRefreshRateState { … }; // Defines the float values closest to repeating decimal scale factors. constexpr float kDsf_1_777 = …; constexpr float kDsf_2_252 = …; constexpr float kDsf_2_666 = …; constexpr float kDsf_1_8 = …; constexpr char kDsfStr_1_777[] = …; constexpr char kDsfStr_2_252[] = …; constexpr char kDsfStr_2_666[] = …; constexpr char kDsfStr_1_8[] = …; // The total number of display zoom factors to enumerate. constexpr int kNumOfZoomFactors = …; // A pair representing the list of zoom values for a given minimum display // resolution width. ZoomListBucket; // A pair representing the list of zoom values for a given minimum default dsf. ZoomListBucketDsf; // For displays with a device scale factor of unity, we use a static list of // initialized zoom values. For a given resolution width of a display, we can // find its associated list of zoom values by simply finding the last bucket // with a width less than the given resolution width. // Ex. A resolution width of 1024, we will use the bucket with the width of 960. constexpr std::array<ZoomListBucket, 8> kZoomListBuckets{ … }; // Displays with a default device scale factor have a static list of initialized // zoom values that includes a zoom level to go to the native resolution of the // display. Ensure that the list of DSFs are in sync with the list of default // device scale factors in display_change_observer.cc. constexpr std::array<ZoomListBucketDsf, 9> kZoomListBucketsForDsf{ … }; // Valid Displays constexpr gfx::Size kWXGA_768{ … }; constexpr gfx::Size kWXGA_800{ … }; constexpr gfx::Size kHD_PLUS{ … }; constexpr gfx::Size kFHD{ … }; constexpr gfx::Size kSHD{ … }; constexpr gfx::Size kWUXGA{ … }; // Dru constexpr gfx::Size kQXGA_P{ … }; constexpr gfx::Size kQHD{ … }; // Chell constexpr gfx::Size kQHD_PLUS{ … }; constexpr gfx::Size k4K_UHD{ … }; // Chromebook special panels constexpr gfx::Size kLux{ … }; constexpr gfx::Size kAkaliQHD{ … }; constexpr gfx::Size kLink{ … }; constexpr gfx::Size kEveDisplay{ … }; constexpr gfx::Size kNocturne{ … }; enum SizeErrorCheckType { … }; constexpr struct Data { … } display_configs[] = …; // A map of DRM formats and modifiers that are supported by the hardware planes // of the display. // See third_party/libdrm/src/include/drm/drm_fourcc.h for the canonical list of // formats and modifiers DrmFormatsAndModifiers; // Converts the display connection type from enum to string. DISPLAY_TYPES_EXPORT std::string DisplayConnectionTypeString( DisplayConnectionType type); } // namespace display #endif // UI_DISPLAY_TYPES_DISPLAY_CONSTANTS_H_