qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PULL 11/12] dmabuf: add y0_top, pass it to spice
  2018-08-21  7:44 [Qemu-devel] [PULL 00/12] Ui 20180821 patches Gerd Hoffmann
@ 2018-08-21  7:45 ` Gerd Hoffmann
  0 siblings, 0 replies; 18+ messages in thread
From: Gerd Hoffmann @ 2018-08-21  7:45 UTC (permalink / raw)
  To: qemu-devel; +Cc: libvir-list, Gerd Hoffmann, Marc-André Lureau

From: Marc-André Lureau <marcandre.lureau@redhat.com>

Some scanouts during boot are top-down without it.

y0_top is set from VHOST_USER_GPU_DMABUF_SCANOUT code path in the last
patch of this series.

In current QEMU code base, only vfio/display uses dmabuf API. But the
VFIO query interface doesn't provide or need that detail so far.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20180713130916.4153-5-marcandre.lureau@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 include/ui/console.h | 1 +
 ui/spice-display.c   | 3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/include/ui/console.h b/include/ui/console.h
index 981b519dde..fb969caf70 100644
--- a/include/ui/console.h
+++ b/include/ui/console.h
@@ -186,6 +186,7 @@ struct QemuDmaBuf {
     uint32_t  stride;
     uint32_t  fourcc;
     uint32_t  texture;
+    bool      y0_top;
 };
 
 typedef struct DisplayChangeListenerOps {
diff --git a/ui/spice-display.c b/ui/spice-display.c
index f1d341091a..e3d0fde77a 100644
--- a/ui/spice-display.c
+++ b/ui/spice-display.c
@@ -1056,7 +1056,8 @@ static void qemu_spice_gl_update(DisplayChangeListener *dcl,
             /* note: spice server will close the fd, so hand over a dup */
             spice_qxl_gl_scanout(&ssd->qxl, dup(dmabuf->fd),
                                  dmabuf->width, dmabuf->height,
-                                 dmabuf->stride, dmabuf->fourcc, false);
+                                 dmabuf->stride, dmabuf->fourcc,
+                                 dmabuf->y0_top);
         }
         qemu_spice_gl_monitor_config(ssd, 0, 0, dmabuf->width, dmabuf->height);
         ssd->guest_dmabuf_refresh = false;
-- 
2.9.3

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

* [Qemu-devel] [PULL 11/12] dmabuf: add y0_top, pass it to spice
  2018-08-21 12:05 [Qemu-devel] [PULL 00/12] Ui 20180821 v2 patches Gerd Hoffmann
@ 2018-08-21 12:05 ` Gerd Hoffmann
  0 siblings, 0 replies; 18+ messages in thread
From: Gerd Hoffmann @ 2018-08-21 12:05 UTC (permalink / raw)
  To: qemu-devel; +Cc: libvir-list, Gerd Hoffmann, Marc-André Lureau

From: Marc-André Lureau <marcandre.lureau@redhat.com>

Some scanouts during boot are top-down without it.

y0_top is set from VHOST_USER_GPU_DMABUF_SCANOUT code path in the last
patch of this series.

In current QEMU code base, only vfio/display uses dmabuf API. But the
VFIO query interface doesn't provide or need that detail so far.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20180713130916.4153-5-marcandre.lureau@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 include/ui/console.h | 1 +
 ui/spice-display.c   | 3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/include/ui/console.h b/include/ui/console.h
index 981b519dde..fb969caf70 100644
--- a/include/ui/console.h
+++ b/include/ui/console.h
@@ -186,6 +186,7 @@ struct QemuDmaBuf {
     uint32_t  stride;
     uint32_t  fourcc;
     uint32_t  texture;
+    bool      y0_top;
 };
 
 typedef struct DisplayChangeListenerOps {
diff --git a/ui/spice-display.c b/ui/spice-display.c
index 7b230987dc..2f8adb6b9f 100644
--- a/ui/spice-display.c
+++ b/ui/spice-display.c
@@ -1056,7 +1056,8 @@ static void qemu_spice_gl_update(DisplayChangeListener *dcl,
             /* note: spice server will close the fd, so hand over a dup */
             spice_qxl_gl_scanout(&ssd->qxl, dup(dmabuf->fd),
                                  dmabuf->width, dmabuf->height,
-                                 dmabuf->stride, dmabuf->fourcc, false);
+                                 dmabuf->stride, dmabuf->fourcc,
+                                 dmabuf->y0_top);
         }
         qemu_spice_gl_monitor_config(ssd, 0, 0, dmabuf->width, dmabuf->height);
         ssd->guest_dmabuf_refresh = false;
-- 
2.9.3

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

* [Qemu-devel] [PULL 00/12] Ui 20180823 v3 patches
@ 2018-08-23  9:56 Gerd Hoffmann
  2018-08-23  9:56 ` [Qemu-devel] [PULL 01/12] ui/sdl2: Remove the obsolete SDL_INIT_NOPARACHUTE flag Gerd Hoffmann
                   ` (12 more replies)
  0 siblings, 13 replies; 18+ messages in thread
From: Gerd Hoffmann @ 2018-08-23  9:56 UTC (permalink / raw)
  To: qemu-devel; +Cc: libvir-list, Gerd Hoffmann

The following changes since commit d0092d90eb546a8bbe9e9120426c189474123797:

  Merge remote-tracking branch 'remotes/cohuck/tags/s390x-20180820' into staging (2018-08-20 17:41:18 +0100)

are available in the git repository at:

  git://git.kraxel.org/qemu tags/ui-20180823-v3-pull-request

for you to fetch changes up to 63cde1d13d0767f778a130e2c93c15ad709e1276:

  util: promote qemu_egl_rendernode_open() to libqemuutil (2018-08-23 11:53:26 +0200)

----------------------------------------------------------------
ui: misc fixes which piled up during 3.0 release freeze

----------------------------------------------------------------

Daniel P. Berrangé (2):
  doc: switch to modern syntax for VNC TLS setup
  vnc: remove support for deprecated tls, x509, x509verify options

Marc-André Lureau (3):
  ui: use enum to string helpers
  dmabuf: add y0_top, pass it to spice
  util: promote qemu_egl_rendernode_open() to libqemuutil

Paolo Bonzini (2):
  spice-display: access ptr_x/ptr_y under Mutex
  spice-display: fix qemu_spice_cursor_refresh_bh locking

Peter Wu (1):
  vnc: fix memleak of the "vnc-worker-output" name

Philippe Mathieu-Daudé (1):
  ui/vnc: Remove useless parenthesis around DIV_ROUND_UP macro

Tao Wu (1):
  sdl2: redraw correctly when scanout_mode enabled.

Thomas Huth (2):
  ui/sdl2: Remove the obsolete SDL_INIT_NOPARACHUTE flag
  ui/sdl2: Fix broken -full-screen CLI option

 include/qemu/drm.h   |  6 ++++
 include/ui/console.h |  1 +
 qemu-keymap.c        |  2 +-
 ui/console.c         |  6 ++--
 ui/egl-helpers.c     | 51 ++--------------------------
 ui/sdl2-gl.c         |  5 +++
 ui/sdl2.c            | 13 +++-----
 ui/spice-display.c   | 42 +++++++++++++++--------
 ui/vnc-enc-tight.c   |  2 +-
 ui/vnc-jobs.c        |  3 +-
 ui/vnc.c             | 94 ++--------------------------------------------------
 util/drm.c           | 66 ++++++++++++++++++++++++++++++++++++
 MAINTAINERS          |  1 +
 qemu-deprecated.texi | 20 -----------
 qemu-doc.texi        | 20 ++++++++---
 qemu-options.hx      | 43 ------------------------
 util/Makefile.objs   |  1 +
 17 files changed, 139 insertions(+), 237 deletions(-)
 create mode 100644 include/qemu/drm.h
 create mode 100644 util/drm.c

