How WINE implements BitBlt function?
This question arouse when I have made some tests in assembly language. I have wrote a program that to allocate some memory bitmap, fill it with some image and then draw it on a window. The in-memory processing is pretty fast so the main time consuming operation is the drawing of the bitmap on the window. The code is the same for the Windows and Linux version of the program and only the code that draws the bitmap on the window differs. In the Windows version it uses DIB and BitBlt function and in the Linux version it uses XImage bitmap and XPutImage function from XLib. I expected to have some similar performance of both programs, but was surprised, that in WINE, the Windows version performs approximately by 50% faster (150fps) than the Linux version (90..100fps) and the Linux version loads the CPU much higher than the Windows one. So, the question: How in WINE is implemented BitBlt function in order to have so high performance and so low CPU load? -- John Found <johnfound(a)asm32.info>
Am 31.01.2015 um 08:11 schrieb John Found <johnfound(a)asm32.info>:
So, the question: How in WINE is implemented BitBlt function in order to have so high performance and so low CPU load? We use the X render extension. See dlls/winex11.drv/xrender.c.
(I am not an expert on the GDI parts of Wine, so no guarantee for correctness of this information. I haven't followed the full path from gdi's BitBlt to the final X11 call)
On 31/01/2015 12:19, Stefan Dösinger wrote:
Am 31.01.2015 um 08:11 schrieb John Found <johnfound(a)asm32.info>:
So, the question: How in WINE is implemented BitBlt function in order to have so high performance and so low CPU load?
We use the X render extension. See dlls/winex11.drv/xrender.c.
(I am not an expert on the GDI parts of Wine, so no guarantee for correctness of this information. I haven't followed the full path from gdi's BitBlt to the final X11 call)
Perhaps using XSHM for such things would be better (at least when the X server is local, which is almost always the case). Shachar
On Wed, 04 Feb 2015 12:24:30 +0200 Shachar Shemesh <shachar(a)shemesh.biz> wrote:
On 31/01/2015 12:19, Stefan Dösinger wrote:
Am 31.01.2015 um 08:11 schrieb John Found <johnfound(a)asm32.info>:
So, the question: How in WINE is implemented BitBlt function in order to have so high performance and so low CPU load?
We use the X render extension. See dlls/winex11.drv/xrender.c.
(I am not an expert on the GDI parts of Wine, so no guarantee for correctness of this information. I haven't followed the full path from gdi's BitBlt to the final X11 call)
Perhaps using XSHM for such things would be better (at least when the X server is local, which is almost always the case).
Shachar
I never heard about XSHM, but it sounds really interesting. Unfortunately Google gives some very sketchy references about it. Is there more informative documentation about XSHM? -- John Found <johnfound(a)asm32.info>
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Am 2015-02-05 um 09:58 schrieb John Found:
I never heard about XSHM, but it sounds really interesting. Unfortunately Google gives some very sketchy references about it. Is there more informative documentation about XSHM? http://www.x.org/releases/current/doc/xextproto/shm.html
Yes, it is quite old and simple. Should still work just as well as it did 24 years ago. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBAgAGBQJU01Y8AAoJEN0/YqbEcdMwnmAQAIUw+5XhAq1dnXAtw7csUCRQ xUTUbkK9bjpo+5nUgcou9RdEBq2+lnfAIJdRBf4eQ/b3Wv5MbLvzs1heA/8Wk2Md KjhyLQNRbxOqcLv9jyFB4J78Nh+dUoYkNdvPa9NwQUDwjaTY8Pjtj1Fsk6kB3eoe okWG0RYDqgfZwpfDX4R/aXetC0STS3U4MD/sqKVkqtGZUQ3xcjGWPXJPd980/Yga 5Ok6x7ekN7QYumPPC/Kb0Nj8BrqnU4/9vdy3dst8yXyX3s3iEh2OPqoDhTc5SCbL MPafJPN9BeEMTYM1w3PHqCJ8qgcqeifd67HVCyIXqxOd+0EnVk1+oJOEUzXben5A MIytPJkGgDMFzCzRv7T9eR9L47cItxNOpWD8vjg5FDEGpSm2KQd4wQ754xNRH2ew 5HFWQRVUMLs55j2Htsd2A/Sd61jppVKd+asoPkigo57q0QJpyqMmwn+ulSgAGhvu r6XixKhAousA7nex9DUE8QZA4lHLAQus5vh8wTAuCQiSkrqDZAIJdk+WAxBFLVJs L/cwsTVypDg7+g5dYcxcUSMnUvfE7RGBpHHBR862XW0B7BIRhupDQkYMEzwO2R/x IVwfeXNzlZfbmS0nssLMoAmn2oP+nztX7tSSxEF7LdFiAamOUzms5mM6w8K8GGqM Q3NoscwzSMNXHL981yK5 =ZYhr -----END PGP SIGNATURE-----
There is a man page for starters.. Tom On Feb 5, 2015 4:58 PM, "John Found" <johnfound(a)asm32.info> wrote:
On Wed, 04 Feb 2015 12:24:30 +0200 Shachar Shemesh <shachar(a)shemesh.biz> wrote:
On 31/01/2015 12:19, Stefan Dösinger wrote:
Am 31.01.2015 um 08:11 schrieb John Found <johnfound(a)asm32.info>:
So, the question: How in WINE is implemented BitBlt function in order
to have so high performance and so low CPU load?
We use the X render extension. See dlls/winex11.drv/xrender.c.
(I am not an expert on the GDI parts of Wine, so no guarantee for
correctness of this information. I haven't followed the full path from gdi's BitBlt to the final X11 call)
Perhaps using XSHM for such things would be better (at least when the X server is local, which is almost always the case).
Shachar
I never heard about XSHM, but it sounds really interesting. Unfortunately Google gives some very sketchy references about it. Is there more informative documentation about XSHM?
-- John Found <johnfound(a)asm32.info>
Example code, docs... http://www.mesa3d.org/brianp/xshm.c http://personales.mundivia.es/jap/xshm.htm Tom On Feb 5, 2015 7:40 PM, "Tom Wickline" <twickline(a)gmail.com> wrote:
There is a man page for starters..
Tom On Feb 5, 2015 4:58 PM, "John Found" <johnfound(a)asm32.info> wrote:
On Wed, 04 Feb 2015 12:24:30 +0200 Shachar Shemesh <shachar(a)shemesh.biz> wrote:
On 31/01/2015 12:19, Stefan Dösinger wrote:
Am 31.01.2015 um 08:11 schrieb John Found <johnfound(a)asm32.info>:
So, the question: How in WINE is implemented BitBlt function in
order to have so high performance and so low CPU load?
We use the X render extension. See dlls/winex11.drv/xrender.c.
(I am not an expert on the GDI parts of Wine, so no guarantee for
correctness of this information. I haven't followed the full path from gdi's BitBlt to the final X11 call)
Perhaps using XSHM for such things would be better (at least when the X server is local, which is almost always the case).
Shachar
I never heard about XSHM, but it sounds really interesting. Unfortunately Google gives some very sketchy references about it. Is there more informative documentation about XSHM?
-- John Found <johnfound(a)asm32.info>
These examples are useful. Thanks. Unfortunately, Linux documentation is so C-centric! For example, in which DLL is this library? I am writing in assembly and can't simply include the C headers. I only can dynamically link to .so library. On Thu, 5 Feb 2015 19:53:55 +0800 Tom Wickline <twickline(a)gmail.com> wrote:
Example code, docs...
http://www.mesa3d.org/brianp/xshm.c
http://personales.mundivia.es/jap/xshm.htm
Tom On Feb 5, 2015 7:40 PM, "Tom Wickline" <twickline(a)gmail.com> wrote:
There is a man page for starters..
Tom On Feb 5, 2015 4:58 PM, "John Found" <johnfound(a)asm32.info> wrote:
On Wed, 04 Feb 2015 12:24:30 +0200 Shachar Shemesh <shachar(a)shemesh.biz> wrote:
On 31/01/2015 12:19, Stefan Dösinger wrote:
Am 31.01.2015 um 08:11 schrieb John Found <johnfound(a)asm32.info>:
So, the question: How in WINE is implemented BitBlt function in
order to have so high performance and so low CPU load?
We use the X render extension. See dlls/winex11.drv/xrender.c.
(I am not an expert on the GDI parts of Wine, so no guarantee for
correctness of this information. I haven't followed the full path from gdi's BitBlt to the final X11 call)
Perhaps using XSHM for such things would be better (at least when the X server is local, which is almost always the case).
Shachar
I never heard about XSHM, but it sounds really interesting. Unfortunately Google gives some very sketchy references about it. Is there more informative documentation about XSHM?
-- John Found <johnfound(a)asm32.info>
-- John Found <johnfound(a)asm32.info>
On 05/02/15 14:12, John Found wrote:
These examples are useful. Thanks. Unfortunately, Linux documentation is so C-centric! For example, in which DLL is this library? I am writing in assembly and can't simply include the C headers. I only can dynamically link to .so library. RTFM nm
In general, the X11 extensions are in the same libraries as the rest of xlib. Shachar
Well, it seems we are in deep off-topic in these mails, but let me finish the subject. Actually, I found the library and it is not libX11.so, as the rest of xlib. The XSHM extension functions are in libXext.so library. Anyway, thanks for the help. I am writing now a small test program in order to test this way. And I will test Xrender as well, if this is what WINE uses. And maybe I have to use both of them in order to provide some compatibility with the systems where XSHM is not installed. Hm, I wander, how many systems have no XSHM installed? On Thu, 05 Feb 2015 21:10:53 +0200 Shachar Shemesh <shachar(a)shemesh.biz> wrote:
On 05/02/15 14:12, John Found wrote:
These examples are useful. Thanks. Unfortunately, Linux documentation is so C-centric! For example, in which DLL is this library? I am writing in assembly and can't simply include the C headers. I only can dynamically link to .so library. RTFM nm
In general, the X11 extensions are in the same libraries as the rest of xlib.
Shachar
-- John Found <johnfound(a)asm32.info>
The systems without XSHM would be native Windows.. Linux, BSD, Solaris, and Mac with X installed are all good to go.. It will even run on android with X installed. http://osxr.org/android/ident?_i=XShmCreatePixmap Tom
On 06/02/15 07:59, Tom Wickline wrote:
The systems without XSHM would be native Windows.. Linux, BSD, Solaris, and Mac with X installed are all good to go..
It will even run on android with X installed.
That's not entirely complete. When working with a non-local X server, XSHM would not be available. I think most users would be okay with degraded performance under such cases, but I think we should try and not break things completely. Also, when running recursive X servers, not all will support XSHM. These include VNC, which is still sometimes used for remote access. Shachar
participants (4)
-
John Found -
Shachar Shemesh -
Stefan Dösinger -
Tom Wickline