desktop: rewrite reserved area handling + improve tests (#12383)
This commit is contained in:
parent
d5c52ef58e
commit
9264436f35
32 changed files with 818 additions and 413 deletions
|
|
@ -603,7 +603,7 @@ bool CMonitor::applyMonitorRule(SMonitorRule* pMonitorRule, bool force) {
|
|||
&& m_transform == RULE->transform && RULE->enable10bit == m_enabled10bit && RULE->cmType == m_cmType && RULE->sdrSaturation == m_sdrSaturation &&
|
||||
RULE->sdrBrightness == m_sdrBrightness && RULE->sdrMinLuminance == m_minLuminance && RULE->sdrMaxLuminance == m_maxLuminance &&
|
||||
RULE->supportsWideColor == m_supportsWideColor && RULE->supportsHDR == m_supportsHDR && RULE->minLuminance == m_minLuminance && RULE->maxLuminance == m_maxLuminance &&
|
||||
RULE->maxAvgLuminance == m_maxAvgLuminance && !std::memcmp(&m_customDrmMode, &RULE->drmMode, sizeof(m_customDrmMode))) {
|
||||
RULE->maxAvgLuminance == m_maxAvgLuminance && !std::memcmp(&m_customDrmMode, &RULE->drmMode, sizeof(m_customDrmMode)) && m_reservedArea == RULE->reservedArea) {
|
||||
|
||||
Debug::log(LOG, "Not applying a new rule to {} because it's already applied!", m_name);
|
||||
|
||||
|
|
@ -614,17 +614,18 @@ bool CMonitor::applyMonitorRule(SMonitorRule* pMonitorRule, bool force) {
|
|||
|
||||
bool autoScale = false;
|
||||
|
||||
if (RULE->scale > 0.1) {
|
||||
if (RULE->scale > 0.1)
|
||||
m_scale = RULE->scale;
|
||||
} else {
|
||||
else {
|
||||
autoScale = true;
|
||||
const auto DEFAULTSCALE = getDefaultScale();
|
||||
m_scale = DEFAULTSCALE;
|
||||
}
|
||||
|
||||
m_setScale = m_scale;
|
||||
m_transform = RULE->transform;
|
||||
m_autoDir = RULE->autoDir;
|
||||
m_setScale = m_scale;
|
||||
m_transform = RULE->transform;
|
||||
m_autoDir = RULE->autoDir;
|
||||
m_reservedArea = RULE->reservedArea;
|
||||
|
||||
// accumulate requested modes in reverse order (cause inesrting at front is inefficient)
|
||||
std::vector<SP<Aquamarine::SOutputMode>> requestedModes;
|
||||
|
|
@ -1517,8 +1518,8 @@ CBox CMonitor::logicalBox() {
|
|||
return {m_position, m_size};
|
||||
}
|
||||
|
||||
CBox CMonitor::logicalBoxMinusExtents() {
|
||||
return {m_position + m_reservedTopLeft, m_size - m_reservedTopLeft - m_reservedBottomRight};
|
||||
CBox CMonitor::logicalBoxMinusReserved() {
|
||||
return m_reservedArea.apply(logicalBox());
|
||||
}
|
||||
|
||||
void CMonitor::scheduleDone() {
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@
|
|||
#include <xf86drmMode.h>
|
||||
#include "time/Timer.hpp"
|
||||
#include "math/Math.hpp"
|
||||
#include "../desktop/reserved/ReservedArea.hpp"
|
||||
#include <optional>
|
||||
#include "../protocols/types/ColorManagement.hpp"
|
||||
#include "signal/Signal.hpp"
|
||||
|
|
@ -37,25 +38,26 @@ enum eAutoDirs : uint8_t {
|
|||
};
|
||||
|
||||
struct SMonitorRule {
|
||||
eAutoDirs autoDir = DIR_AUTO_NONE;
|
||||
std::string name = "";
|
||||
Vector2D resolution = Vector2D(1280, 720);
|
||||
Vector2D offset = Vector2D(0, 0);
|
||||
float scale = 1;
|
||||
float refreshRate = 60; // Hz
|
||||
bool disabled = false;
|
||||
wl_output_transform transform = WL_OUTPUT_TRANSFORM_NORMAL;
|
||||
std::string mirrorOf = "";
|
||||
bool enable10bit = false;
|
||||
NCMType::eCMType cmType = NCMType::CM_SRGB;
|
||||
int sdrEotf = 0;
|
||||
float sdrSaturation = 1.0f; // SDR -> HDR
|
||||
float sdrBrightness = 1.0f; // SDR -> HDR
|
||||
eAutoDirs autoDir = DIR_AUTO_NONE;
|
||||
std::string name = "";
|
||||
Vector2D resolution = Vector2D(1280, 720);
|
||||
Vector2D offset = Vector2D(0, 0);
|
||||
float scale = 1;
|
||||
float refreshRate = 60; // Hz
|
||||
bool disabled = false;
|
||||
wl_output_transform transform = WL_OUTPUT_TRANSFORM_NORMAL;
|
||||
std::string mirrorOf = "";
|
||||
bool enable10bit = false;
|
||||
NCMType::eCMType cmType = NCMType::CM_SRGB;
|
||||
int sdrEotf = 0;
|
||||
float sdrSaturation = 1.0f; // SDR -> HDR
|
||||
float sdrBrightness = 1.0f; // SDR -> HDR
|
||||
Desktop::CReservedArea reservedArea;
|
||||
|
||||
bool supportsWideColor = false; // false does nothing, true overrides EDID
|
||||
bool supportsHDR = false; // false does nothing, true overrides EDID
|
||||
float sdrMinLuminance = 0.2f; // SDR -> HDR
|
||||
int sdrMaxLuminance = 80; // SDR -> HDR
|
||||
bool supportsWideColor = false; // false does nothing, true overrides EDID
|
||||
bool supportsHDR = false; // false does nothing, true overrides EDID
|
||||
float sdrMinLuminance = 0.2f; // SDR -> HDR
|
||||
int sdrMaxLuminance = 80; // SDR -> HDR
|
||||
|
||||
// Incorrect values will result in reduced luminance range or incorrect tonemapping. Shouldn't damage the HW. Use with care in case of a faulty monitor firmware.
|
||||
float minLuminance = -1.0f; // >= 0 overrides EDID
|
||||
|
|
@ -108,11 +110,10 @@ class CMonitor {
|
|||
std::string m_description = "";
|
||||
std::string m_shortDescription = "";
|
||||
|
||||
Vector2D m_reservedTopLeft = Vector2D(0, 0);
|
||||
Vector2D m_reservedBottomRight = Vector2D(0, 0);
|
||||
|
||||
drmModeModeInfo m_customDrmMode = {};
|
||||
|
||||
Desktop::CReservedArea m_reservedArea;
|
||||
|
||||
CMonitorState m_state;
|
||||
CDamageRing m_damage;
|
||||
|
||||
|
|
@ -298,7 +299,7 @@ class CMonitor {
|
|||
WORKSPACEID activeWorkspaceID();
|
||||
WORKSPACEID activeSpecialWorkspaceID();
|
||||
CBox logicalBox();
|
||||
CBox logicalBoxMinusExtents();
|
||||
CBox logicalBoxMinusReserved();
|
||||
void scheduleDone();
|
||||
uint32_t isSolitaryBlocked(bool full = false);
|
||||
void recheckSolitary();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue