diff options
author | Gerd Hoffmann | 2017-10-10 15:54:48 +0200 |
---|---|---|
committer | Gerd Hoffmann | 2017-10-17 10:25:42 +0200 |
commit | 4133fa711f37f0db303bf5aac03ea31b5be6ac1d (patch) | |
tree | 61059c0bc0d3a77083f0fd25dffd632f0d52b8c8 /include | |
parent | Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging (diff) | |
download | qemu-4133fa711f37f0db303bf5aac03ea31b5be6ac1d.tar.gz qemu-4133fa711f37f0db303bf5aac03ea31b5be6ac1d.tar.xz qemu-4133fa711f37f0db303bf5aac03ea31b5be6ac1d.zip |
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 'include')
-rw-r--r-- | include/qemu/typedefs.h | 1 | ||||
-rw-r--r-- | include/ui/console.h | 25 |
2 files changed, 26 insertions, 0 deletions
diff --git a/include/qemu/typedefs.h b/include/qemu/typedefs.h index 980d2b330e..3dbc69b1e9 100644 --- a/include/qemu/typedefs.h +++ b/include/qemu/typedefs.h @@ -83,6 +83,7 @@ typedef struct PropertyInfo PropertyInfo; typedef struct PS2State PS2State; typedef struct QEMUBH QEMUBH; typedef struct QemuConsole QemuConsole; +typedef struct QemuDmaBuf QemuDmaBuf; typedef struct QEMUFile QEMUFile; typedef struct QemuOpt QemuOpt; typedef struct QemuOpts QemuOpts; diff --git a/include/ui/console.h b/include/ui/console.h index 6966e4bd9d..158969f978 100644 --- a/include/ui/console.h +++ b/include/ui/console.h @@ -5,6 +5,7 @@ #include "qom/object.h" #include "qapi/qmp/qdict.h" #include "qemu/notify.h" +#include "qemu/typedefs.h" #include "qapi-types.h" #include "qemu/error-report.h" #include "qapi/error.h" @@ -180,6 +181,15 @@ struct QEMUGLParams { int minor_ver; }; +struct QemuDmaBuf { + int fd; + uint32_t width; + uint32_t height; + uint32_t stride; + uint32_t fourcc; + uint32_t texture; +}; + typedef struct DisplayChangeListenerOps { const char *dpy_name; @@ -220,6 +230,13 @@ typedef struct DisplayChangeListenerOps { uint32_t backing_height, uint32_t x, uint32_t y, uint32_t w, uint32_t h); + void (*dpy_gl_scanout_dmabuf)(DisplayChangeListener *dcl, + QemuDmaBuf *dmabuf); + void (*dpy_gl_cursor_dmabuf)(DisplayChangeListener *dcl, + QemuDmaBuf *dmabuf, + uint32_t pos_x, uint32_t pos_y); + void (*dpy_gl_release_dmabuf)(DisplayChangeListener *dcl, + QemuDmaBuf *dmabuf); void (*dpy_gl_update)(DisplayChangeListener *dcl, uint32_t x, uint32_t y, uint32_t w, uint32_t h); @@ -288,6 +305,13 @@ void dpy_gl_scanout_texture(QemuConsole *con, uint32_t backing_id, bool backing_y_0_top, uint32_t backing_width, uint32_t backing_height, uint32_t x, uint32_t y, uint32_t w, uint32_t h); +void dpy_gl_scanout_dmabuf(QemuConsole *con, + QemuDmaBuf *dmabuf); +void dpy_gl_cursor_dmabuf(QemuConsole *con, + QemuDmaBuf *dmabuf, + uint32_t pos_x, uint32_t pos_y); +void dpy_gl_release_dmabuf(QemuConsole *con, + QemuDmaBuf *dmabuf); void dpy_gl_update(QemuConsole *con, uint32_t x, uint32_t y, uint32_t w, uint32_t h); @@ -298,6 +322,7 @@ int dpy_gl_ctx_make_current(QemuConsole *con, QEMUGLContext ctx); QEMUGLContext dpy_gl_ctx_get_current(QemuConsole *con); bool console_has_gl(QemuConsole *con); +bool console_has_gl_dmabuf(QemuConsole *con); static inline int surface_stride(DisplaySurface *s) { |