diff options
author | Marc-André Lureau | 2021-10-09 21:48:46 +0200 |
---|---|---|
committer | Marc-André Lureau | 2021-12-21 07:50:21 +0100 |
commit | 5e79d516e8ac818d2a90aae9f787775055434ee9 (patch) | |
tree | 572cadfe13cb13f683b0be625929427dbca469e6 /include/ui/console.h | |
parent | ui: dispatch GL events to all listeners (diff) | |
download | qemu-5e79d516e8ac818d2a90aae9f787775055434ee9.tar.gz qemu-5e79d516e8ac818d2a90aae9f787775055434ee9.tar.xz qemu-5e79d516e8ac818d2a90aae9f787775055434ee9.zip |
ui: split the GL context in a different object
This will allow to have one GL context but a variable number of
listeners.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'include/ui/console.h')
-rw-r--r-- | include/ui/console.h | 34 |
1 files changed, 22 insertions, 12 deletions
diff --git a/include/ui/console.h b/include/ui/console.h index 3ff51b492e..fe08b4dd04 100644 --- a/include/ui/console.h +++ b/include/ui/console.h @@ -179,6 +179,7 @@ typedef struct QemuDmaBuf { } QemuDmaBuf; typedef struct DisplayState DisplayState; +typedef struct DisplayGLCtx DisplayGLCtx; typedef struct DisplayChangeListenerOps { const char *dpy_name; @@ -214,16 +215,6 @@ typedef struct DisplayChangeListenerOps { QEMUCursor *cursor); /* required if GL */ - QEMUGLContext (*dpy_gl_ctx_create)(DisplayChangeListener *dcl, - QEMUGLParams *params); - /* required if GL */ - void (*dpy_gl_ctx_destroy)(DisplayChangeListener *dcl, - QEMUGLContext ctx); - /* required if GL */ - int (*dpy_gl_ctx_make_current)(DisplayChangeListener *dcl, - QEMUGLContext ctx); - - /* required if GL */ void (*dpy_gl_scanout_disable)(DisplayChangeListener *dcl); /* required if GL */ void (*dpy_gl_scanout_texture)(DisplayChangeListener *dcl, @@ -263,6 +254,26 @@ struct DisplayChangeListener { QLIST_ENTRY(DisplayChangeListener) next; }; +typedef struct DisplayGLCtxOps { + /* + * We only check if the GLCtx is compatible with a DCL via ops. A natural + * evolution of this would be a callback to check some runtime requirements + * and allow various DCL kinds. + */ + const DisplayChangeListenerOps *compatible_dcl; + + QEMUGLContext (*dpy_gl_ctx_create)(DisplayGLCtx *dgc, + QEMUGLParams *params); + void (*dpy_gl_ctx_destroy)(DisplayGLCtx *dgc, + QEMUGLContext ctx); + int (*dpy_gl_ctx_make_current)(DisplayGLCtx *dgc, + QEMUGLContext ctx); +} DisplayGLCtxOps; + +struct DisplayGLCtx { + const DisplayGLCtxOps *ops; +}; + DisplayState *init_displaystate(void); DisplaySurface *qemu_create_displaysurface_from(int width, int height, pixman_format_code_t format, @@ -409,8 +420,7 @@ void graphic_hw_gl_block(QemuConsole *con, bool block); void qemu_console_early_init(void); -void qemu_console_set_display_gl_ctx(QemuConsole *con, - DisplayChangeListener *dcl); +void qemu_console_set_display_gl_ctx(QemuConsole *con, DisplayGLCtx *ctx); QemuConsole *qemu_console_lookup_by_index(unsigned int index); QemuConsole *qemu_console_lookup_by_device(DeviceState *dev, uint32_t head); |