@@ -234,8 +234,9 @@ typedef struct DisplayChangeListenerOps {
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);
+ QemuDmaBuf *dmabuf);
+ void (*dpy_gl_cursor_position)(DisplayChangeListener *dcl,
+ uint32_t pos_x, uint32_t pos_y);
void (*dpy_gl_release_dmabuf)(DisplayChangeListener *dcl,
QemuDmaBuf *dmabuf);
void (*dpy_gl_update)(DisplayChangeListener *dcl,
@@ -309,8 +310,9 @@ void dpy_gl_scanout_texture(QemuConsole *con,
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);
+ QemuDmaBuf *dmabuf);
+void dpy_gl_cursor_position(QemuConsole *con,
+ uint32_t pos_x, uint32_t pos_y);
void dpy_gl_release_dmabuf(QemuConsole *con,
QemuDmaBuf *dmabuf);
void dpy_gl_update(QemuConsole *con,
@@ -1758,13 +1758,22 @@ void dpy_gl_scanout_dmabuf(QemuConsole *con,
}
void dpy_gl_cursor_dmabuf(QemuConsole *con,
- QemuDmaBuf *dmabuf,
- uint32_t pos_x, uint32_t pos_y)
+ QemuDmaBuf *dmabuf)
{
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);
+ con->gl->ops->dpy_gl_cursor_dmabuf(con->gl, dmabuf);
+ }
+}
+
+void dpy_gl_cursor_position(QemuConsole *con,
+ uint32_t pos_x, uint32_t pos_y)
+{
+ assert(con->gl);
+
+ if (con->gl->ops->dpy_gl_cursor_position) {
+ con->gl->ops->dpy_gl_cursor_position(con->gl, pos_x, pos_y);
}
}
@@ -84,14 +84,10 @@ static void egl_scanout_dmabuf(DisplayChangeListener *dcl,
}
static void egl_cursor_dmabuf(DisplayChangeListener *dcl,
- QemuDmaBuf *dmabuf,
- uint32_t pos_x, uint32_t pos_y)
+ QemuDmaBuf *dmabuf)
{
egl_dpy *edpy = container_of(dcl, egl_dpy, dcl);
- edpy->pos_x = pos_x;
- edpy->pos_y = pos_y;
-
egl_dmabuf_import_texture(dmabuf);
if (!dmabuf->texture) {
return;
@@ -101,6 +97,15 @@ static void egl_cursor_dmabuf(DisplayChangeListener *dcl,
dmabuf->texture, false);
}
+static void egl_cursor_position(DisplayChangeListener *dcl,
+ uint32_t pos_x, uint32_t pos_y)
+{
+ egl_dpy *edpy = container_of(dcl, egl_dpy, dcl);
+
+ edpy->pos_x = pos_x;
+ edpy->pos_y = pos_y;
+}
+
static void egl_release_dmabuf(DisplayChangeListener *dcl,
QemuDmaBuf *dmabuf)
{
@@ -150,6 +155,7 @@ static const DisplayChangeListenerOps egl_ops = {
.dpy_gl_scanout_texture = egl_scanout_texture,
.dpy_gl_scanout_dmabuf = egl_scanout_dmabuf,
.dpy_gl_cursor_dmabuf = egl_cursor_dmabuf,
+ .dpy_gl_cursor_position = egl_cursor_position,
.dpy_gl_release_dmabuf = egl_release_dmabuf,
.dpy_gl_update = egl_scanout_flush,
};
Add a separate callback to set the position of the cursor dmabuf. Note that the position is the upper left corner not the hotspot. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> --- include/ui/console.h | 10 ++++++---- ui/console.c | 15 ++++++++++++--- ui/egl-headless.c | 16 +++++++++++----- 3 files changed, 29 insertions(+), 12 deletions(-)