From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Gerd Hoffmann <kraxel@redhat.com>
Subject: [Qemu-devel] [PATCH 1/4] opengl: split up dpy_gl_cursor ops
Date: Mon, 23 Oct 2017 14:03:14 +0200 [thread overview]
Message-ID: <20171023120317.8296-2-kraxel@redhat.com> (raw)
In-Reply-To: <20171023120317.8296-1-kraxel@redhat.com>
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(-)
diff --git a/include/ui/console.h b/include/ui/console.h
index 580dfc57ee..fa68ba5737 100644
--- a/include/ui/console.h
+++ b/include/ui/console.h
@@ -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,
diff --git a/ui/console.c b/ui/console.c
index eca854cbd5..31c14f83d4 100644
--- a/ui/console.c
+++ b/ui/console.c
@@ -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);
}
}
diff --git a/ui/egl-headless.c b/ui/egl-headless.c
index 5d50226869..c75f5ac655 100644
--- a/ui/egl-headless.c
+++ b/ui/egl-headless.c
@@ -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,
};
--
2.9.3
next prev parent reply other threads:[~2017-10-23 12:03 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-23 12:03 [Qemu-devel] [PATCH 0/4] gtk: add dmabuf support Gerd Hoffmann
2017-10-23 12:03 ` Gerd Hoffmann [this message]
2017-10-23 12:03 ` [Qemu-devel] [PATCH 2/4] gtk: make GtkGlArea usage a runtime option Gerd Hoffmann
2017-10-23 12:03 ` [Qemu-devel] [PATCH 3/4] gtk: use GtkGlArea on wayland only Gerd Hoffmann
2017-10-23 12:03 ` [Qemu-devel] [PATCH 4/4] gtk-egl: add dmabuf support Gerd Hoffmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171023120317.8296-2-kraxel@redhat.com \
--to=kraxel@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).