mirror of
https://github.com/hyprwm/Hyprland.git
synced 2025-05-13 07:10:35 +01:00
renderer: add an option to disable cm and auto-skip cm if not necessary
fixes #9641 adds render:cm_enabled default true
This commit is contained in:
parent
60edb376f2
commit
cca0f48b74
4 changed files with 24 additions and 8 deletions
|
@ -1378,6 +1378,12 @@ inline static const std::vector<SConfigOptionDescription> CONFIG_OPTIONS = {
|
||||||
.type = CONFIG_OPTION_BOOL,
|
.type = CONFIG_OPTION_BOOL,
|
||||||
.data = SConfigOptionDescription::SBoolData{true},
|
.data = SConfigOptionDescription::SBoolData{true},
|
||||||
},
|
},
|
||||||
|
SConfigOptionDescription{
|
||||||
|
.value = "render:cm_enabled",
|
||||||
|
.description = "Enable Color Management pipelines (requires restart to fully take effect)",
|
||||||
|
.type = CONFIG_OPTION_BOOL,
|
||||||
|
.data = SConfigOptionDescription::SBoolData{true},
|
||||||
|
},
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* cursor:
|
* cursor:
|
||||||
|
|
|
@ -692,6 +692,7 @@ CConfigManager::CConfigManager() {
|
||||||
registerConfigVar("render:xp_mode", Hyprlang::INT{0});
|
registerConfigVar("render:xp_mode", Hyprlang::INT{0});
|
||||||
registerConfigVar("render:ctm_animation", Hyprlang::INT{2});
|
registerConfigVar("render:ctm_animation", Hyprlang::INT{2});
|
||||||
registerConfigVar("render:cm_fs_passthrough", Hyprlang::INT{1});
|
registerConfigVar("render:cm_fs_passthrough", Hyprlang::INT{1});
|
||||||
|
registerConfigVar("render:cm_enabled", Hyprlang::INT{1});
|
||||||
|
|
||||||
registerConfigVar("ecosystem:no_update_news", Hyprlang::INT{0});
|
registerConfigVar("ecosystem:no_update_news", Hyprlang::INT{0});
|
||||||
registerConfigVar("ecosystem:no_donation_nag", Hyprlang::INT{0});
|
registerConfigVar("ecosystem:no_donation_nag", Hyprlang::INT{0});
|
||||||
|
|
|
@ -98,6 +98,7 @@ void CProtocolManager::onMonitorModeChange(PHLMONITOR pMonitor) {
|
||||||
CProtocolManager::CProtocolManager() {
|
CProtocolManager::CProtocolManager() {
|
||||||
|
|
||||||
static const auto PENABLEEXPLICIT = CConfigValue<Hyprlang::INT>("render:explicit_sync");
|
static const auto PENABLEEXPLICIT = CConfigValue<Hyprlang::INT>("render:explicit_sync");
|
||||||
|
static const auto PENABLECM = CConfigValue<Hyprlang::INT>("render:cm_enabled");
|
||||||
static const auto PENABLEXXCM = CConfigValue<Hyprlang::INT>("experimental:xx_color_management_v4");
|
static const auto PENABLEXXCM = CConfigValue<Hyprlang::INT>("experimental:xx_color_management_v4");
|
||||||
static const auto PDEBUGCM = CConfigValue<Hyprlang::INT>("debug:full_cm_proto");
|
static const auto PDEBUGCM = CConfigValue<Hyprlang::INT>("debug:full_cm_proto");
|
||||||
|
|
||||||
|
@ -181,14 +182,17 @@ CProtocolManager::CProtocolManager() {
|
||||||
PROTO::ctm = makeUnique<CHyprlandCTMControlProtocol>(&hyprland_ctm_control_manager_v1_interface, 2, "CTMControl");
|
PROTO::ctm = makeUnique<CHyprlandCTMControlProtocol>(&hyprland_ctm_control_manager_v1_interface, 2, "CTMControl");
|
||||||
PROTO::hyprlandSurface = makeUnique<CHyprlandSurfaceProtocol>(&hyprland_surface_manager_v1_interface, 2, "HyprlandSurface");
|
PROTO::hyprlandSurface = makeUnique<CHyprlandSurfaceProtocol>(&hyprland_surface_manager_v1_interface, 2, "HyprlandSurface");
|
||||||
PROTO::contentType = makeUnique<CContentTypeProtocol>(&wp_content_type_manager_v1_interface, 1, "ContentType");
|
PROTO::contentType = makeUnique<CContentTypeProtocol>(&wp_content_type_manager_v1_interface, 1, "ContentType");
|
||||||
PROTO::colorManagement = makeUnique<CColorManagementProtocol>(&wp_color_manager_v1_interface, 1, "ColorManagement", *PDEBUGCM);
|
|
||||||
// please read the top of this file before adding another protocol
|
|
||||||
|
|
||||||
if (*PENABLEXXCM) {
|
if (*PENABLECM)
|
||||||
|
PROTO::colorManagement = makeUnique<CColorManagementProtocol>(&wp_color_manager_v1_interface, 1, "ColorManagement", *PDEBUGCM);
|
||||||
|
|
||||||
|
if (*PENABLEXXCM && *PENABLECM) {
|
||||||
PROTO::xxColorManagement = makeUnique<CXXColorManagementProtocol>(&xx_color_manager_v4_interface, 1, "XXColorManagement");
|
PROTO::xxColorManagement = makeUnique<CXXColorManagementProtocol>(&xx_color_manager_v4_interface, 1, "XXColorManagement");
|
||||||
PROTO::frogColorManagement = makeUnique<CFrogColorManagementProtocol>(&frog_color_management_factory_v1_interface, 1, "FrogColorManagement");
|
PROTO::frogColorManagement = makeUnique<CFrogColorManagementProtocol>(&frog_color_management_factory_v1_interface, 1, "FrogColorManagement");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ! please read the top of this file before adding another protocol
|
||||||
|
|
||||||
for (auto const& b : g_pCompositor->m_pAqBackend->getImplementations()) {
|
for (auto const& b : g_pCompositor->m_pAqBackend->getImplementations()) {
|
||||||
if (b->type() != Aquamarine::AQ_BACKEND_DRM)
|
if (b->type() != Aquamarine::AQ_BACKEND_DRM)
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -1320,8 +1320,9 @@ void CHyprOpenGLImpl::renderTextureInternalWithDamage(SP<CTexture> tex, const CB
|
||||||
CBox newBox = box;
|
CBox newBox = box;
|
||||||
m_RenderData.renderModif.applyToBox(newBox);
|
m_RenderData.renderModif.applyToBox(newBox);
|
||||||
|
|
||||||
static auto PDT = CConfigValue<Hyprlang::INT>("debug:damage_tracking");
|
static const auto PDT = CConfigValue<Hyprlang::INT>("debug:damage_tracking");
|
||||||
static auto PPASS = CConfigValue<Hyprlang::INT>("render:cm_fs_passthrough");
|
static const auto PPASS = CConfigValue<Hyprlang::INT>("render:cm_fs_passthrough");
|
||||||
|
static const auto PENABLECM = CConfigValue<Hyprlang::INT>("render:cm_enabled");
|
||||||
|
|
||||||
// get the needed transform for this texture
|
// get the needed transform for this texture
|
||||||
const bool TRANSFORMS_MATCH = wlTransformToHyprutils(m_RenderData.pMonitor->transform) == tex->m_eTransform; // FIXME: combine them properly!!!
|
const bool TRANSFORMS_MATCH = wlTransformToHyprutils(m_RenderData.pMonitor->transform) == tex->m_eTransform; // FIXME: combine them properly!!!
|
||||||
|
@ -1378,8 +1379,12 @@ void CHyprOpenGLImpl::renderTextureInternalWithDamage(SP<CTexture> tex, const CB
|
||||||
glTexParameteri(tex->m_iTarget, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
glTexParameteri(tex->m_iTarget, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||||
}
|
}
|
||||||
|
|
||||||
const bool skipCM = !m_RenderData.surface /* No surface - no point in CM */
|
const bool SURFACE_HAS_CM = m_RenderData.surface && m_RenderData.surface->colorManagement && m_RenderData.surface->colorManagement->hasImageDescription();
|
||||||
|| !m_bCMSupported /* CM unsupported - hw failed to compile the shader probably */
|
|
||||||
|
const bool skipCM = !*PENABLECM /* CM disabled by the user */
|
||||||
|
|| !m_RenderData.surface /* No surface - no point in CM */
|
||||||
|
|| !m_bCMSupported /* CM unsupported - hw failed to compile the shader probably */
|
||||||
|
|| (!SURFACE_HAS_CM && m_RenderData.pMonitor->imageDescription == SImageDescription{}) /* Surface doesn't have CM and monitor isn't CM'd */
|
||||||
|| (*PPASS && m_RenderData.pMonitor->activeWorkspace && m_RenderData.pMonitor->activeWorkspace->m_bHasFullscreenWindow &&
|
|| (*PPASS && m_RenderData.pMonitor->activeWorkspace && m_RenderData.pMonitor->activeWorkspace->m_bHasFullscreenWindow &&
|
||||||
m_RenderData.pMonitor->activeWorkspace->m_efFullscreenMode == FSMODE_FULLSCREEN) /* Fullscreen window with pass cm enabled */;
|
m_RenderData.pMonitor->activeWorkspace->m_efFullscreenMode == FSMODE_FULLSCREEN) /* Fullscreen window with pass cm enabled */;
|
||||||
|
|
||||||
|
@ -1391,7 +1396,7 @@ void CHyprOpenGLImpl::renderTextureInternalWithDamage(SP<CTexture> tex, const CB
|
||||||
glUseProgram(shader->program);
|
glUseProgram(shader->program);
|
||||||
glUniform1i(shader->texType, texType);
|
glUniform1i(shader->texType, texType);
|
||||||
const auto imageDescription =
|
const auto imageDescription =
|
||||||
m_RenderData.surface.valid() && m_RenderData.surface->colorManagement.valid() ? m_RenderData.surface->colorManagement->imageDescription() : SImageDescription{};
|
m_RenderData.surface && m_RenderData.surface->colorManagement ? m_RenderData.surface->colorManagement->imageDescription() : SImageDescription{};
|
||||||
glUniform1i(shader->sourceTF, imageDescription.transferFunction);
|
glUniform1i(shader->sourceTF, imageDescription.transferFunction);
|
||||||
glUniform1i(shader->targetTF, m_RenderData.pMonitor->imageDescription.transferFunction);
|
glUniform1i(shader->targetTF, m_RenderData.pMonitor->imageDescription.transferFunction);
|
||||||
const auto sourcePrimaries =
|
const auto sourcePrimaries =
|
||||||
|
|
Loading…
Reference in a new issue