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?
Am 31.01.2015 um 08:11 schrieb John Found johnfound@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@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@shemesh.biz wrote:
On 31/01/2015 12:19, Stefan Dösinger wrote:
Am 31.01.2015 um 08:11 schrieb John Found johnfound@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?
-----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.
There is a man page for starters..
Tom On Feb 5, 2015 4:58 PM, "John Found" johnfound@asm32.info wrote:
On Wed, 04 Feb 2015 12:24:30 +0200 Shachar Shemesh shachar@shemesh.biz wrote:
On 31/01/2015 12:19, Stefan Dösinger wrote:
Am 31.01.2015 um 08:11 schrieb John Found johnfound@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@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@gmail.com wrote:
There is a man page for starters..
Tom On Feb 5, 2015 4:58 PM, "John Found" johnfound@asm32.info wrote:
On Wed, 04 Feb 2015 12:24:30 +0200 Shachar Shemesh shachar@shemesh.biz wrote:
On 31/01/2015 12:19, Stefan Dösinger wrote:
Am 31.01.2015 um 08:11 schrieb John Found johnfound@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@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@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@gmail.com wrote:
There is a man page for starters..
Tom On Feb 5, 2015 4:58 PM, "John Found" johnfound@asm32.info wrote:
On Wed, 04 Feb 2015 12:24:30 +0200 Shachar Shemesh shachar@shemesh.biz wrote:
On 31/01/2015 12:19, Stefan Dösinger wrote:
Am 31.01.2015 um 08:11 schrieb John Found johnfound@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@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@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
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