<div dir="ltr"><div dir="ltr">Oh sorry, I just realized that those changes like print_uint16_array_member()<br>or new macros should be sent in a separate patch. They are common changes<br>instead of DRM specific ones.<br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Aug 13, 2019 at 12:42 AM Zhibin Li <<a href="mailto:haoyouab@gmail.com">haoyouab@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">* drm_mpers.c: New file.<br>
* drm.c: Likewise.<br>
* linux/drm/drm.h: Likewise.<br>
* linux/drm/drm_mode.h: Likewise.<br>
* defs.h (drm_decode_number,print_uint16_array_member,<br>
drm_ioctl): New prototype.<br>
(drm_ctx_flags, drm_mode_flags, drm_mode_type): New xlat prototype.<br>
(umove_nor_syserror): New macro, a wrapper for umove and syserror.<br>
* ioctl.c (ioctl_decode): Call drm_ioctl for ioctl type 'd'.<br>
(ioctl_decode_command_number): Call drm_decode_number for ioctl type 'd'.<br>
* Makefile.am (strace_SOURCES): Add drm.c and drm_mpers.c.<br>
(EXTRA_DIST): Add linux/drm/drm.h and linux/drm/drm_mode.h.<br>
* print_fields.h (PRINT_FIELD_DRM_CRTC_ID): New macro. A wrapper of<br>
PRINT_FIELD_U for drm crtc_id fields.<br>
* util.c (print_uint16_array_member): New function.<br>
* xlat/<a href="http://drm_buf_desc_flags.in" rel="noreferrer" target="_blank">drm_buf_desc_flags.in</a>: New file.<br>
* xlat/<a href="http://drm_capability.in" rel="noreferrer" target="_blank">drm_capability.in</a>: Likewise.<br>
* xlat/<a href="http://drm_client_capability.in" rel="noreferrer" target="_blank">drm_client_capability.in</a>: Likewise.<br>
* xlat/<a href="http://drm_control_func.in" rel="noreferrer" target="_blank">drm_control_func.in</a>: Likewise.<br>
* xlat/<a href="http://drm_crtc_sequence_flags.in" rel="noreferrer" target="_blank">drm_crtc_sequence_flags.in</a>: Likewise.<br>
* xlat/<a href="http://drm_ctx_flags.in" rel="noreferrer" target="_blank">drm_ctx_flags.in</a>: Likewise.<br>
* xlat/<a href="http://drm_lock_flags.in" rel="noreferrer" target="_blank">drm_lock_flags.in</a>: Likewise.<br>
* xlat/<a href="http://drm_map_flags.in" rel="noreferrer" target="_blank">drm_map_flags.in</a>: Likewise.<br>
* xlat/<a href="http://drm_map_type.in" rel="noreferrer" target="_blank">drm_map_type.in</a>: Likewise.<br>
* xlat/<a href="http://drm_mode_atomic_flags.in" rel="noreferrer" target="_blank">drm_mode_atomic_flags.in</a>: Likewise.<br>
* xlat/<a href="http://drm_mode_create_lease_flags.in" rel="noreferrer" target="_blank">drm_mode_create_lease_flags.in</a>: Likewise.<br>
* xlat/<a href="http://drm_mode_cursor_flags.in" rel="noreferrer" target="_blank">drm_mode_cursor_flags.in</a>: Likewise.<br>
* xlat/<a href="http://drm_mode_encoder_type.in" rel="noreferrer" target="_blank">drm_mode_encoder_type.in</a>: Likewise.<br>
* xlat/<a href="http://drm_mode_fb_cmd2_flags.in" rel="noreferrer" target="_blank">drm_mode_fb_cmd2_flags.in</a>: Likewise.<br>
* xlat/<a href="http://drm_mode_fb_dirty_cmd_flags.in" rel="noreferrer" target="_blank">drm_mode_fb_dirty_cmd_flags.in</a>: Likewise.<br>
* xlat/<a href="http://drm_mode_flags.in" rel="noreferrer" target="_blank">drm_mode_flags.in</a>: Likewise.<br>
* xlat/drm_mode_get_property_flags.: Likewise.in<br>
* xlat/<a href="http://drm_mode_page_flip_flags.in" rel="noreferrer" target="_blank">drm_mode_page_flip_flags.in</a>: Likewise.<br>
* xlat/<a href="http://drm_mode_set_plane_flags.in" rel="noreferrer" target="_blank">drm_mode_set_plane_flags.in</a>: Likewise.<br>
* xlat/<a href="http://drm_mode_type.in" rel="noreferrer" target="_blank">drm_mode_type.in</a>: Likewise.<br>
* xlat/<a href="http://drm_modeset_cmd.in" rel="noreferrer" target="_blank">drm_modeset_cmd.in</a>: Likewise.<br>
* xlat/<a href="http://drm_prime_handle_flags.in" rel="noreferrer" target="_blank">drm_prime_handle_flags.in</a><br>
* xlat/<a href="http://drm_syncobj_fd_to_handle_flags.in" rel="noreferrer" target="_blank">drm_syncobj_fd_to_handle_flags.in</a>: Likewise.<br>
* xlat/<a href="http://drm_syncobj_flags.in" rel="noreferrer" target="_blank">drm_syncobj_flags.in</a>: Likewise.<br>
* xlat/<a href="http://drm_syncobj_handle_to_fd_flags.in" rel="noreferrer" target="_blank">drm_syncobj_handle_to_fd_flags.in</a>: Likewise.<br>
* xlat/<a href="http://drm_syncobj_wait_flags.in" rel="noreferrer" target="_blank">drm_syncobj_wait_flags.in</a>: Likewise.<br>
* xlat/<a href="http://drm_vblank_seq_type.in" rel="noreferrer" target="_blank">drm_vblank_seq_type.in</a>: Likewise.<br>
* xlat/<a href="http://drm_vblank_seq_type_flags.in" rel="noreferrer" target="_blank">drm_vblank_seq_type_flags.in</a>: Likewise.<br>
<br>
Co-authored-by: Patrik Jakobsson <<a href="mailto:patrik.r.jakobsson@gmail.com" target="_blank">patrik.r.jakobsson@gmail.com</a>><br>
---<br>
 Makefile.am                            |    4 +<br>
 defs.h                                 |   13 +<br>
 drm.c                                  | 1553 ++++++++++++++++++++++++<br>
 drm_mpers.c                            |  882 ++++++++++++++<br>
 ioctl.c                                |    4 +<br>
 linux/drm/drm.h                        | 1042 ++++++++++++++++<br>
 linux/drm/drm_mode.h                   |  914 ++++++++++++++<br>
 print_fields.h                         |    3 +<br>
 util.c                                 |    9 +<br>
 xlat/<a href="http://drm_buf_desc_flags.in" rel="noreferrer" target="_blank">drm_buf_desc_flags.in</a>             |    6 +<br>
 xlat/<a href="http://drm_capability.in" rel="noreferrer" target="_blank">drm_capability.in</a>                 |   15 +<br>
 xlat/<a href="http://drm_client_capability.in" rel="noreferrer" target="_blank">drm_client_capability.in</a>          |    6 +<br>
 xlat/<a href="http://drm_control_func.in" rel="noreferrer" target="_blank">drm_control_func.in</a>               |    5 +<br>
 xlat/<a href="http://drm_crtc_sequence_flags.in" rel="noreferrer" target="_blank">drm_crtc_sequence_flags.in</a>        |    3 +<br>
 xlat/<a href="http://drm_ctx_flags.in" rel="noreferrer" target="_blank">drm_ctx_flags.in</a>                  |    3 +<br>
 xlat/<a href="http://drm_lock_flags.in" rel="noreferrer" target="_blank">drm_lock_flags.in</a>                 |    7 +<br>
 xlat/<a href="http://drm_map_flags.in" rel="noreferrer" target="_blank">drm_map_flags.in</a>                  |    9 +<br>
 xlat/<a href="http://drm_map_type.in" rel="noreferrer" target="_blank">drm_map_type.in</a>                   |    7 +<br>
 xlat/<a href="http://drm_mode_atomic_flags.in" rel="noreferrer" target="_blank">drm_mode_atomic_flags.in</a>          |    6 +<br>
 xlat/<a href="http://drm_mode_create_lease_flags.in" rel="noreferrer" target="_blank">drm_mode_create_lease_flags.in</a>    |    2 +<br>
 xlat/<a href="http://drm_mode_cursor_flags.in" rel="noreferrer" target="_blank">drm_mode_cursor_flags.in</a>          |    3 +<br>
 xlat/<a href="http://drm_mode_encoder_type.in" rel="noreferrer" target="_blank">drm_mode_encoder_type.in</a>          |   10 +<br>
 xlat/<a href="http://drm_mode_fb_cmd2_flags.in" rel="noreferrer" target="_blank">drm_mode_fb_cmd2_flags.in</a>         |    3 +<br>
 xlat/<a href="http://drm_mode_fb_dirty_cmd_flags.in" rel="noreferrer" target="_blank">drm_mode_fb_dirty_cmd_flags.in</a>    |    3 +<br>
 xlat/<a href="http://drm_mode_flags.in" rel="noreferrer" target="_blank">drm_mode_flags.in</a>                 |    6 +<br>
 xlat/<a href="http://drm_mode_get_property_flags.in" rel="noreferrer" target="_blank">drm_mode_get_property_flags.in</a>    |    9 +<br>
 xlat/<a href="http://drm_mode_page_flip_flags.in" rel="noreferrer" target="_blank">drm_mode_page_flip_flags.in</a>       |    5 +<br>
 xlat/<a href="http://drm_mode_set_plane_flags.in" rel="noreferrer" target="_blank">drm_mode_set_plane_flags.in</a>       |    3 +<br>
 xlat/<a href="http://drm_mode_type.in" rel="noreferrer" target="_blank">drm_mode_type.in</a>                  |    8 +<br>
 xlat/<a href="http://drm_modeset_cmd.in" rel="noreferrer" target="_blank">drm_modeset_cmd.in</a>                |    3 +<br>
 xlat/<a href="http://drm_prime_handle_flags.in" rel="noreferrer" target="_blank">drm_prime_handle_flags.in</a>         |    2 +<br>
 xlat/<a href="http://drm_syncobj_fd_to_handle_flags.in" rel="noreferrer" target="_blank">drm_syncobj_fd_to_handle_flags.in</a> |    2 +<br>
 xlat/<a href="http://drm_syncobj_flags.in" rel="noreferrer" target="_blank">drm_syncobj_flags.in</a>              |    2 +<br>
 xlat/<a href="http://drm_syncobj_handle_to_fd_flags.in" rel="noreferrer" target="_blank">drm_syncobj_handle_to_fd_flags.in</a> |    1 +<br>
 xlat/<a href="http://drm_syncobj_wait_flags.in" rel="noreferrer" target="_blank">drm_syncobj_wait_flags.in</a>         |    4 +<br>
 xlat/<a href="http://drm_vblank_seq_type.in" rel="noreferrer" target="_blank">drm_vblank_seq_type.in</a>            |    3 +<br>
 xlat/<a href="http://drm_vblank_seq_type_flags.in" rel="noreferrer" target="_blank">drm_vblank_seq_type_flags.in</a>      |    6 +<br>
 37 files changed, 4566 insertions(+)<br>
 create mode 100644 drm.c<br>
 create mode 100644 drm_mpers.c<br>
 create mode 100644 linux/drm/drm.h<br>
 create mode 100644 linux/drm/drm_mode.h<br>
 create mode 100644 xlat/<a href="http://drm_buf_desc_flags.in" rel="noreferrer" target="_blank">drm_buf_desc_flags.in</a><br>
 create mode 100644 xlat/<a href="http://drm_capability.in" rel="noreferrer" target="_blank">drm_capability.in</a><br>
 create mode 100644 xlat/<a href="http://drm_client_capability.in" rel="noreferrer" target="_blank">drm_client_capability.in</a><br>
 create mode 100644 xlat/<a href="http://drm_control_func.in" rel="noreferrer" target="_blank">drm_control_func.in</a><br>
 create mode 100644 xlat/<a href="http://drm_crtc_sequence_flags.in" rel="noreferrer" target="_blank">drm_crtc_sequence_flags.in</a><br>
 create mode 100644 xlat/<a href="http://drm_ctx_flags.in" rel="noreferrer" target="_blank">drm_ctx_flags.in</a><br>
 create mode 100644 xlat/<a href="http://drm_lock_flags.in" rel="noreferrer" target="_blank">drm_lock_flags.in</a><br>
 create mode 100644 xlat/<a href="http://drm_map_flags.in" rel="noreferrer" target="_blank">drm_map_flags.in</a><br>
 create mode 100644 xlat/<a href="http://drm_map_type.in" rel="noreferrer" target="_blank">drm_map_type.in</a><br>
 create mode 100644 xlat/<a href="http://drm_mode_atomic_flags.in" rel="noreferrer" target="_blank">drm_mode_atomic_flags.in</a><br>
 create mode 100644 xlat/<a href="http://drm_mode_create_lease_flags.in" rel="noreferrer" target="_blank">drm_mode_create_lease_flags.in</a><br>
 create mode 100644 xlat/<a href="http://drm_mode_cursor_flags.in" rel="noreferrer" target="_blank">drm_mode_cursor_flags.in</a><br>
 create mode 100644 xlat/<a href="http://drm_mode_encoder_type.in" rel="noreferrer" target="_blank">drm_mode_encoder_type.in</a><br>
 create mode 100644 xlat/<a href="http://drm_mode_fb_cmd2_flags.in" rel="noreferrer" target="_blank">drm_mode_fb_cmd2_flags.in</a><br>
 create mode 100644 xlat/<a href="http://drm_mode_fb_dirty_cmd_flags.in" rel="noreferrer" target="_blank">drm_mode_fb_dirty_cmd_flags.in</a><br>
 create mode 100644 xlat/<a href="http://drm_mode_flags.in" rel="noreferrer" target="_blank">drm_mode_flags.in</a><br>
 create mode 100644 xlat/<a href="http://drm_mode_get_property_flags.in" rel="noreferrer" target="_blank">drm_mode_get_property_flags.in</a><br>
 create mode 100644 xlat/<a href="http://drm_mode_page_flip_flags.in" rel="noreferrer" target="_blank">drm_mode_page_flip_flags.in</a><br>
 create mode 100644 xlat/<a href="http://drm_mode_set_plane_flags.in" rel="noreferrer" target="_blank">drm_mode_set_plane_flags.in</a><br>
 create mode 100644 xlat/<a href="http://drm_mode_type.in" rel="noreferrer" target="_blank">drm_mode_type.in</a><br>
 create mode 100644 xlat/<a href="http://drm_modeset_cmd.in" rel="noreferrer" target="_blank">drm_modeset_cmd.in</a><br>
 create mode 100644 xlat/<a href="http://drm_prime_handle_flags.in" rel="noreferrer" target="_blank">drm_prime_handle_flags.in</a><br>
 create mode 100644 xlat/<a href="http://drm_syncobj_fd_to_handle_flags.in" rel="noreferrer" target="_blank">drm_syncobj_fd_to_handle_flags.in</a><br>
 create mode 100644 xlat/<a href="http://drm_syncobj_flags.in" rel="noreferrer" target="_blank">drm_syncobj_flags.in</a><br>
 create mode 100644 xlat/<a href="http://drm_syncobj_handle_to_fd_flags.in" rel="noreferrer" target="_blank">drm_syncobj_handle_to_fd_flags.in</a><br>
 create mode 100644 xlat/<a href="http://drm_syncobj_wait_flags.in" rel="noreferrer" target="_blank">drm_syncobj_wait_flags.in</a><br>
 create mode 100644 xlat/<a href="http://drm_vblank_seq_type.in" rel="noreferrer" target="_blank">drm_vblank_seq_type.in</a><br>
 create mode 100644 xlat/<a href="http://drm_vblank_seq_type_flags.in" rel="noreferrer" target="_blank">drm_vblank_seq_type_flags.in</a><br>
<br>
diff --git a/Makefile.am b/Makefile.am<br>
index 25a81f2c..388a7620 100644<br>
--- a/Makefile.am<br>
+++ b/Makefile.am<br>
@@ -101,6 +101,8 @@ strace_SOURCES =    \<br>
        dirent.c        \<br>
        dirent64.c      \<br>
        dm.c            \<br>
+       drm.c           \<br>
+       drm_mpers.c     \<br>
        dyxlat.c        \<br>
        empty.h         \<br>
        epoll.c         \<br>
@@ -538,6 +540,8 @@ EXTRA_DIST =                                \<br>
        linux/csky/syscallent.h         \<br>
        linux/bfin/userent.h            \<br>
        linux/check_scno.c              \<br>
+       linux/drm/drm.h                 \<br>
+       linux/drm/drm_mode.h            \<br>
        linux/dummy.h                   \<br>
        linux/errnoent.h                \<br>
        linux/getregs_old.h             \<br>
diff --git a/defs.h b/defs.h<br>
index 003cc228..1eb699c5 100644<br>
--- a/defs.h<br>
+++ b/defs.h<br>
@@ -313,6 +313,9 @@ extern const struct xlat arp_hardware_types[];<br>
 extern const struct xlat at_flags[];<br>
 extern const struct xlat clocknames[];<br>
 extern const struct xlat dirent_types[];<br>
+extern const struct xlat drm_ctx_flags[];<br>
+extern const struct xlat drm_mode_flags[];<br>
+extern const struct xlat drm_mode_type[];<br>
 extern const struct xlat ethernet_protocols[];<br>
 extern const struct xlat inet_protocols[];<br>
 extern const struct xlat evdev_abs[];<br>
@@ -508,6 +511,12 @@ umoven(struct tcb *, kernel_ulong_t addr, unsigned int len, void *laddr);<br>
 # define umove(pid, addr, objp)        \<br>
        umoven((pid), (addr), sizeof(*(objp)), (void *) (objp))<br>
<br>
+/**<br>
+ * @return true on success, false on error.<br>
+ */<br>
+# define umove_nor_syserror(tcp, arg, objp) \<br>
+       (!syserror(tcp) && !umove(tcp, arg, objp))<br>
+<br>
 /**<br>
  * @return true on success, false on error.<br>
  */<br>
@@ -769,6 +778,8 @@ extern void print_kernel_version(unsigned long version);<br>
 extern void print_abnormal_hi(kernel_ulong_t);<br>
 extern void print_ioprio(unsigned int ioprio);<br>
