qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 0/3] opengl: some dmabuf support updates
@ 2018-02-20 11:04 Gerd Hoffmann
  2018-02-20 11:04 ` [Qemu-devel] [PATCH 1/3] console/opengl: split up dpy_gl_cursor ops Gerd Hoffmann
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Gerd Hoffmann @ 2018-02-20 11:04 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann

This series updates the UI interface for dmabug cursors.  Splits the
callback into two, so we have a separate call for cursor moves.  Also
adds hotspot information.  Series also includes two small fixes in egl
code.

Gerd Hoffmann (3):
  console/opengl: split up dpy_gl_cursor ops
  egl-headless: cursor_dmabuf: handle NULL cursor
  egl-helpers: add alpha channel to texture format

 include/ui/console.h | 13 ++++++++-----
 ui/console.c         | 18 ++++++++++++++----
 ui/egl-headless.c    | 30 ++++++++++++++++++++----------
 ui/egl-helpers.c     |  2 +-
 4 files changed, 43 insertions(+), 20 deletions(-)

-- 
2.9.3

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Qemu-devel] [PATCH 1/3] console/opengl: split up dpy_gl_cursor ops
  2018-02-20 11:04 [Qemu-devel] [PATCH 0/3] opengl: some dmabuf support updates Gerd Hoffmann
@ 2018-02-20 11:04 ` Gerd Hoffmann
  2018-02-20 11:04 ` [Qemu-devel] [PATCH 2/3] egl-headless: cursor_dmabuf: handle NULL cursor Gerd Hoffmann
  2018-02-20 11:04 ` [Qemu-devel] [PATCH 3/3] egl-helpers: add alpha channel to texture format Gerd Hoffmann
  2 siblings, 0 replies; 4+ messages in thread
From: Gerd Hoffmann @ 2018-02-20 11:04 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann

Split the cursor callback into two, one for setting the dmabuf,
one for setting the position.  Also add hotspot information.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 include/ui/console.h | 13 ++++++++-----
 ui/console.c         | 18 ++++++++++++++----
 ui/egl-headless.c    | 17 ++++++++++++-----
 3 files changed, 34 insertions(+), 14 deletions(-)

