uterm: drm: share mode-setting between dumb+drm
authorDavid Herrmann <dh.herrmann@googlemail.com>
Sun, 13 Jan 2013 14:26:56 +0000 (15:26 +0100)
committerDavid Herrmann <dh.herrmann@googlemail.com>
Sun, 13 Jan 2013 14:26:56 +0000 (15:26 +0100)
commit5604a0a32586518ecef2726da24a55f6f8abffc2
tree061eddd93e9bed0f493ed4601db2e11156a22f36
parent1ef166c12cc259cd72250c0f28da4ab4529d90bf
uterm: drm: share mode-setting between dumb+drm

The modesetting code of both DRM backends is almost the same so share it.
This also works around several race-conditions in some DRM drivers. In
particular, we cannot call drmModeSetCrtc while a drmModePageFlip is still
pending. Therefore, we wait for page-flips to complete before performing
an immediate mode-set.

This requires us to handle page-flip events synchronously so we can wait
for kernel page-flip events but the user-space bottom-half is executed in
an idle-handler.

Note that the chance that we have to wait for a page-flip to complete is
pretty small. In fact, without hacking the code to do fast page-flips, I
couldn't get kmscon to run into this condition.

Last but not least, this patch also makes the dumb-backend support
immediate page-flips like the DRM backend did all the time.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Makefile.am
src/uterm_drm_shared.c
src/uterm_drm_shared_internal.h
src/uterm_video_drm.c
src/uterm_video_dumb.c
src/uterm_video_internal.h