<br>
+extern bool print_uint16_array_member(struct tcb *, void *elem_buf,<br>
+                                     size_t elem_size, void *data);<br>
 extern bool print_int32_array_member(struct tcb *, void *elem_buf,<br>
                                     size_t elem_size, void *data);<br>
 extern bool print_uint32_array_member(struct tcb *, void *elem_buf,<br>
@@ -924,6 +935,7 @@ name ## _ioctl(struct tcb *, unsigned int request, kernel_ulong_t arg)      \<br>
 /* End of DECL_IOCTL definition. */<br>
<br>
 DECL_IOCTL(dm);<br>
+DECL_IOCTL(drm);<br>
 DECL_IOCTL(evdev);<br>
 DECL_IOCTL(file);<br>
 DECL_IOCTL(fs_x);<br>
@@ -941,6 +953,7 @@ DECL_IOCTL(uffdio);<br>
<br>
 extern int decode_sg_io_v4(struct tcb *, const kernel_ulong_t arg);<br>
 extern void print_evdev_ff_type(const kernel_ulong_t val);<br>
+extern int drm_decode_number(struct tcb *, const unsigned int code);<br>
<br>
 struct nlmsghdr;<br>
<br>
diff --git a/drm.c b/drm.c<br>
new file mode 100644<br>
index 00000000..c754b16a<br>
--- /dev/null<br>
+++ b/drm.c<br>
@@ -0,0 +1,1553 @@<br>
+/*<br>
+ * Copyright (c) 2015 Intel Corporation<br>
+ * Copyright (c) 2019 Patrik Jakobsson <<a href="mailto:pjakobsson@suse.de" target="_blank">pjakobsson@suse.de</a>><br>
+ * Copyright (c) 2019 The strace developers.<br>
+ * All rights reserved.<br>
+ *<br>
+ * SPDX-License-Identifier: LGPL-2.1-or-later<br>
+ */<br>
+<br>
+#include "defs.h"<br>
+#include "print_fields.h"<br>
+#include <drm/drm.h><br>
+<br>
+#include "xlat/drm_capability.h"<br>
+#include "xlat/drm_client_capability.h"<br>
+#include "xlat/drm_control_func.h"<br>
+#include "xlat/drm_crtc_sequence_flags.h"<br>
+#include "xlat/drm_ctx_flags.h"<br>
+#include "xlat/drm_lock_flags.h"<br>
+#include "xlat/drm_modeset_cmd.h"<br>
+#include "xlat/drm_mode_atomic_flags.h"<br>
+#include "xlat/drm_mode_create_lease_flags.h"<br>
+#include "xlat/drm_mode_cursor_flags.h"<br>
+#include "xlat/drm_mode_encoder_type.h"<br>
+#include "xlat/drm_mode_fb_dirty_cmd_flags.h"<br>
+#include "xlat/drm_mode_flags.h"<br>
+#include "xlat/drm_mode_get_property_flags.h"<br>
+#include "xlat/drm_mode_page_flip_flags.h"<br>
+#include "xlat/drm_mode_set_plane_flags.h"<br>
+#include "xlat/drm_mode_type.h"<br>
+#include "xlat/drm_prime_handle_flags.h"<br>
+#include "xlat/drm_syncobj_fd_to_handle_flags.h"<br>
+#include "xlat/drm_syncobj_flags.h"<br>
+#include "xlat/drm_syncobj_handle_to_fd_flags.h"<br>
+#include "xlat/drm_syncobj_wait_flags.h"<br>
+<br>
+static void<br>
+print_drm_iowr(const unsigned int nr, const unsigned int size,<br>
+              const char *str)<br>
+{<br>
+       tprintf("DRM_IOWR(%#x, %#x) /* %s */", nr, size, str);<br>
+}<br>
+<br>
+int<br>
+drm_decode_number(struct tcb *const tcp, const unsigned int code)<br>
+{<br>
+       const unsigned int nr = _IOC_NR(code);<br>
+       const unsigned int size = _IOC_SIZE(code);<br>
+<br>
+       if (_IOC_DIR(code) == (_IOC_READ | _IOC_WRITE)) {<br>
+               switch (nr) {<br>
+               case _IOC_NR(DRM_IOCTL_MODE_GETCONNECTOR):<br>
+                       /* In Linux commit v3.12-rc7~26^2~2 a u32 padding was */<br>
+                       /* added to struct drm_mode_get_connector so in old */<br>
+                       /* kernel headers the size of this structure is 0x4c */<br>
+                       /* instead of today's 0x50, which makes it different */<br>
+                       /* among personalities in case of older kernels hence */<br>
+                       /* we handle it later in drm_mpers.c instead of here. */<br>
+                       /* The newer 0x50-size is not affected even in mpers. */<br>
+                       print_drm_iowr(nr, size,<br>
+                                      "DRM_IOCTL_MODE_GETCONNECTOR");<br>
+                       return IOCTL_NUMBER_STOP_LOOKUP;<br>
+<br>
+               case _IOC_NR(DRM_IOCTL_MODE_ADDFB2):<br>
+                       /* The struct size differs among versions of kernels. */<br>
+                       /* Specifically, in Linux commit v4.1-rc1~69^2~35^2~57 */<br>
+                       /* modifier field was added to the end of structure. */<br>
+                       print_drm_iowr(nr, size,<br>
+                                      "DRM_IOCTL_MODE_ADDFB2");<br>
+                       return IOCTL_NUMBER_STOP_LOOKUP;<br>
+               }<br>
+       }<br>
+<br>
+       return 0;<br>
+}<br>
+<br>
+static int<br>
+drm_get_magic(struct tcb *const tcp, const kernel_ulong_t arg)<br>
+{<br>
+       struct drm_auth auth;<br>
+<br>
+       if (entering(tcp))<br>
+               return 0;<br>
+<br>
+       /* exiting-only code */<br>
+       if (umove_or_printaddr(tcp, arg, &auth))<br>
+               return RVAL_IOCTL_DECODED;<br>
+<br>
+       PRINT_FIELD_U("{", auth, magic);<br>
+       tprints("}");<br>
+<br>
+       return RVAL_IOCTL_DECODED;<br>
+}<br>
+<br>
+static int<br>
+drm_irq_busid(struct tcb *const tcp, const kernel_ulong_t arg)<br>
+{<br>
+       struct drm_irq_busid busid;<br>
+<br>
+       if (entering(tcp)) {<br>
+               if (umove_or_printaddr(tcp, arg, &busid))<br>
+                       return RVAL_IOCTL_DECODED;<br>
+               PRINT_FIELD_D("{", busid, busnum);<br>
+               PRINT_FIELD_D(", ", busid, devnum);<br>
+               PRINT_FIELD_D(", ", busid, funcnum);<br>
+<br>
+               return 0;<br>
+       }<br>
+<br>
+       if (!syserror(tcp) && !umove(tcp, arg, &busid)) {<br>
+               PRINT_FIELD_D(", ", busid, irq);<br>
+       }<br>
+<br>
+       tprints("}");<br>
+<br>
+       return RVAL_IOCTL_DECODED;<br>
+}<br>
+<br>
+static void<br>
+print_set_version(struct tcb *const tcp, const kernel_ulong_t arg,<br>
+                 struct drm_set_version *ver)<br>
+{<br>
+       PRINT_FIELD_D("{", *ver, drm_di_major);<br>
+       PRINT_FIELD_D(", ", *ver, drm_di_minor);<br>
+       PRINT_FIELD_D(", ", *ver, drm_dd_major);<br>
+       PRINT_FIELD_D(", ", *ver, drm_dd_minor);<br>
+       tprints("}");<br>
+}<br>
+<br>
+static int<br>
+drm_set_version(struct tcb *const tcp, const kernel_ulong_t arg)<br>
+{<br>
+       struct drm_set_version ver;<br>
+<br>
+       if (entering(tcp)) {<br>
+               if (umove_or_printaddr(tcp, arg, &ver))<br>
+                       return RVAL_IOCTL_DECODED;<br>
+               print_set_version(tcp, arg, &ver);<br>
+       }<br>
+<br>
+       if (!syserror(tcp) && !umove(tcp, arg, &ver)) {<br>
+               tprints(" => ");<br>
+               print_set_version(tcp, arg, &ver);<br>
+       }<br>
+<br>
+       return RVAL_IOCTL_DECODED;<br>
+}<br>
+<br>
+<br>
+static int<br>
+drm_modeset_ctl(struct tcb *const tcp, const kernel_ulong_t arg)<br>
+{<br>
+       struct drm_modeset_ctl ctl;<br>
+<br>
+       if (umove_or_printaddr(tcp, arg, &ctl))<br>
+               return RVAL_IOCTL_DECODED;<br>
+<br>
+       PRINT_FIELD_U("{", ctl, crtc);<br>
+       PRINT_FIELD_XVAL(", ", ctl, cmd, drm_modeset_cmd, "_DRM_???");<br>
+       tprints("}");<br>
+<br>
+       return RVAL_IOCTL_DECODED;<br>
+}<br>
+<br>
+static int<br>
+drm_gem_close(struct tcb *const tcp, const kernel_ulong_t arg)<br>
+{<br>
+       struct drm_gem_close close;<br>
+<br>
+       if (umove_or_printaddr(tcp, arg, &close))<br>
+               return RVAL_IOCTL_DECODED;<br>
+<br>
+       PRINT_FIELD_U("{", close, handle);<br>
+       tprints("}");<br>
+<br>
+       return RVAL_IOCTL_DECODED;<br>
+}<br>
+<br>
+static int<br>
+drm_gem_flink(struct tcb *const tcp, const kernel_ulong_t arg)<br>
+{<br>
+       struct drm_gem_flink flink;<br>
+<br>
+       if (entering(tcp)) {<br>
+               if (umove_or_printaddr(tcp, arg, &flink))<br>
+                       return RVAL_IOCTL_DECODED;<br>
+               PRINT_FIELD_U("{", flink, handle);<br>
+<br>
+               return 0;<br>
+       }<br>
+<br>
+       if (!syserror(tcp) && !umove(tcp, arg, &flink)) {<br>
+               PRINT_FIELD_U(", ", flink, name);<br>
+       }<br>
+<br>
+       tprints("}");<br>
+<br>
+       return RVAL_IOCTL_DECODED;<br>
+}<br>
+<br>
+static int<br>
+drm_gem_open(struct tcb *const tcp, const kernel_ulong_t arg)<br>
+{<br>
+       struct drm_gem_open open;<br>
+<br>
+       if (entering(tcp)) {<br>
+               if (umove_or_printaddr(tcp, arg, &open))<br>
+                       return RVAL_IOCTL_DECODED;<br>
+               PRINT_FIELD_U("{", open, name);<br>
+<br>
+               return 0;<br>
+       }<br>
+<br>
+       if (!syserror(tcp) && !umove(tcp, arg, &open)) {<br>
+               PRINT_FIELD_U(", ", open, handle);<br>
+               PRINT_FIELD_U(", ", open, size);<br>
+       }<br>
+<br>
+       tprints("}");<br>
+<br>
+       return RVAL_IOCTL_DECODED;<br>
+}<br>
+<br>
+static int<br>
+drm_get_cap(struct tcb *const tcp, const kernel_ulong_t arg)<br>
+{<br>
+       struct drm_get_cap cap;<br>
+<br>
+       if (entering(tcp)) {<br>
+               if (umove_or_printaddr(tcp, arg, &cap))<br>
+                       return RVAL_IOCTL_DECODED;<br>
+               PRINT_FIELD_XVAL("{", cap, capability, drm_capability,<br>
+                                "DRM_CAP_???");<br>
+<br>
+               return 0;<br>
+       }<br>
+<br>
+       if (!syserror(tcp) && !umove(tcp, arg, &cap)) {<br>
+               PRINT_FIELD_U(", ", cap, value);<br>
+       }<br>
+<br>
+       tprints("}");<br>
+<br>
+       return RVAL_IOCTL_DECODED;<br>
+}<br>
+<br>
+static int<br>
+drm_set_client_cap(struct tcb *const tcp, const kernel_ulong_t arg)<br>
+{<br>
+       struct drm_set_client_cap cap;<br>
+<br>
+       if (umove_or_printaddr(tcp, arg, &cap))<br>
+               return RVAL_IOCTL_DECODED;<br>
+<br>
+       PRINT_FIELD_XVAL("{", cap, capability, drm_client_capability,<br>
+                        "DRM_CLIENT_CAP_???");<br>
+       PRINT_FIELD_U(", ", cap, value);<br>
+       tprints("}");<br>
+<br>
+       return RVAL_IOCTL_DECODED;<br>
+}<br>
+<br>
+static int<br>
+drm_auth_magic(struct tcb *const tcp, const kernel_ulong_t arg)<br>
+{<br>
+       struct drm_auth auth;<br>
+<br>
+       if (umove_or_printaddr(tcp, arg, &auth))<br>
+               return RVAL_IOCTL_DECODED;<br>
+<br>
+       PRINT_FIELD_U("{", auth, magic);<br>
+       tprints("}");<br>
+<br>
+       return RVAL_IOCTL_DECODED;<br>
+}<br>
+<br>
+static int<br>
+drm_noop(struct tcb *const tcp, const kernel_ulong_t arg)<br>
+{<br>
+       /* No-op ioctl */<br>
+       printaddr(arg);<br>
+       return RVAL_IOCTL_DECODED;<br>
+}<br>
+<br>
+static int<br>
+drm_control(struct tcb *const tcp, const kernel_ulong_t arg)<br>
+{<br>
+       struct drm_control control;<br>
+<br>
+       if (umove_or_printaddr(tcp, arg, &control))<br>
+               return RVAL_IOCTL_DECODED;<br>
+<br>
+       PRINT_FIELD_XVAL("{", control, func, drm_control_func,<br>
+                        "DRM_???");<br>
+       PRINT_FIELD_D(", ", control, irq);<br>
+       tprints("}");<br>
+<br>
+       return RVAL_IOCTL_DECODED;<br>
+}<br>
+<br>
+static int<br>
+drm_ctx(struct tcb *const tcp, const kernel_ulong_t arg, bool is_get)<br>
+{<br>
+       /* GET_CTX ioctl does not touch handle */<br>
+       /* field according to the drvier code. */<br>
+       struct drm_ctx ctx;<br>
+<br>
+       if (umove_or_printaddr(tcp, arg, &ctx))<br>
+               return RVAL_IOCTL_DECODED;<br>
+       if (is_get)<br>
+               PRINT_FIELD_FLAGS("{", ctx, flags, drm_ctx_flags,<br>
+                                 "_DRM_CONTEXT_???");<br>
+       else<br>
+               PRINT_FIELD_U("{", ctx, handle);<br>
+<br>
+       tprints("}");<br>
+<br>
+       return RVAL_IOCTL_DECODED;<br>
+}<br>
+<br>
+static int<br>
+drm_lock(struct tcb *const tcp, const kernel_ulong_t arg)<br>
+{<br>
+       struct drm_lock lock;<br>
+<br>
+       if (entering(tcp))<br>
+               return 0;<br>
+<br>
+       /* exiting-only code */<br>
+       if (umove_or_printaddr(tcp, arg, &lock))<br>
+               return RVAL_IOCTL_DECODED;<br>
+       PRINT_FIELD_D("{", lock, context);<br>
+       PRINT_FIELD_FLAGS(", ", lock, flags, drm_lock_flags, "_DRM_LOCK_???");<br>
+       tprints("}");<br>
+<br>
+       return RVAL_IOCTL_DECODED;<br>
+}<br>
+<br>
+static int<br>
+drm_prime_handle_to_fd(struct tcb *const tcp, const kernel_ulong_t arg)<br>
+{<br>
+       struct drm_prime_handle handle;<br>
+<br>
+       if (entering(tcp)) {<br>
+               if (umove_or_printaddr(tcp, arg, &handle))<br>
+                       return RVAL_IOCTL_DECODED;<br>
+               PRINT_FIELD_U("{", handle, handle);<br>
+               PRINT_FIELD_FLAGS(", ", handle, flags, drm_prime_handle_flags,<br>
+                                 "DRM_???");<br>
+<br>
+               return 0;<br>
+       }<br>
+<br>
+       if (!syserror(tcp) && !umove(tcp, arg, &handle)) {<br>
+               PRINT_FIELD_FD(", ", handle, fd, tcp);<br>
+       }<br>
+<br>
+       tprints("}");<br>
+<br>
+       return RVAL_IOCTL_DECODED;<br>
+}<br>
+<br>
+static int<br>
+drm_prime_fd_to_handle(struct tcb *const tcp, const kernel_ulong_t arg)<br>
+{<br>
+       struct drm_prime_handle handle;<br>
+<br>
+       if (entering(tcp)) {<br>
+               if (umove_or_printaddr(tcp, arg, &handle))<br>
+                       return RVAL_IOCTL_DECODED;<br>
+               /* The printing oder here is different comparing to */<br>
+               /* the order of fields in the struture because in */<br>
+               /* this ioctl command we have to get handle via fd. */<br>
+               PRINT_FIELD_FD("{", handle, fd, tcp);<br>
+<br>
+               return 0;<br>
+       }<br>
+<br>
+       if (!syserror(tcp) && !umove(tcp, arg, &handle)) {<br>
+               PRINT_FIELD_U(", ", handle, handle);<br>
+       }<br>
+<br>
+       tprints("}");<br>
+<br>
+       return RVAL_IOCTL_DECODED;<br>
+<br>
+}<br>
+<br>
+static int<br>
+drm_crtc_get_sequence(struct tcb *const tcp, const kernel_ulong_t arg)<br>
+{<br>
+       struct drm_crtc_get_sequence seq;<br>
+<br>
+       if (entering(tcp)) {<br>
+               if (umove_or_printaddr(tcp, arg, &seq))<br>
+                       return RVAL_IOCTL_DECODED;<br>
+               PRINT_FIELD_DRM_CRTC_ID("{", seq, crtc_id);<br>
+<br>
+               return 0;<br>
+       }<br>
+<br>
+       if (!syserror(tcp) && !umove(tcp, arg, &seq)) {<br>
+               PRINT_FIELD_U(", ", seq, active);<br>
+               PRINT_FIELD_U(", ", seq, sequence);<br>
+               PRINT_FIELD_D(", ", seq, sequence_ns);<br>
+       }<br>
+<br>
+       tprints("}");<br>
+<br>
+       return RVAL_IOCTL_DECODED;<br>
+}<br>
+<br>
+static int<br>
+drm_crtc_queue_sequence(struct tcb *const tcp, const kernel_ulong_t arg)<br>
+{<br>
+       struct drm_crtc_queue_sequence seq;<br>
+<br>
+       if (entering(tcp)) {<br>
+               if (umove_or_printaddr(tcp, arg, &seq))<br>
+                       return RVAL_IOCTL_DECODED;<br>
+               PRINT_FIELD_DRM_CRTC_ID("{", seq, crtc_id);<br>
+               PRINT_FIELD_FLAGS(", ", seq, flags, drm_crtc_sequence_flags,<br>
+                                "DRM_CRTC_SEQUENCE_???");<br>
+               PRINT_FIELD_X(", ", seq, user_data);<br>
+               PRINT_FIELD_U(", ", seq, sequence);<br>
+               tprints("}");<br>
+<br>
+               return 0;<br>
+       }<br>
+<br>
+       if (!syserror(tcp) && !umove(tcp, arg, &seq)) {<br>
+               PRINT_FIELD_U(" => {", seq, sequence);<br>
+               tprints("}");<br>
+       }<br>
+<br>
+       return RVAL_IOCTL_DECODED;<br>
+}<br>
+<br>
+static int<br>
+drm_mode_get_resources(struct tcb *const tcp, const kernel_ulong_t arg)<br>
+{<br>
+       struct drm_mode_card_res res;<br>
+       uint32_t u32_val;<br>
+<br>
+       if (entering(tcp)) {<br>
+               if (umove_or_printaddr(tcp, arg, &res))<br>
+                       return RVAL_IOCTL_DECODED;<br>
+               tprints("{fb_id_ptr=");<br>
+               print_array(tcp, res.fb_id_ptr, res.count_fbs,<br>
+                           &u32_val, sizeof(u32_val),<br>
+                           tfetch_mem, print_uint32_array_member, 0);<br>
+               tprints(", crtc_id_ptr=");<br>
+               print_array(tcp, res.crtc_id_ptr, res.count_crtcs,<br>
+                           &u32_val, sizeof(u32_val),<br>
+                           tfetch_mem, print_uint32_array_member, 0);<br>
+               tprints(", connector_id_ptr=");<br>
+               print_array(tcp, res.connector_id_ptr, res.count_connectors,<br>
+                           &u32_val, sizeof(u32_val),<br>
+                           tfetch_mem, print_uint32_array_member, 0);<br>
+               tprints(", encoder_id_ptr=");<br>
+               print_array(tcp, res.encoder_id_ptr, res.count_encoders,<br>
+                           &u32_val, sizeof(u32_val),<br>
+                           tfetch_mem, print_uint32_array_member, 0);<br>
+               PRINT_FIELD_U(", ", res, count_fbs);<br>
+               PRINT_FIELD_U(", ", res, count_crtcs);<br>
+               PRINT_FIELD_U(", ", res, count_connectors);<br>
+               PRINT_FIELD_U(", ", res, count_encoders);<br>
+               tprints("}");<br>
+<br>
+               return 0;<br>
+       }<br>
+<br>
+       if (!syserror(tcp) && !umove(tcp, arg, &res)) {<br>
+               PRINT_FIELD_U(" => {", res, count_fbs);<br>
+               PRINT_FIELD_U(", ", res, count_crtcs);<br>
+               PRINT_FIELD_U(", ", res, count_connectors);<br>
+               PRINT_FIELD_U(", ", res, count_encoders);<br>
+               PRINT_FIELD_U(", ", res, min_width);<br>
+               PRINT_FIELD_U(", ", res, max_width);<br>
+               PRINT_FIELD_U(", ", res, min_height);<br>
+               PRINT_FIELD_U(", ", res, max_height);<br>
+               tprints("}");<br>
+       }<br>
+<br>
+       return RVAL_IOCTL_DECODED;<br>
+}<br>
+<br>
+static void<br>
+print_drm_mode_modeinfo(struct drm_mode_modeinfo *info)<br>
+{<br>
+       PRINT_FIELD_U("{", *info, clock);<br>
+       PRINT_FIELD_U(", ", *info, hdisplay);<br>
+       PRINT_FIELD_U(", ", *info, hsync_start);<br>
+       PRINT_FIELD_U(", ", *info, hsync_end);<br>
+       PRINT_FIELD_U(", ", *info, htotal);<br>
+       PRINT_FIELD_U(", ", *info, hskew);<br>
+       PRINT_FIELD_U(", ", *info, vdisplay);<br>
+       PRINT_FIELD_U(", ", *info, vsync_start);<br>
+       PRINT_FIELD_U(", ", *info, vsync_end);<br>
+       PRINT_FIELD_U(", ", *info, vtotal);<br>
+       PRINT_FIELD_U(", ", *info, vscan);<br>
+       PRINT_FIELD_U(", ", *info, vrefresh);<br>
+       PRINT_FIELD_FLAGS(", ", *info, flags, drm_mode_flags,<br>
+                        "DRM_MODE_FLAG_PIC_???");<br>
+       PRINT_FIELD_XVAL(", ", *info, type, drm_mode_type,<br>
+                        "DRM_MODE_TYPE_???");<br>
+       PRINT_FIELD_CSTRING(", ", *info, name);<br>
+       tprints("}");<br>
+}<br>
+<br>
+static void<br>
+print_drm_mode_crtc_tail(struct tcb *const tcp, struct drm_mode_crtc *crtc,<br>
+                        bool is_get)<br>
+{<br>
+       uint32_t set_connectors_ptr;<br>
+<br>
+       if (!is_get) {<br>
+               tprints(", set_connectors_ptr=");<br>
+               print_array(tcp, crtc->set_connectors_ptr,<br>
+                           crtc->count_connectors,<br>
+                           &set_connectors_ptr, sizeof(set_connectors_ptr),<br>
+                           tfetch_mem, print_uint32_array_member, 0);<br>
+               PRINT_FIELD_U(", ", *crtc, count_connectors);<br>
+       }<br>
+       PRINT_FIELD_U(", ", *crtc, fb_id);<br>
+       PRINT_FIELD_U(", ", *crtc, x);<br>
+       PRINT_FIELD_U(", ", *crtc, y);<br>
+       PRINT_FIELD_U(", ", *crtc, gamma_size);<br>
+       PRINT_FIELD_U(", ", *crtc, mode_valid);<br>
+       tprints(", mode=");<br>
+       print_drm_mode_modeinfo(&crtc->mode);<br>
+}<br>
+<br>
+static int<br>
+drm_mode_crtc(struct tcb *const tcp, const kernel_ulong_t arg,<br>
+             bool is_get)<br>
+{<br>
+       struct drm_mode_crtc crtc;<br>
+<br>
+       if (entering(tcp)) {<br>
+               if (umove_or_printaddr(tcp, arg, &crtc))<br>
+                       return RVAL_IOCTL_DECODED;<br>
+               PRINT_FIELD_DRM_CRTC_ID("{", crtc, crtc_id);<br>
+               if (is_get)<br>
+                       return 0;<br>
+               print_drm_mode_crtc_tail(tcp, &crtc, is_get);<br>
+<br>
+               return 0;<br>
+       }<br>
+<br>
+       if (!syserror(tcp) && !umove(tcp, arg, &crtc) && is_get) {<br>
+               print_drm_mode_crtc_tail(tcp, &crtc, is_get);<br>
+       }<br>
+<br>
+       tprints("}");<br>
+<br>
+       return RVAL_IOCTL_DECODED;<br>
+}<br>
+<br>
+static int<br>
+drm_mode_cursor(struct tcb *const tcp, const kernel_ulong_t arg)<br>
+{<br>
+       struct drm_mode_cursor cursor;<br>
+<br>
+       if (umove_or_printaddr(tcp, arg, &cursor))<br>
+               return RVAL_IOCTL_DECODED;<br>
+<br>
+       PRINT_FIELD_FLAGS("{", cursor, flags, drm_mode_cursor_flags,<br>
+                         "DRM_MODE_CURSOR_???");<br>
+       PRINT_FIELD_DRM_CRTC_ID(", ", cursor, crtc_id);<br>
+       PRINT_FIELD_D(", ", cursor, x);<br>
+       PRINT_FIELD_D(", ", cursor, y);<br>
+       PRINT_FIELD_U(", ", cursor, width);<br>
+       PRINT_FIELD_U(", ", cursor, height);<br>
+       PRINT_FIELD_U(", ", cursor, handle);<br>
+       tprints("}");<br>
+<br>
+       return RVAL_IOCTL_DECODED;<br>
+}<br>
+<br>
+static int<br>
+drm_mode_gamma(struct tcb *const tcp, const kernel_ulong_t arg)<br>
+{<br>
+       struct drm_mode_crtc_lut lut;<br>
+       int array_size;<br>
+       uint16_t u32_val;<br>
+<br>
+       if (umove_or_printaddr(tcp, arg, &lut))<br>
+               return RVAL_IOCTL_DECODED;<br>
+<br>
+       array_size = lut.gamma_size * (sizeof(uint16_t));<br>
+       PRINT_FIELD_DRM_CRTC_ID("{", lut, crtc_id);<br>
+       PRINT_FIELD_U(", ", lut, gamma_size);<br>
+       tprints(", red=");<br>
+       print_array(tcp, lut.red, array_size,<br>
+                   &u32_val, sizeof(u32_val),<br>
+                   tfetch_mem, print_uint16_array_member, 0);<br>
+       tprints(", green=");<br>
+       print_array(tcp, lut.green, array_size,<br>
+                   &u32_val, sizeof(u32_val),<br>
+                   tfetch_mem, print_uint16_array_member, 0);<br>
+       tprints(", blue=");<br>
+       print_array(tcp, lut.blue, array_size,<br>
+                   &u32_val, sizeof(u32_val),<br>
+                   tfetch_mem, print_uint16_array_member, 0);<br>
+<br>
+       tprints("}");<br>
+<br>
+       return RVAL_IOCTL_DECODED;<br>
+}<br>
+<br>
+static int<br>
+drm_mode_get_encoder(struct tcb *const tcp, const kernel_ulong_t arg)<br>
+{<br>
+       struct drm_mode_get_encoder enc;<br>
+<br>
+       if (entering(tcp)) {<br>
+               if (umove_or_printaddr(tcp, arg, &enc))<br>
+                       return RVAL_IOCTL_DECODED;<br>
+<br>
+               PRINT_FIELD_U("{", enc, encoder_id);<br>
+               tprints("}");<br>
+<br>
+               return 0;<br>
+       }<br>
+<br>
+       if (!syserror(tcp) && !umove(tcp, arg, &enc)) {<br>
+               PRINT_FIELD_U(" => {", enc, encoder_id);<br>
+               PRINT_FIELD_XVAL(", ", enc, encoder_type, drm_mode_encoder_type,<br>
+                                "DRM_MODE_ENCODER_???");<br>
+               PRINT_FIELD_DRM_CRTC_ID(", ", enc, crtc_id);<br>
+               PRINT_FIELD_X(", ", enc, possible_crtcs);<br>
+               PRINT_FIELD_X(", ", enc, possible_clones);<br>
+               tprints("}");<br>
+       }<br>
+<br>
+       return RVAL_IOCTL_DECODED;<br>
+}<br>
+<br>
+static bool<br>
+print_drm_mode_property_enum(struct tcb *tcp, void *elem_buf,<br>
+                            size_t elem_size, void *data)<br>
+{<br>
+       const struct drm_mode_property_enum *p = elem_buf;<br>
+       PRINT_FIELD_U("{", *p, value);<br>
+       PRINT_FIELD_CSTRING(", ", *p, name);<br>
+       tprints("}");<br>
+       return true;<br>
+}<br>
+<br>
+static int<br>
+drm_mode_get_property(struct tcb *const tcp, const kernel_ulong_t arg)<br>
+{<br>
+       struct drm_mode_get_property prop;<br>
+       uint64_t values_val;<br>
+       struct drm_mode_property_enum enum_blob_val;<br>
+<br>
+       if (entering(tcp)) {<br>
+               if (umove_or_printaddr(tcp, arg, &prop))<br>
+                       return RVAL_IOCTL_DECODED;<br>
+<br>
+               PRINT_FIELD_U("{", prop, prop_id);<br>
+               PRINT_FIELD_U(", ", prop, count_values);<br>
+               PRINT_FIELD_U(", ", prop, count_enum_blobs);<br>
+               tprints("}");<br>
+<br>
+               return 0;<br>
+       }<br>
+<br>
+       if (!syserror(tcp) && !umove(tcp, arg, &prop)) {<br>
+               tprints(" => {values_ptr=");<br>
+               print_array(tcp, prop.values_ptr, prop.count_values,<br>
+                           &values_val, sizeof(values_val),<br>
+                           tfetch_mem, print_uint64_array_member, 0);<br>
+               tprints(", enum_blob_ptr=");<br>
+               print_array(tcp, prop.enum_blob_ptr, prop.count_enum_blobs,<br>
+                           &enum_blob_val, sizeof(enum_blob_val),<br>
+                           tfetch_mem, print_drm_mode_property_enum, 0);<br>
+               PRINT_FIELD_FLAGS(", ", prop, flags, drm_mode_get_property_flags,<br>
+                                 "DRM_MODE_PROP_???");<br>
+               PRINT_FIELD_CSTRING(", ", prop, name);<br>
+               PRINT_FIELD_U(", ", prop, count_values);<br>
+               PRINT_FIELD_U(", ", prop, count_enum_blobs);<br>
+               tprints("}");<br>
+       }<br>
+<br>
+       return RVAL_IOCTL_DECODED;<br>
+}<br>
+<br>
+static int<br>
+drm_mode_set_property(struct tcb *const tcp, const kernel_ulong_t arg)<br>
+{<br>
+       struct drm_mode_connector_set_property prop;<br>
+<br>
+       if (umove_or_printaddr(tcp, arg, &prop))<br>
+               return RVAL_IOCTL_DECODED;<br>
+<br>
+       PRINT_FIELD_U("{", prop, value);<br>
+       PRINT_FIELD_U(", ", prop, prop_id);<br>
+       PRINT_FIELD_U(", ", prop, connector_id);<br>
+       tprints("}");<br>
+<br>
+       return RVAL_IOCTL_DECODED;<br>
+}<br>
+<br>
+static int<br>
+drm_mode_get_prop_blob(struct tcb *const tcp, const kernel_ulong_t arg)<br>
+{<br>
+       struct drm_mode_get_blob blob;<br>
+<br>
+       if (entering(tcp)) {<br>
+               if (umove_or_printaddr(tcp, arg, &blob))<br>
+                       return RVAL_IOCTL_DECODED;<br>
+               PRINT_FIELD_U("{", blob, blob_id);<br>
+               PRINT_FIELD_U(", ", blob, length);<br>
+               tprints("}");<br>
+<br>
+               return 0;<br>
+       }<br>
+<br>
+       if (!syserror(tcp) && !umove(tcp, arg, &blob)) {<br>
+               PRINT_FIELD_U(" => {", blob, length);<br>
+               PRINT_FIELD_ADDR64(", ", blob, data);<br>
+               tprints("}");<br>
+       }<br>
+<br>
+       return RVAL_IOCTL_DECODED;<br>
+}<br>
+<br>
+static void<br>
+print_drm_mode_fb_cmd_part(struct drm_mode_fb_cmd *cmd)<br>
+{<br>
+       /* The prefix might differ here */<br>
+       /* and it could be ", " or "{". */<br>
+       /* So we print it in the caller. */<br>
+       PRINT_FIELD_U("", *cmd, width);<br>
+       PRINT_FIELD_U(", ", *cmd, height);<br>
+       PRINT_FIELD_U(", ", *cmd, pitch);<br>
+       PRINT_FIELD_U(", ", *cmd, bpp);<br>
+       PRINT_FIELD_U(", ", *cmd, depth);<br>
+       PRINT_FIELD_U(", ", *cmd, handle);<br>
+}<br>
+<br>
+static int<br>
+drm_mode_get_fb(struct tcb *const tcp, const kernel_ulong_t arg)<br>
+{<br>
+       struct drm_mode_fb_cmd cmd;<br>
+<br>
+       if (entering(tcp)) {<br>
+               if (umove_or_printaddr(tcp, arg, &cmd))<br>
+                       return RVAL_IOCTL_DECODED;<br>
+               PRINT_FIELD_U("{", cmd, fb_id);<br>
+<br>
+               return 0;<br>
+       }<br>
+<br>
+       if (!syserror(tcp) && !umove(tcp, arg, &cmd)) {<br>
+               tprints(", ");<br>
+               print_drm_mode_fb_cmd_part(&cmd);<br>
+       }<br>
+<br>
+       tprints("}");<br>
+<br>
+       return RVAL_IOCTL_DECODED;<br>
+}<br>
+<br>
+static int<br>
+drm_mode_add_fb(struct tcb *const tcp, const kernel_ulong_t arg)<br>
+{<br>
+       struct drm_mode_fb_cmd cmd;<br>
+<br>
+       if (entering(tcp)) {<br>
+               if (umove_or_printaddr(tcp, arg, &cmd))<br>
+                       return RVAL_IOCTL_DECODED;<br>
+               tprints("{");<br>
+               print_drm_mode_fb_cmd_part(&cmd);<br>
+<br>
+               return 0;<br>
+       }<br>
+<br>
+       if (!syserror(tcp) && !umove(tcp, arg, &cmd)) {<br>
+               PRINT_FIELD_U(", ", cmd, fb_id);<br>
+       }<br>
+<br>
+       tprints("}");<br>
+<br>
+       return RVAL_IOCTL_DECODED;<br>
+}<br>
+<br>
+static int<br>
+drm_mode_rm_fb(struct tcb *const tcp, const kernel_ulong_t arg)<br>
+{<br>
+       unsigned int fb_id;<br>
+<br>
+       if (umove_or_printaddr(tcp, arg, &fb_id))<br>
+               return RVAL_IOCTL_DECODED;<br>
+<br>
+       tprintf("{fb_id=%u}", fb_id);<br>
+<br>
+       return RVAL_IOCTL_DECODED;<br>
+}<br>
+<br>
+static int<br>
+drm_mode_page_flip(struct tcb *const tcp, const kernel_ulong_t arg)<br>
+{<br>
+       struct drm_mode_crtc_page_flip flip;<br>
+<br>
+       if (umove_or_printaddr(tcp, arg, &flip))<br>
+               return RVAL_IOCTL_DECODED;<br>
+<br>
+       PRINT_FIELD_DRM_CRTC_ID("{", flip, crtc_id);<br>
+       PRINT_FIELD_U(", ", flip, fb_id);<br>
+       PRINT_FIELD_FLAGS(", ", flip, flags, drm_mode_page_flip_flags,<br>
+                        "DRM_MODE_PAGE_FLIP_???");<br>
+       PRINT_FIELD_X(", ", flip, user_data);<br>
+       tprints("}");<br>
+<br>
+       return RVAL_IOCTL_DECODED;<br>
+}<br>
+<br>
+static bool<br>
+print_drm_clip_rect(struct tcb *tcp, void *elem_buf,<br>
+                   size_t elem_size, void *data)<br>
+{<br>
+       const struct drm_clip_rect *p = elem_buf;<br>
+       PRINT_FIELD_U("{", *p, x1);<br>
+       PRINT_FIELD_D(", ", *p, y1);<br>
+       PRINT_FIELD_D(", ", *p, x2);<br>
+       PRINT_FIELD_D(", ", *p, y2);<br>
+       tprints("}");<br>
+       return true;<br>
+}<br>
+<br>
+static int<br>
+drm_mode_dirty_fb(struct tcb *const tcp, const kernel_ulong_t arg)<br>
+{<br>
+       struct drm_mode_fb_dirty_cmd cmd;<br>
+       struct drm_clip_rect clips_val;<br>
+<br>
+       if (umove_or_printaddr(tcp, arg, &cmd))<br>
+               return RVAL_IOCTL_DECODED;<br>
+<br>
+       PRINT_FIELD_U("{", cmd, fb_id);<br>
+       PRINT_FIELD_FLAGS(", ", cmd, flags, drm_mode_fb_dirty_cmd_flags,<br>
+                         "DRM_MODE_FB_DIRTY_ANNOTATE_???");<br>
+       PRINT_FIELD_X(", ", cmd, color);<br>
+       PRINT_FIELD_U(", ", cmd, num_clips);<br>
+       tprints(", clips_ptr=");<br>
+       print_array(tcp, cmd.clips_ptr, cmd. num_clips,<br>
+                   &clips_val, sizeof(clips_val),<br>
+                   tfetch_mem, print_drm_clip_rect, 0);<br>
+       tprints("}");<br>
+<br>
+       return RVAL_IOCTL_DECODED;<br>
+}<br>
+<br>
+static int<br>
+drm_mode_create_dumb(struct tcb *const tcp, const kernel_ulong_t arg)<br>
+{<br>
+       struct drm_mode_create_dumb dumb;<br>
+<br>
+       if (entering(tcp)) {<br>
+               if (umove_or_printaddr(tcp, arg, &dumb))<br>
+                       return RVAL_IOCTL_DECODED;<br>
+               PRINT_FIELD_U("{", dumb, width);<br>
+               PRINT_FIELD_U(", ", dumb, height);<br>
+               PRINT_FIELD_U(", ", dumb, bpp);<br>
+               PRINT_FIELD_X(", ", dumb, flags);<br>
+<br>
+               return 0;<br>
+       }<br>
+<br>
+       if (!syserror(tcp) && !umove(tcp, arg, &dumb)) {<br>
+               PRINT_FIELD_U(", ", dumb, handle);<br>
+               PRINT_FIELD_U(", ", dumb, pitch);<br>
+               PRINT_FIELD_U(", ", dumb, size);<br>
+       }<br>
+<br>
+       tprints("}");<br>
+<br>
+       return RVAL_IOCTL_DECODED;<br>
+}<br>
+<br>
+static int<br>
+drm_mode_map_dumb(struct tcb *const tcp, const kernel_ulong_t arg)<br>
+{<br>
+       struct drm_mode_map_dumb dumb;<br>
+<br>
+       if (entering(tcp)) {<br>
+               if (umove_or_printaddr(tcp, arg, &dumb))<br>
+                       return RVAL_IOCTL_DECODED;<br>
+               PRINT_FIELD_U("{", dumb, handle);<br>
+<br>
+               return 0;<br>
+       }<br>
+<br>
+       if (!syserror(tcp) && !umove(tcp, arg, &dumb)) {<br>
+               PRINT_FIELD_U(", ", dumb, offset);<br>
+       }<br>
+<br>
+       tprints("}");<br>
+<br>
+       return RVAL_IOCTL_DECODED;<br>
+}<br>
+<br>
+static int<br>
+drm_mode_destroy_dumb(struct tcb *const tcp, const kernel_ulong_t arg)<br>
+{<br>
+       struct drm_mode_destroy_dumb dumb;<br>
+<br>
+       if (umove_or_printaddr(tcp, arg, &dumb))<br>
+               return RVAL_IOCTL_DECODED;<br>
+<br>
+       PRINT_FIELD_U("{", dumb, handle);<br>
+       tprints("}");<br>
+<br>
+       return RVAL_IOCTL_DECODED;<br>
+}<br>
+<br>
+static int<br>
+drm_mode_getplane(struct tcb *const tcp, const kernel_ulong_t arg)<br>
+{<br>
+       struct drm_mode_get_plane plane;<br>
+       uint32_t formant_type_val;<br>
+<br>
+       if (entering(tcp)) {<br>
+               if (umove_or_printaddr(tcp, arg, &plane))<br>
+                       return RVAL_IOCTL_DECODED;<br>
+<br>
+               PRINT_FIELD_U("{", plane, plane_id);<br>
+               PRINT_FIELD_U(", ", plane, count_format_types);<br>
+               tprints(", format_type_ptr=");<br>
+               print_array(tcp, plane.format_type_ptr,<br>
+                           plane.count_format_types,<br>
+                           &formant_type_val, sizeof(formant_type_val),<br>
+                           tfetch_mem, print_uint32_array_member, 0);<br>
+<br>
+               tprints("}");<br>
+<br>
+               return 0;<br>
+       }<br>
+<br>
+       if (!syserror(tcp) && !umove(tcp, arg, &plane)) {<br>
+               PRINT_FIELD_U(" => {", plane, plane_id);<br>
+               PRINT_FIELD_DRM_CRTC_ID(", ", plane, crtc_id);<br>
+               PRINT_FIELD_U(", ", plane, fb_id);<br>
+               PRINT_FIELD_U(", ", plane, possible_crtcs);<br>
+               PRINT_FIELD_U(", ", plane, gamma_size);<br>
+               PRINT_FIELD_U(", ", plane, count_format_types);<br>
+<br>
+               tprints("}");<br>
+       }<br>
+<br>
+       return RVAL_IOCTL_DECODED;<br>
+}<br>
+<br>
+static int<br>
+drm_mode_setplane(struct tcb *const tcp, const kernel_ulong_t arg)<br>
+{<br>
+       struct drm_mode_set_plane plane;<br>
+<br>
+       if (entering(tcp)) {<br>
+               if (umove_or_printaddr(tcp, arg, &plane))<br>
+                       return RVAL_IOCTL_DECODED;<br>
+               PRINT_FIELD_U("{", plane, plane_id);<br>
+               PRINT_FIELD_DRM_CRTC_ID(", ", plane, crtc_id);<br>
+               PRINT_FIELD_U(", ", plane, fb_id);<br>
+               PRINT_FIELD_FLAGS(", ", plane, flags, drm_mode_set_plane_flags,<br>
+                                 "DRM_MODE_PRESENT_???");<br>
+<br>
+               return 0;<br>
+       }<br>
+<br>
+       if (!syserror(tcp) && !umove(tcp, arg, &plane)) {<br>
+               PRINT_FIELD_D(", ", plane, crtc_x);<br>
+               PRINT_FIELD_D(", ", plane, crtc_y);<br>
+               PRINT_FIELD_U(", ", plane, crtc_w);<br>
+               PRINT_FIELD_U(", ", plane, crtc_h);<br>
+               /* The printing format reference is from kernel driver. */<br>
+               PRINT_FIELD_U(", ", plane, src_x);<br>
+               tprintf_comment("%u.%06u", plane.src_x >> 16,<br>
+                               ((plane.src_x & 0xffff) * 15625) >> 10);<br>
+               PRINT_FIELD_U(", ", plane, src_y);<br>
+               tprintf_comment("%u.%06u", plane.src_y >> 16,<br>
+                               ((plane.src_y & 0xffff) * 15625) >> 10);<br>
+               PRINT_FIELD_U(", ", plane, src_h);<br>
+               tprintf_comment("%u.%06u", plane.src_h >> 16,<br>
+                               ((plane.src_h & 0xffff) * 15625) >> 10);<br>
+               PRINT_FIELD_U(", ", plane, src_w);<br>
+               tprintf_comment("%u.%06u", plane.src_w >> 16,<br>
+                               ((plane.src_w & 0xffff) * 15625) >> 10);<br>
+<br>
+       }<br>
+<br>
+       tprints("}");<br>
+<br>
+       return RVAL_IOCTL_DECODED;<br>
+}<br>
+<br>
+static int<br>
+drm_mode_cursor2(struct tcb *const tcp, const kernel_ulong_t arg)<br>
+{<br>
+       struct drm_mode_cursor2 cursor;<br>
+<br>
+       if (umove_or_printaddr(tcp, arg, &cursor))<br>
+               return RVAL_IOCTL_DECODED;<br>
+<br>
+       PRINT_FIELD_FLAGS("{", cursor, flags, drm_mode_cursor_flags,<br>
+                         "DRM_MODE_CURSOR_???");<br>
+       PRINT_FIELD_DRM_CRTC_ID(", ", cursor, crtc_id);<br>
+       PRINT_FIELD_D(", ", cursor, x);<br>
+       PRINT_FIELD_D(", ", cursor, y);<br>
+       PRINT_FIELD_U(", ", cursor, width);<br>
+       PRINT_FIELD_U(", ", cursor, height);<br>
+       PRINT_FIELD_U(", ", cursor, handle);<br>
+       PRINT_FIELD_D(", ", cursor, hot_x);<br>
+       PRINT_FIELD_D(", ", cursor, hot_y);<br>
+       tprints("}");<br>
+<br>
+       return RVAL_IOCTL_DECODED;<br>
+}<br>
+<br>
+static int<br>
+drm_mode_atomic(struct tcb *const tcp, const kernel_ulong_t arg)<br>
+{<br>
+       struct drm_mode_atomic atomic;<br>
+       uint32_t u32_val;<br>
+       uint64_t u64_val;<br>
+<br>
+       if (umove_or_printaddr(tcp, arg, &atomic))<br>
+               return RVAL_IOCTL_DECODED;<br>
+<br>
+       PRINT_FIELD_FLAGS("{", atomic, flags, drm_mode_atomic_flags,<br>
+                         "DRM_MODE_ATOMIC_???");<br>
+       PRINT_FIELD_U(", ", atomic, count_objs);<br>
+       tprints(", objs_ptr=");<br>
+       print_array(tcp, atomic.objs_ptr, atomic.count_objs,<br>
+                   &u32_val, sizeof(u32_val),<br>
+                   tfetch_mem, print_uint32_array_member, 0);<br>
+       tprints(", count_props_ptr=");<br>
+       print_array(tcp, atomic.count_props_ptr, atomic.count_objs,<br>
+                   &u32_val, sizeof(u32_val),<br>
+                   tfetch_mem, print_uint32_array_member, 0);<br>
+       tprints(", props_ptr=");<br>
+       print_array(tcp, atomic.props_ptr, atomic.count_objs,<br>
+                   &u32_val, sizeof(u32_val),<br>
+                   tfetch_mem, print_uint32_array_member, 0);<br>
+       tprints(", prop_values_ptr=");<br>
+       print_array(tcp, atomic.prop_values_ptr, atomic.count_objs,<br>
+                   &u64_val, sizeof(u64_val),<br>
+                   tfetch_mem, print_uint64_array_member, 0);<br>
+       if (atomic.reserved)<br>
+               PRINT_FIELD_U(", ", atomic, reserved);<br>
+       PRINT_FIELD_X(", ", atomic, user_data);<br>
+       tprints("}");<br>
+<br>
+       return RVAL_IOCTL_DECODED;<br>
+}<br>
+<br>
+static int<br>
+drm_mode_createpropblob(struct tcb *const tcp, const kernel_ulong_t arg)<br>
+{<br>
+       struct drm_mode_create_blob blob;<br>
+<br>
+       if (entering(tcp)) {<br>
+               if (umove_or_printaddr(tcp, arg, &blob))<br>
+                       return RVAL_IOCTL_DECODED;<br>
+<br>
+               PRINT_FIELD_ADDR64("{", blob, data);<br>
+               PRINT_FIELD_U(", ", blob, length);<br>
+<br>
+               return 0;<br>
+       }<br>
+<br>
+       if (!syserror(tcp) && !umove(tcp, arg, &blob)) {<br>
+               PRINT_FIELD_U(", ", blob, blob_id);<br>
+       }<br>
+<br>
+       tprints("}");<br>
+<br>
+       return RVAL_IOCTL_DECODED;<br>
+}<br>
+<br>
+static int<br>
+drm_mode_destroypropblob(struct tcb *const tcp, const kernel_ulong_t arg)<br>
+{<br>
+       struct drm_mode_destroy_blob blob;<br>
+<br>
+       if (umove_or_printaddr(tcp, arg, &blob))<br>
+               return RVAL_IOCTL_DECODED;<br>
+<br>
+       PRINT_FIELD_U("{", blob, blob_id);<br>
+       tprints("}");<br>
+<br>
+       return RVAL_IOCTL_DECODED;<br>
+}<br>
+<br>
+static int<br>
+drm_syncobj_create(struct tcb *const tcp, const kernel_ulong_t arg)<br>
+{<br>
+       struct drm_syncobj_create create;<br>
+<br>
+       if (entering(tcp)) {<br>
+               if (umove_or_printaddr(tcp, arg, &create))<br>
+                       return RVAL_IOCTL_DECODED;<br>
+<br>
+               PRINT_FIELD_FLAGS("{", create, flags, drm_syncobj_flags,<br>
+                                "DRM_SYNCOBJ_???");<br>
+<br>
+               return 0;<br>
+       }<br>
+<br>
+       if (!syserror(tcp) && !umove(tcp, arg, &create)) {<br>
+               PRINT_FIELD_U(", ", create, handle);<br>
+       }<br>
+<br>
+       tprints("}");<br>
+<br>
+       return RVAL_IOCTL_DECODED;<br>
+}<br>
+<br>
+static int<br>
+drm_syncobj_destroy(struct tcb *const tcp, const kernel_ulong_t arg)<br>
+{<br>
+       struct drm_syncobj_destroy destroy;<br>
+<br>
+       if (umove_or_printaddr(tcp, arg, &destroy))<br>
+               return RVAL_IOCTL_DECODED;<br>
+<br>
+       PRINT_FIELD_U("{", destroy, handle);<br>
+       if (destroy.pad)<br>
+               PRINT_FIELD_U(", ", destroy, pad);<br>
+       tprints("}");<br>
+<br>
+       return RVAL_IOCTL_DECODED;<br>
+}<br>
+<br>
+static int<br>
+drm_syncobj_handle_fd(struct tcb *const tcp, const kernel_ulong_t arg,<br>
+                        bool is_handle_to_fd)<br>
+{<br>
+       struct drm_syncobj_handle handle;<br>
+<br>
+       if (entering(tcp)) {<br>
+               if (umove_or_printaddr(tcp, arg, &handle))<br>
+                       return RVAL_IOCTL_DECODED;<br>
+<br>
+               if (is_handle_to_fd) {<br>
+                       PRINT_FIELD_U("{", handle, handle);<br>
+                       PRINT_FIELD_FLAGS(", ", handle, flags,<br>
+                                         drm_syncobj_handle_to_fd_flags,<br>
+                                         "DRM_SYNCOBJ_???");<br>
+               } else {<br>
+                       PRINT_FIELD_FD("{", handle, fd, tcp);<br>
+                       PRINT_FIELD_FLAGS(", ", handle, flags,<br>
+                                         drm_syncobj_fd_to_handle_flags,<br>
+                                         "DRM_SYNCOBJ_???");<br>
+               }<br>
+               if (handle.pad)<br>
+                       PRINT_FIELD_U(", ", handle, pad);<br>
+<br>
+               return 0;<br>
+       }<br>
+<br>
+       if (!syserror(tcp) && !umove(tcp, arg, &handle)) {<br>
+               if (is_handle_to_fd)<br>
+                       PRINT_FIELD_FD(", ", handle, fd, tcp);<br>
+               else<br>
+                       PRINT_FIELD_U(", ", handle, handle);<br>
+       }<br>
+<br>
+       tprints("}");<br>
+<br>
+       return RVAL_IOCTL_DECODED;<br>
+}<br>
+<br>
+static int<br>
+drm_syncobj_wait(struct tcb *const tcp, const kernel_ulong_t arg)<br>
+{<br>
+       struct drm_syncobj_wait wait;<br>
+       uint32_t handles_val;<br>
+<br>
+       if (entering(tcp)) {<br>
+               if (umove_or_printaddr(tcp, arg, &wait))<br>
+                       return RVAL_IOCTL_DECODED;<br>
+               tprints("{handles=");<br>
+               print_array(tcp, wait.handles, wait.count_handles,<br>
+                           &handles_val, sizeof(handles_val),<br>
+                           tfetch_mem, print_uint32_array_member, 0);<br>
+               PRINT_FIELD_D(", ", wait, timeout_nsec);<br>
+               PRINT_FIELD_U(", ", wait, count_handles);<br>
+               PRINT_FIELD_FLAGS(", ", wait, flags, drm_syncobj_wait_flags,<br>
+                                 "DRM_SYNCOBJ_WAIT_FLAGS_???");<br>
+<br>
+               return 0;<br>
+       }<br>
+<br>
+       if (!syserror(tcp) && !umove(tcp, arg, &wait)) {<br>
+               PRINT_FIELD_U(", ", wait, first_signaled);<br>
+       }<br>
+<br>
+       tprints("}");<br>
+<br>
+       return RVAL_IOCTL_DECODED;<br>
+}<br>
+<br>
+static int<br>
+drm_syncobj_reset_or_signal(struct tcb *const tcp, const kernel_ulong_t arg)<br>
+{<br>
+       struct drm_syncobj_array array;<br>
+       uint32_t handles_val;<br>
+<br>
+       if (umove_or_printaddr(tcp, arg, &array))<br>
+               return RVAL_IOCTL_DECODED;<br>
+<br>
+       tprints("{handles=");<br>
+       print_array(tcp, array.handles, array.count_handles,<br>
+                   &handles_val, sizeof(handles_val),<br>
+                   tfetch_mem, print_uint32_array_member, 0);<br>
+       PRINT_FIELD_U(", ", array, count_handles);<br>
+       if (array.pad)<br>
+               PRINT_FIELD_U(", ", array, pad);<br>
+       tprints("}");<br>
+<br>
+       return RVAL_IOCTL_DECODED;<br>
+}<br>
+<br>
+static int<br>
+drm_mode_create_lease(struct tcb *const tcp, const kernel_ulong_t arg)<br>
+{<br>
+       struct drm_mode_create_lease lease;<br>
+       uint32_t object_val;<br>
+<br>
+       if (entering(tcp)) {<br>
+               if (umove_or_printaddr(tcp, arg, &lease))<br>
+                       return RVAL_IOCTL_DECODED;<br>
+<br>
+               tprints("{object_ids=");<br>
+               print_array(tcp, lease.object_ids, lease.object_count,<br>
+                           &object_val, sizeof(object_val),<br>
+                           tfetch_mem, print_uint32_array_member, 0);<br>
+               PRINT_FIELD_U(", ", lease, object_count);<br>
+               PRINT_FIELD_X(", ", lease, flags);<br>
+               PRINT_FIELD_FLAGS(", ", lease, flags,<br>
+                                 drm_mode_create_lease_flags,<br>
+                                 "O_???");<br>
+<br>
+               return 0;<br>
+       }<br>
+<br>
+       if (!syserror(tcp) && !umove(tcp, arg, &lease)) {<br>
+               PRINT_FIELD_U(", ", lease, lessee_id);<br>
+               PRINT_FIELD_FD(", ", lease, fd, tcp);<br>
+       }<br>
+<br>
+       tprints("}");<br>
+<br>
+       return RVAL_IOCTL_DECODED;<br>
+}<br>
+<br>
+static int<br>
+drm_mode_list_lessees(struct tcb *const tcp, const kernel_ulong_t arg)<br>
+{<br>
+       struct drm_mode_list_lessees lessees;<br>
+       uint32_t lessees_val;<br>
+<br>
+       if (entering(tcp)) {<br>
+               if (umove_or_printaddr(tcp, arg, &lessees))<br>
+                       return RVAL_IOCTL_DECODED;<br>
+<br>
+               PRINT_FIELD_U("{", lessees, count_lessees);<br>
+               if (lessees.pad)<br>
+                       PRINT_FIELD_U(", ", lessees, pad);<br>
+               tprints(", lessees_ptr=");<br>
+               print_array(tcp, lessees.lessees_ptr, lessees.count_lessees,<br>
+                           &lessees_val, sizeof(lessees_val),<br>
+                           tfetch_mem, print_uint32_array_member, 0);<br>
+<br>
+               tprints("}");<br>
+<br>
+               return 0;<br>
+       }<br>
+<br>
+       if (!syserror(tcp) && !umove(tcp, arg, &lessees)) {<br>
+               PRINT_FIELD_U(" => {", lessees, count_lessees);<br>
+               tprints("}");<br>
+       }<br>
+<br>
+       return RVAL_IOCTL_DECODED;<br>
+}<br>
+<br>
+static int<br>
+drm_mode_get_lease(struct tcb *const tcp, const kernel_ulong_t arg)<br>
+{<br>
+       struct drm_mode_get_lease lease;<br>
+       uint32_t objects_val;<br>
+<br>
+       if (entering(tcp)) {<br>
+               if (umove_or_printaddr(tcp, arg, &lease))<br>
+                       return RVAL_IOCTL_DECODED;<br>
+<br>
+               PRINT_FIELD_U("{", lease, count_objects);<br>
+               if (lease.pad)<br>
+                       PRINT_FIELD_U(", ", lease, pad);<br>
+               tprints(", objects_ptr=");<br>
+               print_array(tcp, lease.objects_ptr, lease.count_objects,<br>
+                           &objects_val, sizeof(objects_val),<br>
+                           tfetch_mem, print_uint32_array_member, 0);<br>
+<br>
+               tprints("}");<br>
+<br>
+               return 0;<br>
+       }<br>
+<br>
+       if (!syserror(tcp) && !umove(tcp, arg, &lease)) {<br>
+               PRINT_FIELD_U(" => {", lease, count_objects);<br>
+               tprints("}");<br>
+       }<br>
+<br>
+       return RVAL_IOCTL_DECODED;<br>
+<br>
+}<br>
+<br>
+static int<br>
+drm_mode_revoke_lease(struct tcb *const tcp, const kernel_ulong_t arg)<br>
+{<br>
+       struct drm_mode_revoke_lease lease;<br>
+<br>
+       if (umove_or_printaddr(tcp, arg, &lease))<br>
+               return RVAL_IOCTL_DECODED;<br>
+<br>
+       PRINT_FIELD_U("{", lease, lessee_id);<br>
+       tprints("}");<br>
+<br>
+       return RVAL_IOCTL_DECODED;<br>
+}<br>
+<br>
+static int<br>
+drm_syncobj_timeline_wait(struct tcb *const tcp, const kernel_ulong_t arg)<br>
+{<br>
+       struct drm_syncobj_timeline_wait wait;<br>
+       uint32_t handles_val;<br>
+<br>
+       if (entering(tcp)) {<br>
+               if (umove_or_printaddr(tcp, arg, &wait))<br>
+                       return RVAL_IOCTL_DECODED;<br>
+               tprints("{handles=");<br>
+               print_array(tcp, wait.handles, wait.count_handles,<br>
+                           &handles_val, sizeof(handles_val),<br>
+                           tfetch_mem, print_uint32_array_member, 0);<br>
+               PRINT_FIELD_D(", ", wait, timeout_nsec);<br>
+               PRINT_FIELD_U(", ", wait, count_handles);<br>
+               PRINT_FIELD_FLAGS(", ", wait, flags, drm_syncobj_wait_flags,<br>
+                                "DRM_SYNCOBJ_WAIT_FLAGS_???");<br>
+<br>
+               return 0;<br>
+       }<br>
+<br>
+       if (!syserror(tcp) && !umove(tcp, arg, &wait)) {<br>
+               PRINT_FIELD_U(", ", wait, first_signaled);<br>
+       }<br>
+<br>
+       tprints("}");<br>
+<br>
+       return RVAL_IOCTL_DECODED;<br>
+}<br>
+<br>
+static int<br>
+drm_syncobj_query_or_timeline_signal(struct tcb *const tcp,<br>
+                                    const kernel_ulong_t arg)<br>
+{<br>
+       struct drm_syncobj_timeline_array array;<br>
+       uint32_t handles_val;<br>
+       uint64_t points_val;<br>
+<br>
+       if (umove_or_printaddr(tcp, arg, &array))<br>
+               return RVAL_IOCTL_DECODED;<br>
+<br>
+       tprints("{handles=");<br>
+       print_array(tcp, array.handles, array.count_handles,<br>
+                   &handles_val, sizeof(handles_val),<br>
+                   tfetch_mem, print_uint32_array_member, 0);<br>
+       tprints(", points=");<br>
+       print_array(tcp, array.points, array.count_handles,<br>
+                   &points_val, sizeof(points_val),<br>
+                   tfetch_mem, print_uint64_array_member, 0);<br>
+<br>
+       PRINT_FIELD_U(", ", array, count_handles);<br>
+       if (array.pad)<br>
+               PRINT_FIELD_U(", ", array, pad);<br>
+       tprints("}");<br>
+<br>
+       return RVAL_IOCTL_DECODED;<br>
+}<br>
+<br>
+static int<br>
+drm_syncobj_transfer(struct tcb *const tcp, const kernel_ulong_t arg)<br>
+{<br>
+       struct drm_syncobj_transfer transfer;<br>
+<br>
+       if (umove_or_printaddr(tcp, arg, &transfer))<br>
+               return RVAL_IOCTL_DECODED;<br>
+<br>
+       PRINT_FIELD_U("{", transfer, src_handle);<br>
+       PRINT_FIELD_U(", ", transfer, dst_handle);<br>
+       PRINT_FIELD_U(", ", transfer, src_point);<br>
+       PRINT_FIELD_U(", ", transfer, dst_point);<br>
+       PRINT_FIELD_FLAGS(", ", transfer, flags, drm_syncobj_wait_flags,<br>
+                        "DRM_SYNCOBJ_WAIT_FLAGS_???");<br>
+       if (transfer.pad)<br>
+               PRINT_FIELD_U(", ", transfer, pad);<br>
+       tprints("}");<br>
+<br>
+       return RVAL_IOCTL_DECODED;<br>
+}<br>
+<br>
+int<br>
+drm_ioctl(struct tcb *const tcp, const unsigned int code,<br>
+         const kernel_ulong_t arg)<br>
+{<br>
+       if (entering(tcp))<br>
+               tprints(", ");<br>
+<br>
+       switch (code) {<br>
+       case DRM_IOCTL_GET_MAGIC: /* R */<br>
+               return drm_get_magic(tcp, arg);<br>
+       case DRM_IOCTL_IRQ_BUSID: /* RW */<br>
+               return drm_irq_busid(tcp, arg);<br>
+       case DRM_IOCTL_SET_VERSION: /* RW */<br>
+               return drm_set_version(tcp, arg);<br>
+       case DRM_IOCTL_MODESET_CTL: /* W */<br>
+               return drm_modeset_ctl(tcp, arg);<br>
+       case DRM_IOCTL_GEM_CLOSE: /* W */<br>
+               return drm_gem_close(tcp, arg);<br>
+       case DRM_IOCTL_GEM_FLINK: /* RW */<br>
+               return drm_gem_flink(tcp, arg);<br>
+       case DRM_IOCTL_GEM_OPEN: /* RW */<br>
+               return drm_gem_open(tcp, arg);<br>
+       case DRM_IOCTL_GET_CAP: /* RW */<br>
+               return drm_get_cap(tcp, arg);<br>
+       case DRM_IOCTL_SET_CLIENT_CAP: /* W */<br>
+               return drm_set_client_cap(tcp, arg);<br>
+       case DRM_IOCTL_AUTH_MAGIC: /* W */<br>
+               return drm_auth_magic(tcp, arg);<br>
+       case DRM_IOCTL_BLOCK: /* RW */<br>
+       case DRM_IOCTL_UNBLOCK: /* RW */<br>
+       case DRM_IOCTL_MOD_CTX: /* W */<br>
+       case DRM_IOCTL_ADD_DRAW: /* RW */<br>
+       case DRM_IOCTL_RM_DRAW: /* RW */<br>
+       case DRM_IOCTL_FINISH: /* W */<br>
+       case DRM_IOCTL_MODE_ATTACHMODE: /* RW */<br>
+       case DRM_IOCTL_MODE_DETACHMODE: /* RW */<br>
+       case DRM_IOCTL_GET_STATS: /* R */<br>
+               return drm_noop(tcp, arg);<br>
+       case DRM_IOCTL_CONTROL: /* W */<br>
+               return drm_control(tcp, arg);<br>
+       case DRM_IOCTL_ADD_CTX: /* RW */<br>
+       case DRM_IOCTL_SWITCH_CTX: /* W */<br>
+       case DRM_IOCTL_NEW_CTX: /* W */<br>
+       case DRM_IOCTL_GET_CTX: /* RW */<br>
+               if (entering(tcp))<br>
+                       return 0;<br>
+               return drm_ctx(tcp, arg, code == DRM_IOCTL_GET_CTX);<br>
+       case DRM_IOCTL_RM_CTX: /* RW */<br>
+               return drm_ctx(tcp, arg, false);<br>
+       case DRM_IOCTL_LOCK: /* W */<br>
+       case DRM_IOCTL_UNLOCK: /* W */<br>
+               return drm_lock(tcp, arg);<br>
+       case DRM_IOCTL_PRIME_HANDLE_TO_FD: /* RW */<br>
+               return drm_prime_handle_to_fd(tcp, arg);<br>
+       case DRM_IOCTL_PRIME_FD_TO_HANDLE: /* RW */<br>
+               return drm_prime_fd_to_handle(tcp, arg);<br>
+       case DRM_IOCTL_CRTC_GET_SEQUENCE: /* RW */<br>
+               return drm_crtc_get_sequence(tcp, arg);<br>
+       case DRM_IOCTL_CRTC_QUEUE_SEQUENCE: /* RW */<br>
+               return drm_crtc_queue_sequence(tcp, arg);<br>
+       case DRM_IOCTL_MODE_GETRESOURCES: /* RW */<br>
+               return drm_mode_get_resources(tcp, arg);<br>
+       case DRM_IOCTL_MODE_GETCRTC: /* RW */<br>
+       case DRM_IOCTL_MODE_SETCRTC: /* RW */<br>
+               return drm_mode_crtc(tcp, arg, code == DRM_IOCTL_MODE_GETCRTC);<br>
+       case DRM_IOCTL_MODE_CURSOR: /* RW */<br>
+               return drm_mode_cursor(tcp, arg);<br>
+       case DRM_IOCTL_MODE_GETGAMMA: /* RW */<br>
+       case DRM_IOCTL_MODE_SETGAMMA: /* RW */<br>
+               return drm_mode_gamma(tcp, arg);<br>
+       case DRM_IOCTL_MODE_GETENCODER: /* RW */<br>
+               return drm_mode_get_encoder(tcp, arg);<br>
+       case DRM_IOCTL_MODE_GETPROPERTY: /* RW */<br>
+               return drm_mode_get_property(tcp, arg);<br>
+       case DRM_IOCTL_MODE_SETPROPERTY: /* RW */<br>
+               return drm_mode_set_property(tcp, arg);<br>
+       case DRM_IOCTL_MODE_GETPROPBLOB: /* RW */<br>
+               return drm_mode_get_prop_blob(tcp, arg);<br>
+       case DRM_IOCTL_MODE_GETFB: /* RW */<br>
+               return drm_mode_get_fb(tcp, arg);<br>
+       case DRM_IOCTL_MODE_ADDFB: /* RW */<br>
+               return drm_mode_add_fb(tcp, arg);<br>
+       case DRM_IOCTL_MODE_RMFB: /* RW */<br>
+               return drm_mode_rm_fb(tcp, arg);<br>
+       case DRM_IOCTL_MODE_PAGE_FLIP: /* RW */<br>
+               return drm_mode_page_flip(tcp, arg);<br>
+       case DRM_IOCTL_MODE_DIRTYFB: /* RW */<br>
+               return drm_mode_dirty_fb(tcp, arg);<br>
+       case DRM_IOCTL_MODE_CREATE_DUMB: /* RW */<br>
+               return drm_mode_create_dumb(tcp, arg);<br>
+       case DRM_IOCTL_MODE_MAP_DUMB: /* RW */<br>
+               return drm_mode_map_dumb(tcp, arg);<br>
+       case DRM_IOCTL_MODE_DESTROY_DUMB: /* RW */<br>
+               return drm_mode_destroy_dumb(tcp, arg);<br>
+       case DRM_IOCTL_MODE_GETPLANE: /* RW */<br>
+               return drm_mode_getplane(tcp, arg);<br>
+       case DRM_IOCTL_MODE_SETPLANE: /* RW */<br>
+               return drm_mode_setplane(tcp, arg);<br>
+       case DRM_IOCTL_MODE_CURSOR2: /* RW */<br>
+               return drm_mode_cursor2(tcp, arg);<br>
+       case DRM_IOCTL_MODE_ATOMIC: /* RW */<br>
+               return drm_mode_atomic(tcp, arg);//<br>
+       case DRM_IOCTL_MODE_CREATEPROPBLOB: /* RW */<br>
+               return drm_mode_createpropblob(tcp, arg);<br>
+       case DRM_IOCTL_MODE_DESTROYPROPBLOB: /* RW */<br>
+               return drm_mode_destroypropblob(tcp, arg);<br>
+       case DRM_IOCTL_SYNCOBJ_CREATE: /* RW */<br>
+               return drm_syncobj_create(tcp, arg);<br>
+       case DRM_IOCTL_SYNCOBJ_DESTROY: /* RW */<br>
+               return drm_syncobj_destroy(tcp, arg);<br>
+       case DRM_IOCTL_SYNCOBJ_HANDLE_TO_FD: /* RW */<br>
+       case DRM_IOCTL_SYNCOBJ_FD_TO_HANDLE: /* RW */<br>
+               return drm_syncobj_handle_fd(tcp, arg, code == DRM_IOCTL_SYNCOBJ_HANDLE_TO_FD);<br>
+       case DRM_IOCTL_SYNCOBJ_WAIT: /* RW */<br>
+               return drm_syncobj_wait(tcp, arg);<br>
+       case DRM_IOCTL_SYNCOBJ_RESET: /* RW */<br>
+       case DRM_IOCTL_SYNCOBJ_SIGNAL: /* RW */<br>
+               return drm_syncobj_reset_or_signal(tcp, arg);<br>
+       case DRM_IOCTL_MODE_CREATE_LEASE: /* RW */<br>
+               return drm_mode_create_lease(tcp, arg);<br>
+       case DRM_IOCTL_MODE_LIST_LESSEES: /* RW */<br>
+               return drm_mode_list_lessees(tcp, arg);<br>
+       case DRM_IOCTL_MODE_GET_LEASE: /* RW */<br>
+               return drm_mode_get_lease(tcp, arg);<br>
+       case DRM_IOCTL_MODE_REVOKE_LEASE: /* RW */<br>
+               return drm_mode_revoke_lease(tcp, arg);<br>
+       case DRM_IOCTL_SYNCOBJ_TIMELINE_WAIT: /* RW */<br>
+               return drm_syncobj_timeline_wait(tcp, arg);<br>
+       case DRM_IOCTL_SYNCOBJ_QUERY: /* RW */<br>
+       case DRM_IOCTL_SYNCOBJ_TIMELINE_SIGNAL: /* RW */<br>
+               return drm_syncobj_query_or_timeline_signal(tcp, arg);<br>
+       case DRM_IOCTL_SYNCOBJ_TRANSFER: /* RW */<br>
+               return drm_syncobj_transfer(tcp, arg);<br>
+       default:<br>
+               return drm_ioctl_mpers(tcp, code, arg);<br>
+       }<br>
+}<br>
diff --git a/drm_mpers.c b/drm_mpers.c<br>
new file mode 100644<br>
index 00000000..b34744a8<br>
--- /dev/null<br>
+++ b/drm_mpers.c<br>
@@ -0,0 +1,882 @@<br>
+/*<br>
+ * Copyright (c) 2015 Intel Corporation<br>
+ * Copyright (c) 2019 Patrik Jakobsson <<a href="mailto:pjakobsson@suse.de" target="_blank">pjakobsson@suse.de</a>><br>
+ * Copyright (c) 2019 The strace developers.<br>
+ * All rights reserved.<br>
+ *<br>
+ * SPDX-License-Identifier: LGPL-2.1-or-later<br>
+ */<br>
+<br>
+#include "defs.h"<br>
+#include <drm/drm.h><br>
+<br>
+#include DEF_MPERS_TYPE(struct_drm_version)<br>
+#include DEF_MPERS_TYPE(struct_drm_unique)<br>
+#include DEF_MPERS_TYPE(struct_drm_map)<br>
+#include DEF_MPERS_TYPE(struct_drm_client)<br>
+#include DEF_MPERS_TYPE(struct_drm_stats)<br>
+#include DEF_MPERS_TYPE(struct_drm_buf_desc)<br>
+#include DEF_MPERS_TYPE(struct_drm_buf_info)<br>
+#include DEF_MPERS_TYPE(struct_drm_buf_map)<br>
+#include DEF_MPERS_TYPE(struct_drm_buf_pub)<br>
+#include DEF_MPERS_TYPE(struct_drm_buf_free)<br>
+#include DEF_MPERS_TYPE(struct_drm_ctx_priv_map)<br>
+#include DEF_MPERS_TYPE(struct_drm_ctx_res)<br>
+#include DEF_MPERS_TYPE(struct_drm_agp_mode)<br>
+#include DEF_MPERS_TYPE(struct_drm_agp_info)<br>
+#include DEF_MPERS_TYPE(struct_drm_agp_buffer)<br>
+#include DEF_MPERS_TYPE(struct_drm_agp_binding)<br>
+#include DEF_MPERS_TYPE(struct_drm_scatter_gather)<br>
+#include DEF_MPERS_TYPE(union_drm_wait_vblank)<br>
+#include DEF_MPERS_TYPE(struct_drm_mode_get_connector)<br>
+#include DEF_MPERS_TYPE(struct_drm_mode_fb_cmd2)<br>
+#include DEF_MPERS_TYPE(struct_drm_mode_get_plane_res)<br>
+#include DEF_MPERS_TYPE(struct_drm_mode_obj_get_properties)<br>
+#include DEF_MPERS_TYPE(struct_drm_mode_obj_set_property)<br>
+<br>
+typedef struct drm_version struct_drm_version;<br>
+typedef struct drm_unique struct_drm_unique;<br>
+typedef struct drm_map struct_drm_map;<br>
+typedef struct drm_client struct_drm_client;<br>
+typedef struct drm_stats struct_drm_stats;<br>
+typedef struct drm_buf_desc struct_drm_buf_desc;<br>
+typedef struct drm_buf_info struct_drm_buf_info;<br>
+typedef struct drm_buf_map struct_drm_buf_map;<br>
+typedef struct drm_buf_pub struct_drm_buf_pub;<br>
+typedef struct drm_buf_free struct_drm_buf_free;<br>
+typedef struct drm_ctx_priv_map struct_drm_ctx_priv_map;<br>
+typedef struct drm_ctx_res struct_drm_ctx_res;<br>
+typedef struct drm_agp_mode struct_drm_agp_mode;<br>
+typedef struct drm_agp_info struct_drm_agp_info;<br>
+typedef struct drm_agp_buffer struct_drm_agp_buffer;<br>
+typedef struct drm_agp_binding struct_drm_agp_binding;<br>
+typedef struct drm_scatter_gather struct_drm_scatter_gather;<br>
+typedef union drm_wait_vblank union_drm_wait_vblank;<br>
+typedef struct drm_mode_get_connector struct_drm_mode_get_connector;<br>
+typedef struct drm_mode_fb_cmd2 struct_drm_mode_fb_cmd2;<br>
+typedef struct drm_mode_get_plane_res struct_drm_mode_get_plane_res;<br>
+typedef struct drm_mode_obj_get_properties struct_drm_mode_obj_get_properties;<br>
+typedef struct drm_mode_obj_set_property struct_drm_mode_obj_set_property;<br>
+<br>
+#include MPERS_DEFS<br>
+<br>
+#include "print_fields.h"<br>
+<br>
+#include "xlat/drm_buf_desc_flags.h"<br>
+#include "xlat/drm_map_flags.h"<br>
+#include "xlat/drm_map_type.h"<br>
+#include "xlat/drm_mode_fb_cmd2_flags.h"<br>
+#include "xlat/drm_vblank_seq_type.h"<br>
+#include "xlat/drm_vblank_seq_type_flags.h"<br>
+<br>
+static int<br>
+drm_version(struct tcb *const tcp, const kernel_ulong_t arg)<br>
+{<br>
+       struct_drm_version ver;<br>
+<br>
+       if (entering(tcp)) {<br>
+               if (umove_or_printaddr(tcp, arg, &ver))<br>
+                       return RVAL_IOCTL_DECODED;<br>
+<br>
+               PRINT_FIELD_U("{", ver, name_len);<br>
+               PRINT_FIELD_U(", ", ver, date_len);<br>
+               PRINT_FIELD_U(", ", ver, desc_len);<br>
+               tprints("}");<br>
+<br>
+               return 0;<br>
+       }<br>
+<br>
+       if (umove_nor_syserror(tcp, arg, &ver)) {<br>
+               PRINT_FIELD_D(" => {", ver, version_major);<br>
+               PRINT_FIELD_D(", ", ver, version_minor);<br>
+               PRINT_FIELD_D(", ", ver, version_patchlevel);<br>
+               PRINT_FIELD_U(", ", ver, name_len);<br>
+               tprints(", name=");<br>
+               printstrn(tcp, ptr_to_kulong(<a href="http://ver.name" rel="noreferrer" target="_blank">ver.name</a>), ver.name_len);<br>
+               PRINT_FIELD_U(", ", ver, date_len);<br>
+               tprints(", date=");<br>
+               printstrn(tcp, ptr_to_kulong(ver.date), ver.date_len);<br>
+               PRINT_FIELD_U(", ", ver, desc_len);<br>
+               tprints(", desc=");<br>
+               printstrn(tcp, ptr_to_kulong(ver.desc), ver.desc_len);<br>
+               tprints("}");<br>
+       }<br>
+<br>
+       return RVAL_IOCTL_DECODED;<br>
+}<br>
+<br>
+static int<br>
+drm_unique(struct tcb *const tcp, const kernel_ulong_t arg)<br>
+{<br>
+       struct_drm_unique unique;<br>
+<br>
+       if (entering(tcp)) {<br>
+               if (umove_or_printaddr(tcp, arg, &unique))<br>
+                       return RVAL_IOCTL_DECODED;<br>
+<br>
+               PRINT_FIELD_U("{", unique, unique_len);<br>
+               tprints("}");<br>
+<br>
+               return 0;<br>
+       }<br>
+<br>
+       if (umove_nor_syserror(tcp, arg, &unique)) {<br>
+               PRINT_FIELD_U(" => {", unique, unique_len);<br>
+               tprints(", unique=");<br>
+               printstrn(tcp, ptr_to_kulong(unique.unique), unique.unique_len);<br>
+               tprints("}");<br>
+       }<br>
+<br>
+       return RVAL_IOCTL_DECODED;<br>
+}<br>
+<br>
+static int<br>
+drm_get_map(struct tcb *const tcp, const kernel_ulong_t arg)<br>
+{<br>
+       struct_drm_map map;<br>
+<br>
+       if (entering(tcp)) {<br>
+               if (umove_or_printaddr(tcp, arg, &map))<br>
+                       return RVAL_IOCTL_DECODED;<br>
+<br>
+               PRINT_FIELD_X("{", map, offset);<br>
+               tprints("}");<br>
+<br>
+               return 0;<br>
+       }<br>
+<br>
+       if (umove_nor_syserror(tcp, arg, &map)) {<br>
+               PRINT_FIELD_X(" => {", map, offset);<br>
+               PRINT_FIELD_U(", ", map, size);<br>
+               PRINT_FIELD_XVAL(", ", map, type, drm_map_type, "_DRM_???");<br>
+               PRINT_FIELD_FLAGS(", ", map, flags, drm_map_flags, "_DRM_???");<br>
+               PRINT_FIELD_PTR(", ", map, handle);<br>
+               PRINT_FIELD_D(", ", map, mtrr);<br>
+               tprints("}");<br>
+       }<br>
+<br>
+       return RVAL_IOCTL_DECODED;<br>
+}<br>
+<br>
+static int<br>
+drm_get_client(struct tcb *const tcp, const kernel_ulong_t arg)<br>
+{<br>
+       struct_drm_client client;<br>
+<br>
+       if (entering(tcp)) {<br>
+               if (umove_or_printaddr(tcp, arg, &client))<br>
+                       return RVAL_IOCTL_DECODED;<br>
+               PRINT_FIELD_D("{", client, idx);<br>
+<br>
+               return 0;<br>
+       }<br>
+<br>
+       if (umove_nor_syserror(tcp, arg, &client)) {<br>
+               PRINT_FIELD_D(", ", client, auth);<br>
+               PRINT_FIELD_U(", ", client, pid);<br>
+               PRINT_FIELD_UID(", ", client, uid);<br>
+               PRINT_FIELD_U(", ", client, magic);<br>
+               PRINT_FIELD_U(", ", client, iocs);<br>
+       }<br>
+<br>
+       tprints("}");<br>
+<br>
+       return RVAL_IOCTL_DECODED;<br>
+}<br>
+<br>
+static int<br>
+drm_add_map(struct tcb *const tcp, const kernel_ulong_t arg)<br>
+{<br>
+       struct_drm_map map;<br>
+<br>
+       if (umove_or_printaddr(tcp, arg, &map))<br>
+               return RVAL_IOCTL_DECODED;<br>
+<br>
+       PRINT_FIELD_X("{", map, offset);<br>
+       PRINT_FIELD_U(", ", map, size);<br>
+       PRINT_FIELD_XVAL(", ", map, type, drm_map_type, "_DRM_???");<br>
+       PRINT_FIELD_FLAGS(", ", map, flags, drm_map_flags, "_DRM_???");<br>
+       tprints("}");<br>
+<br>
+       return RVAL_IOCTL_DECODED;<br>
+}<br>
+<br>
+static int<br>
+drm_add_bufs(struct tcb *const tcp, const kernel_ulong_t arg)<br>
+{<br>
+       struct_drm_buf_desc desc;<br>
+<br>
+       if (entering(tcp)) {<br>
+               if (umove_or_printaddr(tcp, arg, &desc))<br>
+                       return RVAL_IOCTL_DECODED;<br>
+<br>
+               PRINT_FIELD_D("{", desc, count);<br>
+               PRINT_FIELD_D(", ", desc, size);<br>
+               PRINT_FIELD_FLAGS(", ", desc, flags, drm_buf_desc_flags,<br>
+                                "_DRM_???");<br>
+               PRINT_FIELD_X(", ", desc, agp_start);<br>
+               tprints("}");<br>
+<br>
+               return 0;<br>
+       }<br>
+<br>
+       if (umove_nor_syserror(tcp, arg, &desc)) {<br>
+               PRINT_FIELD_D(" => {", desc, count);<br>
+               PRINT_FIELD_D(", ", desc, size);<br>
+               tprints("}");<br>
+       }<br>
+<br>
+       return RVAL_IOCTL_DECODED;<br>
+}<br>
+<br>
+static int<br>
+drm_mark_bufs(struct tcb *const tcp, const kernel_ulong_t arg)<br>
+{<br>
+       struct_drm_buf_desc desc;<br>
+<br>
+       if (umove_or_printaddr(tcp, arg, &desc))<br>
+               return RVAL_IOCTL_DECODED;<br>
+<br>
+       PRINT_FIELD_D("{", desc, size);<br>
+       PRINT_FIELD_D(", ", desc, low_mark);<br>
+       PRINT_FIELD_D(", ", desc, high_mark);<br>
+       tprints("}");<br>
+<br>
+       return RVAL_IOCTL_DECODED;<br>
+}<br>
+<br>
+static bool<br>
+print_drm_buf_desc(struct tcb *tcp, void *elem_buf,<br>
+                  size_t elem_size, void *data)<br>
+{<br>
+       const struct_drm_buf_desc *p = elem_buf;<br>
+       PRINT_FIELD_D("{", *p, count);<br>
+       PRINT_FIELD_D(", ", *p, size);<br>
+       PRINT_FIELD_D(", ", *p, low_mark);<br>
+       PRINT_FIELD_D(", ", *p, high_mark);<br>
+       PRINT_FIELD_FLAGS(", ", *p, flags, drm_buf_desc_flags,<br>
+                         "_DRM_???");<br>
+       tprints("}");<br>
+       return true;<br>
+}<br>
+<br>
+static int<br>
+drm_info_bufs(struct tcb *const tcp, const kernel_ulong_t arg)<br>
+{<br>
+       struct_drm_buf_info info;<br>
+       struct_drm_buf_desc desc;<br>
+<br>
+       if (entering(tcp)) {<br>
+               if (umove_or_printaddr(tcp, arg, &info))<br>
+               return RVAL_IOCTL_DECODED;<br>
+<br>
+               tprints("{list=");<br>
+               print_array(tcp, ptr_to_kulong(info.list), info.count,<br>
+                           &desc, sizeof(desc),<br>
+                           tfetch_mem, print_drm_buf_desc, 0);<br>
+               PRINT_FIELD_D(", ", info, count);<br>
+               tprints("}");<br>
+<br>
+               return 0;<br>
+       }<br>
+<br>
+       if (umove_nor_syserror(tcp, arg, &info)) {<br>
+               PRINT_FIELD_D(" => {", info, count);<br>
+               tprints("}");<br>
+       }<br>
+<br>
+       return RVAL_IOCTL_DECODED;<br>
+}<br>
+<br>
+static bool<br>
+print_drm_buf_pub(struct tcb *tcp, void *elem_buf,<br>
+                 size_t elem_size, void *data)<br>
+<br>
+{<br>
+       const struct_drm_buf_pub *p = elem_buf;<br>
+       PRINT_FIELD_D("{", *p, idx);<br>
+       PRINT_FIELD_D(", ", *p, total);<br>
+       PRINT_FIELD_D(", ", *p, used);<br>
+       PRINT_FIELD_PTR(", ", *p, address);<br>
+       tprints("}");<br>
+       return true;<br>
+}<br>
+<br>
+static int<br>
+drm_map_bufs(struct tcb *const tcp, const kernel_ulong_t arg)<br>
+{<br>
+       struct_drm_buf_map map;<br>
+       struct_drm_buf_pub pub;<br>
+<br>
+       if (entering(tcp)) {<br>
+               if (umove_or_printaddr(tcp, arg, &map))<br>
+                       return RVAL_IOCTL_DECODED;<br>
+               PRINT_FIELD_D("{", map, count);<br>
+               PRINT_FIELD_PTR(", ", map, virtual);<br>
+<br>
+               return 0;<br>
+       }<br>
+<br>
+       if (umove_nor_syserror(tcp, arg, &map)) {<br>
+               tprints(", list=");<br>
+               print_array(tcp, ptr_to_kulong(map.list), map.count,<br>
+                           &pub, sizeof(pub),<br>
+                           tfetch_mem, print_drm_buf_pub, 0);<br>
+       }<br>
+<br>
+       tprints("}");<br>
+<br>
+       return RVAL_IOCTL_DECODED;<br>
+}<br>
+<br>
+static int<br>
+drm_free_bufs(struct tcb *const tcp, const kernel_ulong_t arg)<br>
+{<br>
+       struct_drm_buf_free free;<br>
+       int list_val;<br>
+<br>
+       if (umove_or_printaddr(tcp, arg, &free))<br>
+               return RVAL_IOCTL_DECODED;<br>
+<br>
+       PRINT_FIELD_D("{", free, count);<br>
+       tprints(", list=");<br>
+       print_array(tcp, ptr_to_kulong(free.list), free.count,<br>
+                   &list_val, sizeof(list_val),<br>
+                   tfetch_mem, print_int32_array_member, 0);<br>
+       tprints("}");<br>
+<br>
+       return RVAL_IOCTL_DECODED;<br>
+}<br>
+<br>
+static int<br>
+drm_rm_map(struct tcb *const tcp, const kernel_ulong_t arg)<br>
+{<br>
+       struct_drm_map map;<br>
+<br>
+       if (umove_or_printaddr(tcp, arg, &map))<br>
+               return RVAL_IOCTL_DECODED;<br>
+<br>
+       PRINT_FIELD_PTR("{", map, handle);<br>
+       tprints("}");<br>
+<br>
+       return RVAL_IOCTL_DECODED;<br>
+}<br>
+<br>
+static int<br>
+drm_sarea_ctx(struct tcb *const tcp, const kernel_ulong_t arg,<br>
+             const bool is_get)<br>
+{<br>
+       struct_drm_ctx_priv_map map;<br>
+<br>
+       if (entering(tcp)) {<br>
+               if (umove_or_printaddr(tcp, arg, &map))<br>
+                       return RVAL_IOCTL_DECODED;<br>
+               PRINT_FIELD_U("{", map, ctx_id);<br>
+               if (!is_get)<br>
+                       PRINT_FIELD_PTR(", ", map, handle);<br>
+               return 0;<br>
+       }<br>
+<br>
+       if (umove_nor_syserror(tcp, arg, &map) && is_get) {<br>
+               PRINT_FIELD_PTR(", ", map, handle);<br>
+       }<br>
+<br>
+       tprints("}");<br>
+<br>
+       return RVAL_IOCTL_DECODED;<br>
+}<br>
+<br>
+static bool<br>
+print_drm_ctx(struct tcb *tcp, void *elem_buf,<br>
+             size_t elem_size, void *data)<br>
+{<br>
+       const struct drm_ctx *p = elem_buf;<br>
+       PRINT_FIELD_U("{", *p, handle);<br>
+       PRINT_FIELD_FLAGS("{", *p, flags, drm_ctx_flags, "_DRM_CONTEXT_???");<br>
+       tprints("}");<br>
+       return true;<br>
+}<br>
+<br>
+static int<br>
+drm_res_ctx(struct tcb *const tcp, const kernel_ulong_t arg)<br>
+{<br>
+       struct_drm_ctx_res ctx;<br>
+<br>
+       if (entering(tcp)) {<br>
+               if (umove_or_printaddr(tcp, arg, &ctx))<br>
+                       return RVAL_IOCTL_DECODED;<br>
+<br>
+               PRINT_FIELD_D("{", ctx, count);<br>
+               tprints("}");<br>
+<br>
+               return 0;<br>
+       }<br>
+<br>
+       if (umove_nor_syserror(tcp, arg, &ctx)) {<br>
+               PRINT_FIELD_D(" => {", ctx, count);<br>
+               tprints(", contexts=");<br>
+               print_array(tcp, ptr_to_kulong(ctx.contexts), ctx.count,<br>
+                           &ctx, sizeof(ctx),<br>
+                           tfetch_mem, print_drm_ctx, 0);<br>
+               tprints("}");<br>
+       }<br>
+<br>
+       return RVAL_IOCTL_DECODED;<br>
+}<br>
+<br>
+<br>
+static int<br>
+drm_agp_enable(struct tcb *const tcp, const kernel_ulong_t arg)<br>
+{<br>
+       struct_drm_agp_mode mode;<br>
+<br>
+       if (umove_or_printaddr(tcp, arg, &mode))<br>
+               return RVAL_IOCTL_DECODED;<br>
+<br>
+       PRINT_FIELD_U("{", mode, mode);<br>
+       tprints("}");<br>
+<br>
+       return RVAL_IOCTL_DECODED;<br>
+}<br>
+<br>
+static int<br>
+drm_agp_info(struct tcb *const tcp, const kernel_ulong_t arg)<br>
+{<br>
+       struct_drm_agp_info info;<br>
+<br>
+       if (entering(tcp))<br>
+<br>
+       /* exiting-only code */<br>
+       if (umove_or_printaddr(tcp, arg, &info))<br>
+               return RVAL_IOCTL_DECODED;<br>
+       PRINT_FIELD_D("{", info, agp_version_major);<br>
+       PRINT_FIELD_D(", ", info, agp_version_minor);<br>
+       PRINT_FIELD_U(", ", info, mode);<br>
+       PRINT_FIELD_X(", ", info, aperture_base);<br>
+       PRINT_FIELD_U(", ", info, aperture_size);<br>
+       PRINT_FIELD_U(", ", info, memory_allowed);<br>
+       PRINT_FIELD_U(", ", info, memory_used);<br>
+       PRINT_FIELD_X(", ", info, id_vendor);<br>
+       PRINT_FIELD_X(", ", info, id_device);<br>
+       tprints("}");<br>
+<br>
+       return RVAL_IOCTL_DECODED;<br>
+}<br>
+<br>
+static int<br>
+drm_agp_alloc(struct tcb *const tcp, const kernel_ulong_t arg)<br>
+{<br>
+       struct_drm_agp_buffer buffer;<br>
+<br>
+       if (entering(tcp)) {<br>
+               if (umove_or_printaddr(tcp, arg, &buffer))<br>
+                       return RVAL_IOCTL_DECODED;<br>
+               PRINT_FIELD_U("{", buffer, size);<br>
+               PRINT_FIELD_U(", ", buffer, type);<br>
+<br>
+               return 0;<br>
+       }<br>
+<br>
+       if (umove_nor_syserror(tcp, arg, &buffer)) {<br>
+               PRINT_FIELD_U(", ", buffer, handle);<br>
+               PRINT_FIELD_U(", ", buffer, physical);<br>
+       }<br>
+<br>
+       tprints("}");<br>
+<br>
+       return RVAL_IOCTL_DECODED;<br>
+}<br>
+<br>
+static int<br>
+drm_agp_free(struct tcb *const tcp, const kernel_ulong_t arg)<br>
+{<br>
+       struct_drm_agp_buffer buffer;<br>
+<br>
+       if (umove_or_printaddr(tcp, arg, &buffer))<br>
+               return RVAL_IOCTL_DECODED;<br>
+<br>
+       PRINT_FIELD_U("{", buffer, handle);<br>
+       tprints("}");<br>
+<br>
+       return RVAL_IOCTL_DECODED;<br>
+}<br>
+<br>
+static int<br>
+drm_agp_bind(struct tcb *const tcp, const kernel_ulong_t arg, bool is_bind)<br>
+{<br>
+       struct_drm_agp_binding binding;<br>
+<br>
+       if (umove_or_printaddr(tcp, arg, &binding))<br>
+               return RVAL_IOCTL_DECODED;<br>
+<br>
+       PRINT_FIELD_U("{", binding, handle);<br>
+       if (is_bind)<br>
+               PRINT_FIELD_X(", ", binding, offset);<br>
+       tprints("}");<br>
+<br>
+       return RVAL_IOCTL_DECODED;<br>
+}<br>
+<br>
+static int<br>
+drm_scatter_gather(struct tcb *const tcp, const kernel_ulong_t arg,<br>
+                  bool is_alloc)<br>
+{<br>
+       struct_drm_scatter_gather sg;<br>
+<br>
+       if (entering(tcp)) {<br>
+               if (umove_or_printaddr(tcp, arg, &sg))<br>
+                       return RVAL_IOCTL_DECODED;<br>
+               if (is_alloc)<br>
+                       PRINT_FIELD_U("{", sg, size);<br>
+               else<br>
+                       PRINT_FIELD_U("{", sg, handle);<br>
+<br>
+               return 0;<br>
+       }<br>
+<br>
+       if (umove_nor_syserror(tcp, arg, &sg)) {<br>
+               if (is_alloc)<br>
+                       PRINT_FIELD_U(", ", sg, handle);<br>
+       }<br>
+<br>
+       tprints("}");<br>
+<br>
+       return RVAL_IOCTL_DECODED;<br>
+}<br>
+<br>
+static int<br>
+drm_wait_vblank(struct tcb *const tcp, const kernel_ulong_t arg)<br>
+{<br>
+       union_drm_wait_vblank vblank;<br>
+<br>
+       if (entering(tcp)) {<br>
+               if (umove_or_printaddr(tcp, arg, &vblank))<br>
+                       return RVAL_IOCTL_DECODED;<br>
+<br>
+               /* TODO: constants with _DRM_VBLANK_HIGH_CRTC_MASK is not added */<br>
+               tprints("{request={type=");<br>
+               printxval(drm_vblank_seq_type,<br>
+                         vblank.request.type & _DRM_VBLANK_TYPES_MASK,<br>
+                         "_DRM_VBLANK_???");<br>
+               tprints(", type.flags=");<br>
+               printflags(drm_vblank_seq_type_flags,<br>
+                          vblank.request.type & _DRM_VBLANK_FLAGS_MASK,<br>
+                          "_DRM_VBLANK_???");<br>
+               PRINT_FIELD_U(", ", vblank.request, sequence);<br>
+               PRINT_FIELD_U(", ", vblank.request, signal);<br>
+               tprints("}");<br>
+<br>
+               return 0;<br>
+       }<br>
+<br>
+       if (umove_nor_syserror(tcp, arg, &vblank)) {<br>
+               tprints(", {reply={type=");<br>
+               printxval(drm_vblank_seq_type,<br>
+                         vblank.reply.type & _DRM_VBLANK_TYPES_MASK,<br>
+                         "_DRM_VBLANK_???");<br>
+               tprints(", type.flags=");<br>
+               printflags(drm_vblank_seq_type_flags,<br>
+                          vblank.reply.type & _DRM_VBLANK_FLAGS_MASK,<br>
+                          "_DRM_VBLANK_???");<br>
+<br>
+               PRINT_FIELD_U(", ", vblank.reply, sequence);<br>
+               PRINT_FIELD_D(", ", vblank.reply, tval_sec);<br>
+               PRINT_FIELD_D(", ", vblank.reply, tval_usec);<br>
+               tprints("}");<br>
+       }<br>
+<br>
+       tprints("}");<br>
+<br>
+       return RVAL_IOCTL_DECODED;<br>
+}<br>
+<br>
+static bool<br>
+print_drm_mode_modeinfo(struct tcb *tcp, void *elem_buf,<br>
+                       size_t elem_size, void *data)<br>
+{<br>
+       const struct drm_mode_modeinfo *p = elem_buf;<br>
+       PRINT_FIELD_U("{", *p, clock);<br>
+       PRINT_FIELD_U(", ", *p, hdisplay);<br>
+       PRINT_FIELD_U(", ", *p, hsync_start);<br>
+       PRINT_FIELD_U(", ", *p, hsync_end);<br>
+       PRINT_FIELD_U(", ", *p, htotal);<br>
+       PRINT_FIELD_U(", ", *p, hskew);<br>
+       PRINT_FIELD_U(", ", *p, vdisplay);<br>
+       PRINT_FIELD_U(", ", *p, vsync_start);<br>
+       PRINT_FIELD_U(", ", *p, vsync_end);<br>
+       PRINT_FIELD_U(", ", *p, vtotal);<br>
+       PRINT_FIELD_U(", ", *p, vscan);<br>
+       PRINT_FIELD_U(", ", *p, vrefresh);<br>
+       PRINT_FIELD_FLAGS(", ", *p, flags, drm_mode_flags,<br>
+                        "DRM_MODE_FLAG_PIC_???");<br>
+       PRINT_FIELD_XVAL(", ", *p, type, drm_mode_type,<br>
+                        "DRM_MODE_TYPE_???");<br>
+       PRINT_FIELD_CSTRING(", ", *p, name);<br>
+       tprints("}");<br>
+       return true;<br>
+}<br>
+<br>
+static void<br>
+print_mode_get_connector_head(struct tcb *const tcp,<br>
+                             const kernel_ulong_t arg,<br>
+                             struct_drm_mode_get_connector *con,<br>
+                             const char *suffix)<br>
+{<br>
+               PRINT_FIELD_U("{", *con, connector_id);<br>
+               PRINT_FIELD_U(", ", *con, count_modes);<br>
+               PRINT_FIELD_U(", ", *con, count_props);<br>
+               PRINT_FIELD_U(", ", *con, count_encoders);<br>
+               tprints(suffix);<br>
+}<br>
+<br>
+static int<br>
+drm_mode_get_connector(struct tcb *const tcp, const kernel_ulong_t arg,<br>
+                      uint32_t size)<br>
+{<br>
+       struct_drm_mode_get_connector con;<br>
+       struct drm_mode_modeinfo modeinfo;<br>
+       uint32_t u32_val;<br>
+       uint64_t u64_val;<br>
+<br>
+       if (entering(tcp)) {<br>
+               if (umoven_or_printaddr(tcp, arg, size, &con))<br>
+                       return RVAL_IOCTL_DECODED;<br>
+<br>
+               print_mode_get_connector_head(tcp, arg, &con, "}");<br>
+<br>
+               return 0;<br>
+       }<br>
+<br>
+       if (!syserror(tcp) && !umoven(tcp, arg, size, &con)) {<br>
+               tprints(" => ");<br>
+               print_mode_get_connector_head(tcp, arg, &con, "");<br>
+               tprints(", encoders_ptr=");<br>
+               print_array(tcp, con.encoders_ptr, con.count_encoders,<br>
+                           &u32_val, sizeof(u32_val),<br>
+                           tfetch_mem, print_uint32_array_member, 0);<br>
+               tprints(", modes_ptr=");<br>
+               print_array(tcp, con.modes_ptr, con.count_modes,<br>
+                           &modeinfo, sizeof(modeinfo),<br>
+                           tfetch_mem, print_drm_mode_modeinfo, 0);<br>
+               tprints(", props_ptr=");<br>
+               print_array(tcp, con.props_ptr, con.count_props,<br>
+                           &u32_val, sizeof(u32_val),<br>
+                           tfetch_mem, print_uint32_array_member, 0);<br>
+               tprints(", prop_values_ptr=");<br>
+               print_array(tcp, con.prop_values_ptr, con.count_props,<br>
+                           &u64_val, sizeof(u64_val),<br>
+                           tfetch_mem, print_uint64_array_member, 0);<br>
+               PRINT_FIELD_U(", ", con, encoder_id);<br>
+               PRINT_FIELD_U(", ", con, connector_type);<br>
+               PRINT_FIELD_U(", ", con, connector_type_id);<br>
+               PRINT_FIELD_U(", ", con, connection);<br>
+               PRINT_FIELD_U(", ", con, mm_width);<br>
+               PRINT_FIELD_U(", ", con, mm_height);<br>
+               PRINT_FIELD_U(", ", con, subpixel);<br>
+               tprints("}");<br>
+       }<br>
+<br>
+       return RVAL_IOCTL_DECODED;<br>
+}<br>
+<br>
+static int<br>
+drm_mode_add_fb2(struct tcb *const tcp, const kernel_ulong_t arg,<br>
+                uint32_t size)<br>
+{<br>
+       struct_drm_mode_fb_cmd2 cmd;<br>
+<br>
+       if (entering(tcp)) {<br>
+               if (umoven_or_printaddr(tcp, arg, size, &cmd))<br>
+                       return RVAL_IOCTL_DECODED;<br>
+               PRINT_FIELD_U("{", cmd, width);<br>
+               PRINT_FIELD_U(", ", cmd, height);<br>
+               PRINT_FIELD_X(", ", cmd, pixel_format);<br>
+               PRINT_FIELD_FLAGS(", ", cmd, flags, drm_mode_fb_cmd2_flags,<br>
+                                 "DRM_MODE_FB_???");<br>
+               tprintf(", handles=[%u, %u, %u, %u]",<br>
+                       cmd.handles[0], cmd.handles[1],<br>
+                       cmd.handles[2], cmd.handles[3]);<br>
+               tprintf(", pitches=[%u, %u, %u, %u]",<br>
+                       cmd.pitches[0], cmd.pitches[1],<br>
+                       cmd.pitches[2], cmd.pitches[3]);<br>
+               tprintf(", offsets=[%u, %u, %u, %u]",<br>
+                       cmd.offsets[0], cmd.offsets[1],<br>
+                       cmd.offsets[2], cmd.offsets[3]);<br>
+               /* modifier field was added in Linux commit v4.1-rc1~69^2~35^2~57. */<br>
+               if (size > offsetof(struct_drm_mode_fb_cmd2, modifier)) {<br>
+                       tprintf(", modifiers=[%" PRIu64 ", %" PRIu64 ", %" PRIu64 ", %" PRIu64 "]",<br>
+                               (uint64_t) cmd.modifier[0], (uint64_t) cmd.modifier[1],<br>
+                               (uint64_t) cmd.modifier[2], (uint64_t) cmd.modifier[3]);<br>
+               }<br>
+<br>
+               return 0;<br>
+       }<br>
+<br>
+       if (!syserror(tcp) && !umoven(tcp, arg, size, &cmd))<br>
+               PRINT_FIELD_U(", ", cmd, fb_id);<br>
+<br>
+       tprints("}");<br>
+<br>
+       return RVAL_IOCTL_DECODED;<br>
+}<br>
+<br>
+static int<br>
+drm_mode_getplaneresources(struct tcb *const tcp, const kernel_ulong_t arg)<br>
+{<br>
+       struct_drm_mode_get_plane_res res;<br>
+       uint32_t plane_id_val;<br>
+<br>
+       if (entering(tcp)) {<br>
+               if (umove_or_printaddr(tcp, arg, &res))<br>
+                       return RVAL_IOCTL_DECODED;<br>
+<br>
+               tprints("{plane_id_ptr=");<br>
+               print_array(tcp, res.plane_id_ptr, res.count_planes,<br>
+                           &plane_id_val, sizeof(plane_id_val),<br>
+                           tfetch_mem, print_uint32_array_member, 0);<br>
+               PRINT_FIELD_U(", ", res, count_planes);<br>
+               tprints("}");<br>
+<br>
+               return 0;<br>
+       }<br>
+<br>
+       if (umove_nor_syserror(tcp, arg, &res)) {<br>
+               PRINT_FIELD_U(" => {", res, count_planes);<br>
+               tprints("}");<br>
+       }<br>
+<br>
+       return RVAL_IOCTL_DECODED;<br>
+}<br>
+<br>
+static int<br>
+drm_mode_obj_getproperties(struct tcb *const tcp, const kernel_ulong_t arg)<br>
+{<br>
+       struct_drm_mode_obj_get_properties prop;<br>
+       uint32_t u32_val;<br>
+       uint64_t u64_val;<br>
+<br>
+       if (entering(tcp)) {<br>
+               if (umove_or_printaddr(tcp, arg, &prop))<br>
+                       return RVAL_IOCTL_DECODED;<br>
+<br>
+               tprints("{props_ptr=");<br>
+               print_array(tcp, prop.props_ptr, prop.count_props,<br>
+                           &u32_val, sizeof(u32_val),<br>
+                           tfetch_mem, print_uint32_array_member, 0);<br>
+               tprints(", prop_values_ptr=");<br>
+               print_array(tcp, prop.prop_values_ptr, prop.count_props,<br>
+                           &u64_val, sizeof(u64_val),<br>
+                           tfetch_mem, print_uint64_array_member, 0);<br>
+               PRINT_FIELD_U(", ", prop, count_props);<br>
+               PRINT_FIELD_U(", ", prop, obj_id);<br>
+               PRINT_FIELD_U(", ", prop, obj_type);<br>
+               tprints("}");<br>
+<br>
+               return 0;<br>
+       }<br>
+<br>
+       if (umove_nor_syserror(tcp, arg, &prop)) {<br>
+               PRINT_FIELD_U(" => {", prop, count_props);<br>
+               tprints("}");<br>
+       }<br>
+<br>
+       return RVAL_IOCTL_DECODED;<br>
+}<br>
+<br>
+static int<br>
+drm_mode_obj_setproperty(struct tcb *const tcp, const kernel_ulong_t arg)<br>
+{<br>
+       struct_drm_mode_obj_set_property prop;<br>
+<br>
+       if (umove_or_printaddr(tcp, arg, &prop))<br>
+               return RVAL_IOCTL_DECODED;<br>
+<br>
+       PRINT_FIELD_U("{", prop, value);<br>
+       PRINT_FIELD_U(", ", prop, prop_id);<br>
+       PRINT_FIELD_U(", ", prop, obj_id);<br>
+       PRINT_FIELD_U(", ", prop, obj_type);<br>
+       tprints("}");<br>
+<br>
+       return RVAL_IOCTL_DECODED;<br>
+}<br>
+<br>
+MPERS_PRINTER_DECL(int, drm_ioctl_mpers, struct tcb *const tcp,<br>
+                  const unsigned int code, const kernel_ulong_t arg)<br>
+{<br>
+       switch (code) {<br>
+       case DRM_IOCTL_VERSION: /* RW */<br>
+               return drm_version(tcp, arg);<br>
+       case DRM_IOCTL_GET_UNIQUE: /* RW */<br>
+               return drm_unique(tcp, arg);<br>
+       case DRM_IOCTL_GET_MAP: /* RW */<br>
+               return drm_get_map(tcp, arg);<br>
+       case DRM_IOCTL_GET_CLIENT: /* RW */<br>
+               return drm_get_client(tcp, arg);<br>
+       case DRM_IOCTL_ADD_MAP: /* RW */<br>
+               return drm_add_map(tcp, arg);<br>
+       case DRM_IOCTL_ADD_BUFS: /* RW */<br>
+               return drm_add_bufs(tcp, arg);<br>
+       case DRM_IOCTL_MARK_BUFS: /* W */<br>
+               return drm_mark_bufs(tcp, arg);<br>
+       case DRM_IOCTL_INFO_BUFS: /* RW */<br>
+               return drm_info_bufs(tcp, arg);<br>
+       case DRM_IOCTL_MAP_BUFS: /* RW */<br>
+               return drm_map_bufs(tcp, arg);<br>
+       case DRM_IOCTL_FREE_BUFS: /* W */<br>
+               return drm_free_bufs(tcp, arg);<br>
+       case DRM_IOCTL_RM_MAP: /* W */<br>
+               return drm_rm_map(tcp, arg);<br>
+       case DRM_IOCTL_SET_SAREA_CTX:<br>
+       case DRM_IOCTL_GET_SAREA_CTX:<br>
+               return drm_sarea_ctx(tcp, arg, code == DRM_IOCTL_GET_SAREA_CTX);<br>
+       case DRM_IOCTL_RES_CTX: /* RW */<br>
+               return drm_res_ctx(tcp, arg);<br>
+       case DRM_IOCTL_AGP_ENABLE: /* W */<br>
+               return drm_agp_enable(tcp, arg);<br>
+       case DRM_IOCTL_AGP_INFO: /* R */<br>
+               return drm_agp_info(tcp, arg);<br>
+       case DRM_IOCTL_AGP_ALLOC: /* RW */<br>
+               return drm_agp_alloc(tcp, arg);<br>
+       case DRM_IOCTL_AGP_FREE: /* W */<br>
+               return drm_agp_free(tcp, arg);<br>
+       case DRM_IOCTL_AGP_BIND: /* W */<br>
+       case DRM_IOCTL_AGP_UNBIND: /* W */<br>
+               return drm_agp_bind(tcp, arg, code == DRM_IOCTL_AGP_BIND);<br>
+       case DRM_IOCTL_SG_ALLOC: /* RW */<br>
+       case DRM_IOCTL_SG_FREE: /* W */<br>
+               return drm_scatter_gather(tcp, arg, code == DRM_IOCTL_SG_ALLOC);<br>
+       case DRM_IOCTL_WAIT_VBLANK: /* RW */<br>
+               return drm_wait_vblank(tcp, arg);<br>
+       }<br>
+<br>
+       /* The structure sizes of ioctl cmds below are different */<br>
+       /* among kernels and/or personalities so we can't just use */<br>
+       /* switch(code) to identify them but use _IOC_NR instead. */<br>
+<br>
+       if (_IOC_NR(code) == _IOC_NR(DRM_IOCTL_MODE_GETCONNECTOR)) {<br>
+               return drm_mode_get_connector(tcp, arg, _IOC_SIZE(code));<br>
+       }<br>
+<br>
+       if (_IOC_NR(code) == _IOC_NR(DRM_IOCTL_MODE_ADDFB2)) {<br>
+               return drm_mode_add_fb2(tcp, arg, _IOC_SIZE(code));<br>
+       }<br>
+<br>
+       /* The structure sizes of ioctl cmds DRM_IOCTL_MODE_GETPLANERESOURCES, */<br>
+       /* DRM_IOCTL_MODE_OBJ_GETPROPERTIES and DRM_IOCTL_MODE_OBJ_SETPROPERTY */<br>
+       /* differs only among personalities, not versions of kernels, this is */<br>
+       /* a little bit different from DRM_IOCTL_MODE_GETCONNECTOR which may */<br>
+       /* differs among both kernels and personalities */<br>
+       if (_IOC_NR(code) == _IOC_NR(DRM_IOCTL_MODE_GETPLANERESOURCES)) {<br>
+               return drm_mode_getplaneresources(tcp, arg);<br>
+       }<br>
+<br>
+       if (_IOC_NR(code) == _IOC_NR(DRM_IOCTL_MODE_OBJ_GETPROPERTIES)) {<br>
+               return drm_mode_obj_getproperties(tcp, arg);<br>
+       }<br>
+<br>
+       if (_IOC_NR(code) == _IOC_NR(DRM_IOCTL_MODE_OBJ_SETPROPERTY)) {<br>
+               return drm_mode_obj_setproperty(tcp, arg);<br>
+       }<br>
+<br>
+       return RVAL_DECODED;<br>
+}<br>
diff --git a/ioctl.c b/ioctl.c<br>
index b80292cb..75bdc209 100644<br>
--- a/ioctl.c<br>
+++ b/ioctl.c<br>
@@ -195,6 +195,8 @@ ioctl_decode_command_number(struct tcb *tcp)<br>
                                return 1;<br>
                        }<br>
                        return 0;<br>
