mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-02 14:26:00 +01:00
add 10bit support to displays
This commit is contained in:
parent
28c81fc71e
commit
7d6ccca695
5 changed files with 34 additions and 1 deletions
|
@ -532,6 +532,9 @@ void CConfigManager::handleMonitor(const std::string& command, const std::string
|
|||
if (ARGS[argno] == "mirror") {
|
||||
newrule.mirrorOf = ARGS[argno + 1];
|
||||
argno++;
|
||||
} else if (ARGS[argno] == "bitdepth") {
|
||||
newrule.enable10bit = ARGS[argno + 1] == "10";
|
||||
argno++;
|
||||
} else {
|
||||
Debug::log(ERR, "Config error: invalid monitor syntax");
|
||||
parseError = "invalid syntax at \"" + ARGS[argno] + "\"";
|
||||
|
|
|
@ -38,6 +38,7 @@ struct SMonitorRule {
|
|||
bool disabled = false;
|
||||
wl_output_transform transform = WL_OUTPUT_TRANSFORM_NORMAL;
|
||||
std::string mirrorOf = "";
|
||||
bool enable10bit = false;
|
||||
};
|
||||
|
||||
struct SMonitorAdditionalReservedArea {
|
||||
|
|
|
@ -39,6 +39,7 @@ public:
|
|||
|
||||
bool dpmsStatus = true;
|
||||
bool vrrActive = false; // this can be TRUE even if VRR is not active in the case that this display does not support it.
|
||||
bool enabled10bit = false; // as above, this can be TRUE even if 10 bit failed.
|
||||
|
||||
// mirroring
|
||||
CMonitor* pMirrorOf = nullptr;
|
||||
|
|
|
@ -100,6 +100,8 @@ extern "C" {
|
|||
#include <wlr/types/wlr_touch.h>
|
||||
#include <wlr/types/wlr_switch.h>
|
||||
|
||||
#include <drm_fourcc.h>
|
||||
|
||||
#ifndef NO_XWAYLAND
|
||||
#include <wlr/xwayland.h>
|
||||
#include <X11/Xproto.h>
|
||||
|
|
|
@ -950,7 +950,8 @@ bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorR
|
|||
&& DELTALESSTHAN(pMonitor->refreshRate, pMonitorRule->refreshRate, 1)
|
||||
&& pMonitor->scale == pMonitorRule->scale
|
||||
&& ((DELTALESSTHAN(pMonitor->vecPosition.x, pMonitorRule->offset.x, 1) && DELTALESSTHAN(pMonitor->vecPosition.y, pMonitorRule->offset.y, 1)) || pMonitorRule->offset == Vector2D(-1, -1))
|
||||
&& pMonitor->transform == pMonitorRule->transform) {
|
||||
&& pMonitor->transform == pMonitorRule->transform
|
||||
&& pMonitorRule->enable10bit == pMonitor->enabled10bit) {
|
||||
|
||||
Debug::log(LOG, "Not applying a new rule to %s because it's already applied!", pMonitor->szName.c_str());
|
||||
return true;
|
||||
|
@ -1160,6 +1161,31 @@ bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorR
|
|||
|
||||
pMonitor->vecPixelSize = pMonitor->vecSize;
|
||||
|
||||
if (pMonitorRule->enable10bit) {
|
||||
// try 10b RGB
|
||||
wlr_output_set_render_format(pMonitor->output, DRM_FORMAT_XRGB2101010);
|
||||
pMonitor->enabled10bit = true;
|
||||
|
||||
if (!wlr_output_test(pMonitor->output)) {
|
||||
Debug::log(ERR, "Output %s -> 10 bit enabled, but failed format DRM_FORMAT_XRGB2101010. Trying BGR.", pMonitor->output->name);
|
||||
|
||||
wlr_output_set_render_format(pMonitor->output, DRM_FORMAT_XBGR2101010);
|
||||
|
||||
if (!wlr_output_test(pMonitor->output)) {
|
||||
Debug::log(ERR, "Output %s -> 10 bit enabled, but failed format DRM_FORMAT_XBGR2101010. Falling back to 8 bit.", pMonitor->output->name);
|
||||
|
||||
wlr_output_set_render_format(pMonitor->output, DRM_FORMAT_XRGB8888);
|
||||
} else {
|
||||
Debug::log(LOG, "10bit format DRM_FORMAT_XBGR2101010 succeeded for output %s", pMonitor->output->name);
|
||||
}
|
||||
} else {
|
||||
Debug::log(LOG, "10bit format DRM_FORMAT_XRGB2101010 succeeded for output %s", pMonitor->output->name);
|
||||
}
|
||||
} else {
|
||||
wlr_output_set_render_format(pMonitor->output, DRM_FORMAT_XRGB8888);
|
||||
pMonitor->enabled10bit = false;
|
||||
}
|
||||
|
||||
if (!wlr_output_commit(pMonitor->output)) {
|
||||
Debug::log(ERR, "Couldn't commit output named %s", pMonitor->output->name);
|
||||
return true;
|
||||
|
|
Loading…
Reference in a new issue