aboutsummaryrefslogtreecommitdiff
path: root/ui
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2017-10-10 15:54:48 +0200
committerGerd Hoffmann <kraxel@redhat.com>2017-10-17 10:25:42 +0200
commit4133fa711f37f0db303bf5aac03ea31b5be6ac1d (patch)
tree61059c0bc0d3a77083f0fd25dffd632f0d52b8c8 /ui
parentc5bbcaa4b7c0f8a322bebe9ec563560178a68b55 (diff)
downloadqemu-4133fa711f37f0db303bf5aac03ea31b5be6ac1d.zip
qemu-4133fa711f37f0db303bf5aac03ea31b5be6ac1d.tar.gz
qemu-4133fa711f37f0db303bf5aac03ea31b5be6ac1d.tar.bz2
console: add support for dmabufs
This patch adds support for dma-bufs to the qemu console interfaces. It adds a new "struct QemuDmaBuf" to represent a dmabuf with accociated metatdata (size, format). It adds three functions (and DisplayChangeListenerOps operations) to set a dma-buf as display scanout, as cursor and to release a dmabuf. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Message-id: 20171010135453.6704-2-kraxel@redhat.com
Diffstat (limited to 'ui')
-rw-r--r--ui/console.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/ui/console.c b/ui/console.c
index b82c279..eca854c 100644
--- a/ui/console.c
+++ b/ui/console.c
@@ -1404,6 +1404,11 @@ bool console_has_gl(QemuConsole *con)
return con->gl != NULL;
}
+bool console_has_gl_dmabuf(QemuConsole *con)
+{
+ return con->gl != NULL && con->gl->ops->dpy_gl_scanout_dmabuf != NULL;
+}
+
void register_displaychangelistener(DisplayChangeListener *dcl)
{
static const char nodev[] =
@@ -1745,6 +1750,34 @@ void dpy_gl_scanout_texture(QemuConsole *con,
x, y, width, height);
}
+void dpy_gl_scanout_dmabuf(QemuConsole *con,
+ QemuDmaBuf *dmabuf)
+{
+ assert(con->gl);
+ con->gl->ops->dpy_gl_scanout_dmabuf(con->gl, dmabuf);
+}
+
+void dpy_gl_cursor_dmabuf(QemuConsole *con,
+ QemuDmaBuf *dmabuf,
+ uint32_t pos_x, uint32_t pos_y)
+{
+ assert(con->gl);
+
+ if (con->gl->ops->dpy_gl_cursor_dmabuf) {
+ con->gl->ops->dpy_gl_cursor_dmabuf(con->gl, dmabuf, pos_x, pos_y);
+ }
+}
+
+void dpy_gl_release_dmabuf(QemuConsole *con,
+ QemuDmaBuf *dmabuf)
+{
+ assert(con->gl);
+
+ if (con->gl->ops->dpy_gl_release_dmabuf) {
+ con->gl->ops->dpy_gl_release_dmabuf(con->gl, dmabuf);
+ }
+}
+
void dpy_gl_update(QemuConsole *con,
uint32_t x, uint32_t y, uint32_t w, uint32_t h)
{