+               case 'd':<br>
+                       return drm_decode_number(tcp, code);<br>
                default:<br>
                        return 0;<br>
        }<br>
@@ -264,6 +266,8 @@ ioctl_decode(struct tcb *tcp)<br>
                return fs_x_ioctl(tcp, code, arg);<br>
        case 0x22:<br>
                return scsi_ioctl(tcp, code, arg);<br>
+       case 'd':<br>
+               return drm_ioctl(tcp, code, arg);<br>
        case 'L':<br>
                return loop_ioctl(tcp, code, arg);<br>
 #ifdef HAVE_STRUCT_MTD_WRITE_REQ<br>
diff --git a/linux/drm/drm.h b/linux/drm/drm.h<br>
new file mode 100644<br>
index 00000000..efcd16c3<br>
--- /dev/null<br>
+++ b/linux/drm/drm.h<br>
@@ -0,0 +1,1042 @@<br>
+/**<br>
+ * \file drm.h<br>
+ * Header for the Direct Rendering Manager<br>
+ *<br>
+ * \author Rickard E. (Rik) Faith <<a href="mailto:faith@valinux.com" target="_blank">faith@valinux.com</a>><br>
+ *<br>
+ * \par Acknowledgments:<br>
+ * Dec 1999, Richard Henderson <<a href="mailto:rth@twiddle.net" target="_blank">rth@twiddle.net</a>>, move to generic \c cmpxchg.<br>
+ */<br>
+<br>
+/*<br>
+ * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.<br>
+ * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.<br>
+ * All rights reserved.<br>
+ *<br>
+ * Permission is hereby granted, free of charge, to any person obtaining a<br>
+ * copy of this software and associated documentation files (the "Software"),<br>
+ * to deal in the Software without restriction, including without limitation<br>
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,<br>
+ * and/or sell copies of the Software, and to permit persons to whom the<br>
+ * Software is furnished to do so, subject to the following conditions:<br>
+ *<br>
+ * The above copyright notice and this permission notice (including the next<br>
+ * paragraph) shall be included in all copies or substantial portions of the<br>
+ * Software.<br>
+ *<br>
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR<br>
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,<br>
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL<br>
+ * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR<br>
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,<br>
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR<br>
+ * OTHER DEALINGS IN THE SOFTWARE.<br>
+ */<br>
+<br>
+#ifndef _DRM_H_<br>
+#define _DRM_H_<br>
+<br>
+#if   defined(__linux__)<br>
+<br>
+#include <linux/types.h><br>
+#include <linux/fcntl.h><br>
+#include <asm/ioctl.h><br>
+typedef unsigned int drm_handle_t;<br>
+<br>
+#else /* One of the BSDs */<br>
+<br>
+#include <stdint.h><br>
+#include <sys/ioccom.h><br>
+#include <sys/types.h><br>
+typedef int8_t   __s8;<br>
+typedef uint8_t  __u8;<br>
+typedef int16_t  __s16;<br>
+typedef uint16_t __u16;<br>
+typedef int32_t  __s32;<br>
+typedef uint32_t __u32;<br>
+typedef int64_t  __s64;<br>
+typedef uint64_t __u64;<br>
+typedef unsigned long drm_handle_t;<br>
+<br>
+#endif<br>
+<br>
+#if defined(__cplusplus)<br>
+extern "C" {<br>
+#endif<br>
+<br>
+#define DRM_NAME       "drm"     /**< Name in kernel, /dev, and /proc */<br>
+#define DRM_MIN_ORDER  5         /**< At least 2^5 bytes = 32 bytes */<br>
+#define DRM_MAX_ORDER  22        /**< Up to 2^22 bytes = 4MB */<br>
+#define DRM_RAM_PERCENT 10       /**< How much system ram can we lock? */<br>
+<br>
+#define _DRM_LOCK_HELD 0x80000000U /**< Hardware lock is held */<br>
+#define _DRM_LOCK_CONT 0x40000000U /**< Hardware lock is contended */<br>
+#define _DRM_LOCK_IS_HELD(lock)           ((lock) & _DRM_LOCK_HELD)<br>
+#define _DRM_LOCK_IS_CONT(lock)           ((lock) & _DRM_LOCK_CONT)<br>
+#define _DRM_LOCKING_CONTEXT(lock) ((lock) & ~(_DRM_LOCK_HELD|_DRM_LOCK_CONT))<br>
+<br>
+typedef unsigned int drm_context_t;<br>
+typedef unsigned int drm_drawable_t;<br>
+typedef unsigned int drm_magic_t;<br>
+<br>
+/**<br>
+ * Cliprect.<br>
+ *<br>
+ * \warning: If you change this structure, make sure you change<br>
+ * XF86DRIClipRectRec in the server as well<br>
+ *<br>
+ * \note KW: Actually it's illegal to change either for<br>
+ * backwards-compatibility reasons.<br>
+ */<br>
+struct drm_clip_rect {<br>
+       unsigned short x1;<br>
+       unsigned short y1;<br>
+       unsigned short x2;<br>
+       unsigned short y2;<br>
+};<br>
+<br>
+/**<br>
+ * Drawable information.<br>
+ */<br>
+struct drm_drawable_info {<br>
+       unsigned int num_rects;<br>
+       struct drm_clip_rect *rects;<br>
+};<br>
+<br>
+/**<br>
+ * Texture region,<br>
+ */<br>
+struct drm_tex_region {<br>
+       unsigned char next;<br>
+       unsigned char prev;<br>
+       unsigned char in_use;<br>
+       unsigned char padding;<br>
+       unsigned int age;<br>
+};<br>
+<br>
+/**<br>
+ * Hardware lock.<br>
+ *<br>
+ * The lock structure is a simple cache-line aligned integer.  To avoid<br>
+ * processor bus contention on a multiprocessor system, there should not be any<br>
+ * other data stored in the same cache line.<br>
+ */<br>
+struct drm_hw_lock {<br>
+       __volatile__ unsigned int lock;         /**< lock variable */<br>
+       char padding[60];                       /**< Pad to cache line */<br>
+};<br>
+<br>
+/**<br>
+ * DRM_IOCTL_VERSION ioctl argument type.<br>
+ *<br>
+ * \sa drmGetVersion().<br>
+ */<br>
+struct drm_version {<br>
+       int version_major;        /**< Major version */<br>
+       int version_minor;        /**< Minor version */<br>
+       int version_patchlevel;   /**< Patch level */<br>
+       size_t name_len;          /**< Length of name buffer */<br>
+       char *name;       /**< Name of driver */<br>
+       size_t date_len;          /**< Length of date buffer */<br>
+       char *date;       /**< User-space buffer to hold date */<br>
+       size_t desc_len;          /**< Length of desc buffer */<br>
+       char *desc;       /**< User-space buffer to hold desc */<br>
+};<br>
+<br>
+/**<br>
+ * DRM_IOCTL_GET_UNIQUE ioctl argument type.<br>
+ *<br>
+ * \sa drmGetBusid() and drmSetBusId().<br>
+ */<br>
+struct drm_unique {<br>
+       size_t unique_len;        /**< Length of unique */<br>
+       char *unique;     /**< Unique name for driver instantiation */<br>
+};<br>
+<br>
+struct drm_list {<br>
+       int count;                /**< Length of user-space structures */<br>
+       struct drm_version *version;<br>
+};<br>
+<br>
+struct drm_block {<br>
+       int unused;<br>
+};<br>
+<br>
+/**<br>
+ * DRM_IOCTL_CONTROL ioctl argument type.<br>
+ *<br>
+ * \sa drmCtlInstHandler() and drmCtlUninstHandler().<br>
+ */<br>
+struct drm_control {<br>
+       enum {<br>
+               DRM_ADD_COMMAND,<br>
+               DRM_RM_COMMAND,<br>
+               DRM_INST_HANDLER,<br>
+               DRM_UNINST_HANDLER<br>
+       } func;<br>
+       int irq;<br>
+};<br>
+<br>
+/**<br>
+ * Type of memory to map.<br>
+ */<br>
+enum drm_map_type {<br>
+       _DRM_FRAME_BUFFER = 0,    /**< WC (no caching), no core dump */<br>
+       _DRM_REGISTERS = 1,       /**< no caching, no core dump */<br>
+       _DRM_SHM = 2,             /**< shared, cached */<br>
+       _DRM_AGP = 3,             /**< AGP/GART */<br>
+       _DRM_SCATTER_GATHER = 4,  /**< Scatter/gather memory for PCI DMA */<br>
+       _DRM_CONSISTENT = 5       /**< Consistent memory for PCI DMA */<br>
+};<br>
+<br>
+/**<br>
+ * Memory mapping flags.<br>
+ */<br>
+enum drm_map_flags {<br>
+       _DRM_RESTRICTED = 0x01,      /**< Cannot be mapped to user-virtual */<br>
+       _DRM_READ_ONLY = 0x02,<br>
+       _DRM_LOCKED = 0x04,          /**< shared, cached, locked */<br>
+       _DRM_KERNEL = 0x08,          /**< kernel requires access */<br>
+       _DRM_WRITE_COMBINING = 0x10, /**< use write-combining if available */<br>
+       _DRM_CONTAINS_LOCK = 0x20,   /**< SHM page that contains lock */<br>
+       _DRM_REMOVABLE = 0x40,       /**< Removable mapping */<br>
+       _DRM_DRIVER = 0x80           /**< Managed by driver */<br>
+};<br>
+<br>
+struct drm_ctx_priv_map {<br>
+       unsigned int ctx_id;     /**< Context requesting private mapping */<br>
+       void *handle;            /**< Handle of map */<br>
+};<br>
+<br>
+/**<br>
+ * DRM_IOCTL_GET_MAP, DRM_IOCTL_ADD_MAP and DRM_IOCTL_RM_MAP ioctls<br>
+ * argument type.<br>
+ *<br>
+ * \sa drmAddMap().<br>
+ */<br>
+struct drm_map {<br>
+       unsigned long offset;    /**< Requested physical address (0 for SAREA)*/<br>
+       unsigned long size;      /**< Requested physical size (bytes) */<br>
+       enum drm_map_type type;  /**< Type of memory to map */<br>
+       enum drm_map_flags flags;        /**< Flags */<br>
+       void *handle;            /**< User-space: "Handle" to pass to mmap() */<br>
+                                /**< Kernel-space: kernel-virtual address */<br>
+       int mtrr;                /**< MTRR slot used */<br>
+       /*   Private data */<br>
+};<br>
+<br>
+/**<br>
+ * DRM_IOCTL_GET_CLIENT ioctl argument type.<br>
+ */<br>
+struct drm_client {<br>
+       int idx;                /**< Which client desired? */<br>
+       int auth;               /**< Is client authenticated? */<br>
+       unsigned long pid;      /**< Process ID */<br>
+       unsigned long uid;      /**< User ID */<br>
+       unsigned long magic;    /**< Magic */<br>
+       unsigned long iocs;     /**< Ioctl count */<br>
+};<br>
+<br>
+enum drm_stat_type {<br>
+       _DRM_STAT_LOCK,<br>
+       _DRM_STAT_OPENS,<br>
+       _DRM_STAT_CLOSES,<br>
+       _DRM_STAT_IOCTLS,<br>
+       _DRM_STAT_LOCKS,<br>
+       _DRM_STAT_UNLOCKS,<br>
+       _DRM_STAT_VALUE,        /**< Generic value */<br>
+       _DRM_STAT_BYTE,         /**< Generic byte counter (1024bytes/K) */<br>
+       _DRM_STAT_COUNT,        /**< Generic non-byte counter (1000/k) */<br>
+<br>
+       _DRM_STAT_IRQ,          /**< IRQ */<br>
+       _DRM_STAT_PRIMARY,      /**< Primary DMA bytes */<br>
+       _DRM_STAT_SECONDARY,    /**< Secondary DMA bytes */<br>
+       _DRM_STAT_DMA,          /**< DMA */<br>
+       _DRM_STAT_SPECIAL,      /**< Special DMA (e.g., priority or polled) */<br>
+       _DRM_STAT_MISSED        /**< Missed DMA opportunity */<br>
+           /* Add to the *END* of the list */<br>
+};<br>
+<br>
+/**<br>
+ * DRM_IOCTL_GET_STATS ioctl argument type.<br>
+ */<br>
+struct drm_stats {<br>
+       unsigned long count;<br>
+       struct {<br>
+               unsigned long value;<br>
+               enum drm_stat_type type;<br>
+       } data[15];<br>
+};<br>
+<br>
+/**<br>
+ * Hardware locking flags.<br>
+ */<br>
+enum drm_lock_flags {<br>
+       _DRM_LOCK_READY = 0x01,      /**< Wait until hardware is ready for DMA */<br>
+       _DRM_LOCK_QUIESCENT = 0x02,  /**< Wait until hardware quiescent */<br>
+       _DRM_LOCK_FLUSH = 0x04,      /**< Flush this context's DMA queue first */<br>
+       _DRM_LOCK_FLUSH_ALL = 0x08,  /**< Flush all DMA queues first */<br>
+       /* These *HALT* flags aren't supported yet<br>
+          -- they will be used to support the<br>
+          full-screen DGA-like mode. */<br>
+       _DRM_HALT_ALL_QUEUES = 0x10, /**< Halt all current and future queues */<br>
+       _DRM_HALT_CUR_QUEUES = 0x20  /**< Halt all current queues */<br>
+};<br>
+<br>
+/**<br>
+ * DRM_IOCTL_LOCK, DRM_IOCTL_UNLOCK and DRM_IOCTL_FINISH ioctl argument type.<br>
+ *<br>
+ * \sa drmGetLock() and drmUnlock().<br>
+ */<br>
+struct drm_lock {<br>
+       int context;<br>
+       enum drm_lock_flags flags;<br>
+};<br>
+<br>
+/**<br>
+ * DMA flags<br>
+ *<br>
+ * \warning<br>
+ * These values \e must match xf86drm.h.<br>
+ *<br>
+ * \sa drm_dma.<br>
+ */<br>
+enum drm_dma_flags {<br>
+       /* Flags for DMA buffer dispatch */<br>
+       _DRM_DMA_BLOCK = 0x01,        /**<<br>
+                                      * Block until buffer dispatched.<br>
+                                      *<br>
+                                      * \note The buffer may not yet have<br>
+                                      * been processed by the hardware --<br>
+                                      * getting a hardware lock with the<br>
+                                      * hardware quiescent will ensure<br>
+                                      * that the buffer has been<br>
+                                      * processed.<br>
+                                      */<br>
+       _DRM_DMA_WHILE_LOCKED = 0x02, /**< Dispatch while lock held */<br>
+       _DRM_DMA_PRIORITY = 0x04,     /**< High priority dispatch */<br>
+<br>
+       /* Flags for DMA buffer request */<br>
+       _DRM_DMA_WAIT = 0x10,         /**< Wait for free buffers */<br>
+       _DRM_DMA_SMALLER_OK = 0x20,   /**< Smaller-than-requested buffers OK */<br>
+       _DRM_DMA_LARGER_OK = 0x40     /**< Larger-than-requested buffers OK */<br>
+};<br>
+<br>
+/**<br>
+ * DRM_IOCTL_ADD_BUFS and DRM_IOCTL_MARK_BUFS ioctl argument type.<br>
+ *<br>
+ * \sa drmAddBufs().<br>
+ */<br>
+struct drm_buf_desc {<br>
+       int count;               /**< Number of buffers of this size */<br>
+       int size;                /**< Size in bytes */<br>
+       int low_mark;            /**< Low water mark */<br>
+       int high_mark;           /**< High water mark */<br>
+       enum {<br>
+               _DRM_PAGE_ALIGN = 0x01, /**< Align on page boundaries for DMA */<br>
+               _DRM_AGP_BUFFER = 0x02, /**< Buffer is in AGP space */<br>
+               _DRM_SG_BUFFER = 0x04,  /**< Scatter/gather memory buffer */<br>
+               _DRM_FB_BUFFER = 0x08,  /**< Buffer is in frame buffer */<br>
+               _DRM_PCI_BUFFER_RO = 0x10 /**< Map PCI DMA buffer read-only */<br>
+       } flags;<br>
+       unsigned long agp_start; /**<<br>
+                                 * Start address of where the AGP buffers are<br>
+                                 * in the AGP aperture<br>
+                                 */<br>
+};<br>
+<br>
+/**<br>
+ * DRM_IOCTL_INFO_BUFS ioctl argument type.<br>
+ */<br>
+struct drm_buf_info {<br>
+       int count;              /**< Entries in list */<br>
+       struct drm_buf_desc *list;<br>
+};<br>
+<br>
+/**<br>
+ * DRM_IOCTL_FREE_BUFS ioctl argument type.<br>
+ */<br>
+struct drm_buf_free {<br>
+       int count;<br>
+       int *list;<br>
+};<br>
+<br>
+/**<br>
+ * Buffer information<br>
+ *<br>
+ * \sa drm_buf_map.<br>
+ */<br>
+struct drm_buf_pub {<br>
+       int idx;                       /**< Index into the master buffer list */<br>
+       int total;                     /**< Buffer size */<br>
+       int used;                      /**< Amount of buffer in use (for DMA) */<br>
+       void *address;         /**< Address of buffer */<br>
+};<br>
+<br>
+/**<br>
+ * DRM_IOCTL_MAP_BUFS ioctl argument type.<br>
+ */<br>
+struct drm_buf_map {<br>
+       int count;              /**< Length of the buffer list */<br>
+#ifdef __cplusplus<br>
+       void *virt;<br>
+#else<br>
+       void *virtual;          /**< Mmap'd area in user-virtual */<br>
+#endif<br>
+       struct drm_buf_pub *list;       /**< Buffer information */<br>
+};<br>
+<br>
+/**<br>
+ * DRM_IOCTL_DMA ioctl argument type.<br>
+ *<br>
+ * Indices here refer to the offset into the buffer list in drm_buf_get.<br>
+ *<br>
+ * \sa drmDMA().<br>
+ */<br>
+struct drm_dma {<br>
+       int context;                      /**< Context handle */<br>
+       int send_count;                   /**< Number of buffers to send */<br>
+       int *send_indices;        /**< List of handles to buffers */<br>
+       int *send_sizes;                  /**< Lengths of data to send */<br>
+       enum drm_dma_flags flags;         /**< Flags */<br>
+       int request_count;                /**< Number of buffers requested */<br>
+       int request_size;                 /**< Desired size for buffers */<br>
+       int *request_indices;     /**< Buffer information */<br>
+       int *request_sizes;<br>
+       int granted_count;                /**< Number of buffers granted */<br>
+};<br>
+<br>
+enum drm_ctx_flags {<br>
+       _DRM_CONTEXT_PRESERVED = 0x01,<br>
+       _DRM_CONTEXT_2DONLY = 0x02<br>
+};<br>
+<br>
+/**<br>
+ * DRM_IOCTL_ADD_CTX ioctl argument type.<br>
+ *<br>
+ * \sa drmCreateContext() and drmDestroyContext().<br>
+ */<br>
+struct drm_ctx {<br>
+       drm_context_t handle;<br>
+       enum drm_ctx_flags flags;<br>
+};<br>
+<br>
+/**<br>
+ * DRM_IOCTL_RES_CTX ioctl argument type.<br>
+ */<br>
+struct drm_ctx_res {<br>
+       int count;<br>
+       struct drm_ctx *contexts;<br>
+};<br>
+<br>
+/**<br>
+ * DRM_IOCTL_ADD_DRAW and DRM_IOCTL_RM_DRAW ioctl argument type.<br>
+ */<br>
+struct drm_draw {<br>
+       drm_drawable_t handle;<br>
+};<br>
+<br>
+/**<br>
+ * DRM_IOCTL_UPDATE_DRAW ioctl argument type.<br>
+ */<br>
+typedef enum {<br>
+       DRM_DRAWABLE_CLIPRECTS<br>
+} drm_drawable_info_type_t;<br>
+<br>
+struct drm_update_draw {<br>
+       drm_drawable_t handle;<br>
+       unsigned int type;<br>
+       unsigned int num;<br>
+       unsigned long long data;<br>
+};<br>
+<br>
+/**<br>
+ * DRM_IOCTL_GET_MAGIC and DRM_IOCTL_AUTH_MAGIC ioctl argument type.<br>
+ */<br>
+struct drm_auth {<br>
+       drm_magic_t magic;<br>
+};<br>
+<br>
+/**<br>
+ * DRM_IOCTL_IRQ_BUSID ioctl argument type.<br>
+ *<br>
+ * \sa drmGetInterruptFromBusID().<br>
+ */<br>
+struct drm_irq_busid {<br>
+       int irq;        /**< IRQ number */<br>
+       int busnum;     /**< bus number */<br>
+       int devnum;     /**< device number */<br>
+       int funcnum;    /**< function number */<br>
+};<br>
+<br>
+enum drm_vblank_seq_type {<br>
+       _DRM_VBLANK_ABSOLUTE = 0x0,     /**< Wait for specific vblank sequence number */<br>
+       _DRM_VBLANK_RELATIVE = 0x1,     /**< Wait for given number of vblanks */<br>
+       /* bits 1-6 are reserved for high crtcs */<br>
+       _DRM_VBLANK_HIGH_CRTC_MASK = 0x0000003e,<br>
+       _DRM_VBLANK_EVENT = 0x4000000,   /**< Send event instead of blocking */<br>
+       _DRM_VBLANK_FLIP = 0x8000000,   /**< Scheduled buffer swap should flip */<br>
+       _DRM_VBLANK_NEXTONMISS = 0x10000000,    /**< If missed, wait for next vblank */<br>
+       _DRM_VBLANK_SECONDARY = 0x20000000,     /**< Secondary display controller */<br>
+       _DRM_VBLANK_SIGNAL = 0x40000000 /**< Send signal instead of blocking, unsupported */<br>
+};<br>
+#define _DRM_VBLANK_HIGH_CRTC_SHIFT 1<br>
+<br>
+#define _DRM_VBLANK_TYPES_MASK (_DRM_VBLANK_ABSOLUTE | _DRM_VBLANK_RELATIVE)<br>
+#define _DRM_VBLANK_FLAGS_MASK (_DRM_VBLANK_EVENT | _DRM_VBLANK_SIGNAL | \<br>
+                               _DRM_VBLANK_SECONDARY | _DRM_VBLANK_NEXTONMISS)<br>
+<br>
+struct drm_wait_vblank_request {<br>
+       enum drm_vblank_seq_type type;<br>
+       unsigned int sequence;<br>
+       unsigned long signal;<br>
+};<br>
+<br>
+struct drm_wait_vblank_reply {<br>
+       enum drm_vblank_seq_type type;<br>
+       unsigned int sequence;<br>
+       long tval_sec;<br>
+       long tval_usec;<br>
+};<br>
+<br>
+/**<br>
+ * DRM_IOCTL_WAIT_VBLANK ioctl argument type.<br>
+ *<br>
+ * \sa drmWaitVBlank().<br>
+ */<br>
+union drm_wait_vblank {<br>
+       struct drm_wait_vblank_request request;<br>
+       struct drm_wait_vblank_reply reply;<br>
+};<br>
+<br>
+#define _DRM_PRE_MODESET 1<br>
+#define _DRM_POST_MODESET 2<br>
+<br>
+/**<br>
+ * DRM_IOCTL_MODESET_CTL ioctl argument type<br>
+ *<br>
+ * \sa drmModesetCtl().<br>
+ */<br>
+struct drm_modeset_ctl {<br>
+       __u32 crtc;<br>
+       __u32 cmd;<br>
+};<br>
+<br>
+/**<br>
+ * DRM_IOCTL_AGP_ENABLE ioctl argument type.<br>
+ *<br>
+ * \sa drmAgpEnable().<br>
+ */<br>
+struct drm_agp_mode {<br>
+       unsigned long mode;     /**< AGP mode */<br>
+};<br>
+<br>
+/**<br>
+ * DRM_IOCTL_AGP_ALLOC and DRM_IOCTL_AGP_FREE ioctls argument type.<br>
+ *<br>
+ * \sa drmAgpAlloc() and drmAgpFree().<br>
+ */<br>
+struct drm_agp_buffer {<br>
+       unsigned long size;     /**< In bytes -- will round to page boundary */<br>
+       unsigned long handle;   /**< Used for binding / unbinding */<br>
+       unsigned long type;     /**< Type of memory to allocate */<br>
+       unsigned long physical; /**< Physical used by i810 */<br>
+};<br>
+<br>
+/**<br>
+ * DRM_IOCTL_AGP_BIND and DRM_IOCTL_AGP_UNBIND ioctls argument type.<br>
+ *<br>
+ * \sa drmAgpBind() and drmAgpUnbind().<br>
+ */<br>
+struct drm_agp_binding {<br>
+       unsigned long handle;   /**< From drm_agp_buffer */<br>
+       unsigned long offset;   /**< In bytes -- will round to page boundary */<br>
+};<br>
+<br>
+/**<br>
+ * DRM_IOCTL_AGP_INFO ioctl argument type.<br>
+ *<br>
+ * \sa drmAgpVersionMajor(), drmAgpVersionMinor(), drmAgpGetMode(),<br>
+ * drmAgpBase(), drmAgpSize(), drmAgpMemoryUsed(), drmAgpMemoryAvail(),<br>
+ * drmAgpVendorId() and drmAgpDeviceId().<br>
+ */<br>
+struct drm_agp_info {<br>
+       int agp_version_major;<br>
+       int agp_version_minor;<br>
+       unsigned long mode;<br>
+       unsigned long aperture_base;    /* physical address */<br>
+       unsigned long aperture_size;    /* bytes */<br>
+       unsigned long memory_allowed;   /* bytes */<br>
+       unsigned long memory_used;<br>
+<br>
+       /* PCI information */<br>
+       unsigned short id_vendor;<br>
+       unsigned short id_device;<br>
+};<br>
+<br>
+/**<br>
+ * DRM_IOCTL_SG_ALLOC ioctl argument type.<br>
+ */<br>
+struct drm_scatter_gather {<br>
+       unsigned long size;     /**< In bytes -- will round to page boundary */<br>
+       unsigned long handle;   /**< Used for mapping / unmapping */<br>
+};<br>
+<br>
+/**<br>
+ * DRM_IOCTL_SET_VERSION ioctl argument type.<br>
+ */<br>
+struct drm_set_version {<br>
+       int drm_di_major;<br>
+       int drm_di_minor;<br>
+       int drm_dd_major;<br>
+       int drm_dd_minor;<br>
+};<br>
+<br>
+/** DRM_IOCTL_GEM_CLOSE ioctl argument type */<br>
+struct drm_gem_close {<br>
+       /** Handle of the object to be closed. */<br>
+       __u32 handle;<br>
+       __u32 pad;<br>
+};<br>
+<br>
+/** DRM_IOCTL_GEM_FLINK ioctl argument type */<br>
+struct drm_gem_flink {<br>
+       /** Handle for the object being named */<br>
+       __u32 handle;<br>
+<br>
+       /** Returned global name */<br>
+       __u32 name;<br>
+};<br>
+<br>
+/** DRM_IOCTL_GEM_OPEN ioctl argument type */<br>
+struct drm_gem_open {<br>
+       /** Name of object being opened */<br>
+       __u32 name;<br>
+<br>
+       /** Returned handle for the object */<br>
+       __u32 handle;<br>
+<br>
+       /** Returned size of the object */<br>
+       __u64 size;<br>
+};<br>
+<br>
+#define DRM_CAP_DUMB_BUFFER            0x1<br>
+#define DRM_CAP_VBLANK_HIGH_CRTC       0x2<br>
+#define DRM_CAP_DUMB_PREFERRED_DEPTH   0x3<br>
+#define DRM_CAP_DUMB_PREFER_SHADOW     0x4<br>
+#define DRM_CAP_PRIME                  0x5<br>
+#define  DRM_PRIME_CAP_IMPORT          0x1<br>
+#define  DRM_PRIME_CAP_EXPORT          0x2<br>
+#define DRM_CAP_TIMESTAMP_MONOTONIC    0x6<br>
+#define DRM_CAP_ASYNC_PAGE_FLIP                0x7<br>
+/*<br>
+ * The CURSOR_WIDTH and CURSOR_HEIGHT capabilities return a valid widthxheight<br>
+ * combination for the hardware cursor. The intention is that a hardware<br>
+ * agnostic userspace can query a cursor plane size to use.<br>
+ *<br>
+ * Note that the cross-driver contract is to merely return a valid size;<br>
+ * drivers are free to attach another meaning on top, eg. i915 returns the<br>
+ * maximum plane size.<br>
+ */<br>
+#define DRM_CAP_CURSOR_WIDTH           0x8<br>
+#define DRM_CAP_CURSOR_HEIGHT          0x9<br>
+#define DRM_CAP_ADDFB2_MODIFIERS       0x10<br>
+#define DRM_CAP_PAGE_FLIP_TARGET       0x11<br>
+#define DRM_CAP_CRTC_IN_VBLANK_EVENT   0x12<br>
+#define DRM_CAP_SYNCOBJ                0x13<br>
+#define DRM_CAP_SYNCOBJ_TIMELINE       0x14<br>
+<br>
+/** DRM_IOCTL_GET_CAP ioctl argument type */<br>
+struct drm_get_cap {<br>
+       __u64 capability;<br>
+       __u64 value;<br>
+};<br>
+<br>
+/**<br>
+ * DRM_CLIENT_CAP_STEREO_3D<br>
+ *<br>
+ * if set to 1, the DRM core will expose the stereo 3D capabilities of the<br>
+ * monitor by advertising the supported 3D layouts in the flags of struct<br>
+ * drm_mode_modeinfo.<br>
+ */<br>
+#define DRM_CLIENT_CAP_STEREO_3D       1<br>
+<br>
+/**<br>
+ * DRM_CLIENT_CAP_UNIVERSAL_PLANES<br>
+ *<br>
+ * If set to 1, the DRM core will expose all planes (overlay, primary, and<br>
+ * cursor) to userspace.<br>
+ */<br>
+#define DRM_CLIENT_CAP_UNIVERSAL_PLANES  2<br>
+<br>
+/**<br>
+ * DRM_CLIENT_CAP_ATOMIC<br>
+ *<br>
+ * If set to 1, the DRM core will expose atomic properties to userspace<br>
+ */<br>
+#define DRM_CLIENT_CAP_ATOMIC  3<br>
+<br>
+/**<br>
+ * DRM_CLIENT_CAP_ASPECT_RATIO<br>
+ *<br>
+ * If set to 1, the DRM core will provide aspect ratio information in modes.<br>
+ */<br>
+#define DRM_CLIENT_CAP_ASPECT_RATIO    4<br>
+<br>
+/**<br>
+ * DRM_CLIENT_CAP_WRITEBACK_CONNECTORS<br>
+ *<br>
+ * If set to 1, the DRM core will expose special connectors to be used for<br>
+ * writing back to memory the scene setup in the commit. Depends on client<br>
+ * also supporting DRM_CLIENT_CAP_ATOMIC<br>
+ */<br>
+#define DRM_CLIENT_CAP_WRITEBACK_CONNECTORS    5<br>
+<br>
+/** DRM_IOCTL_SET_CLIENT_CAP ioctl argument type */<br>
+struct drm_set_client_cap {<br>
+       __u64 capability;<br>
+       __u64 value;<br>
+};<br>
+<br>
+#define DRM_RDWR O_RDWR<br>
+#define DRM_CLOEXEC O_CLOEXEC<br>
+struct drm_prime_handle {<br>
+       __u32 handle;<br>
+<br>
+       /** Flags.. only applicable for handle->fd */<br>
+       __u32 flags;<br>
+<br>
+       /** Returned dmabuf file descriptor */<br>
+       __s32 fd;<br>
+};<br>
+<br>
+struct drm_syncobj_create {<br>
+       __u32 handle;<br>
+#define DRM_SYNCOBJ_CREATE_SIGNALED (1 << 0)<br>
+       __u32 flags;<br>
+};<br>
+<br>
+struct drm_syncobj_destroy {<br>
+       __u32 handle;<br>
+       __u32 pad;<br>
+};<br>
+<br>
+#define DRM_SYNCOBJ_FD_TO_HANDLE_FLAGS_IMPORT_SYNC_FILE (1 << 0)<br>
+#define DRM_SYNCOBJ_HANDLE_TO_FD_FLAGS_EXPORT_SYNC_FILE (1 << 0)<br>
+struct drm_syncobj_handle {<br>
+       __u32 handle;<br>
+       __u32 flags;<br>
+<br>
+       __s32 fd;<br>
+       __u32 pad;<br>
+};<br>
+<br>
+struct drm_syncobj_transfer {<br>
+       __u32 src_handle;<br>
+       __u32 dst_handle;<br>
+       __u64 src_point;<br>
+       __u64 dst_point;<br>
+       __u32 flags;<br>
+       __u32 pad;<br>
+};<br>
+<br>
+#define DRM_SYNCOBJ_WAIT_FLAGS_WAIT_ALL (1 << 0)<br>
+#define DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT (1 << 1)<br>
+#define DRM_SYNCOBJ_WAIT_FLAGS_WAIT_AVAILABLE (1 << 2) /* wait for time point to become available */<br>
+struct drm_syncobj_wait {<br>
+       __u64 handles;<br>
+       /* absolute timeout */<br>
+       __s64 timeout_nsec;<br>
+       __u32 count_handles;<br>
+       __u32 flags;<br>
+       __u32 first_signaled; /* only valid when not waiting all */<br>
+       __u32 pad;<br>
+};<br>
+<br>
+struct drm_syncobj_timeline_wait {<br>
+       __u64 handles;<br>
+       /* wait on specific timeline point for every handles*/<br>
+       __u64 points;<br>
+       /* absolute timeout */<br>
+       __s64 timeout_nsec;<br>
+       __u32 count_handles;<br>
+       __u32 flags;<br>
+       __u32 first_signaled; /* only valid when not waiting all */<br>
+       __u32 pad;<br>
+};<br>
+<br>
+<br>
+struct drm_syncobj_array {<br>
+       __u64 handles;<br>
+       __u32 count_handles;<br>
+       __u32 pad;<br>
+};<br>
+<br>
+struct drm_syncobj_timeline_array {<br>
+       __u64 handles;<br>
+       __u64 points;<br>
+       __u32 count_handles;<br>
+       __u32 pad;<br>
+};<br>
+<br>
+<br>
+/* Query current scanout sequence number */<br>
+struct drm_crtc_get_sequence {<br>
+       __u32 crtc_id;          /* requested crtc_id */<br>
+       __u32 active;           /* return: crtc output is active */<br>
+       __u64 sequence;         /* return: most recent vblank sequence */<br>
+       __s64 sequence_ns;      /* return: most recent time of first pixel out */<br>
+};<br>
+<br>
+/* Queue event to be delivered at specified sequence. Time stamp marks<br>
+ * when the first pixel of the refresh cycle leaves the display engine<br>
+ * for the display<br>
+ */<br>
+#define DRM_CRTC_SEQUENCE_RELATIVE             0x00000001      /* sequence is relative to current */<br>
+#define DRM_CRTC_SEQUENCE_NEXT_ON_MISS         0x00000002      /* Use next sequence if we've missed */<br>
+<br>
+struct drm_crtc_queue_sequence {<br>
+       __u32 crtc_id;<br>
+       __u32 flags;<br>
+       __u64 sequence;         /* on input, target sequence. on output, actual sequence */<br>
+       __u64 user_data;        /* user data passed to event */<br>
+};<br>
+<br>
+#if defined(__cplusplus)<br>
+}<br>
+#endif<br>
+<br>
+#include "drm_mode.h"<br>
+<br>
+#if defined(__cplusplus)<br>
+extern "C" {<br>
+#endif<br>
+<br>
+#define DRM_IOCTL_BASE                 'd'<br>
+#define DRM_IO(nr)                     _IO(DRM_IOCTL_BASE,nr)<br>
+#define DRM_IOR(nr,type)               _IOR(DRM_IOCTL_BASE,nr,type)<br>
+#define DRM_IOW(nr,type)               _IOW(DRM_IOCTL_BASE,nr,type)<br>
+#define DRM_IOWR(nr,type)              _IOWR(DRM_IOCTL_BASE,nr,type)<br>
+<br>
+#define DRM_IOCTL_VERSION              DRM_IOWR(0x00, struct drm_version)<br>
+#define DRM_IOCTL_GET_UNIQUE           DRM_IOWR(0x01, struct drm_unique)<br>
+#define DRM_IOCTL_GET_MAGIC            DRM_IOR( 0x02, struct drm_auth)<br>
+#define DRM_IOCTL_IRQ_BUSID            DRM_IOWR(0x03, struct drm_irq_busid)<br>
+#define DRM_IOCTL_GET_MAP               DRM_IOWR(0x04, struct drm_map)<br>
+#define DRM_IOCTL_GET_CLIENT            DRM_IOWR(0x05, struct drm_client)<br>
+#define DRM_IOCTL_GET_STATS             DRM_IOR( 0x06, struct drm_stats)<br>
+#define DRM_IOCTL_SET_VERSION          DRM_IOWR(0x07, struct drm_set_version)<br>
+#define DRM_IOCTL_MODESET_CTL           DRM_IOW(0x08, struct drm_modeset_ctl)<br>
+#define DRM_IOCTL_GEM_CLOSE            DRM_IOW (0x09, struct drm_gem_close)<br>
+#define DRM_IOCTL_GEM_FLINK            DRM_IOWR(0x0a, struct drm_gem_flink)<br>
+#define DRM_IOCTL_GEM_OPEN             DRM_IOWR(0x0b, struct drm_gem_open)<br>
+#define DRM_IOCTL_GET_CAP              DRM_IOWR(0x0c, struct drm_get_cap)<br>
+#define DRM_IOCTL_SET_CLIENT_CAP       DRM_IOW( 0x0d, struct drm_set_client_cap)<br>
+<br>
+#define DRM_IOCTL_SET_UNIQUE           DRM_IOW( 0x10, struct drm_unique)<br>
+#define DRM_IOCTL_AUTH_MAGIC           DRM_IOW( 0x11, struct drm_auth)<br>
+#define DRM_IOCTL_BLOCK                        DRM_IOWR(0x12, struct drm_block)<br>
+#define DRM_IOCTL_UNBLOCK              DRM_IOWR(0x13, struct drm_block)<br>
+#define DRM_IOCTL_CONTROL              DRM_IOW( 0x14, struct drm_control)<br>
+#define DRM_IOCTL_ADD_MAP              DRM_IOWR(0x15, struct drm_map)<br>
+#define DRM_IOCTL_ADD_BUFS             DRM_IOWR(0x16, struct drm_buf_desc)<br>
+#define DRM_IOCTL_MARK_BUFS            DRM_IOW( 0x17, struct drm_buf_desc)<br>
+#define DRM_IOCTL_INFO_BUFS            DRM_IOWR(0x18, struct drm_buf_info)<br>
+#define DRM_IOCTL_MAP_BUFS             DRM_IOWR(0x19, struct drm_buf_map)<br>
+#define DRM_IOCTL_FREE_BUFS            DRM_IOW( 0x1a, struct drm_buf_free)<br>
+<br>
+#define DRM_IOCTL_RM_MAP               DRM_IOW( 0x1b, struct drm_map)<br>
+<br>
+#define DRM_IOCTL_SET_SAREA_CTX                DRM_IOW( 0x1c, struct drm_ctx_priv_map)<br>
+#define DRM_IOCTL_GET_SAREA_CTX        DRM_IOWR(0x1d, struct drm_ctx_priv_map)<br>
+<br>
+#define DRM_IOCTL_SET_MASTER            DRM_IO(0x1e)<br>
+#define DRM_IOCTL_DROP_MASTER           DRM_IO(0x1f)<br>
+<br>
+#define DRM_IOCTL_ADD_CTX              DRM_IOWR(0x20, struct drm_ctx)<br>
+#define DRM_IOCTL_RM_CTX               DRM_IOWR(0x21, struct drm_ctx)<br>
+#define DRM_IOCTL_MOD_CTX              DRM_IOW( 0x22, struct drm_ctx)<br>
+#define DRM_IOCTL_GET_CTX              DRM_IOWR(0x23, struct drm_ctx)<br>
+#define DRM_IOCTL_SWITCH_CTX           DRM_IOW( 0x24, struct drm_ctx)<br>
+#define DRM_IOCTL_NEW_CTX              DRM_IOW( 0x25, struct drm_ctx)<br>
+#define DRM_IOCTL_RES_CTX              DRM_IOWR(0x26, struct drm_ctx_res)<br>
+#define DRM_IOCTL_ADD_DRAW             DRM_IOWR(0x27, struct drm_draw)<br>
+#define DRM_IOCTL_RM_DRAW              DRM_IOWR(0x28, struct drm_draw)<br>
+#define DRM_IOCTL_DMA                  DRM_IOWR(0x29, struct drm_dma)<br>
+#define DRM_IOCTL_LOCK                 DRM_IOW( 0x2a, struct drm_lock)<br>
+#define DRM_IOCTL_UNLOCK               DRM_IOW( 0x2b, struct drm_lock)<br>
+#define DRM_IOCTL_FINISH               DRM_IOW( 0x2c, struct drm_lock)<br>
+<br>
+#define DRM_IOCTL_PRIME_HANDLE_TO_FD    DRM_IOWR(0x2d, struct drm_prime_handle)<br>
+#define DRM_IOCTL_PRIME_FD_TO_HANDLE    DRM_IOWR(0x2e, struct drm_prime_handle)<br>
+<br>
+#define DRM_IOCTL_AGP_ACQUIRE          DRM_IO(  0x30)<br>
+#define DRM_IOCTL_AGP_RELEASE          DRM_IO(  0x31)<br>
+#define DRM_IOCTL_AGP_ENABLE           DRM_IOW( 0x32, struct drm_agp_mode)<br>
+#define DRM_IOCTL_AGP_INFO             DRM_IOR( 0x33, struct drm_agp_info)<br>
+#define DRM_IOCTL_AGP_ALLOC            DRM_IOWR(0x34, struct drm_agp_buffer)<br>
+#define DRM_IOCTL_AGP_FREE             DRM_IOW( 0x35, struct drm_agp_buffer)<br>
+#define DRM_IOCTL_AGP_BIND             DRM_IOW( 0x36, struct drm_agp_binding)<br>
+#define DRM_IOCTL_AGP_UNBIND           DRM_IOW( 0x37, struct drm_agp_binding)<br>
+<br>
+#define DRM_IOCTL_SG_ALLOC             DRM_IOWR(0x38, struct drm_scatter_gather)<br>
+#define DRM_IOCTL_SG_FREE              DRM_IOW( 0x39, struct drm_scatter_gather)<br>
+<br>
+#define DRM_IOCTL_WAIT_VBLANK          DRM_IOWR(0x3a, union drm_wait_vblank)<br>
+<br>
+#define DRM_IOCTL_CRTC_GET_SEQUENCE    DRM_IOWR(0x3b, struct drm_crtc_get_sequence)<br>
+#define DRM_IOCTL_CRTC_QUEUE_SEQUENCE  DRM_IOWR(0x3c, struct drm_crtc_queue_sequence)<br>
+<br>
+#define DRM_IOCTL_UPDATE_DRAW          DRM_IOW(0x3f, struct drm_update_draw)<br>
+<br>
+#define DRM_IOCTL_MODE_GETRESOURCES    DRM_IOWR(0xA0, struct drm_mode_card_res)<br>
+#define DRM_IOCTL_MODE_GETCRTC         DRM_IOWR(0xA1, struct drm_mode_crtc)<br>
+#define DRM_IOCTL_MODE_SETCRTC         DRM_IOWR(0xA2, struct drm_mode_crtc)<br>
+#define DRM_IOCTL_MODE_CURSOR          DRM_IOWR(0xA3, struct drm_mode_cursor)<br>
+#define DRM_IOCTL_MODE_GETGAMMA                DRM_IOWR(0xA4, struct drm_mode_crtc_lut)<br>
+#define DRM_IOCTL_MODE_SETGAMMA                DRM_IOWR(0xA5, struct drm_mode_crtc_lut)<br>
+#define DRM_IOCTL_MODE_GETENCODER      DRM_IOWR(0xA6, struct drm_mode_get_encoder)<br>
+#define DRM_IOCTL_MODE_GETCONNECTOR    DRM_IOWR(0xA7, struct drm_mode_get_connector)<br>
+#define DRM_IOCTL_MODE_ATTACHMODE      DRM_IOWR(0xA8, struct drm_mode_mode_cmd) /* deprecated (never worked) */<br>
+#define DRM_IOCTL_MODE_DETACHMODE      DRM_IOWR(0xA9, struct drm_mode_mode_cmd) /* deprecated (never worked) */<br>
+<br>
+#define DRM_IOCTL_MODE_GETPROPERTY     DRM_IOWR(0xAA, struct drm_mode_get_property)<br>
+#define DRM_IOCTL_MODE_SETPROPERTY     DRM_IOWR(0xAB, struct drm_mode_connector_set_property)<br>
+#define DRM_IOCTL_MODE_GETPROPBLOB     DRM_IOWR(0xAC, struct drm_mode_get_blob)<br>
+#define DRM_IOCTL_MODE_GETFB           DRM_IOWR(0xAD, struct drm_mode_fb_cmd)<br>
+#define DRM_IOCTL_MODE_ADDFB           DRM_IOWR(0xAE, struct drm_mode_fb_cmd)<br>
+#define DRM_IOCTL_MODE_RMFB            DRM_IOWR(0xAF, unsigned int)<br>
+#define DRM_IOCTL_MODE_PAGE_FLIP       DRM_IOWR(0xB0, struct drm_mode_crtc_page_flip)<br>
+#define DRM_IOCTL_MODE_DIRTYFB         DRM_IOWR(0xB1, struct drm_mode_fb_dirty_cmd)<br>
+<br>
+#define DRM_IOCTL_MODE_CREATE_DUMB DRM_IOWR(0xB2, struct drm_mode_create_dumb)<br>
+#define DRM_IOCTL_MODE_MAP_DUMB    DRM_IOWR(0xB3, struct drm_mode_map_dumb)<br>
+#define DRM_IOCTL_MODE_DESTROY_DUMB    DRM_IOWR(0xB4, struct drm_mode_destroy_dumb)<br>
+#define DRM_IOCTL_MODE_GETPLANERESOURCES DRM_IOWR(0xB5, struct drm_mode_get_plane_res)<br>
+#define DRM_IOCTL_MODE_GETPLANE        DRM_IOWR(0xB6, struct drm_mode_get_plane)<br>
+#define DRM_IOCTL_MODE_SETPLANE        DRM_IOWR(0xB7, struct drm_mode_set_plane)<br>
+#define DRM_IOCTL_MODE_ADDFB2          DRM_IOWR(0xB8, struct drm_mode_fb_cmd2)<br>
+#define DRM_IOCTL_MODE_OBJ_GETPROPERTIES       DRM_IOWR(0xB9, struct drm_mode_obj_get_properties)<br>
+#define DRM_IOCTL_MODE_OBJ_SETPROPERTY DRM_IOWR(0xBA, struct drm_mode_obj_set_property)<br>
+#define DRM_IOCTL_MODE_CURSOR2         DRM_IOWR(0xBB, struct drm_mode_cursor2)<br>
+#define DRM_IOCTL_MODE_ATOMIC          DRM_IOWR(0xBC, struct drm_mode_atomic)<br>
+#define DRM_IOCTL_MODE_CREATEPROPBLOB  DRM_IOWR(0xBD, struct drm_mode_create_blob)<br>
+#define DRM_IOCTL_MODE_DESTROYPROPBLOB DRM_IOWR(0xBE, struct drm_mode_destroy_blob)<br>
+<br>
+#define DRM_IOCTL_SYNCOBJ_CREATE       DRM_IOWR(0xBF, struct drm_syncobj_create)<br>
+#define DRM_IOCTL_SYNCOBJ_DESTROY      DRM_IOWR(0xC0, struct drm_syncobj_destroy)<br>
+#define DRM_IOCTL_SYNCOBJ_HANDLE_TO_FD DRM_IOWR(0xC1, struct drm_syncobj_handle)<br>
+#define DRM_IOCTL_SYNCOBJ_FD_TO_HANDLE DRM_IOWR(0xC2, struct drm_syncobj_handle)<br>
+#define DRM_IOCTL_SYNCOBJ_WAIT         DRM_IOWR(0xC3, struct drm_syncobj_wait)<br>
+#define DRM_IOCTL_SYNCOBJ_RESET                DRM_IOWR(0xC4, struct drm_syncobj_array)<br>
+#define DRM_IOCTL_SYNCOBJ_SIGNAL       DRM_IOWR(0xC5, struct drm_syncobj_array)<br>
+<br>
+#define DRM_IOCTL_MODE_CREATE_LEASE    DRM_IOWR(0xC6, struct drm_mode_create_lease)<br>
+#define DRM_IOCTL_MODE_LIST_LESSEES    DRM_IOWR(0xC7, struct drm_mode_list_lessees)<br>
+#define DRM_IOCTL_MODE_GET_LEASE       DRM_IOWR(0xC8, struct drm_mode_get_lease)<br>
+#define DRM_IOCTL_MODE_REVOKE_LEASE    DRM_IOWR(0xC9, struct drm_mode_revoke_lease)<br>
+<br>
+#define DRM_IOCTL_SYNCOBJ_TIMELINE_WAIT        DRM_IOWR(0xCA, struct drm_syncobj_timeline_wait)<br>
+#define DRM_IOCTL_SYNCOBJ_QUERY                DRM_IOWR(0xCB, struct drm_syncobj_timeline_array)<br>
+#define DRM_IOCTL_SYNCOBJ_TRANSFER     DRM_IOWR(0xCC, struct drm_syncobj_transfer)<br>
+#define DRM_IOCTL_SYNCOBJ_TIMELINE_SIGNAL      DRM_IOWR(0xCD, struct drm_syncobj_timeline_array)<br>
+<br>
+/**<br>
+ * Device specific ioctls should only be in their respective headers<br>
+ * The device specific ioctl range is from 0x40 to 0x9f.<br>
+ * Generic IOCTLS restart at 0xA0.<br>
+ *<br>
+ * \sa drmCommandNone(), drmCommandRead(), drmCommandWrite(), and<br>
+ * drmCommandReadWrite().<br>
+ */<br>
+#define DRM_COMMAND_BASE                0x40<br>
+#define DRM_COMMAND_END                        0xA0<br>
+<br>
+/**<br>
+ * Header for events written back to userspace on the drm fd.  The<br>
+ * type defines the type of event, the length specifies the total<br>
+ * length of the event (including the header), and user_data is<br>
+ * typically a 64 bit value passed with the ioctl that triggered the<br>
+ * event.  A read on the drm fd will always only return complete<br>
+ * events, that is, if for example the read buffer is 100 bytes, and<br>
+ * there are two 64 byte events pending, only one will be returned.<br>
+ *<br>
+ * Event types 0 - 0x7fffffff are generic drm events, 0x80000000 and<br>
+ * up are chipset specific.<br>
+ */<br>
+struct drm_event {<br>
+       __u32 type;<br>
+       __u32 length;<br>
+};<br>
+<br>
+#define DRM_EVENT_VBLANK 0x01<br>
+#define DRM_EVENT_FLIP_COMPLETE 0x02<br>
+#define DRM_EVENT_CRTC_SEQUENCE        0x03<br>
+<br>
+struct drm_event_vblank {<br>
+       struct drm_event base;<br>
+       __u64 user_data;<br>
+       __u32 tv_sec;<br>
+       __u32 tv_usec;<br>
+       __u32 sequence;<br>
+       __u32 crtc_id; /* 0 on older kernels that do not support this */<br>
+};<br>
+<br>
+/* Event delivered at sequence. Time stamp marks when the first pixel<br>
+ * of the refresh cycle leaves the display engine for the display<br>
+ */<br>
+struct drm_event_crtc_sequence {<br>
+       struct drm_event        base;<br>
+       __u64                   user_data;<br>
+       __s64                   time_ns;<br>
+       __u64                   sequence;<br>
+};<br>
+<br>
+/* typedef area */<br>
+typedef struct drm_clip_rect drm_clip_rect_t;<br>
+typedef struct drm_drawable_info drm_drawable_info_t;<br>
+typedef struct drm_tex_region drm_tex_region_t;<br>
+typedef struct drm_hw_lock drm_hw_lock_t;<br>
+typedef struct drm_version drm_version_t;<br>
+typedef struct drm_unique drm_unique_t;<br>
+typedef struct drm_list drm_list_t;<br>
+typedef struct drm_block drm_block_t;<br>
+typedef struct drm_control drm_control_t;<br>
+typedef enum drm_map_type drm_map_type_t;<br>
+typedef enum drm_map_flags drm_map_flags_t;<br>
+typedef struct drm_ctx_priv_map drm_ctx_priv_map_t;<br>
+typedef struct drm_map drm_map_t;<br>
+typedef struct drm_client drm_client_t;<br>
+typedef enum drm_stat_type drm_stat_type_t;<br>
+typedef struct drm_stats drm_stats_t;<br>
+typedef enum drm_lock_flags drm_lock_flags_t;<br>
+typedef struct drm_lock drm_lock_t;<br>
+typedef enum drm_dma_flags drm_dma_flags_t;<br>
+typedef struct drm_buf_desc drm_buf_desc_t;<br>
+typedef struct drm_buf_info drm_buf_info_t;<br>
+typedef struct drm_buf_free drm_buf_free_t;<br>
+typedef struct drm_buf_pub drm_buf_pub_t;<br>
+typedef struct drm_buf_map drm_buf_map_t;<br>
+typedef struct drm_dma drm_dma_t;<br>
+typedef union drm_wait_vblank drm_wait_vblank_t;<br>
+typedef struct drm_agp_mode drm_agp_mode_t;<br>
+typedef enum drm_ctx_flags drm_ctx_flags_t;<br>
+typedef struct drm_ctx drm_ctx_t;<br>
+typedef struct drm_ctx_res drm_ctx_res_t;<br>
+typedef struct drm_draw drm_draw_t;<br>
+typedef struct drm_update_draw drm_update_draw_t;<br>
+typedef struct drm_auth drm_auth_t;<br>
+typedef struct drm_irq_busid drm_irq_busid_t;<br>
+typedef enum drm_vblank_seq_type drm_vblank_seq_type_t;<br>
+<br>
+typedef struct drm_agp_buffer drm_agp_buffer_t;<br>
+typedef struct drm_agp_binding drm_agp_binding_t;<br>
+typedef struct drm_agp_info drm_agp_info_t;<br>
+typedef struct drm_scatter_gather drm_scatter_gather_t;<br>
+typedef struct drm_set_version drm_set_version_t;<br>
+<br>
+#if defined(__cplusplus)<br>
+}<br>
+#endif<br>
+<br>
+#endif<br>
diff --git a/linux/drm/drm_mode.h b/linux/drm/drm_mode.h<br>
new file mode 100644<br>
index 00000000..5fe6c649<br>
--- /dev/null<br>
+++ b/linux/drm/drm_mode.h<br>
@@ -0,0 +1,914 @@<br>
+/*<br>
+ * Copyright (c) 2007 Dave Airlie <<a href="mailto:airlied@linux.ie" target="_blank">airlied@linux.ie</a>><br>
+ * Copyright (c) 2007 Jakob Bornecrantz <<a href="mailto:wallbraker@gmail.com" target="_blank">wallbraker@gmail.com</a>><br>
+ * Copyright (c) 2008 Red Hat Inc.<br>
+ * Copyright (c) 2007-2008 Tungsten Graphics, Inc., Cedar Park, TX., USA<br>
+ * Copyright (c) 2007-2008 Intel Corporation<br>
+ *<br>
+ * Permission is hereby granted, free of charge, to any person obtaining a<br>
+ * copy of this software and associated documentation files (the "Software"),<br>
+ * to deal in the Software without restriction, including without limitation<br>
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,<br>
+ * and/or sell copies of the Software, and to permit persons to whom the<br>
+ * Software is furnished to do so, subject to the following conditions:<br>
+ *<br>
+ * The above copyright notice and this permission notice shall be included in<br>
+ * all copies or substantial portions of the Software.<br>
+ *<br>
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR<br>
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,<br>
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE<br>
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER<br>
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING<br>
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS<br>
+ * IN THE SOFTWARE.<br>
+ */<br>
+<br>
+#ifndef _DRM_MODE_H<br>
+#define _DRM_MODE_H<br>
+<br>
+#include "drm.h"<br>
+<br>
+#if defined(__cplusplus)<br>
+extern "C" {<br>
+#endif<br>
+<br>
+#define DRM_CONNECTOR_NAME_LEN 32<br>
+#define DRM_DISPLAY_MODE_LEN   32<br>
+#define DRM_PROP_NAME_LEN      32<br>
+<br>
+#define DRM_MODE_TYPE_BUILTIN  (1<<0) /* deprecated */<br>
+#define DRM_MODE_TYPE_CLOCK_C  ((1<<1) | DRM_MODE_TYPE_BUILTIN) /* deprecated */<br>
+#define DRM_MODE_TYPE_CRTC_C   ((1<<2) | DRM_MODE_TYPE_BUILTIN) /* deprecated */<br>
+#define DRM_MODE_TYPE_PREFERRED        (1<<3)<br>
+#define DRM_MODE_TYPE_DEFAULT  (1<<4) /* deprecated */<br>
+#define DRM_MODE_TYPE_USERDEF  (1<<5)<br>
+#define DRM_MODE_TYPE_DRIVER   (1<<6)<br>
+<br>
+#define DRM_MODE_TYPE_ALL      (DRM_MODE_TYPE_PREFERRED |      \<br>
+                                DRM_MODE_TYPE_USERDEF |        \<br>
+                                DRM_MODE_TYPE_DRIVER)<br>
+<br>
+/* Video mode flags */<br>
+/* bit compatible with the xrandr RR_ definitions (bits 0-13)<br>
+ *<br>
+ * ABI warning: Existing userspace really expects<br>
+ * the mode flags to match the xrandr definitions. Any<br>
+ * changes that don't match the xrandr definitions will<br>
+ * likely need a new client cap or some other mechanism<br>
+ * to avoid breaking existing userspace. This includes<br>
+ * allocating new flags in the previously unused bits!<br>
+ */<br>
+#define DRM_MODE_FLAG_PHSYNC                   (1<<0)<br>
+#define DRM_MODE_FLAG_NHSYNC                   (1<<1)<br>
+#define DRM_MODE_FLAG_PVSYNC                   (1<<2)<br>
+#define DRM_MODE_FLAG_NVSYNC                   (1<<3)<br>
+#define DRM_MODE_FLAG_INTERLACE                        (1<<4)<br>
+#define DRM_MODE_FLAG_DBLSCAN                  (1<<5)<br>
+#define DRM_MODE_FLAG_CSYNC                    (1<<6)<br>
+#define DRM_MODE_FLAG_PCSYNC                   (1<<7)<br>
+#define DRM_MODE_FLAG_NCSYNC                   (1<<8)<br>
+#define DRM_MODE_FLAG_HSKEW                    (1<<9) /* hskew provided */<br>
+#define DRM_MODE_FLAG_BCAST                    (1<<10) /* deprecated */<br>
+#define DRM_MODE_FLAG_PIXMUX                   (1<<11) /* deprecated */<br>
+#define DRM_MODE_FLAG_DBLCLK                   (1<<12)<br>
+#define DRM_MODE_FLAG_CLKDIV2                  (1<<13)<br>
+ /*<br>
+  * When adding a new stereo mode don't forget to adjust DRM_MODE_FLAGS_3D_MAX<br>
+  * (define not exposed to user space).<br>
+  */<br>
+#define DRM_MODE_FLAG_3D_MASK                  (0x1f<<14)<br>
+#define  DRM_MODE_FLAG_3D_NONE         (0<<14)<br>
+#define  DRM_MODE_FLAG_3D_FRAME_PACKING                (1<<14)<br>
+#define  DRM_MODE_FLAG_3D_FIELD_ALTERNATIVE    (2<<14)<br>
+#define  DRM_MODE_FLAG_3D_LINE_ALTERNATIVE     (3<<14)<br>
+#define  DRM_MODE_FLAG_3D_SIDE_BY_SIDE_FULL    (4<<14)<br>
+#define  DRM_MODE_FLAG_3D_L_DEPTH              (5<<14)<br>
+#define  DRM_MODE_FLAG_3D_L_DEPTH_GFX_GFX_DEPTH        (6<<14)<br>
+#define  DRM_MODE_FLAG_3D_TOP_AND_BOTTOM       (7<<14)<br>
+#define  DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF    (8<<14)<br>
+<br>
+/* Picture aspect ratio options */<br>
+#define DRM_MODE_PICTURE_ASPECT_NONE           0<br>
+#define DRM_MODE_PICTURE_ASPECT_4_3            1<br>
+#define DRM_MODE_PICTURE_ASPECT_16_9           2<br>
+#define DRM_MODE_PICTURE_ASPECT_64_27          3<br>
+#define DRM_MODE_PICTURE_ASPECT_256_135                4<br>
+<br>
+/* Content type options */<br>
+#define DRM_MODE_CONTENT_TYPE_NO_DATA          0<br>
+#define DRM_MODE_CONTENT_TYPE_GRAPHICS         1<br>
+#define DRM_MODE_CONTENT_TYPE_PHOTO            2<br>
+#define DRM_MODE_CONTENT_TYPE_CINEMA           3<br>
+#define DRM_MODE_CONTENT_TYPE_GAME             4<br>
+<br>
+/* Aspect ratio flag bitmask (4 bits 22:19) */<br>
+#define DRM_MODE_FLAG_PIC_AR_MASK              (0x0F<<19)<br>
+#define  DRM_MODE_FLAG_PIC_AR_NONE \<br>
+                       (DRM_MODE_PICTURE_ASPECT_NONE<<19)<br>
+#define  DRM_MODE_FLAG_PIC_AR_4_3 \<br>
+                       (DRM_MODE_PICTURE_ASPECT_4_3<<19)<br>
+#define  DRM_MODE_FLAG_PIC_AR_16_9 \<br>
+                       (DRM_MODE_PICTURE_ASPECT_16_9<<19)<br>
+#define  DRM_MODE_FLAG_PIC_AR_64_27 \<br>
+                       (DRM_MODE_PICTURE_ASPECT_64_27<<19)<br>
+#define  DRM_MODE_FLAG_PIC_AR_256_135 \<br>
+                       (DRM_MODE_PICTURE_ASPECT_256_135<<19)<br>
+<br>
+#define  DRM_MODE_FLAG_ALL     (DRM_MODE_FLAG_PHSYNC |         \<br>
+                                DRM_MODE_FLAG_NHSYNC |         \<br>
+                                DRM_MODE_FLAG_PVSYNC |         \<br>
+                                DRM_MODE_FLAG_NVSYNC |         \<br>
+                                DRM_MODE_FLAG_INTERLACE |      \<br>
+                                DRM_MODE_FLAG_DBLSCAN |        \<br>
+                                DRM_MODE_FLAG_CSYNC |          \<br>
+                                DRM_MODE_FLAG_PCSYNC |         \<br>
+                                DRM_MODE_FLAG_NCSYNC |         \<br>
+                                DRM_MODE_FLAG_HSKEW |          \<br>
+                                DRM_MODE_FLAG_DBLCLK |         \<br>
+                                DRM_MODE_FLAG_CLKDIV2 |        \<br>
+                                DRM_MODE_FLAG_3D_MASK)<br>
+<br>
+/* DPMS flags */<br>
+/* bit compatible with the xorg definitions. */<br>
+#define DRM_MODE_DPMS_ON       0<br>
+#define DRM_MODE_DPMS_STANDBY  1<br>
+#define DRM_MODE_DPMS_SUSPEND  2<br>
+#define DRM_MODE_DPMS_OFF      3<br>
+<br>
+/* Scaling mode options */<br>
+#define DRM_MODE_SCALE_NONE            0 /* Unmodified timing (display or<br>
+                                            software can still scale) */<br>
+#define DRM_MODE_SCALE_FULLSCREEN      1 /* Full screen, ignore aspect */<br>
+#define DRM_MODE_SCALE_CENTER          2 /* Centered, no scaling */<br>
+#define DRM_MODE_SCALE_ASPECT          3 /* Full screen, preserve aspect */<br>
+<br>
+/* Dithering mode options */<br>
+#define DRM_MODE_DITHERING_OFF 0<br>
+#define DRM_MODE_DITHERING_ON  1<br>
+#define DRM_MODE_DITHERING_AUTO 2<br>
+<br>
+/* Dirty info options */<br>
+#define DRM_MODE_DIRTY_OFF      0<br>
+#define DRM_MODE_DIRTY_ON       1<br>
+#define DRM_MODE_DIRTY_ANNOTATE 2<br>
+<br>
+/* Link Status options */<br>
+#define DRM_MODE_LINK_STATUS_GOOD      0<br>
+#define DRM_MODE_LINK_STATUS_BAD       1<br>
+<br>
+/*<br>
+ * DRM_MODE_ROTATE_<degrees><br>
+ *<br>
+ * Signals that a drm plane is been rotated <degrees> degrees in counter<br>
+ * clockwise direction.<br>
+ *<br>
+ * This define is provided as a convenience, looking up the property id<br>
+ * using the name->prop id lookup is the preferred method.<br>
+ */<br>
+#define DRM_MODE_ROTATE_0       (1<<0)<br>
+#define DRM_MODE_ROTATE_90      (1<<1)<br>
+#define DRM_MODE_ROTATE_180     (1<<2)<br>
+#define DRM_MODE_ROTATE_270     (1<<3)<br>
+<br>
+/*<br>
+ * DRM_MODE_ROTATE_MASK<br>
+ *<br>
+ * Bitmask used to look for drm plane rotations.<br>
+ */<br>
+#define DRM_MODE_ROTATE_MASK (\<br>
+               DRM_MODE_ROTATE_0  | \<br>
+               DRM_MODE_ROTATE_90  | \<br>
+               DRM_MODE_ROTATE_180 | \<br>
+               DRM_MODE_ROTATE_270)<br>
+<br>
+/*<br>
+ * DRM_MODE_REFLECT_<axis><br>
+ *<br>
+ * Signals that the contents of a drm plane is reflected along the <axis> axis,<br>
+ * in the same way as mirroring.<br>
+ * See kerneldoc chapter "Plane Composition Properties" for more details.<br>
+ *<br>
+ * This define is provided as a convenience, looking up the property id<br>
+ * using the name->prop id lookup is the preferred method.<br>
+ */<br>
+#define DRM_MODE_REFLECT_X      (1<<4)<br>
+#define DRM_MODE_REFLECT_Y      (1<<5)<br>
+<br>
+/*<br>
+ * DRM_MODE_REFLECT_MASK<br>
+ *<br>
+ * Bitmask used to look for drm plane reflections.<br>
+ */<br>
+#define DRM_MODE_REFLECT_MASK (\<br>
+               DRM_MODE_REFLECT_X | \<br>
+               DRM_MODE_REFLECT_Y)<br>
+<br>
+/* Content Protection Flags */<br>
+#define DRM_MODE_CONTENT_PROTECTION_UNDESIRED  0<br>
+#define DRM_MODE_CONTENT_PROTECTION_DESIRED     1<br>
+#define DRM_MODE_CONTENT_PROTECTION_ENABLED     2<br>
+<br>
+struct drm_mode_modeinfo {<br>
+       __u32 clock;<br>
+       __u16 hdisplay;<br>
+       __u16 hsync_start;<br>
+       __u16 hsync_end;<br>
+       __u16 htotal;<br>
+       __u16 hskew;<br>
+       __u16 vdisplay;<br>
+       __u16 vsync_start;<br>
+       __u16 vsync_end;<br>
+       __u16 vtotal;<br>
+       __u16 vscan;<br>
+<br>
+       __u32 vrefresh;<br>
+<br>
+       __u32 flags;<br>
+       __u32 type;<br>
+       char name[DRM_DISPLAY_MODE_LEN];<br>
+};<br>
+<br>
+struct drm_mode_card_res {<br>
+       __u64 fb_id_ptr;<br>
+       __u64 crtc_id_ptr;<br>
+       __u64 connector_id_ptr;<br>
+       __u64 encoder_id_ptr;<br>
+       __u32 count_fbs;<br>
+       __u32 count_crtcs;<br>
+       __u32 count_connectors;<br>
+       __u32 count_encoders;<br>
+       __u32 min_width;<br>
+       __u32 max_width;<br>
+       __u32 min_height;<br>
+       __u32 max_height;<br>
+};<br>
+<br>
+struct drm_mode_crtc {<br>
+       __u64 set_connectors_ptr;<br>
+       __u32 count_connectors;<br>
+<br>
+       __u32 crtc_id; /**< Id */<br>
+       __u32 fb_id; /**< Id of framebuffer */<br>
+<br>
+       __u32 x; /**< x Position on the framebuffer */<br>
+       __u32 y; /**< y Position on the framebuffer */<br>
+<br>
+       __u32 gamma_size;<br>
+       __u32 mode_valid;<br>
+       struct drm_mode_modeinfo mode;<br>
+};<br>
+<br>
+#define DRM_MODE_PRESENT_TOP_FIELD     (1<<0)<br>
+#define DRM_MODE_PRESENT_BOTTOM_FIELD  (1<<1)<br>
+<br>
+/* Planes blend with or override other bits on the CRTC */<br>
+struct drm_mode_set_plane {<br>
+       __u32 plane_id;<br>
+       __u32 crtc_id;<br>
+       __u32 fb_id; /* fb object contains surface format type */<br>
+       __u32 flags; /* see above flags */<br>
+<br>
+       /* Signed dest location allows it to be partially off screen */<br>
+       __s32 crtc_x;<br>
+       __s32 crtc_y;<br>
+       __u32 crtc_w;<br>
+       __u32 crtc_h;<br>
+<br>
+       /* Source values are 16.16 fixed point */<br>
+       __u32 src_x;<br>
+       __u32 src_y;<br>
+       __u32 src_h;<br>
+       __u32 src_w;<br>
+};<br>
+<br>
+struct drm_mode_get_plane {<br>
+       __u32 plane_id;<br>
+<br>
+       __u32 crtc_id;<br>
+       __u32 fb_id;<br>
+<br>
+       __u32 possible_crtcs;<br>
+       __u32 gamma_size;<br>
+<br>
+       __u32 count_format_types;<br>
+       __u64 format_type_ptr;<br>
+};<br>
+<br>
+struct drm_mode_get_plane_res {<br>
+       __u64 plane_id_ptr;<br>
+       __u32 count_planes;<br>
+};<br>
+<br>
+#define DRM_MODE_ENCODER_NONE  0<br>
+#define DRM_MODE_ENCODER_DAC   1<br>
+#define DRM_MODE_ENCODER_TMDS  2<br>
+#define DRM_MODE_ENCODER_LVDS  3<br>
+#define DRM_MODE_ENCODER_TVDAC 4<br>
+#define DRM_MODE_ENCODER_VIRTUAL 5<br>
+#define DRM_MODE_ENCODER_DSI   6<br>
+#define DRM_MODE_ENCODER_DPMST 7<br>
+#define DRM_MODE_ENCODER_DPI   8<br>
+<br>
+struct drm_mode_get_encoder {<br>
+       __u32 encoder_id;<br>
+       __u32 encoder_type;<br>
+<br>
+       __u32 crtc_id; /**< Id of crtc */<br>
+<br>
+       __u32 possible_crtcs;<br>
+       __u32 possible_clones;<br>
+};<br>
+<br>
+/* This is for connectors with multiple signal types. */<br>
+/* Try to match DRM_MODE_CONNECTOR_X as closely as possible. */<br>
+enum drm_mode_subconnector {<br>
+       DRM_MODE_SUBCONNECTOR_Automatic = 0,<br>
+       DRM_MODE_SUBCONNECTOR_Unknown = 0,<br>
+       DRM_MODE_SUBCONNECTOR_DVID = 3,<br>
+       DRM_MODE_SUBCONNECTOR_DVIA = 4,<br>
+       DRM_MODE_SUBCONNECTOR_Composite = 5,<br>
+       DRM_MODE_SUBCONNECTOR_SVIDEO = 6,<br>
+       DRM_MODE_SUBCONNECTOR_Component = 8,<br>
+       DRM_MODE_SUBCONNECTOR_SCART = 9,<br>
+};<br>
+<br>
+#define DRM_MODE_CONNECTOR_Unknown     0<br>
+#define DRM_MODE_CONNECTOR_VGA         1<br>
+#define DRM_MODE_CONNECTOR_DVII                2<br>
+#define DRM_MODE_CONNECTOR_DVID                3<br>
+#define DRM_MODE_CONNECTOR_DVIA                4<br>
+#define DRM_MODE_CONNECTOR_Composite   5<br>
+#define DRM_MODE_CONNECTOR_SVIDEO      6<br>
+#define DRM_MODE_CONNECTOR_LVDS                7<br>
+#define DRM_MODE_CONNECTOR_Component   8<br>
+#define DRM_MODE_CONNECTOR_9PinDIN     9<br>
+#define DRM_MODE_CONNECTOR_DisplayPort 10<br>
+#define DRM_MODE_CONNECTOR_HDMIA       11<br>
+#define DRM_MODE_CONNECTOR_HDMIB       12<br>
+#define DRM_MODE_CONNECTOR_TV          13<br>
+#define DRM_MODE_CONNECTOR_eDP         14<br>
+#define DRM_MODE_CONNECTOR_VIRTUAL      15<br>
+#define DRM_MODE_CONNECTOR_DSI         16<br>
+#define DRM_MODE_CONNECTOR_DPI         17<br>
+#define DRM_MODE_CONNECTOR_WRITEBACK   18<br>
+<br>
+struct drm_mode_get_connector {<br>
+<br>
+       __u64 encoders_ptr;<br>
+       __u64 modes_ptr;<br>
+       __u64 props_ptr;<br>
+       __u64 prop_values_ptr;<br>
+<br>
+       __u32 count_modes;<br>
+       __u32 count_props;<br>
+       __u32 count_encoders;<br>
+<br>
+       __u32 encoder_id; /**< Current Encoder */<br>
+       __u32 connector_id; /**< Id */<br>
+       __u32 connector_type;<br>
+       __u32 connector_type_id;<br>
+<br>
+       __u32 connection;<br>
+       __u32 mm_width;  /**< width in millimeters */<br>
+       __u32 mm_height; /**< height in millimeters */<br>
+       __u32 subpixel;<br>
+<br>
+       __u32 pad;<br>
+};<br>
+<br>
+#define DRM_MODE_PROP_PENDING  (1<<0) /* deprecated, do not use */<br>
+#define DRM_MODE_PROP_RANGE    (1<<1)<br>
+#define DRM_MODE_PROP_IMMUTABLE        (1<<2)<br>
+#define DRM_MODE_PROP_ENUM     (1<<3) /* enumerated type with text strings */<br>
+#define DRM_MODE_PROP_BLOB     (1<<4)<br>
+#define DRM_MODE_PROP_BITMASK  (1<<5) /* bitmask of enumerated types */<br>
+<br>
+/* non-extended types: legacy bitmask, one bit per type: */<br>
+#define DRM_MODE_PROP_LEGACY_TYPE  ( \<br>
+               DRM_MODE_PROP_RANGE | \<br>
+               DRM_MODE_PROP_ENUM | \<br>
+               DRM_MODE_PROP_BLOB | \<br>
+               DRM_MODE_PROP_BITMASK)<br>
+<br>
+/* extended-types: rather than continue to consume a bit per type,<br>
+ * grab a chunk of the bits to use as integer type id.<br>
+ */<br>
+#define DRM_MODE_PROP_EXTENDED_TYPE    0x0000ffc0<br>
+#define DRM_MODE_PROP_TYPE(n)          ((n) << 6)<br>
+#define DRM_MODE_PROP_OBJECT           DRM_MODE_PROP_TYPE(1)<br>
+#define DRM_MODE_PROP_SIGNED_RANGE     DRM_MODE_PROP_TYPE(2)<br>
+<br>
+/* the PROP_ATOMIC flag is used to hide properties from userspace that<br>
+ * is not aware of atomic properties.  This is mostly to work around<br>
+ * older userspace (DDX drivers) that read/write each prop they find,<br>
+ * without being aware that this could be triggering a lengthy modeset.<br>
+ */<br>
+#define DRM_MODE_PROP_ATOMIC        0x80000000<br>
+<br>
+struct drm_mode_property_enum {<br>
+       __u64 value;<br>
+       char name[DRM_PROP_NAME_LEN];<br>
+};<br>
+<br>
+struct drm_mode_get_property {<br>
+       __u64 values_ptr; /* values and blob lengths */<br>
+       __u64 enum_blob_ptr; /* enum and blob id ptrs */<br>
+<br>
+       __u32 prop_id;<br>
+       __u32 flags;<br>
+       char name[DRM_PROP_NAME_LEN];<br>
+<br>
+       __u32 count_values;<br>
+       /* This is only used to count enum values, not blobs. The _blobs is<br>
+        * simply because of a historical reason, i.e. backwards compat. */<br>
+       __u32 count_enum_blobs;<br>
+};<br>
+<br>
+struct drm_mode_connector_set_property {<br>
+       __u64 value;<br>
+       __u32 prop_id;<br>
+       __u32 connector_id;<br>
+};<br>
+<br>
+#define DRM_MODE_OBJECT_CRTC 0xcccccccc<br>
+#define DRM_MODE_OBJECT_CONNECTOR 0xc0c0c0c0<br>
+#define DRM_MODE_OBJECT_ENCODER 0xe0e0e0e0<br>
+#define DRM_MODE_OBJECT_MODE 0xdededede<br>
+#define DRM_MODE_OBJECT_PROPERTY 0xb0b0b0b0<br>
+#define DRM_MODE_OBJECT_FB 0xfbfbfbfb<br>
+#define DRM_MODE_OBJECT_BLOB 0xbbbbbbbb<br>
+#define DRM_MODE_OBJECT_PLANE 0xeeeeeeee<br>
+#define DRM_MODE_OBJECT_ANY 0<br>
+<br>
+struct drm_mode_obj_get_properties {<br>
+       __u64 props_ptr;<br>
+       __u64 prop_values_ptr;<br>
+       __u32 count_props;<br>
+       __u32 obj_id;<br>
+       __u32 obj_type;<br>
+};<br>
+<br>
+struct drm_mode_obj_set_property {<br>
+       __u64 value;<br>
+       __u32 prop_id;<br>
+       __u32 obj_id;<br>
+       __u32 obj_type;<br>
+};<br>
+<br>
+struct drm_mode_get_blob {<br>
+       __u32 blob_id;<br>
+       __u32 length;<br>
+       __u64 data;<br>
+};<br>
+<br>
+struct drm_mode_fb_cmd {<br>
+       __u32 fb_id;<br>
+       __u32 width;<br>
+       __u32 height;<br>
+       __u32 pitch;<br>
+       __u32 bpp;<br>
+       __u32 depth;<br>
+       /* driver specific handle */<br>
+       __u32 handle;<br>
+};<br>
+<br>
+#define DRM_MODE_FB_INTERLACED (1<<0) /* for interlaced framebuffers */<br>
+#define DRM_MODE_FB_MODIFIERS  (1<<1) /* enables ->modifer[] */<br>
+<br>
+struct drm_mode_fb_cmd2 {<br>
+       __u32 fb_id;<br>
+       __u32 width;<br>
+       __u32 height;<br>
+       __u32 pixel_format; /* fourcc code from drm_fourcc.h */<br>
+       __u32 flags; /* see above flags */<br>
+<br>
+       /*<br>
+        * In case of planar formats, this ioctl allows up to 4<br>
+        * buffer objects with offsets and pitches per plane.<br>
+        * The pitch and offset order is dictated by the fourcc,<br>
+        * e.g. NV12 (<a href="http://fourcc.org/yuv.php#NV12" rel="noreferrer" target="_blank">http://fourcc.org/yuv.php#NV12</a>) is described as:<br>
+        *<br>
+        *   YUV 4:2:0 image with a plane of 8 bit Y samples<br>
+        *   followed by an interleaved U/V plane containing<br>
+        *   8 bit 2x2 subsampled colour difference samples.<br>
+        *<br>
+        * So it would consist of Y as offsets[0] and UV as<br>
+        * offsets[1].  Note that offsets[0] will generally<br>
+        * be 0 (but this is not required).<br>
+        *<br>
+        * To accommodate tiled, compressed, etc formats, a<br>
+        * modifier can be specified.  The default value of zero<br>
+        * indicates "native" format as specified by the fourcc.<br>
+        * Vendor specific modifier token.  Note that even though<br>
+        * it looks like we have a modifier per-plane, we in fact<br>
+        * do not. The modifier for each plane must be identical.<br>
+        * Thus all combinations of different data layouts for<br>
+        * multi plane formats must be enumerated as separate<br>
+        * modifiers.<br>
+        */<br>
+       __u32 handles[4];<br>
+       __u32 pitches[4]; /* pitch for each plane */<br>
+       __u32 offsets[4]; /* offset of each plane */<br>
+       __u64 modifier[4]; /* ie, tiling, compress */<br>
+};<br>
+<br>
+#define DRM_MODE_FB_DIRTY_ANNOTATE_COPY 0x01<br>
+#define DRM_MODE_FB_DIRTY_ANNOTATE_FILL 0x02<br>
+#define DRM_MODE_FB_DIRTY_FLAGS         0x03<br>
+<br>
+#define DRM_MODE_FB_DIRTY_MAX_CLIPS     256<br>
+<br>
+/*<br>
+ * Mark a region of a framebuffer as dirty.<br>
+ *<br>
+ * Some hardware does not automatically update display contents<br>
+ * as a hardware or software draw to a framebuffer. This ioctl<br>
+ * allows userspace to tell the kernel and the hardware what<br>
+ * regions of the framebuffer have changed.<br>
+ *<br>
+ * The kernel or hardware is free to update more then just the<br>
+ * region specified by the clip rects. The kernel or hardware<br>
+ * may also delay and/or coalesce several calls to dirty into a<br>
+ * single update.<br>
+ *<br>
+ * Userspace may annotate the updates, the annotates are a<br>
+ * promise made by the caller that the change is either a copy<br>
+ * of pixels or a fill of a single color in the region specified.<br>
+ *<br>
+ * If the DRM_MODE_FB_DIRTY_ANNOTATE_COPY flag is given then<br>
+ * the number of updated regions are half of num_clips given,<br>
+ * where the clip rects are paired in src and dst. The width and<br>
+ * height of each one of the pairs must match.<br>
+ *<br>
+ * If the DRM_MODE_FB_DIRTY_ANNOTATE_FILL flag is given the caller<br>
+ * promises that the region specified of the clip rects is filled<br>
+ * completely with a single color as given in the color argument.<br>
+ */<br>
+<br>
+struct drm_mode_fb_dirty_cmd {<br>
+       __u32 fb_id;<br>
+       __u32 flags;<br>
+       __u32 color;<br>
+       __u32 num_clips;<br>
+       __u64 clips_ptr;<br>
+};<br>
+<br>
+struct drm_mode_mode_cmd {<br>
+       __u32 connector_id;<br>
+       struct drm_mode_modeinfo mode;<br>
+};<br>
+<br>
+#define DRM_MODE_CURSOR_BO     0x01<br>
+#define DRM_MODE_CURSOR_MOVE   0x02<br>
+#define DRM_MODE_CURSOR_FLAGS  0x03<br>
+<br>
+/*<br>
+ * depending on the value in flags different members are used.<br>
+ *<br>
+ * CURSOR_BO uses<br>
+ *    crtc_id<br>
+ *    width<br>
+ *    height<br>
+ *    handle - if 0 turns the cursor off<br>
+ *<br>
+ * CURSOR_MOVE uses<br>
+ *    crtc_id<br>
+ *    x<br>
+ *    y<br>
+ */<br>
+struct drm_mode_cursor {<br>
+       __u32 flags;<br>
+       __u32 crtc_id;<br>
+       __s32 x;<br>
+       __s32 y;<br>
+       __u32 width;<br>
+       __u32 height;<br>
+       /* driver specific handle */<br>
+       __u32 handle;<br>
+};<br>
+<br>
+struct drm_mode_cursor2 {<br>
+       __u32 flags;<br>
+       __u32 crtc_id;<br>
+       __s32 x;<br>
+       __s32 y;<br>
+       __u32 width;<br>
+       __u32 height;<br>
+       /* driver specific handle */<br>
+       __u32 handle;<br>
+       __s32 hot_x;<br>
+       __s32 hot_y;<br>
+};<br>
+<br>
+struct drm_mode_crtc_lut {<br>
+       __u32 crtc_id;<br>
+       __u32 gamma_size;<br>
+<br>
+       /* pointers to arrays */<br>
+       __u64 red;<br>
+       __u64 green;<br>
+       __u64 blue;<br>
+};<br>
+<br>
+struct drm_color_ctm {<br>
+       /*<br>
+        * Conversion matrix in S31.32 sign-magnitude<br>
+        * (not two's complement!) format.<br>
+        */<br>
+       __u64 matrix[9];<br>
+};<br>
+<br>
+struct drm_color_lut {<br>
+       /*<br>
+        * Values are mapped linearly to 0.0 - 1.0 range, with 0x0 == 0.0 and<br>
+        * 0xffff == 1.0.<br>
+        */<br>
+       __u16 red;<br>
+       __u16 green;<br>
+       __u16 blue;<br>
+       __u16 reserved;<br>
+};<br>
+<br>
+#define DRM_MODE_PAGE_FLIP_EVENT 0x01<br>
+#define DRM_MODE_PAGE_FLIP_ASYNC 0x02<br>
+#define DRM_MODE_PAGE_FLIP_TARGET_ABSOLUTE 0x4<br>
+#define DRM_MODE_PAGE_FLIP_TARGET_RELATIVE 0x8<br>
+#define DRM_MODE_PAGE_FLIP_TARGET (DRM_MODE_PAGE_FLIP_TARGET_ABSOLUTE | \<br>
+                                  DRM_MODE_PAGE_FLIP_TARGET_RELATIVE)<br>
+#define DRM_MODE_PAGE_FLIP_FLAGS (DRM_MODE_PAGE_FLIP_EVENT | \<br>
+                                 DRM_MODE_PAGE_FLIP_ASYNC | \<br>
+                                 DRM_MODE_PAGE_FLIP_TARGET)<br>
+<br>
+/*<br>
+ * Request a page flip on the specified crtc.<br>
+ *<br>
+ * This ioctl will ask KMS to schedule a page flip for the specified<br>
+ * crtc.  Once any pending rendering targeting the specified fb (as of<br>
+ * ioctl time) has completed, the crtc will be reprogrammed to display<br>
+ * that fb after the next vertical refresh.  The ioctl returns<br>
+ * immediately, but subsequent rendering to the current fb will block<br>
+ * in the execbuffer ioctl until the page flip happens.  If a page<br>
+ * flip is already pending as the ioctl is called, EBUSY will be<br>
+ * returned.<br>
+ *<br>
+ * Flag DRM_MODE_PAGE_FLIP_EVENT requests that drm sends back a vblank<br>
+ * event (see drm.h: struct drm_event_vblank) when the page flip is<br>
+ * done.  The user_data field passed in with this ioctl will be<br>
+ * returned as the user_data field in the vblank event struct.<br>
+ *<br>
+ * Flag DRM_MODE_PAGE_FLIP_ASYNC requests that the flip happen<br>
+ * 'as soon as possible', meaning that it not delay waiting for vblank.<br>
+ * This may cause tearing on the screen.<br>
+ *<br>
+ * The reserved field must be zero.<br>
+ */<br>
+<br>
+struct drm_mode_crtc_page_flip {<br>
+       __u32 crtc_id;<br>
+       __u32 fb_id;<br>
+       __u32 flags;<br>
+       __u32 reserved;<br>
+       __u64 user_data;<br>
+};<br>
+<br>
+/*<br>
+ * Request a page flip on the specified crtc.<br>
+ *<br>
+ * Same as struct drm_mode_crtc_page_flip, but supports new flags and<br>
+ * re-purposes the reserved field:<br>
+ *<br>
+ * The sequence field must be zero unless either of the<br>
+ * DRM_MODE_PAGE_FLIP_TARGET_ABSOLUTE/RELATIVE flags is specified. When<br>
+ * the ABSOLUTE flag is specified, the sequence field denotes the absolute<br>
+ * vblank sequence when the flip should take effect. When the RELATIVE<br>
+ * flag is specified, the sequence field denotes the relative (to the<br>
+ * current one when the ioctl is called) vblank sequence when the flip<br>
+ * should take effect. NOTE: DRM_IOCTL_WAIT_VBLANK must still be used to<br>
+ * make sure the vblank sequence before the target one has passed before<br>
+ * calling this ioctl. The purpose of the<br>
+ * DRM_MODE_PAGE_FLIP_TARGET_ABSOLUTE/RELATIVE flags is merely to clarify<br>
+ * the target for when code dealing with a page flip runs during a<br>
+ * vertical blank period.<br>
+ */<br>
+<br>
+struct drm_mode_crtc_page_flip_target {<br>
+       __u32 crtc_id;<br>
+       __u32 fb_id;<br>
+       __u32 flags;<br>
+       __u32 sequence;<br>
+       __u64 user_data;<br>
+};<br>
+<br>
+/* create a dumb scanout buffer */<br>
+struct drm_mode_create_dumb {<br>
+       __u32 height;<br>
+       __u32 width;<br>
+       __u32 bpp;<br>
+       __u32 flags;<br>
+       /* handle, pitch, size will be returned */<br>
+       __u32 handle;<br>
+       __u32 pitch;<br>
+       __u64 size;<br>
+};<br>
+<br>
+/* set up for mmap of a dumb scanout buffer */<br>
+struct drm_mode_map_dumb {<br>
+       /** Handle for the object being mapped. */<br>
+       __u32 handle;<br>
+       __u32 pad;<br>
+       /**<br>
+        * Fake offset to use for subsequent mmap call<br>
+        *<br>
+        * This is a fixed-size type for 32/64 compatibility.<br>
+        */<br>
+       __u64 offset;<br>
+};<br>
+<br>
+struct drm_mode_destroy_dumb {<br>
+       __u32 handle;<br>
+};<br>
+<br>
+/* page-flip flags are valid, plus: */<br>
+#define DRM_MODE_ATOMIC_TEST_ONLY 0x0100<br>
+#define DRM_MODE_ATOMIC_NONBLOCK  0x0200<br>
+#define DRM_MODE_ATOMIC_ALLOW_MODESET 0x0400<br>
+<br>
+#define DRM_MODE_ATOMIC_FLAGS (\<br>
+               DRM_MODE_PAGE_FLIP_EVENT |\<br>
+               DRM_MODE_PAGE_FLIP_ASYNC |\<br>
+               DRM_MODE_ATOMIC_TEST_ONLY |\<br>
+               DRM_MODE_ATOMIC_NONBLOCK |\<br>
+               DRM_MODE_ATOMIC_ALLOW_MODESET)<br>
+<br>
+struct drm_mode_atomic {<br>
+       __u32 flags;<br>
+       __u32 count_objs;<br>
+       __u64 objs_ptr;<br>
+       __u64 count_props_ptr;<br>
+       __u64 props_ptr;<br>
+       __u64 prop_values_ptr;<br>
+       __u64 reserved;<br>
+       __u64 user_data;<br>
+};<br>
+<br>
+struct drm_format_modifier_blob {<br>
+#define FORMAT_BLOB_CURRENT 1<br>
+       /* Version of this blob format */<br>
+       __u32 version;<br>
+<br>
+       /* Flags */<br>
+       __u32 flags;<br>
+<br>
+       /* Number of fourcc formats supported */<br>
+       __u32 count_formats;<br>
+<br>
+       /* Where in this blob the formats exist (in bytes) */<br>
+       __u32 formats_offset;<br>
+<br>
+       /* Number of drm_format_modifiers */<br>
+       __u32 count_modifiers;<br>
+<br>
+       /* Where in this blob the modifiers exist (in bytes) */<br>
+       __u32 modifiers_offset;<br>
+<br>
+       /* __u32 formats[] */<br>
+       /* struct drm_format_modifier modifiers[] */<br>
+};<br>
+<br>
+struct drm_format_modifier {<br>
+       /* Bitmask of formats in get_plane format list this info applies to. The<br>
+        * offset allows a sliding window of which 64 formats (bits).<br>
+        *<br>
+        * Some examples:<br>
+        * In today's world with < 65 formats, and formats 0, and 2 are<br>
+        * supported<br>
+        * 0x0000000000000005<br>
+        *                ^-offset = 0, formats = 5<br>
+        *<br>
+        * If the number formats grew to 128, and formats 98-102 are<br>
+        * supported with the modifier:<br>
+        *<br>
+        * 0x0000007c00000000 0000000000000000<br>
+        *                ^<br>
+        *                |__offset = 64, formats = 0x7c00000000<br>
+        *<br>
+        */<br>
+       __u64 formats;<br>
+       __u32 offset;<br>
+       __u32 pad;<br>
+<br>
+       /* The modifier that applies to the >get_plane format list bitmask. */<br>
+       __u64 modifier;<br>
+};<br>
+<br>
+/**<br>
+ * Create a new 'blob' data property, copying length bytes from data pointer,<br>
+ * and returning new blob ID.<br>
+ */<br>
+struct drm_mode_create_blob {<br>
+       /** Pointer to data to copy. */<br>
+       __u64 data;<br>
+       /** Length of data to copy. */<br>
+       __u32 length;<br>
+       /** Return: new property ID. */<br>
+       __u32 blob_id;<br>
+};<br>
+<br>
+/**<br>
+ * Destroy a user-created blob property.<br>
+ */<br>
+struct drm_mode_destroy_blob {<br>
+       __u32 blob_id;<br>
+};<br>
+<br>
+/**<br>
+ * Lease mode resources, creating another drm_master.<br>
+ */<br>
+struct drm_mode_create_lease {<br>
+       /** Pointer to array of object ids (__u32) */<br>
+       __u64 object_ids;<br>
+       /** Number of object ids */<br>
+       __u32 object_count;<br>
+       /** flags for new FD (O_CLOEXEC, etc) */<br>
+       __u32 flags;<br>
+<br>
+       /** Return: unique identifier for lessee. */<br>
+       __u32 lessee_id;<br>
+       /** Return: file descriptor to new drm_master file */<br>
+       __u32 fd;<br>
+};<br>
+<br>
+/**<br>
+ * List lesses from a drm_master<br>
+ */<br>
+struct drm_mode_list_lessees {<br>
+       /** Number of lessees.<br>
+        * On input, provides length of the array.<br>
+        * On output, provides total number. No<br>
+        * more than the input number will be written<br>
+        * back, so two calls can be used to get<br>
+        * the size and then the data.<br>
+        */<br>
+       __u32 count_lessees;<br>
+       __u32 pad;<br>
+<br>
+       /** Pointer to lessees.<br>
+        * pointer to __u64 array of lessee ids<br>
+        */<br>
+       __u64 lessees_ptr;<br>
+};<br>
+<br>
+/**<br>
+ * Get leased objects<br>
+ */<br>
+struct drm_mode_get_lease {<br>
+       /** Number of leased objects.<br>
+        * On input, provides length of the array.<br>
+        * On output, provides total number. No<br>
+        * more than the input number will be written<br>
+        * back, so two calls can be used to get<br>
+        * the size and then the data.<br>
+        */<br>
+       __u32 count_objects;<br>
+       __u32 pad;<br>
+<br>
+       /** Pointer to objects.<br>
+        * pointer to __u32 array of object ids<br>
+        */<br>
+       __u64 objects_ptr;<br>
+};<br>
+<br>
+/**<br>
+ * Revoke lease<br>
+ */<br>
+struct drm_mode_revoke_lease {<br>
+       /** Unique ID of lessee<br>
+        */<br>
+       __u32 lessee_id;<br>
+};<br>
+<br>
+/**<br>
+ * struct drm_mode_rect - Two dimensional rectangle.<br>
+ * @x1: Horizontal starting coordinate (inclusive).<br>
+ * @y1: Vertical starting coordinate (inclusive).<br>
+ * @x2: Horizontal ending coordinate (exclusive).<br>
+ * @y2: Vertical ending coordinate (exclusive).<br>
+ *<br>
+ * With drm subsystem using struct drm_rect to manage rectangular area this<br>
+ * export it to user-space.<br>
+ *<br>
+ * Currently used by drm_mode_atomic blob property FB_DAMAGE_CLIPS.<br>
+ */<br>
+struct drm_mode_rect {<br>
+       __s32 x1;<br>
+       __s32 y1;<br>
+       __s32 x2;<br>
+       __s32 y2;<br>
+};<br>
+<br>
+#if defined(__cplusplus)<br>
+}<br>
+#endif<br>
+<br>
+#endif<br>
diff --git a/print_fields.h b/print_fields.h<br>
index 677b5f6c..12c32a72 100644<br>
--- a/print_fields.h<br>
+++ b/print_fields.h<br>
@@ -25,6 +25,9 @@<br>
        STRACE_PRINTF("%s%s=%llu", (prefix_), #field_,                  \<br>
                      zero_extend_signed_to_ull((where_).field_))<br>
