[Intel-gfx] [PATCH] Add modesetting pageflip ioctl and corresponding drm event

Jesse Barnes jbarnes at virtuousgeek.org
Fri May 15 21:46:37 CEST 2009


On Fri, 15 May 2009 12:16:14 -0700
Jesse Barnes <jbarnes at virtuousgeek.org> wrote:

> On Thu, 14 May 2009 23:04:51 -0400
> Kristian Høgsberg <krh at bitplanet.net> wrote:
> 
> > From: Kristian Høgsberg <krh at redhat.com>
> > 
> > This patch adds a vblank synced pageflip ioctl for to the
> > modesetting family of ioctls.  The ioctl takes a crtc and an fb and
> > schedules a pageflip to the new fb at the next coming vertical
> > blank event.  This feature lets userspace implement tear-free
> > updating of the screen contents with hw-guaranteed low latency page
> > flipping.
> > 
> > The ioctl is asynchronous in that it returns immediately and then
> > later notifies the client by making an event available for reading
> > on the drm fd. This lets applications add the drm fd to their main
> > loop and handle other tasks while waiting for the flip to happen.
> > The event includes the time of the flip, the frame counter and a 64
> > bit opaque token provided by user space in the ioctl.
> > 
> > Based on initial work and suggestions from
> > 	Jesse Barnes <jbarnes at virtuousgeek.org> and
> > 	Jakob Bornecrantz <wallbraker at gmail.com>.
> > 
> > Signed-off-by: Kristian Høgsberg <krh at redhat.com>
> > ---
> > 
> > This update addresses a few of the issues brought up by Jakob:
> > 
> > 	- the u64 user_data field is moved the page flip event
> > 	  from the drm header struct.
> > 
> > 	- the implementation of the page flip ioctl is moved to
> > 	  drm_crtc.h instead of drm_crtc_helper.c
> > 
> > and cleanup in drm_release() is simpler and should clean up
> > everything (it was missing an unpin before, now we just use the
> > same code as the normal drm_read() case).
> > 
> > What's still missing is:
> > 
> > 	- don't block on setting the domain in set_base
> > 
> > 	- the synchronous version of the ioctl; userspace can
> > 	  just use the ioctl followed by a read loop.
> 
> Here's an update that makes the set_base async using a new
> work_struct.  I'll push the libdrm changes into the kms-pageflip
> branch now too.
> 
> The set_base thing is really ugly; apparently on x86 there's a
> set_base macro in the global namespace now, gross.  Hopefully that
> will be fixed before this is pushed upstream.

Just realized this one has a potential deadlock in the teardown path.
We should probably flush the work queue *after* the crtc has been
removed from the list, but w/o holding the struct mutex, since the
async_work func needs that.

Doesn't look like I'll have much more time today to work on the
userspace side though...

-- 
Jesse Barnes, Intel Open Source Technology Center



More information about the Intel-gfx mailing list