Module: wine Branch: master Commit: 6dfad4c2fb238620296942ec57171136f8db4ff7 URL: https://source.winehq.org/git/wine.git/?a=commit;h=6dfad4c2fb238620296942ec5...
Author: Florian Will florian.will@gmail.com Date: Fri Nov 26 09:20:26 2021 +0000
win32u: Only retrieve the dc size if needed.
SetMapMode(.., MM_TEXT) is called a lot in common gdiplus use cases via gdi_transform_acquire(). Querying the size and resolution can be expensive, so skip it when its not needed.
When running the "ZusiDisplay" ET423 diagnostic display, which uses gdiplus heavily, this change increases the "indicator blinking speed" from 0.6 per second to 1 per second and probably hits the FPS limit now. Also, CPU usage of the ZusiDisplay.exe process goes down from ~75% to ~42% of one core according to "top", and wineserver CPU usage goes down from ~48% to ~3%.
Signed-off-by: Florian Will florian.will@gmail.com Signed-off-by: Huw Davies huw@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/win32u/mapping.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/dlls/win32u/mapping.c b/dlls/win32u/mapping.c index 6c20f50a302..6e7c42fe7cc 100644 --- a/dlls/win32u/mapping.c +++ b/dlls/win32u/mapping.c @@ -117,8 +117,6 @@ BOOL set_map_mode( DC *dc, int mode ) if (mode == dc->attr->map_mode && (mode == MM_ISOTROPIC || mode == MM_ANISOTROPIC)) return TRUE;
- virtual_size = get_dc_virtual_size( dc ); - virtual_res = get_dc_virtual_res( dc ); switch (mode) { case MM_TEXT: @@ -129,30 +127,40 @@ BOOL set_map_mode( DC *dc, int mode ) break; case MM_LOMETRIC: case MM_ISOTROPIC: + virtual_size = get_dc_virtual_size( dc ); + virtual_res = get_dc_virtual_res( dc ); dc->attr->wnd_ext.cx = virtual_size.cx * 10; dc->attr->wnd_ext.cy = virtual_size.cy * 10; dc->attr->vport_ext.cx = virtual_res.cx; dc->attr->vport_ext.cy = -virtual_res.cy; break; case MM_HIMETRIC: + virtual_size = get_dc_virtual_size( dc ); + virtual_res = get_dc_virtual_res( dc ); dc->attr->wnd_ext.cx = virtual_size.cx * 100; dc->attr->wnd_ext.cy = virtual_size.cy * 100; dc->attr->vport_ext.cx = virtual_res.cx; dc->attr->vport_ext.cy = -virtual_res.cy; break; case MM_LOENGLISH: + virtual_size = get_dc_virtual_size( dc ); + virtual_res = get_dc_virtual_res( dc ); dc->attr->wnd_ext.cx = muldiv(1000, virtual_size.cx, 254); dc->attr->wnd_ext.cy = muldiv(1000, virtual_size.cy, 254); dc->attr->vport_ext.cx = virtual_res.cx; dc->attr->vport_ext.cy = -virtual_res.cy; break; case MM_HIENGLISH: + virtual_size = get_dc_virtual_size( dc ); + virtual_res = get_dc_virtual_res( dc ); dc->attr->wnd_ext.cx = muldiv(10000, virtual_size.cx, 254); dc->attr->wnd_ext.cy = muldiv(10000, virtual_size.cy, 254); dc->attr->vport_ext.cx = virtual_res.cx; dc->attr->vport_ext.cy = -virtual_res.cy; break; case MM_TWIPS: + virtual_size = get_dc_virtual_size( dc ); + virtual_res = get_dc_virtual_res( dc ); dc->attr->wnd_ext.cx = muldiv(14400, virtual_size.cx, 254); dc->attr->wnd_ext.cy = muldiv(14400, virtual_size.cy, 254); dc->attr->vport_ext.cx = virtual_res.cx;