<br>
+# define PRINT_FIELD_DRM_CRTC_ID(prefix_, where_, field_)              \<br>
+       PRINT_FIELD_U(prefix_, where_, field_)<br>
+<br>
 # define PRINT_FIELD_U_CAST(prefix_, where_, field_, type_)            \<br>
        STRACE_PRINTF("%s%s=%llu", (prefix_), #field_,                  \<br>
                      zero_extend_signed_to_ull((type_) (where_).field_))<br>
diff --git a/util.c b/util.c<br>
index ec86cdb9..2b85fafa 100644<br>
--- a/util.c<br>
+++ b/util.c<br>
@@ -1248,6 +1248,15 @@ umoven_or_printaddr64_ignore_syserror(struct tcb *const tcp,<br>
        return -1;<br>
 }<br>
<br>
+bool<br>
+print_uint16_array_member(struct tcb *tcp, void *elem_buf, size_t elem_size,<br>
+                         void *data)<br>
+{<br>
+       tprintf("%" PRIu16, *(uint16_t*) elem_buf);<br>
+<br>
+       return true;<br>
+}<br>
+<br>
 bool<br>
 print_int32_array_member(struct tcb *tcp, void *elem_buf, size_t elem_size,<br>
                         void *data)<br>
diff --git a/xlat/<a href="http://drm_buf_desc_flags.in" rel="noreferrer" target="_blank">drm_buf_desc_flags.in</a> b/xlat/<a href="http://drm_buf_desc_flags.in" rel="noreferrer" target="_blank">drm_buf_desc_flags.in</a><br>
new file mode 100644<br>
index 00000000..79667094<br>
--- /dev/null<br>
+++ b/xlat/<a href="http://drm_buf_desc_flags.in" rel="noreferrer" target="_blank">drm_buf_desc_flags.in</a><br>
@@ -0,0 +1,6 @@<br>
+#sorted<br>
+_DRM_PAGE_ALIGN                0x01<br>
+_DRM_AGP_BUFFER                0x02<br>
+_DRM_SG_BUFFER         0x04<br>
+_DRM_FB_BUFFER         0x08<br>
+_DRM_PCI_BUFFER_RO     0x10<br>
diff --git a/xlat/<a href="http://drm_capability.in" rel="noreferrer" target="_blank">drm_capability.in</a> b/xlat/<a href="http://drm_capability.in" rel="noreferrer" target="_blank">drm_capability.in</a><br>
new file mode 100644<br>
index 00000000..383b2535<br>
--- /dev/null<br>
+++ b/xlat/<a href="http://drm_capability.in" rel="noreferrer" target="_blank">drm_capability.in</a><br>
@@ -0,0 +1,15 @@<br>
+#value_indexed<br>
+DRM_CAP_DUMB_BUFFER            0x1<br>
+DRM_CAP_VBLANK_HIGH_CRTC       0x2<br>
+DRM_CAP_DUMB_PREFERRED_DEPTH   0x3<br>
+DRM_CAP_DUMB_PREFER_SHADOW     0x4<br>
+DRM_CAP_PRIME                  0x5<br>
+DRM_CAP_TIMESTAMP_MONOTONIC    0x6<br>
+DRM_CAP_ASYNC_PAGE_FLIP                0x7<br>
+DRM_CAP_CURSOR_WIDTH           0x8<br>
+DRM_CAP_CURSOR_HEIGHT          0x9<br>
+DRM_CAP_ADDFB2_MODIFIERS       0x10<br>
+DRM_CAP_PAGE_FLIP_TARGET       0x11<br>
+DRM_CAP_CRTC_IN_VBLANK_EVENT   0x12<br>
+DRM_CAP_SYNCOBJ                        0x13<br>
+DRM_CAP_SYNCOBJ_TIMELINE       0x14<br>
diff --git a/xlat/<a href="http://drm_client_capability.in" rel="noreferrer" target="_blank">drm_client_capability.in</a> b/xlat/<a href="http://drm_client_capability.in" rel="noreferrer" target="_blank">drm_client_capability.in</a><br>
new file mode 100644<br>
index 00000000..efbf1283<br>
--- /dev/null<br>
+++ b/xlat/<a href="http://drm_client_capability.in" rel="noreferrer" target="_blank">drm_client_capability.in</a><br>
@@ -0,0 +1,6 @@<br>
+#value_indexed<br>
+DRM_CLIENT_CAP_STEREO_3D               1<br>
+DRM_CLIENT_CAP_UNIVERSAL_PLANES                2<br>
+DRM_CLIENT_CAP_ATOMIC                  3<br>
+DRM_CLIENT_CAP_ASPECT_RATIO            4<br>
+DRM_CLIENT_CAP_WRITEBACK_CONNECTORS    5<br>
diff --git a/xlat/<a href="http://drm_control_func.in" rel="noreferrer" target="_blank">drm_control_func.in</a> b/xlat/<a href="http://drm_control_func.in" rel="noreferrer" target="_blank">drm_control_func.in</a><br>
new file mode 100644<br>
index 00000000..1942c92d<br>
--- /dev/null<br>
+++ b/xlat/<a href="http://drm_control_func.in" rel="noreferrer" target="_blank">drm_control_func.in</a><br>
@@ -0,0 +1,5 @@<br>
+#value_indexed<br>
+DRM_ADD_COMMAND                0<br>
+DRM_RM_COMMAND         1<br>
+DRM_INST_HANDLER       2<br>
+DRM_UNINST_HANDLER     3<br>
diff --git a/xlat/<a href="http://drm_crtc_sequence_flags.in" rel="noreferrer" target="_blank">drm_crtc_sequence_flags.in</a> b/xlat/<a href="http://drm_crtc_sequence_flags.in" rel="noreferrer" target="_blank">drm_crtc_sequence_flags.in</a><br>
new file mode 100644<br>
index 00000000..e444bca2<br>
--- /dev/null<br>
+++ b/xlat/<a href="http://drm_crtc_sequence_flags.in" rel="noreferrer" target="_blank">drm_crtc_sequence_flags.in</a><br>
@@ -0,0 +1,3 @@<br>
+#sorted<br>
+DRM_CRTC_SEQUENCE_RELATIVE     0x00000001<br>
+DRM_CRTC_SEQUENCE_NEXT_ON_MISS 0x00000002<br>
diff --git a/xlat/<a href="http://drm_ctx_flags.in" rel="noreferrer" target="_blank">drm_ctx_flags.in</a> b/xlat/<a href="http://drm_ctx_flags.in" rel="noreferrer" target="_blank">drm_ctx_flags.in</a><br>
new file mode 100644<br>
index 00000000..c07a2524<br>
--- /dev/null<br>
+++ b/xlat/<a href="http://drm_ctx_flags.in" rel="noreferrer" target="_blank">drm_ctx_flags.in</a><br>
@@ -0,0 +1,3 @@<br>
+#sorted<br>
+_DRM_CONTEXT_PRESERVED 0x01<br>
+_DRM_CONTEXT_2DONLY    0x02<br>
diff --git a/xlat/<a href="http://drm_lock_flags.in" rel="noreferrer" target="_blank">drm_lock_flags.in</a> b/xlat/<a href="http://drm_lock_flags.in" rel="noreferrer" target="_blank">drm_lock_flags.in</a><br>
new file mode 100644<br>
index 00000000..4ae983fa<br>
--- /dev/null<br>
+++ b/xlat/<a href="http://drm_lock_flags.in" rel="noreferrer" target="_blank">drm_lock_flags.in</a><br>
@@ -0,0 +1,7 @@<br>
+#sorted<br>
+_DRM_LOCK_READY                0x01<br>
+_DRM_LOCK_QUIESCENT    0x02<br>
+_DRM_LOCK_FLUSH                0x04<br>
+_DRM_LOCK_FLUSH_ALL    0x08<br>
+_DRM_HALT_ALL_QUEUES   0x10<br>
+_DRM_HALT_CUR_QUEUES   0x20<br>
diff --git a/xlat/<a href="http://drm_map_flags.in" rel="noreferrer" target="_blank">drm_map_flags.in</a> b/xlat/<a href="http://drm_map_flags.in" rel="noreferrer" target="_blank">drm_map_flags.in</a><br>
new file mode 100644<br>
index 00000000..4fed3ca1<br>
--- /dev/null<br>
+++ b/xlat/<a href="http://drm_map_flags.in" rel="noreferrer" target="_blank">drm_map_flags.in</a><br>
@@ -0,0 +1,9 @@<br>
+#sorted<br>
+_DRM_RESTRICTED                0x01<br>
+_DRM_READ_ONLY         0x02<br>
+_DRM_LOCKED            0x04<br>
+_DRM_KERNEL            0x08<br>
+_DRM_WRITE_COMBINING   0x10<br>
+_DRM_CONTAINS_LOCK     0x20<br>
+_DRM_REMOVABLE         0x40<br>
+_DRM_DRIVER            0x80<br>
diff --git a/xlat/<a href="http://drm_map_type.in" rel="noreferrer" target="_blank">drm_map_type.in</a> b/xlat/<a href="http://drm_map_type.in" rel="noreferrer" target="_blank">drm_map_type.in</a><br>
new file mode 100644<br>
index 00000000..cc84306e<br>
--- /dev/null<br>
+++ b/xlat/<a href="http://drm_map_type.in" rel="noreferrer" target="_blank">drm_map_type.in</a><br>
@@ -0,0 +1,7 @@<br>
+#value_indexed<br>
+_DRM_FRAME_BUFFER      0<br>
+_DRM_REGISTERS         1<br>
+_DRM_SHM               2<br>
+_DRM_AGP               3<br>
+_DRM_SCATTER_GATHER    4<br>
+_DRM_CONSISTENT                5<br>
diff --git a/xlat/<a href="http://drm_mode_atomic_flags.in" rel="noreferrer" target="_blank">drm_mode_atomic_flags.in</a> b/xlat/<a href="http://drm_mode_atomic_flags.in" rel="noreferrer" target="_blank">drm_mode_atomic_flags.in</a><br>
new file mode 100644<br>
index 00000000..665eed42<br>
--- /dev/null<br>
+++ b/xlat/<a href="http://drm_mode_atomic_flags.in" rel="noreferrer" target="_blank">drm_mode_atomic_flags.in</a><br>
@@ -0,0 +1,6 @@<br>
+#sorted<br>
+DRM_MODE_PAGE_FLIP_EVENT               0x1<br>
+DRM_MODE_PAGE_FLIP_ASYNC               0x2<br>
+DRM_MODE_ATOMIC_TEST_ONLY              0x100<br>
+DRM_MODE_ATOMIC_NONBLOCK               0x200<br>
+DRM_MODE_ATOMIC_ALLOW_MODESET          0x400<br>
diff --git a/xlat/<a href="http://drm_mode_create_lease_flags.in" rel="noreferrer" target="_blank">drm_mode_create_lease_flags.in</a> b/xlat/<a href="http://drm_mode_create_lease_flags.in" rel="noreferrer" target="_blank">drm_mode_create_lease_flags.in</a><br>
new file mode 100644<br>
index 00000000..231c4a72<br>
--- /dev/null<br>
+++ b/xlat/<a href="http://drm_mode_create_lease_flags.in" rel="noreferrer" target="_blank">drm_mode_create_lease_flags.in</a><br>
@@ -0,0 +1,2 @@<br>
+O_CLOEXEC<br>
+O_NONBLOCK<br>
diff --git a/xlat/<a href="http://drm_mode_cursor_flags.in" rel="noreferrer" target="_blank">drm_mode_cursor_flags.in</a> b/xlat/<a href="http://drm_mode_cursor_flags.in" rel="noreferrer" target="_blank">drm_mode_cursor_flags.in</a><br>
new file mode 100644<br>
index 00000000..a703d383<br>
--- /dev/null<br>
+++ b/xlat/<a href="http://drm_mode_cursor_flags.in" rel="noreferrer" target="_blank">drm_mode_cursor_flags.in</a><br>
@@ -0,0 +1,3 @@<br>
+#sorted<br>
+DRM_MODE_CURSOR_BO     0x01<br>
+DRM_MODE_CURSOR_MOVE   0x02<br>
diff --git a/xlat/<a href="http://drm_mode_encoder_type.in" rel="noreferrer" target="_blank">drm_mode_encoder_type.in</a> b/xlat/<a href="http://drm_mode_encoder_type.in" rel="noreferrer" target="_blank">drm_mode_encoder_type.in</a><br>
new file mode 100644<br>
index 00000000..58435446<br>
--- /dev/null<br>
+++ b/xlat/<a href="http://drm_mode_encoder_type.in" rel="noreferrer" target="_blank">drm_mode_encoder_type.in</a><br>
@@ -0,0 +1,10 @@<br>
+#value_indexed<br>
+DRM_MODE_ENCODER_NONE          0<br>
+DRM_MODE_ENCODER_DAC           1<br>
+DRM_MODE_ENCODER_TMDS          2<br>
+DRM_MODE_ENCODER_LVDS          3<br>
+DRM_MODE_ENCODER_TVDAC         4<br>
+DRM_MODE_ENCODER_VIRTUAL       5<br>
+DRM_MODE_ENCODER_DSI           6<br>
+DRM_MODE_ENCODER_DPMST         7<br>
+DRM_MODE_ENCODER_DPI           8<br>
diff --git a/xlat/<a href="http://drm_mode_fb_cmd2_flags.in" rel="noreferrer" target="_blank">drm_mode_fb_cmd2_flags.in</a> b/xlat/<a href="http://drm_mode_fb_cmd2_flags.in" rel="noreferrer" target="_blank">drm_mode_fb_cmd2_flags.in</a><br>
new file mode 100644<br>
index 00000000..d0f30f59<br>
--- /dev/null<br>
+++ b/xlat/<a href="http://drm_mode_fb_cmd2_flags.in" rel="noreferrer" target="_blank">drm_mode_fb_cmd2_flags.in</a><br>
@@ -0,0 +1,3 @@<br>
+#sorted<br>
+DRM_MODE_FB_INTERLACED (1<<0)<br>
+DRM_MODE_FB_MODIFIERS  (1<<1)<br>
diff --git a/xlat/<a href="http://drm_mode_fb_dirty_cmd_flags.in" rel="noreferrer" target="_blank">drm_mode_fb_dirty_cmd_flags.in</a> b/xlat/<a href="http://drm_mode_fb_dirty_cmd_flags.in" rel="noreferrer" target="_blank">drm_mode_fb_dirty_cmd_flags.in</a><br>
new file mode 100644<br>
index 00000000..7b1585f3<br>
--- /dev/null<br>
+++ b/xlat/<a href="http://drm_mode_fb_dirty_cmd_flags.in" rel="noreferrer" target="_blank">drm_mode_fb_dirty_cmd_flags.in</a><br>
@@ -0,0 +1,3 @@<br>
+#sorted<br>
+DRM_MODE_FB_DIRTY_ANNOTATE_COPY                0x01<br>
+DRM_MODE_FB_DIRTY_ANNOTATE_FILL                0x02<br>
diff --git a/xlat/<a href="http://drm_mode_flags.in" rel="noreferrer" target="_blank">drm_mode_flags.in</a> b/xlat/<a href="http://drm_mode_flags.in" rel="noreferrer" target="_blank">drm_mode_flags.in</a><br>
new file mode 100644<br>
index 00000000..c4c55749<br>
--- /dev/null<br>
+++ b/xlat/<a href="http://drm_mode_flags.in" rel="noreferrer" target="_blank">drm_mode_flags.in</a><br>
@@ -0,0 +1,6 @@<br>
+#sorted<br>
+DRM_MODE_FLAG_PIC_AR_NONE      (0 << 19)<br>
+DRM_MODE_FLAG_PIC_AR_4_3       (1 << 19)<br>
+DRM_MODE_FLAG_PIC_AR_16_9      (2 << 19)<br>
+DRM_MODE_FLAG_PIC_AR_64_27     (3 << 19)<br>
+DRM_MODE_FLAG_PIC_AR_256_135   (4 << 19)<br>
diff --git a/xlat/<a href="http://drm_mode_get_property_flags.in" rel="noreferrer" target="_blank">drm_mode_get_property_flags.in</a> b/xlat/<a href="http://drm_mode_get_property_flags.in" rel="noreferrer" target="_blank">drm_mode_get_property_flags.in</a><br>
new file mode 100644<br>
index 00000000..f9e13889<br>
--- /dev/null<br>
+++ b/xlat/<a href="http://drm_mode_get_property_flags.in" rel="noreferrer" target="_blank">drm_mode_get_property_flags.in</a><br>
@@ -0,0 +1,9 @@<br>
+#sorted<br>
+DRM_MODE_PROP_PENDING          (1<<0)<br>
+DRM_MODE_PROP_RANGE            (1<<1)<br>
+DRM_MODE_PROP_IMMUTABLE                (1<<2)<br>
+DRM_MODE_PROP_ENUM             (1<<3)<br>
+DRM_MODE_PROP_BLOB             (1<<4)<br>
+DRM_MODE_PROP_BITMASK          (1<<5)<br>
+DRM_MODE_PROP_EXTENDED_TYPE    0x0000ffc0<br>
+DRM_MODE_PROP_ATOMIC           0x80000000<br>
diff --git a/xlat/<a href="http://drm_mode_page_flip_flags.in" rel="noreferrer" target="_blank">drm_mode_page_flip_flags.in</a> b/xlat/<a href="http://drm_mode_page_flip_flags.in" rel="noreferrer" target="_blank">drm_mode_page_flip_flags.in</a><br>
new file mode 100644<br>
index 00000000..da3fec1c<br>
--- /dev/null<br>
+++ b/xlat/<a href="http://drm_mode_page_flip_flags.in" rel="noreferrer" target="_blank">drm_mode_page_flip_flags.in</a><br>
@@ -0,0 +1,5 @@<br>
+DRM_MODE_PAGE_FLIP_EVENT               0x01<br>
+DRM_MODE_PAGE_FLIP_ASYNC               0x02<br>
+DRM_MODE_PAGE_FLIP_TARGET              (DRM_MODE_PAGE_FLIP_TARGET_ABSOLUTE | DRM_MODE_PAGE_FLIP_TARGET_RELATIVE)<br>
+DRM_MODE_PAGE_FLIP_TARGET_ABSOLUTE     0x04<br>
+DRM_MODE_PAGE_FLIP_TARGET_RELATIVE     0x08<br>
diff --git a/xlat/<a href="http://drm_mode_set_plane_flags.in" rel="noreferrer" target="_blank">drm_mode_set_plane_flags.in</a> b/xlat/<a href="http://drm_mode_set_plane_flags.in" rel="noreferrer" target="_blank">drm_mode_set_plane_flags.in</a><br>
new file mode 100644<br>
index 00000000..d5128547<br>
--- /dev/null<br>
+++ b/xlat/<a href="http://drm_mode_set_plane_flags.in" rel="noreferrer" target="_blank">drm_mode_set_plane_flags.in</a><br>
@@ -0,0 +1,3 @@<br>
+#sorted<br>
+DRM_MODE_PRESENT_TOP_FIELD     (1<<0)<br>
+DRM_MODE_PRESENT_BOTTOM_FIELD  (1<<1)<br>
diff --git a/xlat/<a href="http://drm_mode_type.in" rel="noreferrer" target="_blank">drm_mode_type.in</a> b/xlat/<a href="http://drm_mode_type.in" rel="noreferrer" target="_blank">drm_mode_type.in</a><br>
new file mode 100644<br>
index 00000000..74a29678<br>
--- /dev/null<br>
+++ b/xlat/<a href="http://drm_mode_type.in" rel="noreferrer" target="_blank">drm_mode_type.in</a><br>
@@ -0,0 +1,8 @@<br>
+#sorted<br>
+DRM_MODE_TYPE_BUILTIN          (1 << 0)<br>
+DRM_MODE_TYPE_CLOCK_C          (1 << 1 | DRM_MODE_TYPE_BUILTIN)<br>
+DRM_MODE_TYPE_CRTC_C           (1 << 2 | DRM_MODE_TYPE_BUILTIN)<br>
+DRM_MODE_TYPE_PREFERRED                (1 << 3)<br>
+DRM_MODE_TYPE_DEFAULT          (1 << 4)<br>
+DRM_MODE_TYPE_USERDEF          (1 << 5)<br>
+DRM_MODE_TYPE_DRIVER           (1 << 6)<br>
diff --git a/xlat/<a href="http://drm_modeset_cmd.in" rel="noreferrer" target="_blank">drm_modeset_cmd.in</a> b/xlat/<a href="http://drm_modeset_cmd.in" rel="noreferrer" target="_blank">drm_modeset_cmd.in</a><br>
new file mode 100644<br>
index 00000000..2152f3da<br>
--- /dev/null<br>
+++ b/xlat/<a href="http://drm_modeset_cmd.in" rel="noreferrer" target="_blank">drm_modeset_cmd.in</a><br>
@@ -0,0 +1,3 @@<br>
+#value_indexed<br>
+_DRM_PRE_MODESET       1<br>
+_DRM_POST_MODESET      2<br>
diff --git a/xlat/<a href="http://drm_prime_handle_flags.in" rel="noreferrer" target="_blank">drm_prime_handle_flags.in</a> b/xlat/<a href="http://drm_prime_handle_flags.in" rel="noreferrer" target="_blank">drm_prime_handle_flags.in</a><br>
new file mode 100644<br>
index 00000000..5ace5a54<br>
--- /dev/null<br>
+++ b/xlat/<a href="http://drm_prime_handle_flags.in" rel="noreferrer" target="_blank">drm_prime_handle_flags.in</a><br>
@@ -0,0 +1,2 @@<br>
+DRM_RDWR<br>
+DRM_CLOEXEC<br>
diff --git a/xlat/<a href="http://drm_syncobj_fd_to_handle_flags.in" rel="noreferrer" target="_blank">drm_syncobj_fd_to_handle_flags.in</a> b/xlat/<a href="http://drm_syncobj_fd_to_handle_flags.in" rel="noreferrer" target="_blank">drm_syncobj_fd_to_handle_flags.in</a><br>
new file mode 100644<br>
index 00000000..838e6d81<br>
--- /dev/null<br>
+++ b/xlat/<a href="http://drm_syncobj_fd_to_handle_flags.in" rel="noreferrer" target="_blank">drm_syncobj_fd_to_handle_flags.in</a><br>
@@ -0,0 +1,2 @@<br>
+#sorted<br>
+DRM_SYNCOBJ_FD_TO_HANDLE_FLAGS_IMPORT_SYNC_FILE<br>
diff --git a/xlat/<a href="http://drm_syncobj_flags.in" rel="noreferrer" target="_blank">drm_syncobj_flags.in</a> b/xlat/<a href="http://drm_syncobj_flags.in" rel="noreferrer" target="_blank">drm_syncobj_flags.in</a><br>
new file mode 100644<br>
index 00000000..8817528b<br>
--- /dev/null<br>
+++ b/xlat/<a href="http://drm_syncobj_flags.in" rel="noreferrer" target="_blank">drm_syncobj_flags.in</a><br>
@@ -0,0 +1,2 @@<br>
+#sorted<br>
+DRM_SYNCOBJ_CREATE_SIGNALED    (1 << 0)<br>
diff --git a/xlat/<a href="http://drm_syncobj_handle_to_fd_flags.in" rel="noreferrer" target="_blank">drm_syncobj_handle_to_fd_flags.in</a> b/xlat/<a href="http://drm_syncobj_handle_to_fd_flags.in" rel="noreferrer" target="_blank">drm_syncobj_handle_to_fd_flags.in</a><br>
new file mode 100644<br>
index 00000000..5968102a<br>
--- /dev/null<br>
+++ b/xlat/<a href="http://drm_syncobj_handle_to_fd_flags.in" rel="noreferrer" target="_blank">drm_syncobj_handle_to_fd_flags.in</a><br>
@@ -0,0 +1 @@<br>
+DRM_SYNCOBJ_HANDLE_TO_FD_FLAGS_EXPORT_SYNC_FILE<br>
diff --git a/xlat/<a href="http://drm_syncobj_wait_flags.in" rel="noreferrer" target="_blank">drm_syncobj_wait_flags.in</a> b/xlat/<a href="http://drm_syncobj_wait_flags.in" rel="noreferrer" target="_blank">drm_syncobj_wait_flags.in</a><br>
new file mode 100644<br>
index 00000000..d576b51f<br>
--- /dev/null<br>
+++ b/xlat/<a href="http://drm_syncobj_wait_flags.in" rel="noreferrer" target="_blank">drm_syncobj_wait_flags.in</a><br>
@@ -0,0 +1,4 @@<br>
+#sorted<br>
+DRM_SYNCOBJ_WAIT_FLAGS_WAIT_ALL                (1 << 0)<br>
+DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT (1 << 1)<br>
+DRM_SYNCOBJ_WAIT_FLAGS_WAIT_AVAILABLE  (1 << 2)<br>
diff --git a/xlat/<a href="http://drm_vblank_seq_type.in" rel="noreferrer" target="_blank">drm_vblank_seq_type.in</a> b/xlat/<a href="http://drm_vblank_seq_type.in" rel="noreferrer" target="_blank">drm_vblank_seq_type.in</a><br>
new file mode 100644<br>
index 00000000..97e3043a<br>
--- /dev/null<br>
+++ b/xlat/<a href="http://drm_vblank_seq_type.in" rel="noreferrer" target="_blank">drm_vblank_seq_type.in</a><br>
@@ -0,0 +1,3 @@<br>
+#sorted<br>
+_DRM_VBLANK_ABSOLUTE           0x0<br>
+_DRM_VBLANK_RELATIVE           0x1<br>
diff --git a/xlat/<a href="http://drm_vblank_seq_type_flags.in" rel="noreferrer" target="_blank">drm_vblank_seq_type_flags.in</a> b/xlat/<a href="http://drm_vblank_seq_type_flags.in" rel="noreferrer" target="_blank">drm_vblank_seq_type_flags.in</a><br>
new file mode 100644<br>
index 00000000..be9e2e4f<br>
--- /dev/null<br>
+++ b/xlat/<a href="http://drm_vblank_seq_type_flags.in" rel="noreferrer" target="_blank">drm_vblank_seq_type_flags.in</a><br>
@@ -0,0 +1,6 @@<br>
+#sorted<br>
+_DRM_VBLANK_EVENT      0x4000000<br>
+_DRM_VBLANK_FLIP       0x8000000<br>
+_DRM_VBLANK_NEXTONMISS 0x10000000<br>
+_DRM_VBLANK_SECONDARY  0x20000000<br>
+_DRM_VBLANK_SIGNAL     0x40000000<br>
-- <br>
2.20.1<br>
<br>
</blockquote></div></div>