qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Gerd Hoffmann <kraxel@redhat.com>
Subject: [Qemu-devel] [PULL 4/9] spice: add scanout_disable support
Date: Mon, 27 Feb 2017 17:18:38 +0100	[thread overview]
Message-ID: <1488212323-26882-5-git-send-email-kraxel@redhat.com> (raw)
In-Reply-To: <1488212323-26882-1-git-send-email-kraxel@redhat.com>

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-id: 1487669841-13668-5-git-send-email-kraxel@redhat.com
---
 ui/spice-display.c | 36 +++++++++++++++++++++---------------
 1 file changed, 21 insertions(+), 15 deletions(-)

diff --git a/ui/spice-display.c b/ui/spice-display.c
index b80a9f3..23ccf2a 100644
--- a/ui/spice-display.c
+++ b/ui/spice-display.c
@@ -928,6 +928,17 @@ static QEMUGLContext qemu_spice_gl_create_context(DisplayChangeListener *dcl,
     return qemu_egl_create_context(dcl, params);
 }
 
+static void qemu_spice_gl_scanout_disable(DisplayChangeListener *dcl)
+{
+    SimpleSpiceDisplay *ssd = container_of(dcl, SimpleSpiceDisplay, dcl);
+
+    dprint(1, "%s: no framebuffer\n", __func__);
+    spice_qxl_gl_scanout(&ssd->qxl, -1, 0, 0, 0, 0, false);
+    qemu_spice_gl_monitor_config(ssd, 0, 0, 0, 0);
+    ssd->have_surface = false;
+    ssd->have_scanout = false;
+}
+
 static void qemu_spice_gl_scanout_texture(DisplayChangeListener *dcl,
                                           uint32_t tex_id,
                                           bool y_0_top,
@@ -940,27 +951,21 @@ static void qemu_spice_gl_scanout_texture(DisplayChangeListener *dcl,
     EGLint stride = 0, fourcc = 0;
     int fd = -1;
 
-    if (tex_id) {
-        fd = egl_get_fd_for_texture(tex_id, &stride, &fourcc);
-        if (fd < 0) {
-            fprintf(stderr, "%s: failed to get fd for texture\n", __func__);
-            return;
-        }
-        dprint(1, "%s: %dx%d (stride %d, fourcc 0x%x)\n", __func__,
-               w, h, stride, fourcc);
-    } else {
-        dprint(1, "%s: no texture (no framebuffer)\n", __func__);
+    assert(tex_id);
+    fd = egl_get_fd_for_texture(tex_id, &stride, &fourcc);
+    if (fd < 0) {
+        fprintf(stderr, "%s: failed to get fd for texture\n", __func__);
+        return;
     }
-
-    assert(!tex_id || fd >= 0);
+    dprint(1, "%s: %dx%d (stride %d, fourcc 0x%x)\n", __func__,
+           w, h, stride, fourcc);
 
     /* note: spice server will close the fd */
     spice_qxl_gl_scanout(&ssd->qxl, fd, backing_width, backing_height,
                          stride, fourcc, y_0_top);
-    ssd->have_surface = false;
-    ssd->have_scanout = (tex_id != 0);
-
     qemu_spice_gl_monitor_config(ssd, x, y, w, h);
+    ssd->have_surface = false;
+    ssd->have_scanout = true;
 }
 
 static void qemu_spice_gl_update(DisplayChangeListener *dcl,
@@ -993,6 +998,7 @@ static const DisplayChangeListenerOps display_listener_gl_ops = {
     .dpy_gl_ctx_make_current = qemu_egl_make_context_current,
     .dpy_gl_ctx_get_current  = qemu_egl_get_current_context,
 
+    .dpy_gl_scanout_disable  = qemu_spice_gl_scanout_disable,
     .dpy_gl_scanout_texture  = qemu_spice_gl_scanout_texture,
     .dpy_gl_update           = qemu_spice_gl_update,
 };
-- 
1.8.3.1

  parent reply	other threads:[~2017-02-27 16:18 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-27 16:18 [Qemu-devel] [PULL 0/9] ui patch queue Gerd Hoffmann
2017-02-27 16:18 ` [Qemu-devel] [PULL 1/9] console: rename dpy_gl_scanout to dpy_gl_scanout_texture Gerd Hoffmann
2017-02-27 16:18 ` [Qemu-devel] [PULL 2/9] console: add dpy_gl_scanout_disable Gerd Hoffmann
2017-02-27 16:18 ` [Qemu-devel] [PULL 3/9] virtio-gpu: use dpy_gl_scanout_disable Gerd Hoffmann
2017-02-27 16:18 ` Gerd Hoffmann [this message]
2017-02-27 16:18 ` [Qemu-devel] [PULL 5/9] sdl2: add scanout_disable support Gerd Hoffmann
2017-02-27 16:18 ` [Qemu-devel] [PULL 6/9] gtk-egl: " Gerd Hoffmann
2017-02-27 16:18 ` [Qemu-devel] [PULL 7/9] ui: Use XkbGetMap and XkbGetNames instead of XkbGetKeyboard Gerd Hoffmann
2017-02-27 16:18 ` [Qemu-devel] [PULL 8/9] spice: add display & head options Gerd Hoffmann
2017-02-27 16:18 ` [Qemu-devel] [PULL 9/9] vnc: fix double free issues Gerd Hoffmann
2017-02-28  8:45 ` [Qemu-devel] [PULL 0/9] ui patch queue Peter Maydell

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=1488212323-26882-5-git-send-email-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).