-- 
2.9.3

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

* [Qemu-devel] [PULL 01/12] ui/sdl2: Remove the obsolete SDL_INIT_NOPARACHUTE flag
  2018-08-23  9:56 [Qemu-devel] [PULL 00/12] Ui 20180823 v3 patches Gerd Hoffmann
@ 2018-08-23  9:56 ` Gerd Hoffmann
  2018-08-23  9:56 ` [Qemu-devel] [PULL 02/12] vnc: fix memleak of the "vnc-worker-output" name Gerd Hoffmann
                   ` (11 subsequent siblings)
  12 siblings, 0 replies; 18+ messages in thread
From: Gerd Hoffmann @ 2018-08-23  9:56 UTC (permalink / raw)
  To: qemu-devel; +Cc: libvir-list, Gerd Hoffmann, Thomas Huth

From: Thomas Huth <thuth@redhat.com>

SDL_INIT_NOPARACHUTE is not used in SDL2 anymore, and the define is just
a dummy (see https://wiki.libsdl.org/MigrationGuide#Some_general_truths
for example). So we can remove it and get rid of the "flags" variable
nowadays.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-id: 1533721602-15763-1-git-send-email-thuth@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 ui/sdl2.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/ui/sdl2.c b/ui/sdl2.c
index 76e59427cc..755a7134ff 100644
--- a/ui/sdl2.c
+++ b/ui/sdl2.c
@@ -761,7 +761,6 @@ static void sdl2_display_early_init(DisplayOptions *o)
 
 static void sdl2_display_init(DisplayState *ds, DisplayOptions *o)
 {
-    int flags;
     uint8_t data = 0;
     char *filename;
     int i;
@@ -782,8 +781,7 @@ static void sdl2_display_init(DisplayState *ds, DisplayOptions *o)
     setenv("SDL_VIDEODRIVER", "x11", 0);
 #endif
 
-    flags = SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE;
-    if (SDL_Init(flags)) {
+    if (SDL_Init(SDL_INIT_VIDEO)) {
         fprintf(stderr, "Could not initialize SDL(%s) - exiting\n",
                 SDL_GetError());
         exit(1);
-- 
2.9.3

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

* [Qemu-devel] [PULL 02/12] vnc: fix memleak of the "vnc-worker-output" name
  2018-08-23  9:56 [Qemu-devel] [PULL 00/12] Ui 20180823 v3 patches Gerd Hoffmann
  2018-08-23  9:56 ` [Qemu-devel] [PULL 01/12] ui/sdl2: Remove the obsolete SDL_INIT_NOPARACHUTE flag Gerd Hoffmann
@ 2018-08-23  9:56 ` Gerd Hoffmann
  2018-08-23  9:56 ` [Qemu-devel] [PULL 03/12] ui: use enum to string helpers Gerd Hoffmann
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 18+ messages in thread
From: Gerd Hoffmann @ 2018-08-23  9:56 UTC (permalink / raw)
  To: qemu-devel; +Cc: libvir-list, Gerd Hoffmann, Peter Wu, qemu-stable

From: Peter Wu <peter@lekensteyn.nl>

Fixes repeated memory leaks of 18 bytes when using VNC:

    Direct leak of 831024 byte(s) in 46168 object(s) allocated from:
        ...
        #4 0x7f6d2f919bdd in g_strdup_vprintf glib/gstrfuncs.c:514
        #5 0x56085cdcf660 in buffer_init util/buffer.c:59
        #6 0x56085ca6a7ec in vnc_async_encoding_start ui/vnc-jobs.c:177
        #7 0x56085ca6b815 in vnc_worker_thread_loop ui/vnc-jobs.c:240

Fixes: 543b95801f98 ("vnc: attach names to buffers")
Cc: Gerd Hoffmann <kraxel@redhat.com>
CC: qemu-stable@nongnu.org
Signed-off-by: Peter Wu <peter@lekensteyn.nl>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-id: 20180807221830.3844-1-peter@lekensteyn.nl
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 ui/vnc-jobs.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/ui/vnc-jobs.c b/ui/vnc-jobs.c
index b0b15d42a8..929391f85d 100644
--- a/ui/vnc-jobs.c
+++ b/ui/vnc-jobs.c
@@ -193,6 +193,7 @@ static void vnc_async_encoding_start(VncState *orig, VncState *local)
 
 static void vnc_async_encoding_end(VncState *orig, VncState *local)
 {
+    buffer_free(&local->output);
     orig->tight = local->tight;
     orig->zlib = local->zlib;
     orig->hextile = local->hextile;
@@ -278,7 +279,7 @@ static int vnc_worker_thread_loop(VncJobQueue *queue)
         /* Copy persistent encoding data */
         vnc_async_encoding_end(job->vs, &vs);
 
-	qemu_bh_schedule(job->vs->bh);
+        qemu_bh_schedule(job->vs->bh);
     }  else {
         buffer_reset(&vs.output);
         /* Copy persistent encoding data */
-- 
2.9.3

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

* [Qemu-devel] [PULL 03/12] ui: use enum to string helpers
  2018-08-23  9:56 [Qemu-devel] [PULL 00/12] Ui 20180823 v3 patches Gerd Hoffmann
  2018-08-23  9:56 ` [Qemu-devel] [PULL 01/12] ui/sdl2: Remove the obsolete SDL_INIT_NOPARACHUTE flag Gerd Hoffmann
  2018-08-23  9:56 ` [Qemu-devel] [PULL 02/12] vnc: fix memleak of the "vnc-worker-output" name Gerd Hoffmann
@ 2018-08-23  9:56 ` Gerd Hoffmann
  2018-08-23  9:56 ` [Qemu-devel] [PULL 04/12] sdl2: redraw correctly when scanout_mode enabled Gerd Hoffmann
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 18+ messages in thread
From: Gerd Hoffmann @ 2018-08-23  9:56 UTC (permalink / raw)
  To: qemu-devel; +Cc: libvir-list, Gerd Hoffmann, Marc-André Lureau

From: Marc-André Lureau <marcandre.lureau@redhat.com>

Minor code simplification.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Message-id: 20180801092508.4927-1-marcandre.lureau@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 qemu-keymap.c | 2 +-
 ui/console.c  | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/qemu-keymap.c b/qemu-keymap.c
index 6216371aa1..4d00468747 100644
--- a/qemu-keymap.c
+++ b/qemu-keymap.c
@@ -84,7 +84,7 @@ static void walk_map(struct xkb_keymap *map, xkb_keycode_t code, void *data)
     }
     fprintf(outfile, "# evdev %d (0x%x), QKeyCode \"%s\", number 0x%x\n",
             evdev, evdev,
-            QKeyCode_lookup.array[qcode],
+            QKeyCode_str(qcode),
             qcode_to_number(qcode));
 
     /*
diff --git a/ui/console.c b/ui/console.c
index bc58458ee8..3a285bae00 100644
--- a/ui/console.c
+++ b/ui/console.c
@@ -2319,7 +2319,7 @@ bool qemu_display_find_default(DisplayOptions *opts)
 
     for (i = 0; i < ARRAY_SIZE(prio); i++) {
         if (dpys[prio[i]] == NULL) {
-            ui_module_load_one(DisplayType_lookup.array[prio[i]]);
+            ui_module_load_one(DisplayType_str(prio[i]));
         }
         if (dpys[prio[i]] == NULL) {
             continue;
@@ -2337,11 +2337,11 @@ void qemu_display_early_init(DisplayOptions *opts)
         return;
     }
     if (dpys[opts->type] == NULL) {
-        ui_module_load_one(DisplayType_lookup.array[opts->type]);
+        ui_module_load_one(DisplayType_str(opts->type));
     }
     if (dpys[opts->type] == NULL) {
         error_report("Display '%s' is not available.",
-                     DisplayType_lookup.array[opts->type]);
+                     DisplayType_str(opts->type));
         exit(1);
     }
     if (dpys[opts->type]->early_init) {
-- 
2.9.3

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

* [Qemu-devel] [PULL 04/12] sdl2: redraw correctly when scanout_mode enabled.
  2018-08-23  9:56 [Qemu-devel] [PULL 00/12] Ui 20180823 v3 patches Gerd Hoffmann
                   ` (2 preceding siblings ...)
  2018-08-23  9:56 ` [Qemu-devel] [PULL 03/12] ui: use enum to string helpers Gerd Hoffmann
@ 2018-08-23  9:56 ` Gerd Hoffmann
  2018-08-23  9:56 ` [Qemu-devel] [PULL 05/12] doc: switch to modern syntax for VNC TLS setup Gerd Hoffmann
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 18+ messages in thread
From: Gerd Hoffmann @ 2018-08-23  9:56 UTC (permalink / raw)
  To: qemu-devel; +Cc: libvir-list, Gerd Hoffmann, Tao Wu

From: Tao Wu <lepton@google.com>

When scanout_mode enabled, surface is out of sync with actual screen.
In such case, we just call sdl2_gl_scanout_flush to do redraw. This
fixes bug reported in
https://lists.freedesktop.org/archives/virglrenderer-devel/2018-July/001330.html

Signed-off-by: Tao Wu <lepton@google.com>
Message-id: 20180726225900.180698-1-lepton@google.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 ui/sdl2-gl.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/ui/sdl2-gl.c b/ui/sdl2-gl.c
index 83b71853d1..1bf4542d8d 100644
--- a/ui/sdl2-gl.c
+++ b/ui/sdl2-gl.c
@@ -124,6 +124,11 @@ void sdl2_gl_redraw(struct sdl2_console *scon)
 {
     assert(scon->opengl);
 
+    if (scon->scanout_mode) {
+        /* sdl2_gl_scanout_flush actually only care about
+         * the first argument. */
+        return sdl2_gl_scanout_flush(&scon->dcl, 0, 0, 0, 0);
+    }
     if (scon->surface) {
         sdl2_gl_render_surface(scon);
     }
