[idd] config: support fractional refresh rates
Some checks failed
build / client (Debug, map[cc:clang cxx:clang++], libdecor) (push) Has been cancelled
build / client (Debug, map[cc:clang cxx:clang++], xdg-shell) (push) Has been cancelled
build / client (Debug, map[cc:gcc cxx:g++], libdecor) (push) Has been cancelled
build / client (Debug, map[cc:gcc cxx:g++], xdg-shell) (push) Has been cancelled
build / client (Release, map[cc:clang cxx:clang++], libdecor) (push) Has been cancelled
build / client (Release, map[cc:clang cxx:clang++], xdg-shell) (push) Has been cancelled
build / client (Release, map[cc:gcc cxx:g++], libdecor) (push) Has been cancelled
build / client (Release, map[cc:gcc cxx:g++], xdg-shell) (push) Has been cancelled
build / module (push) Has been cancelled
build / host-linux (push) Has been cancelled
build / host-windows-cross (push) Has been cancelled
build / host-windows-native (push) Has been cancelled
build / idd (push) Has been cancelled
build / obs (clang) (push) Has been cancelled
build / obs (gcc) (push) Has been cancelled
build / docs (push) Has been cancelled
build / client-tests (Debug, map[cc:clang cxx:clang++], libdecor) (push) Has been cancelled
build / client-tests (Debug, map[cc:clang cxx:clang++], xdg-shell) (push) Has been cancelled
build / client-tests (Debug, map[cc:gcc cxx:g++], libdecor) (push) Has been cancelled
build / client-tests (Debug, map[cc:gcc cxx:g++], xdg-shell) (push) Has been cancelled
build / client-tests (Release, map[cc:clang cxx:clang++], libdecor) (push) Has been cancelled
build / client-tests (Release, map[cc:clang cxx:clang++], xdg-shell) (push) Has been cancelled
build / client-tests (Release, map[cc:gcc cxx:g++], libdecor) (push) Has been cancelled
build / client-tests (Release, map[cc:gcc cxx:g++], xdg-shell) (push) Has been cancelled

Store refresh rates in millihertz and preserve three decimal places.

Advertise exact rational rates while accepting legacy integer values.

Accept rates from 23.900 through 1000.000 Hz.
This commit is contained in:
Geoffrey McRae
2026-08-06 23:40:08 +10:00
parent a279a87bdb
commit ce47758ebd
13 changed files with 317 additions and 96 deletions

View File

@@ -86,8 +86,8 @@ static const BYTE CTA_COLORIMETRY_BT2020_RGB = (BYTE)(1 << 7);
// changing these timings at runtime can make it treat the IDD as a new monitor.
static const CSettings::DisplayMode EDID_DISPLAY_MODES[] =
{
{ 1024, 768, 60, true , false },
{ 800, 600, 60, false, false }
{ 1024, 768, 60000, true , false },
{ 800, 600, 60000, false, false }
};
#pragma pack(push, 1)
@@ -366,7 +366,8 @@ bool CEdid::GetTiming(Timing& timing, const CSettings::DisplayMode& mode)
timing.hActive = mode.width;
timing.vActive = mode.height;
if (timing.hActive == 0 || timing.vActive == 0 || mode.refresh == 0)
if (timing.hActive == 0 || timing.vActive == 0 ||
mode.refreshMilliHz == 0)
return false;
timing.hBlank = std::max<DWORD>(160,
@@ -390,12 +391,11 @@ bool CEdid::GetTiming(Timing& timing, const CSettings::DisplayMode& mode)
if (timing.vFront + timing.vSync >= timing.vBlank)
return false;
const UINT64 pixelClock =
const UINT64 pixelClockMilliHz =
(UINT64)(timing.hActive + timing.hBlank) *
(UINT64)(timing.vActive + timing.vBlank) *
(UINT64)mode.refresh;
const UINT64 pixelClock10KHz = (pixelClock + 5000) / 10000;
timing.pixelClock = pixelClock10KHz * 10000;
(UINT64)mode.refreshMilliHz;
timing.pixelClock = (pixelClockMilliHz + 500) / 1000;
return timing.pixelClock != 0;
}
@@ -411,7 +411,7 @@ static bool MakeDetailedTiming(
timing.hBlank > 4095 || timing.vBlank > 4095)
return false;
const UINT64 pixelClock10KHz = timing.pixelClock / 10000;
const UINT64 pixelClock10KHz = (timing.pixelClock + 5000) / 10000;
if (pixelClock10KHz == 0 || pixelClock10KHz > 0xffff)
return false;