qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: marcandre.lureau@redhat.com
To: qemu-devel@nongnu.org
Cc: kraxel@redhat.com, "Marc-André Lureau" <marcandre.lureau@redhat.com>
Subject: [Qemu-devel] [RFC 11/14] console: add dpy_gl_scanout2()
Date: Sat,  4 Jun 2016 23:33:20 +0200	[thread overview]
Message-ID: <1465076003-26291-12-git-send-email-marcandre.lureau@redhat.com> (raw)
In-Reply-To: <1465076003-26291-1-git-send-email-marcandre.lureau@redhat.com>

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

Add a new scanout callback that doesn't require any gl context in
qemu (importing a dmabuf fd would require qemu egl&gl contexts, and
would be unnecessary when using spice anyway)

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 include/ui/console.h | 10 ++++++++++
 ui/console.c         | 12 ++++++++++++
 ui/spice-display.c   | 19 +++++++++++++++++++
 3 files changed, 41 insertions(+)

diff --git a/include/ui/console.h b/include/ui/console.h
index 52a5f65..14fd5ad 100644
--- a/include/ui/console.h
+++ b/include/ui/console.h
@@ -218,6 +218,11 @@ typedef struct DisplayChangeListenerOps {
     void (*dpy_gl_scanout)(DisplayChangeListener *dcl,
                            uint32_t backing_id, bool backing_y_0_top,
                            uint32_t x, uint32_t y, uint32_t w, uint32_t h);
+    void (*dpy_gl_scanout2)(DisplayChangeListener *dcl,
+                            int fd, bool backing_y_0_top,
+                            uint32_t x, uint32_t y, uint32_t w, uint32_t h,
+                            uint32_t fd_w, uint32_t fd_h, uint32_t fd_stride,
+                            int fd_fourcc);
     void (*dpy_gl_update)(DisplayChangeListener *dcl,
                           uint32_t x, uint32_t y, uint32_t w, uint32_t h);
 
@@ -286,6 +291,11 @@ bool dpy_gfx_check_format(QemuConsole *con,
 void dpy_gl_scanout(QemuConsole *con,
                     uint32_t backing_id, bool backing_y_0_top,
                     uint32_t x, uint32_t y, uint32_t w, uint32_t h);
+void dpy_gl_scanout2(QemuConsole *con,
+                     int fd, bool backing_y_0_top,
+                     uint32_t x, uint32_t y, uint32_t w, uint32_t h,
+                     uint32_t fd_w, uint32_t fd_h, uint32_t fd_stride,
+                     int fd_fourcc);
 void dpy_gl_update(QemuConsole *con,
                    uint32_t x, uint32_t y, uint32_t w, uint32_t h);
 
diff --git a/ui/console.c b/ui/console.c
index bf38579..c36f742 100644
--- a/ui/console.c
+++ b/ui/console.c
@@ -1712,6 +1712,18 @@ void dpy_gl_scanout(QemuConsole *con,
                                  x, y, width, height);
 }
 
+void dpy_gl_scanout2(QemuConsole *con,
+                     int fd, bool backing_y_0_top,
+                     uint32_t x, uint32_t y, uint32_t w, uint32_t h,
+                     uint32_t fd_w, uint32_t fd_h, uint32_t fd_stride,
+                     int fd_fourcc)
+{
+    assert(con->gl);
+    con->gl->ops->dpy_gl_scanout2(con->gl, fd, backing_y_0_top,
+                                  x, y, w, h, fd_w, fd_h, fd_stride,
+                                  fd_fourcc);
+}
+
 void dpy_gl_update(QemuConsole *con,
                    uint32_t x, uint32_t y, uint32_t w, uint32_t h)
 {
diff --git a/ui/spice-display.c b/ui/spice-display.c
index 0553c5e..06d2e4e 100644
--- a/ui/spice-display.c
+++ b/ui/spice-display.c
@@ -888,6 +888,24 @@ static void qemu_spice_gl_scanout(DisplayChangeListener *dcl,
     qemu_spice_gl_monitor_config(ssd, x, y, w, h);
 }
 
+static void
+qemu_spice_gl_scanout2(DisplayChangeListener *dcl,
+                       int fd, bool y_0_top,
+                       uint32_t x, uint32_t y, uint32_t w, uint32_t h,
+                       uint32_t fd_w, uint32_t fd_h, uint32_t fd_stride,
+                       int fd_fourcc)
+{
+    SimpleSpiceDisplay *ssd = container_of(dcl, SimpleSpiceDisplay, dcl);
+
+    /* note: spice server will close the fd */
+    spice_qxl_gl_scanout(&ssd->qxl, fd,
+                         fd_w,
+                         fd_h,
+                         fd_stride, fd_fourcc, y_0_top);
+
+    qemu_spice_gl_monitor_config(ssd, x, y, w, h);
+}
+
 static void qemu_spice_gl_update(DisplayChangeListener *dcl,
                                  uint32_t x, uint32_t y, uint32_t w, uint32_t h)
 {
@@ -915,6 +933,7 @@ static const DisplayChangeListenerOps display_listener_gl_ops = {
     .dpy_gl_ctx_get_current  = qemu_egl_get_current_context,
 
     .dpy_gl_scanout          = qemu_spice_gl_scanout,
+    .dpy_gl_scanout2         = qemu_spice_gl_scanout2,
     .dpy_gl_update           = qemu_spice_gl_update,
 };
 
-- 
2.7.4

  parent reply	other threads:[~2016-06-04 21:33 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-04 21:33 [Qemu-devel] [RFC 00/14] vhost-user backends for gpu & input virtio devices marcandre.lureau
2016-06-04 21:33 ` [Qemu-devel] [RFC 01/14] Add qemu_chr_open_socket() marcandre.lureau
2016-06-04 21:33 ` [Qemu-devel] [RFC 02/14] Add vhost-user-backend marcandre.lureau
2016-06-04 21:33 ` [Qemu-devel] [RFC 03/14] vhost-user: split vhost_user_read() marcandre.lureau
2016-06-04 21:33 ` [Qemu-devel] [RFC 04/14] vhost-user: add vhost_user_input_get_config() marcandre.lureau
2016-06-04 21:33 ` [Qemu-devel] [RFC 05/14] Add vhost-user backend to virtio-input-host marcandre.lureau
2016-06-06  6:22   ` Gerd Hoffmann
2016-06-04 21:33 ` [Qemu-devel] [RFC 06/14] contrib: add vhost-user-input marcandre.lureau
2016-06-04 21:33 ` [Qemu-devel] [RFC 07/14] misc: rename virtio-gpu.h header guard marcandre.lureau
2016-06-04 21:33 ` [Qemu-devel] [RFC 08/14] vhost: make sure call fd has been received marcandre.lureau
2016-06-04 21:33 ` [Qemu-devel] [RFC 09/14] qemu-char: use READ_RETRIES marcandre.lureau
2016-06-04 21:33 ` [Qemu-devel] [RFC 10/14] qemu-char: block during sync read marcandre.lureau
2016-06-04 21:33 ` marcandre.lureau [this message]
2016-06-06  6:35   ` [Qemu-devel] [RFC 11/14] console: add dpy_gl_scanout2() Gerd Hoffmann
2016-06-06 13:18     ` Marc-André Lureau
2016-06-06 14:04       ` Gerd Hoffmann
2016-06-04 21:33 ` [Qemu-devel] [RFC 12/14] contrib: add vhost-user-gpu marcandre.lureau
2016-06-04 21:33 ` [Qemu-devel] [RFC 13/14] vhost-user: add vhost_user_gpu_set_socket() marcandre.lureau
2016-06-06  6:36   ` Gerd Hoffmann
2016-06-04 21:33 ` [Qemu-devel] [RFC 14/14] Add virtio-gpu vhost-user backend marcandre.lureau
2016-06-06  6:54   ` Gerd Hoffmann
2016-06-06 13:54 ` [Qemu-devel] [RFC 00/14] vhost-user backends for gpu & input virtio devices Marc-André Lureau
2016-06-07 14:47   ` Gerd Hoffmann
2016-06-07 15:01     ` Marc-André Lureau
2016-06-08  6:11       ` Gerd Hoffmann
2016-06-08 12:53         ` Marc-André Lureau

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=1465076003-26291-12-git-send-email-marcandre.lureau@redhat.com \
    --to=marcandre.lureau@redhat.com \
    --cc=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).