[PATCH 5/5] drm/tegra: Implement page-flipping support

Thierry Reding thierry.reding at avionic-design.de
Wed Jan 30 03:14:36 PST 2013


On Wed, Jan 30, 2013 at 11:42:40AM +0200, Ville Syrjälä wrote:
> On Wed, Jan 30, 2013 at 10:32:47AM +0100, Thierry Reding wrote:
> > On Wed, Jan 16, 2013 at 01:36:17PM +0100, Daniel Vetter wrote:
> > > On Wed, Jan 16, 2013 at 11:01 AM, Thierry Reding
> > > <thierry.reding at avionic-design.de> wrote:
> > > > drm_events_release() should be enough to clean up the events, but I
> > > > suspect the reason why Laurent put that code in was that the drm_crtc
> > > > private data still has a reference to the event and needs to clear it.
> > > > Otherwise the next page flip won't be scheduled because .page_flip()
> > > > would return -EBUSY.
> > > 
> > > Hm, indeed we seem to have a nice bug in most drivers there :(
> > 
> > I think I may just recently have run into this bug on Intel hardware.
> > Although perhaps I just used this wrongly.
> > 
> > Just for the fun of it I wanted to implement Conway's Game of Life on
> > top of DRM/KMS. So I use two dumb buffer objects to alternately render
> > to. Then I wanted to use page-flipping to synchronize with VBLANK.
> > 
> > So the sequence is basically:
> > 
> > 	while (!done) {
> > 		grid_tick(grid);
> > 		grid_draw(grid, screen);
> > 		screen_flip(screen);
> > 		grid_swap(grid);
> > 	}
> > 
> > Where screen_flip() chooses the framebuffer and passes it to
> > drmModePageFlip() like so:
> > 
> > 	int fb = screen->fb[screen->current];
> > 
> > 	drmModePageFlip(screen->fd, screen->crtc, fb,
> > 			DRM_MODE_PAGE_FLIP_EVENT, screen);
> > 
> > This runs for about 3 seconds and then hangs, so the display is no
> > longer updated. I've also verified that the same happens on Radeon.
> > But maybe I am mistaken and this isn't the proper programming sequence?
> 
> You asked for page flip events. Do you actually handle them in your code?

Duh. No I wasn't =) I suppose some queue must be running full if the
event isn't handled by calling drmHandleEvent(). Okay, this now works
properly with page-flipping.

Thanks.
Thierry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/dri-devel/attachments/20130130/4df62937/attachment.pgp>


More information about the dri-devel mailing list