[PATCH 1/2] winex11.drv: optimise mode tests in X11DRV_ChangeDisplaySettingsEx Fields: DM_PELSWIDTH , DM_PELSHEIGHT are re-tested in the mode testing loop multiple times. However these fields have already been tested before the loop. Add pre-tests for the requested mode bpp and frequency.

MichaƂ Janiszewski janisozaur at gmail.com
Mon Aug 6 13:39:36 CDT 2018


The subject line in this and other patch seem overlong. Make sure you
format the subject line correctly and separate it from rest of the commit
message by a blank line.

On Mon, 6 Aug 2018, 19:47 Rob Walker, <bob.mt.wya at gmail.com> wrote:

> ---
>  dlls/winex11.drv/settings.c | 23 +++++++++--------------
>  1 file changed, 9 insertions(+), 14 deletions(-)
>
> diff --git a/dlls/winex11.drv/settings.c b/dlls/winex11.drv/settings.c
> index afa26cf543..b0164d5806 100644
> --- a/dlls/winex11.drv/settings.c
> +++ b/dlls/winex11.drv/settings.c
> @@ -344,7 +344,7 @@ LONG CDECL X11DRV_ChangeDisplaySettingsEx( LPCWSTR
> devname, LPDEVMODEW devmode,
>  {
>      DWORD i, dwBpp = 0;
>      DEVMODEW dm;
> -    BOOL def_mode = TRUE;
> +    BOOL def_mode = TRUE, test_bpp, test_frequency;
>
>
>  TRACE("(%s,%p,%p,0x%08x,%p)\n",debugstr_w(devname),devmode,hwnd,flags,lpvoid);
>      TRACE("flags=%s\n",_CDS_flags(flags));
> @@ -387,29 +387,24 @@ LONG CDECL X11DRV_ChangeDisplaySettingsEx( LPCWSTR
> devname, LPDEVMODEW devmode,
>          return DISP_CHANGE_BADMODE;
>      }
>
> +    test_bpp = devmode->dmFields & DM_BITSPERPEL;
> +    test_frequency = (devmode->dmFields & DM_DISPLAYFREQUENCY) &&
> +                     (devmode->dmDisplayFrequency != 0);
>      for (i = 0; i < dd_mode_count; i++)
>      {
> -        if (devmode->dmFields & DM_BITSPERPEL)
> +        if (devmode->dmPelsWidth != dd_modes[i].width) continue;
> +        if (devmode->dmPelsHeight != dd_modes[i].height) continue;
> +        if (test_bpp)
>          {
>              if (dwBpp != dd_modes[i].bpp)
>                  continue;
>          }
> -        if (devmode->dmFields & DM_PELSWIDTH)
> -        {
> -            if (devmode->dmPelsWidth != dd_modes[i].width)
> -                continue;
> -        }
> -        if (devmode->dmFields & DM_PELSHEIGHT)
> -        {
> -            if (devmode->dmPelsHeight != dd_modes[i].height)
> -                continue;
> -        }
> -        if ((devmode->dmFields & DM_DISPLAYFREQUENCY) &&
> (dd_modes[i].refresh_rate != 0) &&
> -            devmode->dmDisplayFrequency != 0)
> +        if (test_frequency && (dd_modes[i].refresh_rate != 0))
>          {
>              if (devmode->dmDisplayFrequency != dd_modes[i].refresh_rate)
>                  continue;
>          }
> +
>          /* we have a valid mode */
>          TRACE("Requested display settings match mode %d (%s)\n", i,
> handler_name);
>
> --
> 2.18.0
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20180806/a67cc348/attachment.html>


More information about the wine-devel mailing list