ui: add a DCLOps callback to check dmabuf support

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20210204105232.834642-13-marcandre.lureau@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
This commit is contained in:
Marc-André Lureau 2021-02-04 14:52:24 +04:00 committed by Gerd Hoffmann
parent a7dfbe289e
commit d0e137bc9a
2 changed files with 15 additions and 0 deletions

View File

@ -224,6 +224,8 @@ typedef struct DisplayChangeListenerOps {
uint32_t backing_height,
uint32_t x, uint32_t y,
uint32_t w, uint32_t h);
/* optional (default to true if has dpy_gl_scanout_dmabuf) */
bool (*dpy_has_dmabuf)(DisplayChangeListener *dcl);
/* optional */
void (*dpy_gl_scanout_dmabuf)(DisplayChangeListener *dcl,
QemuDmaBuf *dmabuf);

View File

@ -1463,6 +1463,19 @@ bool console_has_gl(QemuConsole *con)
return con->gl != NULL;
}
static bool displaychangelistener_has_dmabuf(DisplayChangeListener *dcl)
{
if (dcl->ops->dpy_has_dmabuf) {
return dcl->ops->dpy_has_dmabuf(dcl);
}
if (dcl->ops->dpy_gl_scanout_dmabuf) {
return true;
}
return false;
}
void register_displaychangelistener(DisplayChangeListener *dcl)
{
static const char nodev[] =