summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThierry Reding <treding@nvidia.com>2016-12-15 12:15:17 +0100
committerThierry Reding <treding@nvidia.com>2017-09-06 09:36:03 +0200
commitafa63e7896805f972f4b1672119eaeffc4643d14 (patch)
treea292a712b225ad934541ce0f035123798e499ded
parentd55d0804f9e37637d7510f38f97e07a50c6b7baa (diff)
Bump event read size to 4 KiBstaging/fixes
drmHandleEvent() currently reads events in 1 KiB chunks. Within the kernel each DRM device is allowed to carry up to 4 KiB of event data, and the drm_read() implementation will only hand out complete events. All of this combined could cause applications to go into a busy loop if drivers queue events larger than 1 KiB, because drm_read() will requeue the event and drm_poll() would never see the list of queued events become empty and therefore always return immediately. This patch increases the buffer for event reads to 4 KiB, so that all events will be read at once. This ensures that at least one event can always be dequeued, therefore avoiding the busy loop condition. A complementary patch will be applied to the kernel to limit the size of events to 1 KiB to ensure that versions of the libdrm library prior to this change won't break. Fortunately, there currently aren't any event producers that exceed the 1 KiB limit. Signed-off-by: Thierry Reding <treding@nvidia.com>
-rw-r--r--xf86drmMode.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/xf86drmMode.c b/xf86drmMode.c
index d3bc20ea..c4bccd6f 100644
--- a/xf86drmMode.c
+++ b/xf86drmMode.c
@@ -885,7 +885,7 @@ int drmModeCrtcSetGamma(int fd, uint32_t crtc_id, uint32_t size,
int drmHandleEvent(int fd, drmEventContextPtr evctx)
{
- char buffer[1024];
+ char buffer[4096];
int len, i;
struct drm_event *e;
struct drm_event_vblank *vblank;