-- 
2.9.3

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

* [Qemu-devel] [PULL 05/12] doc: switch to modern syntax for VNC TLS setup
  2018-08-23  9:56 [Qemu-devel] [PULL 00/12] Ui 20180823 v3 patches Gerd Hoffmann
                   ` (3 preceding siblings ...)
  2018-08-23  9:56 ` [Qemu-devel] [PULL 04/12] sdl2: redraw correctly when scanout_mode enabled Gerd Hoffmann
@ 2018-08-23  9:56 ` Gerd Hoffmann
  2018-08-23  9:56 ` [Qemu-devel] [PULL 06/12] vnc: remove support for deprecated tls, x509, x509verify options Gerd Hoffmann
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 18+ messages in thread
From: Gerd Hoffmann @ 2018-08-23  9:56 UTC (permalink / raw)
  To: qemu-devel; +Cc: libvir-list, Gerd Hoffmann, Daniel P. Berrangé

From: Daniel P. Berrangé <berrange@redhat.com>

The use of 'tls', 'x509' and 'x509verify' properties is the deprecated
backcompat syntax, replaced by use of TLS creds objects.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Message-id: 20180725092751.21767-2-berrange@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 qemu-doc.texi | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/qemu-doc.texi b/qemu-doc.texi
index f74542a0e9..7bd449f398 100644
--- a/qemu-doc.texi
+++ b/qemu-doc.texi
@@ -1103,7 +1103,9 @@ support provides a secure session, but no authentication. This allows any
 client to connect, and provides an encrypted session.
 
 @example
-qemu-system-i386 [...OPTIONS...] -vnc :1,tls,x509=/etc/pki/qemu -monitor stdio
+qemu-system-i386 [...OPTIONS...] \
+  -object tls-creds-x509,id=tls0,dir=/etc/pki/qemu,endpoint=server,verify-peer=no \
+  -vnc :1,tls-creds=tls0 -monitor stdio
 @end example
 
 In the above example @code{/etc/pki/qemu} should contain at least three files,
@@ -1118,10 +1120,14 @@ only be readable by the user owning it.
 Certificates can also provide a means to authenticate the client connecting.
 The server will request that the client provide a certificate, which it will
 then validate against the CA certificate. This is a good choice if deploying
-in an environment with a private internal certificate authority.
+in an environment with a private internal certificate authority. It uses the
+same syntax as previously, but with @code{verify-peer} set to @code{yes}
+instead.
 
 @example
-qemu-system-i386 [...OPTIONS...] -vnc :1,tls,x509verify=/etc/pki/qemu -monitor stdio
+qemu-system-i386 [...OPTIONS...] \
+  -object tls-creds-x509,id=tls0,dir=/etc/pki/qemu,endpoint=server,verify-peer=yes \
+  -vnc :1,tls-creds=tls0 -monitor stdio
 @end example
 
 
@@ -1132,7 +1138,9 @@ Finally, the previous method can be combined with VNC password authentication
 to provide two layers of authentication for clients.
 
 @example
-qemu-system-i386 [...OPTIONS...] -vnc :1,password,tls,x509verify=/etc/pki/qemu -monitor stdio
+qemu-system-i386 [...OPTIONS...] \
+  -object tls-creds-x509,id=tls0,dir=/etc/pki/qemu,endpoint=server,verify-peer=yes \
+  -vnc :1,tls-creds=tls0,password -monitor stdio
 (qemu) change vnc password
 Password: ********
 (qemu)
@@ -1169,7 +1177,9 @@ credentials. This can be enabled, by combining the 'sasl' option
 with the aforementioned TLS + x509 options:
 
 @example
-qemu-system-i386 [...OPTIONS...] -vnc :1,tls,x509,sasl -monitor stdio
+qemu-system-i386 [...OPTIONS...] \
+  -object tls-creds-x509,id=tls0,dir=/etc/pki/qemu,endpoint=server,verify-peer=yes \
+  -vnc :1,tls-creds=tls0,sasl -monitor stdio
 @end example
 
 @node vnc_setup_sasl
-- 
2.9.3

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

* [Qemu-devel] [PULL 06/12] vnc: remove support for deprecated tls, x509, x509verify options
  2018-08-23  9:56 [Qemu-devel] [PULL 00/12] Ui 20180823 v3 patches Gerd Hoffmann
                   ` (4 preceding siblings ...)
  2018-08-23  9:56 ` [Qemu-devel] [PULL 05/12] doc: switch to modern syntax for VNC TLS setup Gerd Hoffmann
@ 2018-08-23  9:56 ` Gerd Hoffmann
  2018-08-23  9:56 ` [Qemu-devel] [PULL 07/12] spice-display: access ptr_x/ptr_y under Mutex Gerd Hoffmann
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 18+ messages in thread
From: Gerd Hoffmann @ 2018-08-23  9:56 UTC (permalink / raw)
  To: qemu-devel; +Cc: libvir-list, Gerd Hoffmann, Daniel P. Berrangé

From: Daniel P. Berrangé <berrange@redhat.com>

The 'tls-creds' option accepts the name of a TLS credentials
object. This replaced the usage of 'tls', 'x509' and 'x509verify'
options in 2.5.0. These deprecated options were grandfathered in
when the deprecation policy was introduded in 2.10.0, so can now
finally be removed.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Message-id: 20180725092751.21767-3-berrange@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 ui/vnc.c             | 91 ----------------------------------------------------
 qemu-deprecated.texi | 20 ------------
 qemu-options.hx      | 43 -------------------------
 3 files changed, 154 deletions(-)