diff --git a/include/ui/console.h b/include/ui/console.h
index 12fef80923..94a670492a 100644
--- a/include/ui/console.h
+++ b/include/ui/console.h
@@ -230,8 +230,10 @@ 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, bool have_hot,
+                                 uint32_t hot_x, uint32_t hot_y);
+    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,
@@ -304,9 +306,10 @@ void dpy_gl_scanout_texture(QemuConsole *con,
                             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_cursor_dmabuf(QemuConsole *con, QemuDmaBuf *dmabuf,
+                          bool have_hot, uint32_t hot_x, uint32_t hot_y);
+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 36584d039e..e22931a396 100644
--- a/ui/console.c
+++ b/ui/console.c
@@ -1760,14 +1760,24 @@ void dpy_gl_scanout_dmabuf(QemuConsole *con,
     con->gl->ops->dpy_gl_scanout_dmabuf(con->gl, dmabuf);
 }
 
-void dpy_gl_cursor_dmabuf(QemuConsole *con,
-                          QemuDmaBuf *dmabuf,
-                          uint32_t pos_x, uint32_t pos_y)
+void dpy_gl_cursor_dmabuf(QemuConsole *con, QemuDmaBuf *dmabuf,
+                          bool have_hot, uint32_t hot_x, uint32_t hot_y)
 {
     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,
+                                           have_hot, hot_x, hot_y);
+    }
+}
+
+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..825ee5cc12 100644
--- a/ui/egl-headless.c
+++ b/ui/egl-headless.c
@@ -84,14 +84,11 @@ 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, bool have_hot,
+                              uint32_t hot_x, uint32_t hot_y)
 {
     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 +98,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 +156,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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [Qemu-devel] [PATCH 2/3] egl-headless: cursor_dmabuf: handle NULL cursor
  2018-02-20 11:04 [Qemu-devel] [PATCH 0/3] opengl: some dmabuf support updates Gerd Hoffmann
  2018-02-20 11:04 ` [Qemu-devel] [PATCH 1/3] console/opengl: split up dpy_gl_cursor ops Gerd Hoffmann
@ 2018-02-20 11:04 ` Gerd Hoffmann
  2018-02-20 11:04 ` [Qemu-devel] [PATCH 3/3] egl-helpers: add alpha channel to texture format Gerd Hoffmann
  2 siblings, 0 replies; 4+ messages in thread
From: Gerd Hoffmann @ 2018-02-20 11:04 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann

The cursor dmabuf can be NULL, in case no cursor defined by the guest.
Happens for example when linux guests show the framebuffer console.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 ui/egl-headless.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/ui/egl-headless.c b/ui/egl-headless.c
index 825ee5cc12..60c9061114 100644
--- a/ui/egl-headless.c
+++ b/ui/egl-headless.c
@@ -89,13 +89,16 @@ static void egl_cursor_dmabuf(DisplayChangeListener *dcl,
 {
     egl_dpy *edpy = container_of(dcl, egl_dpy, dcl);
 
-    egl_dmabuf_import_texture(dmabuf);
-    if (!dmabuf->texture) {
-        return;
+    if (dmabuf) {
+        egl_dmabuf_import_texture(dmabuf);
+        if (!dmabuf->texture) {
+            return;
+        }
+        egl_fb_setup_for_tex(&edpy->cursor_fb, dmabuf->width, dmabuf->height,
+                             dmabuf->texture, false);
+    } else {
+        egl_fb_destroy(&edpy->cursor_fb);
     }
-
-    egl_fb_setup_for_tex(&edpy->cursor_fb, dmabuf->width, dmabuf->height,
-                         dmabuf->texture, false);
 }
 
 static void egl_cursor_position(DisplayChangeListener *dcl,
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [Qemu-devel] [PATCH 3/3] egl-helpers: add alpha channel to texture format
  2018-02-20 11:04 [Qemu-devel] [PATCH 0/3] opengl: some dmabuf support updates Gerd Hoffmann
  2018-02-20 11:04 ` [Qemu-devel] [PATCH 1/3] console/opengl: split up dpy_gl_cursor ops Gerd Hoffmann
  2018-02-20 11:04 ` [Qemu-devel] [PATCH 2/3] egl-headless: cursor_dmabuf: handle NULL cursor Gerd Hoffmann
@ 2018-02-20 11:04 ` Gerd Hoffmann
  2 siblings, 0 replies; 4+ messages in thread
From: Gerd Hoffmann @ 2018-02-20 11:04 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann

Needed when rendering cursers which (unlike framebuffers)
actually are transparent.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 ui/egl-helpers.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ui/egl-helpers.c b/ui/egl-helpers.c
index 5fa60ef4e8..16dc3ded36 100644
--- a/ui/egl-helpers.c
+++ b/ui/egl-helpers.c
@@ -83,7 +83,7 @@ void egl_fb_setup_new_tex(egl_fb *fb, int width, int height)
 
     glGenTextures(1, &texture);
     glBindTexture(GL_TEXTURE_2D, texture);
-    glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height,
+    glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height,
                  0, GL_BGRA, GL_UNSIGNED_BYTE, 0);
 
     egl_fb_setup_for_tex(fb, width, height, texture, true);
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-02-20 11:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-20 11:04 [Qemu-devel] [PATCH 0/3] opengl: some dmabuf support updates Gerd Hoffmann
2018-02-20 11:04 ` [Qemu-devel] [PATCH 1/3] console/opengl: split up dpy_gl_cursor ops Gerd Hoffmann
2018-02-20 11:04 ` [Qemu-devel] [PATCH 2/3] egl-headless: cursor_dmabuf: handle NULL cursor Gerd Hoffmann
2018-02-20 11:04 ` [Qemu-devel] [PATCH 3/3] egl-helpers: add alpha channel to texture format Gerd Hoffmann

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).