[PATCH] winex11.drv: Fix incorrect frequency for doublescan and interlaced modes.

Zhiyi Zhang zzhang at codeweavers.com
Tue Feb 4 02:37:40 CST 2020



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



More information about the wine-devel mailing list