diff --git a/ui/vnc.c b/ui/vnc.c
index 359693238b..fd929b0957 100644
--- a/ui/vnc.c
+++ b/ui/vnc.c
@@ -3345,10 +3345,6 @@ static QemuOptsList qemu_vnc_opts = {
             .name = "tls-creds",
             .type = QEMU_OPT_STRING,
         },{
-            /* Deprecated in favour of tls-creds */
-            .name = "x509",
-            .type = QEMU_OPT_STRING,
-        },{
             .name = "share",
             .type = QEMU_OPT_STRING,
         },{
@@ -3385,14 +3381,6 @@ static QemuOptsList qemu_vnc_opts = {
             .name = "sasl",
             .type = QEMU_OPT_BOOL,
         },{
-            /* Deprecated in favour of tls-creds */
-            .name = "tls",
-            .type = QEMU_OPT_BOOL,
-        },{
-            /* Deprecated in favour of tls-creds */
-            .name = "x509verify",
-            .type = QEMU_OPT_STRING,
-        },{
             .name = "acl",
             .type = QEMU_OPT_BOOL,
         },{
@@ -3519,51 +3507,6 @@ vnc_display_setup_auth(int *auth,
 }
 
 
-/*
- * Handle back compat with old CLI syntax by creating some
- * suitable QCryptoTLSCreds objects
- */
-static QCryptoTLSCreds *
-vnc_display_create_creds(bool x509,
-                         bool x509verify,
-                         const char *dir,
-                         const char *id,
-                         Error **errp)
-{
-    gchar *credsid = g_strdup_printf("tlsvnc%s", id);
-    Object *parent = object_get_objects_root();
-    Object *creds;
-    Error *err = NULL;
-
-    if (x509) {
-        creds = object_new_with_props(TYPE_QCRYPTO_TLS_CREDS_X509,
-                                      parent,
-                                      credsid,
-                                      &err,
-                                      "endpoint", "server",
-                                      "dir", dir,
-                                      "verify-peer", x509verify ? "yes" : "no",
-                                      NULL);
-    } else {
-        creds = object_new_with_props(TYPE_QCRYPTO_TLS_CREDS_ANON,
-                                      parent,
-                                      credsid,
-                                      &err,
-                                      "endpoint", "server",
-                                      NULL);
-    }
-
-    g_free(credsid);
-
-    if (err) {
-        error_propagate(errp, err);
-        return NULL;
-    }
-
-    return QCRYPTO_TLS_CREDS(creds);
-}
-
-
 static int vnc_display_get_address(const char *addrstr,
                                    bool websocket,
                                    bool reverse,
@@ -3930,15 +3873,6 @@ void vnc_display_open(const char *id, Error **errp)
     credid = qemu_opt_get(opts, "tls-creds");
     if (credid) {
         Object *creds;
-        if (qemu_opt_get(opts, "tls") ||
-            qemu_opt_get(opts, "x509") ||
-            qemu_opt_get(opts, "x509verify")) {
-            error_setg(errp,
-                       "'tls-creds' parameter is mutually exclusive with "
-                       "'tls', 'x509' and 'x509verify' parameters");
-            goto fail;
-        }
-
         creds = object_resolve_path_component(
             object_get_objects_root(), credid);
         if (!creds) {
@@ -3961,31 +3895,6 @@ void vnc_display_open(const char *id, Error **errp)
                        "Expecting TLS credentials with a server endpoint");
             goto fail;
         }
-    } else {
-        const char *path;
-        bool tls = false, x509 = false, x509verify = false;
-        tls  = qemu_opt_get_bool(opts, "tls", false);
-        if (tls) {
-            path = qemu_opt_get(opts, "x509");
-
-            if (path) {
-                x509 = true;
-            } else {
-                path = qemu_opt_get(opts, "x509verify");
-                if (path) {
-                    x509 = true;
-                    x509verify = true;
-                }
-            }
-            vd->tlscreds = vnc_display_create_creds(x509,
-                                                    x509verify,
-                                                    path,
-                                                    vd->id,
-                                                    errp);
-            if (!vd->tlscreds) {
-                goto fail;
-            }
-        }
     }
     acl = qemu_opt_get_bool(opts, "acl", false);
 
diff --git a/qemu-deprecated.texi b/qemu-deprecated.texi
index 67b721156f..1993164695 100644
--- a/qemu-deprecated.texi
+++ b/qemu-deprecated.texi
@@ -40,26 +40,6 @@ which is the default.
 The ``-no-kvm'' argument is now a synonym for setting
 ``-machine accel=tcg''.
 
-@subsection -vnc tls (since 2.5.0)
-
-The ``-vnc tls'' argument is now a synonym for setting
-``-object tls-creds-anon,id=tls0'' combined with
-``-vnc tls-creds=tls0'
-
-@subsection -vnc x509 (since 2.5.0)
-
-The ``-vnc x509=/path/to/certs'' argument is now a
-synonym for setting
-``-object tls-creds-x509,dir=/path/to/certs,id=tls0,verify-peer=no''
-combined with ``-vnc tls-creds=tls0'
-
-@subsection -vnc x509verify (since 2.5.0)
-
-The ``-vnc x509verify=/path/to/certs'' argument is now a
-synonym for setting
-``-object tls-creds-x509,dir=/path/to/certs,id=tls0,verify-peer=yes''
-combined with ``-vnc tls-creds=tls0'
-
 @subsection -tftp (since 2.6.0)
 
 The ``-tftp /some/dir'' argument is replaced by either
diff --git a/qemu-options.hx b/qemu-options.hx
index 4efdedfdbb..d52a6f56cd 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -1632,49 +1632,6 @@ will cause the VNC server socket to enable the VeNCrypt auth
 mechanism.  The credentials should have been previously created
 using the @option{-object tls-creds} argument.
 
-The @option{tls-creds} parameter obsoletes the @option{tls},
-@option{x509}, and @option{x509verify} options, and as such
-it is not permitted to set both new and old type options at
-the same time.
-
-@item tls
-
-Require that client use TLS when communicating with the VNC server. This
-uses anonymous TLS credentials so is susceptible to a man-in-the-middle
-attack. It is recommended that this option be combined with either the
-@option{x509} or @option{x509verify} options.
-
-This option is now deprecated in favor of using the @option{tls-creds}
-argument.
-
-@item x509=@var{/path/to/certificate/dir}
-
-Valid if @option{tls} is specified. Require that x509 credentials are used
-for negotiating the TLS session. The server will send its x509 certificate
-to the client. It is recommended that a password be set on the VNC server
-to provide authentication of the client when this is used. The path following
-this option specifies where the x509 certificates are to be loaded from.
-See the @ref{vnc_security} section for details on generating certificates.
-
-This option is now deprecated in favour of using the @option{tls-creds}
-argument.
-
-@item x509verify=@var{/path/to/certificate/dir}
-
-Valid if @option{tls} is specified. Require that x509 credentials are used
-for negotiating the TLS session. The server will send its x509 certificate
-to the client, and request that the client send its own x509 certificate.
-The server will validate the client's certificate against the CA certificate,
-and reject clients when validation fails. If the certificate authority is
-trusted, this is a sufficient authentication mechanism. You may still wish
-to set a password on the VNC server as a second authentication layer. The
-path following this option specifies where the x509 certificates are to
-be loaded from. See the @ref{vnc_security} section for details on generating
-certificates.
-
-This option is now deprecated in favour of using the @option{tls-creds}
-argument.
-
 @item sasl
 
 Require that the client use SASL to authenticate with the VNC server.
-- 
2.9.3

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

* [Qemu-devel] [PULL 07/12] spice-display: access ptr_x/ptr_y under Mutex
  2018-08-23  9:56 [Qemu-devel] [PULL 00/12] Ui 20180823 v3 patches Gerd Hoffmann
                   ` (5 preceding siblings ...)
  2018-08-23  9:56 ` [Qemu-devel] [PULL 06/12] vnc: remove support for deprecated tls, x509, x509verify options Gerd Hoffmann
@ 2018-08-23  9:56 ` Gerd Hoffmann
  2018-08-23  9:56 ` [Qemu-devel] [PULL 08/12] spice-display: fix qemu_spice_cursor_refresh_bh locking Gerd Hoffmann
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 18+ messages in thread
From: Gerd Hoffmann @ 2018-08-23  9:56 UTC (permalink / raw)
  To: qemu-devel; +Cc: libvir-list, Gerd Hoffmann, Paolo Bonzini

From: Paolo Bonzini <pbonzini@redhat.com>

The OpenGL-enabled SPICE code was not accessing the cursor position
under the SimpleSpiceDisplay lock.  Fix this.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-id: 20180720063109.4631-2-pbonzini@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 ui/spice-display.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/ui/spice-display.c b/ui/spice-display.c
index fe734821dd..46df673cd7 100644
--- a/ui/spice-display.c
+++ b/ui/spice-display.c
@@ -976,8 +976,10 @@ static void qemu_spice_gl_cursor_position(DisplayChangeListener *dcl,
 {
     SimpleSpiceDisplay *ssd = container_of(dcl, SimpleSpiceDisplay, dcl);
 
+    qemu_mutex_lock(&ssd->lock);
     ssd->ptr_x = pos_x;
     ssd->ptr_y = pos_y;
+    qemu_mutex_unlock(&ssd->lock);
 }
 
 static void qemu_spice_gl_release_dmabuf(DisplayChangeListener *dcl,
@@ -1055,10 +1057,15 @@ static void qemu_spice_gl_update(DisplayChangeListener *dcl,
     }
 
     if (render_cursor) {
+        int x, y;
+        qemu_mutex_lock(&ssd->lock);
+        x = ssd->ptr_x;
+        y = ssd->ptr_y;
+        qemu_mutex_unlock(&ssd->lock);
         egl_texture_blit(ssd->gls, &ssd->blit_fb, &ssd->guest_fb,
                          !y_0_top);
         egl_texture_blend(ssd->gls, &ssd->blit_fb, &ssd->cursor_fb,
-                          !y_0_top, ssd->ptr_x, ssd->ptr_y);
+                          !y_0_top, x, y);
         glFlush();
     }
 
-- 
2.9.3

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

* [Qemu-devel] [PULL 08/12] spice-display: fix qemu_spice_cursor_refresh_bh locking
  2018-08-23  9:56 [Qemu-devel] [PULL 00/12] Ui 20180823 v3 patches Gerd Hoffmann
                   ` (6 preceding siblings ...)
  2018-08-23  9:56 ` [Qemu-devel] [PULL 07/12] spice-display: access ptr_x/ptr_y under Mutex Gerd Hoffmann
@ 2018-08-23  9:56 ` Gerd Hoffmann
  2018-08-23  9:56 ` [Qemu-devel] [PULL 09/12] ui/sdl2: Fix broken -full-screen CLI option Gerd Hoffmann
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 18+ messages in thread
From: Gerd Hoffmann @ 2018-08-23  9:56 UTC (permalink / raw)
  To: qemu-devel; +Cc: libvir-list, Gerd Hoffmann, Paolo Bonzini

From: Paolo Bonzini <pbonzini@redhat.com>

spice-display should not call the ui/console.c functions dpy_cursor_define
and dpy_moues_set with the SimpleSpiceDisplay lock taken.  That will cause
a deadlock, because the DisplayChangeListener callbacks will take the lock
again.  It is also in general a bad idea to invoke generic callbacks with a
lock taken, because it can cause AB-BA deadlocks in the long run.  The only
thing that requires care is that the cursor may disappear as soon as the
mutex is released, so you need an extra cursor_get/cursor_put pair.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-id: 20180720063109.4631-3-pbonzini@redhat.com

[ kraxel: fix dpy_cursor_define() call ]

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 ui/spice-display.c | 30 ++++++++++++++++++------------
 1 file changed, 18 insertions(+), 12 deletions(-)

diff --git a/ui/spice-display.c b/ui/spice-display.c
index 46df673cd7..7b230987dc 100644
--- a/ui/spice-display.c
+++ b/ui/spice-display.c
@@ -450,29 +450,35 @@ void qemu_spice_display_switch(SimpleSpiceDisplay *ssd,
     qemu_mutex_unlock(&ssd->lock);
 }
 
-static void qemu_spice_cursor_refresh_unlocked(SimpleSpiceDisplay *ssd)
+void qemu_spice_cursor_refresh_bh(void *opaque)
 {
+    SimpleSpiceDisplay *ssd = opaque;
+
+    qemu_mutex_lock(&ssd->lock);
     if (ssd->cursor) {
+        QEMUCursor *c = ssd->cursor;
         assert(ssd->dcl.con);
-        dpy_cursor_define(ssd->dcl.con, ssd->cursor);
+        cursor_get(c);
+        qemu_mutex_unlock(&ssd->lock);
+        dpy_cursor_define(ssd->dcl.con, c);
+        qemu_mutex_lock(&ssd->lock);
+        cursor_put(c);
     }
+
     if (ssd->mouse_x != -1 && ssd->mouse_y != -1) {
+        int x, y;
         assert(ssd->dcl.con);
-        dpy_mouse_set(ssd->dcl.con, ssd->mouse_x, ssd->mouse_y, 1);
+        x = ssd->mouse_x;
+        y = ssd->mouse_y;
         ssd->mouse_x = -1;
         ssd->mouse_y = -1;
+        qemu_mutex_unlock(&ssd->lock);
+        dpy_mouse_set(ssd->dcl.con, x, y, 1);
+    } else {
+        qemu_mutex_unlock(&ssd->lock);
     }
 }
 
-void qemu_spice_cursor_refresh_bh(void *opaque)
-{
-    SimpleSpiceDisplay *ssd = opaque;
-
-    qemu_mutex_lock(&ssd->lock);
-    qemu_spice_cursor_refresh_unlocked(ssd);
-    qemu_mutex_unlock(&ssd->lock);
-}
-
 void qemu_spice_display_refresh(SimpleSpiceDisplay *ssd)
 {
     graphic_hw_update(ssd->dcl.con);
-- 
2.9.3

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

* [Qemu-devel] [PULL 09/12] ui/sdl2: Fix broken -full-screen CLI option
  2018-08-23  9:56 [Qemu-devel] [PULL 00/12] Ui 20180823 v3 patches Gerd Hoffmann
                   ` (7 preceding siblings ...)
  2018-08-23  9:56 ` [Qemu-devel] [PULL 08/12] spice-display: fix qemu_spice_cursor_refresh_bh locking Gerd Hoffmann
@ 2018-08-23  9:56 ` Gerd Hoffmann
  2018-08-23  9:56 ` [Qemu-devel] [PULL 10/12] ui/vnc: Remove useless parenthesis around DIV_ROUND_UP macro Gerd Hoffmann
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 18+ messages in thread
From: Gerd Hoffmann @ 2018-08-23  9:56 UTC (permalink / raw)
  To: qemu-devel; +Cc: libvir-list, Gerd Hoffmann, Thomas Huth

From: Thomas Huth <thuth@redhat.com>

We've got to set the gui_fullscreen variable before creating the
SDL2 window, otherwise the initial window will not be created in
fullscreen mode.

Buglink: https://bugs.launchpad.net/bugs/1780812
Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-id: 1531161850-6860-1-git-send-email-thuth@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 ui/sdl2.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/ui/sdl2.c b/ui/sdl2.c
index 755a7134ff..0a9a18a964 100644
--- a/ui/sdl2.c
+++ b/ui/sdl2.c
@@ -790,6 +790,8 @@ static void sdl2_display_init(DisplayState *ds, DisplayOptions *o)
     memset(&info, 0, sizeof(info));
     SDL_VERSION(&info.version);
 
+    gui_fullscreen = o->has_full_screen && o->full_screen;
+
     for (i = 0;; i++) {
         QemuConsole *con = qemu_console_lookup_by_index(i);
         if (!con) {
@@ -842,17 +844,14 @@ static void sdl2_display_init(DisplayState *ds, DisplayOptions *o)
         g_free(filename);
     }
 
-    if (sdl2_console->opts->has_full_screen &&
-        sdl2_console->opts->full_screen) {
-        gui_fullscreen = 1;
+    gui_grab = 0;
+    if (gui_fullscreen) {
         sdl_grab_start(0);
     }
 
     mouse_mode_notifier.notify = sdl_mouse_mode_change;
     qemu_add_mouse_mode_change_notifier(&mouse_mode_notifier);
 
-    gui_grab = 0;
-
     sdl_cursor_hidden = SDL_CreateCursor(&data, &data, 8, 1, 0, 0);
     sdl_cursor_normal = SDL_GetCursor();
 
-- 
2.9.3

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

* [Qemu-devel] [PULL 10/12] ui/vnc: Remove useless parenthesis around DIV_ROUND_UP macro
  2018-08-23  9:56 [Qemu-devel] [PULL 00/12] Ui 20180823 v3 patches Gerd Hoffmann
                   ` (8 preceding siblings ...)
  2018-08-23  9:56 ` [Qemu-devel] [PULL 09/12] ui/sdl2: Fix broken -full-screen CLI option Gerd Hoffmann
@ 2018-08-23  9:56 ` Gerd Hoffmann
  2018-08-23  9:56 ` [Qemu-devel] [PULL 11/12] dmabuf: add y0_top, pass it to spice Gerd Hoffmann
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 18+ messages in thread
From: Gerd Hoffmann @ 2018-08-23  9:56 UTC (permalink / raw)
  To: qemu-devel; +Cc: libvir-list, Gerd Hoffmann, Philippe Mathieu-Daudé

From: Philippe Mathieu-Daudé <f4bug@amsat.org>

Patch created mechanically by rerunning:

  $  spatch --sp-file scripts/coccinelle/round.cocci \
            --macro-file scripts/cocci-macro-file.h \
            --dir . --in-place

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20180704153919.12432-7-f4bug@amsat.org>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 ui/vnc-enc-tight.c | 2 +-
 ui/vnc.c           | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/ui/vnc-enc-tight.c b/ui/vnc-enc-tight.c
index f38aceb4da..0b4a5ac71f 100644
--- a/ui/vnc-enc-tight.c
+++ b/ui/vnc-enc-tight.c
@@ -979,7 +979,7 @@ static int send_mono_rect(VncState *vs, int x, int y,
     }
 #endif
 
-    bytes = (DIV_ROUND_UP(w, 8)) * h;
+    bytes = DIV_ROUND_UP(w, 8) * h;
 
     vnc_write_u8(vs, (stream | VNC_TIGHT_EXPLICIT_FILTER) << 4);
     vnc_write_u8(vs, VNC_TIGHT_FILTER_PALETTE);
diff --git a/ui/vnc.c b/ui/vnc.c
index fd929b0957..ccb1335d86 100644
--- a/ui/vnc.c
+++ b/ui/vnc.c
@@ -2967,7 +2967,8 @@ static int vnc_refresh_server_surface(VncDisplay *vd)
             PIXMAN_FORMAT_BPP(pixman_image_get_format(vd->guest.fb));
         guest_row0 = (uint8_t *)pixman_image_get_data(vd->guest.fb);
         guest_stride = pixman_image_get_stride(vd->guest.fb);
-        guest_ll = pixman_image_get_width(vd->guest.fb) * (DIV_ROUND_UP(guest_bpp, 8));
+        guest_ll = pixman_image_get_width(vd->guest.fb)
+                   * DIV_ROUND_UP(guest_bpp, 8);
     }
     line_bytes = MIN(server_stride, guest_ll);
 
-- 
2.9.3

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

* [Qemu-devel] [PULL 11/12] dmabuf: add y0_top, pass it to spice
  2018-08-23  9:56 [Qemu-devel] [PULL 00/12] Ui 20180823 v3 patches Gerd Hoffmann
                   ` (9 preceding siblings ...)
  2018-08-23  9:56 ` [Qemu-devel] [PULL 10/12] ui/vnc: Remove useless parenthesis around DIV_ROUND_UP macro Gerd Hoffmann
@ 2018-08-23  9:56 ` Gerd Hoffmann
  2018-08-23  9:56 ` [Qemu-devel] [PULL 12/12] util: promote qemu_egl_rendernode_open() to libqemuutil Gerd Hoffmann
  2018-08-24 22:09 ` [Qemu-devel] [PULL 00/12] Ui 20180823 v3 patches Peter Maydell
  12 siblings, 0 replies; 18+ messages in thread
From: Gerd Hoffmann @ 2018-08-23  9:56 UTC (permalink / raw)
  To: qemu-devel; +Cc: libvir-list, Gerd Hoffmann, Marc-André Lureau

From: Marc-André Lureau <marcandre.lureau@redhat.com>

Some scanouts during boot are top-down without it.

y0_top is set from VHOST_USER_GPU_DMABUF_SCANOUT code path in the last
patch of this series.

In current QEMU code base, only vfio/display uses dmabuf API. But the
VFIO query interface doesn't provide or need that detail so far.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20180713130916.4153-5-marcandre.lureau@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 include/ui/console.h | 1 +
 ui/spice-display.c   | 3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/include/ui/console.h b/include/ui/console.h
index 981b519dde..fb969caf70 100644
--- a/include/ui/console.h
+++ b/include/ui/console.h
@@ -186,6 +186,7 @@ struct QemuDmaBuf {
     uint32_t  stride;
     uint32_t  fourcc;
     uint32_t  texture;
+    bool      y0_top;
 };
 
 typedef struct DisplayChangeListenerOps {
diff --git a/ui/spice-display.c b/ui/spice-display.c
index 7b230987dc..2f8adb6b9f 100644
--- a/ui/spice-display.c
+++ b/ui/spice-display.c
@@ -1056,7 +1056,8 @@ static void qemu_spice_gl_update(DisplayChangeListener *dcl,
             /* note: spice server will close the fd, so hand over a dup */
             spice_qxl_gl_scanout(&ssd->qxl, dup(dmabuf->fd),
                                  dmabuf->width, dmabuf->height,
-                                 dmabuf->stride, dmabuf->fourcc, false);
+                                 dmabuf->stride, dmabuf->fourcc,
+                                 dmabuf->y0_top);
         }
         qemu_spice_gl_monitor_config(ssd, 0, 0, dmabuf->width, dmabuf->height);
         ssd->guest_dmabuf_refresh = false;
-- 
2.9.3

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

* [Qemu-devel] [PULL 12/12] util: promote qemu_egl_rendernode_open() to libqemuutil
  2018-08-23  9:56 [Qemu-devel] [PULL 00/12] Ui 20180823 v3 patches Gerd Hoffmann
                   ` (10 preceding siblings ...)
  2018-08-23  9:56 ` [Qemu-devel] [PULL 11/12] dmabuf: add y0_top, pass it to spice Gerd Hoffmann
@ 2018-08-23  9:56 ` Gerd Hoffmann
  2018-08-24 22:09 ` [Qemu-devel] [PULL 00/12] Ui 20180823 v3 patches Peter Maydell
  12 siblings, 0 replies; 18+ messages in thread
From: Gerd Hoffmann @ 2018-08-23  9:56 UTC (permalink / raw)
  To: qemu-devel; +Cc: libvir-list, Gerd Hoffmann, Marc-André Lureau

From: Marc-André Lureau <marcandre.lureau@redhat.com>

vhost-user-gpu will share the same code to open a DRM node.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20180713130916.4153-20-marcandre.lureau@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 include/qemu/drm.h |  6 +++++
 ui/egl-helpers.c   | 51 ++---------------------------------------
 util/drm.c         | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 MAINTAINERS        |  1 +
 util/Makefile.objs |  1 +
 5 files changed, 76 insertions(+), 49 deletions(-)
 create mode 100644 include/qemu/drm.h
 create mode 100644 util/drm.c

diff --git a/include/qemu/drm.h b/include/qemu/drm.h
new file mode 100644
index 0000000000..4c3e622f5c
--- /dev/null
+++ b/include/qemu/drm.h
@@ -0,0 +1,6 @@
+#ifndef QEMU_DRM_H_
+#define QEMU_DRM_H_
+
+int qemu_drm_rendernode_open(const char *rendernode);
+
+#endif
diff --git a/ui/egl-helpers.c b/ui/egl-helpers.c
index 71b6a97bd1..4f475142fc 100644
--- a/ui/egl-helpers.c
+++ b/ui/egl-helpers.c
@@ -15,9 +15,7 @@
  * License along with this library; if not, see <http://www.gnu.org/licenses/>.
  */
 #include "qemu/osdep.h"
-#include <glob.h>
-#include <dirent.h>
-
+#include "qemu/drm.h"
 #include "qemu/error-report.h"
 #include "ui/console.h"
 #include "ui/egl-helpers.h"
@@ -147,57 +145,12 @@ int qemu_egl_rn_fd;
 struct gbm_device *qemu_egl_rn_gbm_dev;
 EGLContext qemu_egl_rn_ctx;
 
-static int qemu_egl_rendernode_open(const char *rendernode)
-{
-    DIR *dir;
-    struct dirent *e;
-    int r, fd;
-    char *p;
-
-    if (rendernode) {
-        return open(rendernode, O_RDWR | O_CLOEXEC | O_NOCTTY | O_NONBLOCK);
-    }
-
-    dir = opendir("/dev/dri");
-    if (!dir) {
-        return -1;
-    }
-
-    fd = -1;
-    while ((e = readdir(dir))) {
-        if (e->d_type != DT_CHR) {
-            continue;
-        }
-
-        if (strncmp(e->d_name, "renderD", 7)) {
-            continue;
-        }
-
-        p = g_strdup_printf("/dev/dri/%s", e->d_name);
-
-        r = open(p, O_RDWR | O_CLOEXEC | O_NOCTTY | O_NONBLOCK);
-        if (r < 0) {
-            g_free(p);
-            continue;
-        }
-        fd = r;
-        g_free(p);
-        break;
-    }
-
-    closedir(dir);
-    if (fd < 0) {
-        return -1;
-    }
-    return fd;
-}
-
 int egl_rendernode_init(const char *rendernode, DisplayGLMode mode)
 {
     qemu_egl_rn_fd = -1;
     int rc;
 
-    qemu_egl_rn_fd = qemu_egl_rendernode_open(rendernode);
+    qemu_egl_rn_fd = qemu_drm_rendernode_open(rendernode);
     if (qemu_egl_rn_fd == -1) {
         error_report("egl: no drm render node available");
         goto err;
diff --git a/util/drm.c b/util/drm.c
new file mode 100644
index 0000000000..a23ff24538
--- /dev/null
+++ b/util/drm.c
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2015-2016 Gerd Hoffmann <kraxel@redhat.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+#include "qemu/osdep.h"
+#include "qemu/drm.h"
+
+#include <glob.h>
+#include <dirent.h>
+
+int qemu_drm_rendernode_open(const char *rendernode)
+{
+    DIR *dir;
+    struct dirent *e;
+    int r, fd;
+    char *p;
+
+    if (rendernode) {
+        return open(rendernode, O_RDWR | O_CLOEXEC | O_NOCTTY | O_NONBLOCK);
+    }
+
+    dir = opendir("/dev/dri");
+    if (!dir) {
+        return -1;
+    }
+
+    fd = -1;
+    while ((e = readdir(dir))) {
+        if (e->d_type != DT_CHR) {
+            continue;
+        }
+
+        if (strncmp(e->d_name, "renderD", 7)) {
+            continue;
+        }
+
+        p = g_strdup_printf("/dev/dri/%s", e->d_name);
+
+        r = open(p, O_RDWR | O_CLOEXEC | O_NOCTTY | O_NONBLOCK);
+        if (r < 0) {
+            g_free(p);
+            continue;
+        }
+        fd = r;
+        g_free(p);
+        break;
+    }
+
+    closedir(dir);
+    if (fd < 0) {
+        return -1;
+    }
+    return fd;
+}
diff --git a/MAINTAINERS b/MAINTAINERS
index 6902a568f4..282d6a8ae5 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1566,6 +1566,7 @@ S: Odd Fixes
 F: ui/
 F: include/ui/
 F: qapi/ui.json
+F: util/drm.c
 
 Cocoa graphics
 M: Peter Maydell <peter.maydell@linaro.org>
diff --git a/util/Makefile.objs b/util/Makefile.objs
index e1c3fed4dc..1810f970ef 100644
--- a/util/Makefile.objs
+++ b/util/Makefile.objs
@@ -49,3 +49,4 @@ util-obj-y += stats64.o
 util-obj-y += systemd.o
 util-obj-y += iova-tree.o
 util-obj-$(CONFIG_LINUX) += vfio-helpers.o
+util-obj-$(CONFIG_LINUX) += drm.o
-- 
2.9.3

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

* Re: [Qemu-devel] [PULL 00/12] Ui 20180823 v3 patches
  2018-08-23  9:56 [Qemu-devel] [PULL 00/12] Ui 20180823 v3 patches Gerd Hoffmann
                   ` (11 preceding siblings ...)
  2018-08-23  9:56 ` [Qemu-devel] [PULL 12/12] util: promote qemu_egl_rendernode_open() to libqemuutil Gerd Hoffmann
@ 2018-08-24 22:09 ` Peter Maydell
  2018-08-27  8:53   ` Gerd Hoffmann
  12 siblings, 1 reply; 18+ messages in thread
From: Peter Maydell @ 2018-08-24 22:09 UTC (permalink / raw)
  To: Gerd Hoffmann; +Cc: QEMU Developers, Libvirt

On 23 August 2018 at 10:56, Gerd Hoffmann <kraxel@redhat.com> wrote:
> The following changes since commit d0092d90eb546a8bbe9e9120426c189474123797:
>
>   Merge remote-tracking branch 'remotes/cohuck/tags/s390x-20180820' into staging (2018-08-20 17:41:18 +0100)
>
> are available in the git repository at:
>
>   git://git.kraxel.org/qemu tags/ui-20180823-v3-pull-request
>
> for you to fetch changes up to 63cde1d13d0767f778a130e2c93c15ad709e1276:
>
>   util: promote qemu_egl_rendernode_open() to libqemuutil (2018-08-23 11:53:26 +0200)
>
> ----------------------------------------------------------------
> ui: misc fixes which piled up during 3.0 release freeze
>
> ----------------------------------------------------------------

Hi; this failed to build on openbsd (the VM setup in tests/vm).
Linking of all the qemu-system-foo binaries failed with:

../ui/egl-helpers.o: In function `egl_rendernode_init':
ui/egl-helpers.c:153: undefined reference to `qemu_drm_rendernode_open'


thanks
-- PMM

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

* [Qemu-devel] [PULL 11/12] dmabuf: add y0_top, pass it to spice
  2018-08-27  8:53 [Qemu-devel] [PULL 00/12] Ui 20180827 v4 patches Gerd Hoffmann
@ 2018-08-27  8:53 ` Gerd Hoffmann
  0 siblings, 0 replies; 18+ messages in thread
From: Gerd Hoffmann @ 2018-08-27  8:53 UTC (permalink / raw)
  To: qemu-devel; +Cc: libvir-list, Gerd Hoffmann, Marc-André Lureau

From: Marc-André Lureau <marcandre.lureau@redhat.com>

Some scanouts during boot are top-down without it.

y0_top is set from VHOST_USER_GPU_DMABUF_SCANOUT code path in the last
patch of this series.

In current QEMU code base, only vfio/display uses dmabuf API. But the
VFIO query interface doesn't provide or need that detail so far.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20180713130916.4153-5-marcandre.lureau@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 include/ui/console.h | 1 +
 ui/spice-display.c   | 3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/include/ui/console.h b/include/ui/console.h
index 981b519dde..fb969caf70 100644
--- a/include/ui/console.h
+++ b/include/ui/console.h
@@ -186,6 +186,7 @@ struct QemuDmaBuf {
     uint32_t  stride;
     uint32_t  fourcc;
     uint32_t  texture;
+    bool      y0_top;
 };
 
 typedef struct DisplayChangeListenerOps {
diff --git a/ui/spice-display.c b/ui/spice-display.c
index 7b230987dc..2f8adb6b9f 100644
--- a/ui/spice-display.c
+++ b/ui/spice-display.c
@@ -1056,7 +1056,8 @@ static void qemu_spice_gl_update(DisplayChangeListener *dcl,
             /* note: spice server will close the fd, so hand over a dup */
             spice_qxl_gl_scanout(&ssd->qxl, dup(dmabuf->fd),
                                  dmabuf->width, dmabuf->height,
-                                 dmabuf->stride, dmabuf->fourcc, false);
+                                 dmabuf->stride, dmabuf->fourcc,
+                                 dmabuf->y0_top);
         }
         qemu_spice_gl_monitor_config(ssd, 0, 0, dmabuf->width, dmabuf->height);
         ssd->guest_dmabuf_refresh = false;
-- 
2.9.3

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

* Re: [Qemu-devel] [PULL 00/12] Ui 20180823 v3 patches
  2018-08-24 22:09 ` [Qemu-devel] [PULL 00/12] Ui 20180823 v3 patches Peter Maydell
@ 2018-08-27  8:53   ` Gerd Hoffmann
  0 siblings, 0 replies; 18+ messages in thread
From: Gerd Hoffmann @ 2018-08-27  8:53 UTC (permalink / raw)
  To: Peter Maydell; +Cc: QEMU Developers, Libvirt

On Fri, Aug 24, 2018 at 11:09:50PM +0100, Peter Maydell wrote:
> On 23 August 2018 at 10:56, Gerd Hoffmann <kraxel@redhat.com> wrote:
> > The following changes since commit d0092d90eb546a8bbe9e9120426c189474123797:
> >
> >   Merge remote-tracking branch 'remotes/cohuck/tags/s390x-20180820' into staging (2018-08-20 17:41:18 +0100)
> >
> > are available in the git repository at:
> >
> >   git://git.kraxel.org/qemu tags/ui-20180823-v3-pull-request
> >
> > for you to fetch changes up to 63cde1d13d0767f778a130e2c93c15ad709e1276:
> >
> >   util: promote qemu_egl_rendernode_open() to libqemuutil (2018-08-23 11:53:26 +0200)
> >
> > ----------------------------------------------------------------
> > ui: misc fixes which piled up during 3.0 release freeze
> >
> > ----------------------------------------------------------------
> 
> Hi; this failed to build on openbsd (the VM setup in tests/vm).
> Linking of all the qemu-system-foo binaries failed with:
> 
> ../ui/egl-helpers.o: In function `egl_rendernode_init':
> ui/egl-helpers.c:153: undefined reference to `qemu_drm_rendernode_open'

Fixed, v4 sent.

> 
> 
> thanks
> -- PMM

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

end of thread, other threads:[~2018-08-27  8:53 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-08-23  9:56 [Qemu-devel] [PULL 00/12] Ui 20180823 v3 patches Gerd Hoffmann
2018-08-23  9:56 ` [Qemu-devel] [PULL 01/12] ui/sdl2: Remove the obsolete SDL_INIT_NOPARACHUTE flag Gerd Hoffmann
2018-08-23  9:56 ` [Qemu-devel] [PULL 02/12] vnc: fix memleak of the "vnc-worker-output" name Gerd Hoffmann
2018-08-23  9:56 ` [Qemu-devel] [PULL 03/12] ui: use enum to string helpers Gerd Hoffmann
2018-08-23  9:56 ` [Qemu-devel] [PULL 04/12] sdl2: redraw correctly when scanout_mode enabled Gerd Hoffmann
2018-08-23  9:56 ` [Qemu-devel] [PULL 05/12] doc: switch to modern syntax for VNC TLS setup Gerd Hoffmann
2018-08-23  9:56 ` [Qemu-devel] [PULL 06/12] vnc: remove support for deprecated tls, x509, x509verify options Gerd Hoffmann
2018-08-23  9:56 ` [Qemu-devel] [PULL 07/12] spice-display: access ptr_x/ptr_y under Mutex Gerd Hoffmann
2018-08-23  9:56 ` [Qemu-devel] [PULL 08/12] spice-display: fix qemu_spice_cursor_refresh_bh locking Gerd Hoffmann
2018-08-23  9:56 ` [Qemu-devel] [PULL 09/12] ui/sdl2: Fix broken -full-screen CLI option Gerd Hoffmann
2018-08-23  9:56 ` [Qemu-devel] [PULL 10/12] ui/vnc: Remove useless parenthesis around DIV_ROUND_UP macro Gerd Hoffmann
2018-08-23  9:56 ` [Qemu-devel] [PULL 11/12] dmabuf: add y0_top, pass it to spice Gerd Hoffmann
2018-08-23  9:56 ` [Qemu-devel] [PULL 12/12] util: promote qemu_egl_rendernode_open() to libqemuutil Gerd Hoffmann
2018-08-24 22:09 ` [Qemu-devel] [PULL 00/12] Ui 20180823 v3 patches Peter Maydell
2018-08-27  8:53   ` Gerd Hoffmann
  -- strict thread matches above, loose matches on Subject: below --
2018-08-27  8:53 [Qemu-devel] [PULL 00/12] Ui 20180827 v4 patches Gerd Hoffmann
2018-08-27  8:53 ` [Qemu-devel] [PULL 11/12] dmabuf: add y0_top, pass it to spice Gerd Hoffmann
2018-08-21 12:05 [Qemu-devel] [PULL 00/12] Ui 20180821 v2 patches Gerd Hoffmann
2018-08-21 12:05 ` [Qemu-devel] [PULL 11/12] dmabuf: add y0_top, pass it to spice Gerd Hoffmann
2018-08-21  7:44 [Qemu-devel] [PULL 00/12] Ui 20180821 patches Gerd Hoffmann
2018-08-21  7:45 ` [Qemu-devel] [PULL 11/12] dmabuf: add y0_top, pass it to spice 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).