mirror of
https://github.com/brl/mutter.git
synced 2025-02-11 02:44:09 +00:00
monitor-manager-kms: poll() on KMS fd on EAGAIN
When drmHandleEvent() returns an error and errno is set to EAGAIN, instead of ending up in a busy loop, poll() the fd until there is anything to read. This is a simple backport of commit 406359bba1. https://bugzilla.gnome.org/show_bug.cgi?id=791024
This commit is contained in:
parent
bf91e2b4ca
commit
6dd28bd2c7
@ -34,6 +34,7 @@
|
|||||||
|
|
||||||
#include <drm.h>
|
#include <drm.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <poll.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
@ -1782,7 +1783,34 @@ meta_monitor_manager_kms_wait_for_flip (MetaMonitorManagerKms *manager_kms)
|
|||||||
memset (&evctx, 0, sizeof evctx);
|
memset (&evctx, 0, sizeof evctx);
|
||||||
evctx.version = DRM_EVENT_CONTEXT_VERSION;
|
evctx.version = DRM_EVENT_CONTEXT_VERSION;
|
||||||
evctx.page_flip_handler = page_flip_handler;
|
evctx.page_flip_handler = page_flip_handler;
|
||||||
drmHandleEvent (manager_kms->fd, &evctx);
|
|
||||||
|
while (TRUE)
|
||||||
|
{
|
||||||
|
if (drmHandleEvent (manager_kms->fd, &evctx) != 0)
|
||||||
|
{
|
||||||
|
struct pollfd pfd;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
if (errno != EAGAIN)
|
||||||
|
{
|
||||||
|
g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED,
|
||||||
|
strerror (errno));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
pfd.fd = manager_kms->fd;
|
||||||
|
pfd.events = POLL_IN | POLL_ERR;
|
||||||
|
do
|
||||||
|
{
|
||||||
|
ret = poll (&pfd, 1, -1);
|
||||||
|
}
|
||||||
|
while (ret == -1 && errno == EINTR);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
Loading…
x
Reference in New Issue
Block a user