Speed of gdi vs opengl DirectDrawRenderer
jonas.maebe at elis.ugent.be
Thu Feb 19 14:12:40 CST 2015
I had a problem with Majesty Gold HD running at glacial speed on my
machine (quad Core i5 2.9GHz, NVidia GeForce GT 750M 1GB, OS X 10.9.5).
I'm using wine 1.7.35, but I've had similar problems with older wine
versions. It's a DirectDraw7 game that has been partially remastered to
run on modern systems, but still uses DirectDraw7.
This is a common problem on Windows too, but generally can be resolved
by telling the game to use the DirectDraw blitter (instead of blitting
itself). That didn't help on Wine though.
I profiled wine (Instruments time profile) and noticed that most time
was spent in wined3d's convert_r5g6b5_x8r8g8b8. Replacing that routine
with an optimized sse2 version from pixman did not make much of a
Then I discovered that if I told the game to render to a 16 bit instead
of to a 32 bit surface, wine would let OpenGL handle the colour
conversion. Unfortunately, while this significantly reduced wine's cpu
usage, it by no means made the game any faster. Looking at the OpenGL
Driver Monitor stats, it seems the cpu was simply waiting all the time
on the GPU, probably while it was blitting all of those 1920x1080 images
to the screen. Reducing the resolution to the lowest supported by the
game (800x600) made it slightly faster, but not much.
Next, I added the DirectDrawRenderer registry key and set it to gdi.
Now, while it's still slow at 1920x1080, the game runs much faster at
800x600 and even still at 1024x768. Profiling the gdi renderer shows
that it has way higher cpu usage than the OpenGL renderer (virtually all
in convert_to_8888), but it seems that for some reason it has causes
much less traffic to the GPU.
The wiki's wording suggests the gdi renderer is deprecated though. Does
that mean this qualifies as a bug in the OpenGL renderer (maybe it tries
to update the screen more often than necessary, saturating the bus that
way?), and are there any things I can try to narrow down why the gdi
renderer is so much faster? I didn't immediately see where it blits
things actually to the screen.
More information about the wine-devel