View Single Post
Posts: 310 | Thanked: 383 times | Joined on Jan 2010
#1
Hey everyone,

I've been spending the last few days trying to reduce tearing on pannable widgets (ie. photo browser) and the desktop.

I'm just starting this thread as a placeholder; as I make progress I'll post updates here. And, of course, if anyone has any insight I'd appreciate it. I'm a C coder and have fairly extensive experience with Qt, but virtually none with gtk, gles, hildon, clutter, etc. If any experts on this stuff are reading this you'll no doubt cringe at my haphazard and uneducated approach to this.

So far I've identified an ioctl() that seems to wait for vsync.

I assumed it didn't exist, but after applying a kernel patch to implement FBIO_WAITFORVSYNC I found by Brian Swetland against drivers/video/omap, I realized that the n900 doesn't seem to use that driver at all. It seems to use the one under omap2.

In looking through omap2/omapfb/omapfb-ioctl.c I discovered OMAPFB_WAITFORVSYNC, which seems to work!

According to my quick test, it cycles ~60 times/second, which I would assume is the default frame rate while the device is active. Interestingly, when the screen is off, that rate drops dramatically (I assume for power saving).

Now, I inserted this ioctl() into hildon-pannable-area.c (hildon_pannable_area_timeout) just prior to gdk_window_process_updates (), just to see what would happen.

Unfortunately it didn't seem to have the desired effect. Now I don't know enough about what happens, so my guesses would be:

1. gdk_window_process_updates () doesn't actually block and swap frames; frame swapping is asynchronous
2. updates are so slow the frame swapping occurs between frames anyway
3. it's not double buffered, and updates take longer than one frame

Again, apologies if the answer is obvious and I'm off the mark.. I'm still learning.

In any case, it appears the hildon desktop uses clutter and its own method for panning (ie. not hildon-pannable-area), and it was the main thing I was trying to fix, I so put hildon-pannable-area on hold, and focused on clutter.

I assume clutter is using the eglx backend on the n900?

All I've done so far is implement OMAPFB_WAITFORVSYNC and some debug code in clutter_backend_egl_redraw(), but it doesn't seem to get called on the device. Still trying to figure this one out.

I know enabling WSEGL_UseHWSync is supposed to have some sort of effect but I don't really see it (still tears badly), and I can't find any references to that variable anywhere in hildon-desktop, except in the bundled hildon-desktop.ini.

Another alternative I wanted to explore was reducing the LCD's refresh rate to 30hz, as this would reduce tearing even without frame sync. And there's no reason to have it any higher that I can think of. I assume it's just a matter of adjusting the pixel clock/timings.

Anyway, if anyone has any insights or words of wisdom to share (like I'm going in completely the wrong direction), please do share.

Last edited by nightfire; 2011-03-05 at 22:20.
 

The Following 18 Users Say Thank You to nightfire For This Useful Post: