Hardware Based XRender Slower than Software Rendering? 297
Neon Spiral Injector writes "Rasterman of Enlightenment fame has finally updated the news page of his personal site. It seems that the behind the scenes work for E is coming along. He is investigating rendering backends for Evas. The default backend is a software renderer written by Raster. Trying to gain a little more speed he ported it to the XRender extension, only to find that it became 20-50 times slower on his NVidia card. He has placed some sample code on this same news page for people to try, and see if this is also experienced on other setups."
The damndest thing. (Score:5, Informative)
One word: (Score:4, Informative)
IrisGL or OpenGL (I think OpenGL is based on IrisGL, so Irix probably now uses OpenGL) is used extensively in Irix, for both 2D and 3D.
Not enough details (Score:5, Informative)
Here is the entry from the driver README:
Following that option, this one is noted:
Raster's on holiday (Score:5, Informative)
I highly doubt he meant for this to get wide-spread exposure beyond developers of Enlightenment or X. Since it has, this is a good opportunity. I'll make this clear for anyone that didn't catch it, raster WANTS XRENDER TO BE FASTER! If there is a way to alter configuration or to recode the benchmark to do so, he wants to know about it.
Rather than posting questions about his configuration (which he can't answer right now), grab the benchmarks that he put up and get better results.
Now back to your regularly scheduled trolling...
Unfair comparison (Score:3, Informative)
nVidia Linux woes (Score:4, Informative)
Re:2D acceleration using OpenGL? (Score:4, Informative)
The current version of Evas is actually the second iteration. The first version had a backend written for OpenGL, which performed quite well for large drawing areas, but was sluggish with many small areas (bad for window managers). The software engine easily outperformed in those cases, and will be used for the resulting window manager's border drawing.
For now, there is not an OpenGL engine in Evas, because of time constraints. E has a relatively small active development team atm, so it's difficult to say when someone will get around to adding the OpenGL engine. There should be one eventually, all nicely encapsulated except for a couple setup functions.
Re: Graphics cards and computation (Score:5, Informative)
> There has been some work on using graphics cards for computation. The tough part is figuring out how to rephrase your algorithm in terms of what the GPU can handle.
Isn't there a lot of sloth involved in reading your results back as well?
Meanwhile, users of GCC can exploit whatever multimedia SIMD instructions their processor supports by telling the processor you want to use them. For x86 see this [gnu.org] and this [gnu.org]; for other architectures start here [gnu.org]. (Notice the GCC version in the URL; the supported options sometimes change between versions, so you should look in a version of the GCC Manual that matches what you're actually using.)
I confess I haven't benchmarked these options, but in theory they should boost the performance of some kinds of number-crunching algorithms.
BTW, Linuxers can find what multimedia extensions their CPU supports with cat
And post us back if you do some benchmarking, or find some good ones on the Web.
Render Bench (Score:5, Informative)
Re:One word: (Score:3, Informative)
Re:I actually downloaded and ran his benchmark (Score:2, Informative)
Re:An important truth about X (Score:3, Informative)
Also, with any application, the code space doesn't take system RAM in the same sense as data space does. Normally you map in pages of memory that point straight to the I/O device the executable exists on. (this is called mmap [freebsd.org]). You only have a few pages of system memory actually in-use, for the areas of the program that are currently executing or have executed recently. It's pretty easy to draw an analogy to this and swap memory, except this is a lot simpler to implement in a kernel.
I've build mini systems where XFree86 and Linux and a handful of fun apps ran in 4Mb of RAM. For a diskless system, you would want to use something like XIP (eXecute-In-Place). that way you don't have to go crazy loading in applications into system RAM or have funny mmap things that try to cache memory. (if it's all in RAM disk why are you caching RAM with more RAM?
Also check out the AgendaVR3 pda [agendacomputing.de]. I own one of these gizmos. The company is basically out of business, but their PDAs definently ran XFree86 and a ton of apps with only 8Mb of flash and 8Mb of RAM.
Of course. If XFree86 is still too big for you, there is always The MGR Window System [hack.org]. This fun program is designed to basically allow you to run multiple shells on the same screen in a graphical way, with each one having it's own font size if you want. It looks like monochrome X11, but it's a lot smaller. It also works over both telnet and ssh quite transparently. (all the GUI stuff is encoded in vt100-like escape codes). You can even do real graphics with it, look at this big screen shot [hack.org] if you don't believe me. Also it's open source, which is good because it probably hasn't used on linux after kernel version 1.2, have fun tinking with it.
Re:2D acceleration using OpenGL? (Score:5, Informative)
On using OpenGL in multiple windows....
While my graphics hardware is not quite representative (the Matrox G450 is not known for great 3D performance), I ran two instances of glxgears.
Short conclusion: MesaGL on Linux has the same problem. Long conclusion: the windows showed noticable slowdowns, up to the point where animation was suspended in one window while the other ran, with the system switching the running window at seemingly random intervals.
System specs:
Hope this helps,
Mart
Re:accelerated? (Score:5, Informative)
Obviously XRender is getting crushed here by Imlib2. There are a million reasons this might be happening, it's definitely worth looking into. In the best Slashdot tradition, here's some wild speculation about what might be causing the slowdown:
Nothing is wrong with XRender? (Score:2, Informative)
Test: Test Xrender doing non-scaled Over blends
Time: 16.234 sec.
Test: Test Xrender (offscreen) doing non-scaled Over blends
Time: 16.108 sec.
Test: Test Imlib2 doing non-scaled Over blends
Time: 1.932 sec.
That was with hardware acceleration disabled. I was surprised that enabling the hardware acceleration speeds the first test up by that much (up to 32 times actually).
I also confirm the previous posters' findings that Imlib2 tests don't draw anything onscreen.
Re:2D acceleration using OpenGL? (Score:5, Informative)
Single glxgears: 3600
3 glxgears: 1200
5 glxgears: 700
(All aprox numbers). So basically it scales almost perfectly with the number of open windows.
Re:accelerated? (Score:4, Informative)
Certain things seemed to trigger it, e.g. loading up OpenOffice would guarantee a lock-up.
So yes, hardware RENDER acceleration isn't really there at the moment. I expect this has something to do with the poor results the Rasterman got.
Re:Not enough details (Score:4, Informative)
Re:Works nice and fast for me (Score:1, Informative)
I get different results - hardware is MUCH faster (Score:1, Informative)
Test: Test Xrender doing non-scaled Over blends
Time: 0.085 sec.
Test: Test Xrender (offscreen) doing non-scaled Over blends
Time: 0.095 sec.
Test: Test Imlib2 doing non-scaled Over blends
Time: 4.893 sec.
Test: Test Xrender doing 1/2 scaled Over blends
Time: 0.028 sec.
Test: Test Xrender (offscreen) doing 1/2 scaled Over blends
Time: 0.033 sec.
Test: Test Imlib2 doing 1/2 scaled Over blends
Time: 1.344 sec.
Test: Test Xrender doing 2* smooth scaled Over blends
Time: 0.328 sec.
Test: Test Xrender (offscreen) doing 2* smooth scaled Over blends
Time: 0.370 sec.
Test: Test Imlib2 doing 2* smooth scaled Over blends
Time: 28.058 sec.
Test: Test Xrender doing 2* nearest scaled Over blends
Time: 0.323 sec.
Test: Test Xrender (offscreen) doing 2* nearest scaled Over blends
Time: 0.370 sec.
Test: Test Imlib2 doing 2* nearest scaled Over blends
Time: 20.745 sec.
Test: Test Xrender doing general nearest scaled Over blends
Time: 0.780 sec.
Test: Test Xrender (offscreen) doing general nearest scaled Over blends
Time: 0.855 sec.
Test: Test Imlib2 doing general nearest scaled Over blends
Time: 45.613 sec.
Test: Test Xrender doing general smooth scaled Over blends
Time: 0.611 sec.
Test: Test Xrender (offscreen) doing general smooth scaled Over blends
Time: 0.849 sec.
Test: Test Imlib2 doing general smooth scaled Over blends
Time: 74.811 sec.
I ran the benchmark with RenderAccel true (Score:5, Informative)
Here are the results for the interested:
Available XRENDER filters:
nearest
bilinear
fast
good
best
Se
*** ROUND 1 ***
Test: Test Xrender doing non-scaled Over blends Time: 0.190 sec.
Test: Test Xrender (offscreen) doing non-scaled Over blends Time: 0.303 sec.
Test: Test Imlib2 doing non-scaled Over blends Time: 0.697 sec.
*** ROUND 2 ***
Test: Test Xrender doing 1/2 scaled Over blends Time: 10.347 sec.
Test: Test Xrender (offscreen) doing 1/2 scaled Over blends Time: 10.231 sec.
Test: Test Imlib2 doing 1/2 scaled Over blends Time: 0.315 sec.
*** ROUND 3 ***
Test: Test Xrender doing 2* smooth scaled Over blends Time: 207.028 sec.
Test: Test Xrender (offscreen) doing 2* smooth scaled Over blends Time: 205.275 sec.
Test: Test Imlib2 doing 2* smooth scaled Over blends Time: 5.695 sec.
*** ROUND 4 ***
Test: Test Xrender doing 2* nearest scaled Over blends Time: 164.460 sec.
Test: Test Xrender (offscreen) doing 2* nearest scaled Over blends Time: 166.281 sec.
Test: Test Imlib2 doing 2* nearest scaled Over blends Time: 4.119 sec.
*** ROUND 6 ***
Test: Test Xrender doing general nearest scaled Over blends Time: 313.187 sec.
Test: Test Xrender (offscreen) doing general nearest scaled Over blends Time: 310.261 sec.
Test: Test Imlib2 doing general nearest scaled Over blends Time: 11.444 sec.
*** ROUND 7 ***
Test: Test Xrender doing general smooth scaled Over blends Time: 477.511 sec.
Test: Test Xrender (offscreen) doing general smooth scaled Over blends Time: 474.695 sec.
Test: Test Imlib2 doing general smooth scaled Over blends Time: 17.290 sec.
(reformatted to get past the lameness filter)
Re:2D acceleration using OpenGL? (Score:3, Informative)
I have a dual Athlon MP 2600 running w/ an nVidia GeForce 4 MX440. Here's what I get for 1 through 4 glxgears:
The fall-off is slightly more harsh than linear for 1 through 3, probably synchronization overhead. 4 seems to get faster in terms of total frame rate across all four instances. 2*3000 == 6000, 3*1500 = 4500, 4*1300 = 5200(!)
--JoeRe:is this the man who said that "Windows has won" (Score:3, Informative)
Re:One word: (Score:3, Informative)
The file manager, for example, used resizable icons. Moving a slider would make the icons bigger or smaller. Those were definitely vector graphics. I'm not 100% sure, but I'd bet those were opengl objects.
About grandparent's comment, yes, SGI created IrisGL first, then moved onto OpenGL when they opened up the specs, and had a glue library for compatibility with old apps, called Igloo (IrisGL on OpenGL)
Btw, I've tried rasterman's test on my ancient Riva TNT card and software rendering is indeed a lot faster.
Building E17 from CVS right now :)
Re:The results are not obviously broken (Score:3, Informative)
Well, you have the means at hand to confirm it.
A quick glance reveals, no, the result is not cached in the sense you probably assume.
The Imlib2 scales and fitlers the image in each of the REPS iterations.
Re:It's wrong to use 3D functionality for 2D graph (Score:2, Informative)
Re:It's RIGHT to use 3D functionality for 2D graph (Score:4, Informative)
This ends up being even more true if you do any sort of complex compositing (eg: alpha blending, hardware accelerated mpeg / video, openGL windows, etc, etc). Enlightenment uses alpha channels, it would be fater to composite in hardware than software. These sorts of operations are not accelerated at all on the 2d path, and have to be done in software.
Go check out Quartz Extreme at http://www.apple.com/macosx/jaguar/quartzextreme.h tml (excuse the space in html).
Having used Xfree86 and Quartz extreme on the same graphics hardware, I can tell you there's no comparison. Quartz is much faster and much more capable.
Re:One word: (Score:4, Informative)
Re:2D acceleration using OpenGL? (Score:2, Informative)
Quartz Extreme in a few words (Score:5, Informative)
That's not accurate. Quartz is really made of two parts: Quartz 2D and the Quartz Compositor.
The Quartz Compositor is reponsible for compositing all the layers (desktop, windows, layers inside windows) on-screen. It offers Porter-Duff compositing, which was developped at Pixar more than 15 years ago. See this post [google.com] from Mike Paquette for details. Mr Paquette is one of the main developpers of Quartz. Quartz Extreme is "simply" an OpenGL implementation of Porter-Duff compositing and modern graphic cards offer the primitives needed to do that very efficiently.
The Quartz 2D layer is what offers drawing primitives following the Postscript drawing model. The same drawing model is used with PDF (no surprise), Java2D and SVG (and Microsoft's GDI+ ?). This part is not HW accelerated. I am sure Apple is working on it, but it wouldn't surprise me if new HW will be required to make this possible. There is a strong incentive for card manufacturers to offer acceleration, since Longhorn is supposed to use GDI+ extensively. I doubt that such acceleration will fit in the traditionnal OpenGL/Direct3D rendering pipeline.
The Apple JVM team implemented HW accelerated Java2D drawing in their 1.3.1 JVM. Their 1.4 JVM doesn't offer it (1.4.1 was a massive rewrite for them, 1.3.1 was more of a quick port to OS-X using some of their "old" carbon code). There were quite a few problems when HW acceleration was used. I hope they can and will wait for a system-wide Quartz-2D HW acceleration, it seems ludicrous to have the JVM team spend resources on an effort that will be wasted once Quartz2D is accelerated.
See Apple Marketing page [apple.com], another post from Mike Paquette [google.com], and the presentation from Apple at SIGgraph about Quartz Extreme and OpenGL [opengl.org].
If that post doesn't end-up rated +5 informative, I don't know what will !
Re:2D acceleration using OpenGL? (Score:5, Informative)
Which means it's broken. All the windows should run at full speed until the graphics pipeline saturates.
There are several problems. First, make sure that you're not running with "wait for VBLANK" off. There's a stupid overclocker mania for running the graphics system faster than the display can refresh. This leads to high, meaningless frame rates, and to lower system performance because the useless redraws are using up all the CPU time.
Once you're past that, the issues are more fundamental.
The real problem is that OpenGL is double-buffered, but most windowing systems don't understand double-buffering or frame-synchronous drawing very well. Even OpenGL has no notion of time. But this could be fixed.
Usually, each app draws into the back buffer, then makes the OpenGL call to swap the buffers. This blocks the app (older NVidia drivers for Windows spin-locked, but I got them to fix that), but worse, it typically locks up the OpenGL subsystem until the frame ends and the buffer swap occurs. Implementations like that can only draw one window per frame time, obviously.
What ought to happen is that a request for a buffer swap should schedule a buffer swap for the next frame cycle, block the app, then let other apps get in their draw time. At the end of the frame, when everybody is done drawing, all windows get buffer swapped, and all the apps stuck in the OpenGL buffer swap call then unblock simultaneously. That way, multiple OpenGL apps running in different windows all run at full frame rate, until the scene complexity hits the limits of the graphics hardware.
Part of the problem is that X and OpenGL are such drastically different architectures that making them play well together is tough. X assumes a network-centric model; OpenGL assumes you're local. X expects a weak terminal; OpenGL needs good graphics acceleration. X is built around a windowing concept; OpenGL doesn't know about windows. X and OpenGL are defined by different organizations.
Microsoft is pulling this together in the Windows world, but it's all done with Microsoft APIs, and, recently, undocumented hardware that favors those APIs.