Merge tag 'for-upstream' of https://gitlab.com/bonzini/qemu into staging
[qemu/ar7.git] / ui / udmabuf.c
blobcebceb261001be02da9e4c330e98bb36b0e95650
1 /*
2 * udmabuf helper functions.
4 * This work is licensed under the terms of the GNU GPL, version 2 or later.
5 * See the COPYING file in the top-level directory.
6 */
7 #include "qemu/osdep.h"
8 #include "qapi/error.h"
9 #include "ui/console.h"
11 #include <fcntl.h>
12 #include <sys/ioctl.h>
14 int udmabuf_fd(void)
16 static bool first = true;
17 static int udmabuf;
19 if (!first) {
20 return udmabuf;
22 first = false;
24 udmabuf = open("/dev/udmabuf", O_RDWR);
25 if (udmabuf < 0) {
26 warn_report("open /dev/udmabuf: %s", strerror(errno));
28 return udmabuf;