[PATCH] winex11.drv: Fix incorrect frequency for doublescan and interlaced modes.
Gabriel Ivăncescu
gabrielopcode at gmail.com
Tue Feb 4 07:03:03 CST 2020
On 04/02/2020 10:37, Zhiyi Zhang wrote:
>
>
> On 2/4/20 4:27 PM, Dmitry Timoshkov wrote:
>> Zhiyi Zhang <zzhang at codeweavers.com> wrote:
>>
>>> +static DWORD get_frequency( const XRRModeInfo *mode )
>>> +{
>>> + if (mode->hTotal && mode->vTotal)
>>> + {
>>> + double v_total = mode->vTotal;
>>> +
>>> + if (mode->modeFlags & RR_DoubleScan)
>>> + v_total *= 2;
>>> + if (mode->modeFlags & RR_Interlace)
>>> + v_total /= 2;
>>> +
>>> + /* Adding 0.05 instead of 0.5 to round so that common frequencies like
>>> + * 59.94Hz and 23.976Hz become 59Hz and 24Hz. Using 0.5 would make
>>> + * 59.94Hz become 60Hz and would make it seem like there are two 60Hz modes */
>>> + return mode->dotClock / (mode->hTotal * v_total) + 0.05;
>>> + }
>>> +
>>> + return 0;
>>> +}
>> It seems that floating point (and especially double) is not needed here
>> to do a proper calculation.
>>
> It's needed. See https://gitlab.freedesktop.org/xorg/app/xrandr/commit/00c795e99fe29ecd56e05e915e508c7af0ac39ad
>
I think he meant, can't you just multiply both v_total and
mode->dotClock by 2 for same effect?
int v_total = mode->vTotal * 2;
...
return mode->dotClock * 2 / (mode->hTotal * v_total);
Admittedly it doesn't handle the 0.05 but that seems somewhat arbitrary.
More information about the wine-devel
mailing list