blob: 833044283088ac758ac25663e1eec70f28939ecf [file] [log] [blame]
David Herrmann6b7e45c2012-09-28 23:44:19 +02001<?xml version='1.0'?> <!--*-nxml-*-->
2<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
4
5<!--
6 Written 2012 by David Herrmann <dh.herrmann@googlemail.com>
7 Dedicated to the Public Domain
8-->
9
10<refentry id="drmHandleEvent">
11 <refentryinfo>
12 <title>Direct Rendering Manager</title>
13 <productname>libdrm</productname>
14 <date>September 2012</date>
15 <authorgroup>
16 <author>
17 <contrib>Developer</contrib>
18 <firstname>David</firstname>
19 <surname>Herrmann</surname>
20 <email>dh.herrmann@googlemail.com</email>
21 </author>
22 </authorgroup>
23 </refentryinfo>
24
25 <refmeta>
26 <refentrytitle>drmHandleEvent</refentrytitle>
27 <manvolnum>3</manvolnum>
28 </refmeta>
29
30 <refnamediv>
31 <refname>drmHandleEvent</refname>
32 <refpurpose>read and process pending DRM events</refpurpose>
33 </refnamediv>
34
35 <refsynopsisdiv>
36
37 <funcsynopsis>
38 <funcsynopsisinfo>#include &lt;xf86drm.h&gt;</funcsynopsisinfo>
39
40 <funcprototype>
41 <funcdef>int <function>drmHandleEvent</function></funcdef>
42 <paramdef>int <parameter>fd</parameter></paramdef>
43 <paramdef>drmEventContextPtr <parameter>evctx</parameter></paramdef>
44 </funcprototype>
45 </funcsynopsis>
46
47 </refsynopsisdiv>
48
49 <refsect1>
50 <title>Description</title>
51 <para><function>drmHandleEvent</function> processes outstanding DRM events
52 on the DRM file-descriptor passed as <parameter>fd</parameter>. This
53 function should be called after the DRM file-descriptor has polled
54 readable; it will read the events and use the passed-in
55 <parameter>evctx</parameter> structure to call function pointers
56 with the parameters noted below:
57
58<programlisting>
59typedef struct _drmEventContext {
60 int version;
61 void (*vblank_handler) (int fd,
62 unsigned int sequence,
63 unsigned int tv_sec,
64 unsigned int tv_usec,
65 void *user_data)
66 void (*page_flip_handler) (int fd,
67 unsigned int sequence,
68 unsigned int tv_sec,
69 unsigned int tv_usec,
70 void *user_data)
71} drmEventContext, *drmEventContextPtr;
72</programlisting>
73
74 </para>
75
76 </refsect1>
77
78 <refsect1>
79 <title>Return Value</title>
80 <para><function>drmHandleEvent</function> returns <literal>0</literal> on
81 success, or if there is no data to read from the file-descriptor.
82 Returns <literal>-1</literal> if the read on the file-descriptor fails
83 or returns less than a full event record.</para>
84 </refsect1>
85
86 <refsect1>
87 <title>Reporting Bugs</title>
88 <para>Bugs in this function should be reported to
Eric Engestrom10ca5e12017-04-04 18:05:53 +010089 https://bugs.freedesktop.org/enter_bug.cgi?product=DRI&amp;component=libdrm
Eric Engestrom294be262017-04-04 17:37:02 +010090 under the "DRI" product, component "libdrm"</para>
David Herrmann6b7e45c2012-09-28 23:44:19 +020091 </refsect1>
92
93 <refsect1>
94 <title>See Also</title>
95 <para>
96 <citerefentry><refentrytitle>drm</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
97 <citerefentry><refentrytitle>drm-kms</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
98 <citerefentry><refentrytitle>drmModePageFlip</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
99 <citerefentry><refentrytitle>drmWaitVBlank</refentrytitle><manvolnum>3</manvolnum></citerefentry>
100 </para>
101 </refsect1>
102</refentry>