[Spice-devel,spice-server] Define a new interface for Qemu to pass EGL display

Submitted by Frediano Ziglio on Feb. 22, 2017, 11:29 a.m.

Details

Message ID 20170222112905.3940-1-fziglio@redhat.com
State New
Headers show
Series "Define a new interface for Qemu to pass EGL display" ( rev: 1 ) in Spice

Not browsing as part of any series.

Commit Message

Frediano Ziglio Feb. 22, 2017, 11:29 a.m.
The new interface pass directly the EGL display to make
possible to extract texture data if necessary.
Also allows to use the same device using hardware
encoders.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
---
 server/red-qxl.c         | 10 ++++++++++
 server/spice-qxl.h       |  3 +++
 server/spice-server.syms |  5 +++++
 3 files changed, 18 insertions(+)

Patch hide | download patch | download mbox

diff --git a/server/red-qxl.c b/server/red-qxl.c
index b6b3770..367a428 100644
--- a/server/red-qxl.c
+++ b/server/red-qxl.c
@@ -60,6 +60,8 @@  struct QXLState {
     RedsState *reds;
     RedWorker *worker;
 
+    void *egl_display;
+
     pthread_mutex_t scanout_mutex;
     SpiceMsgDisplayGlScanoutUnix scanout;
     struct AsyncCommand *gl_draw_async;
@@ -865,6 +867,14 @@  void red_qxl_put_gl_scanout(QXLInstance *qxl, SpiceMsgDisplayGlScanoutUnix *scan
 }
 
 SPICE_GNUC_VISIBLE
+void spice_qxl_gl_setup(QXLInstance *qxl,
+                        void *egl_display)
+{
+    QXLState *qxl_state = qxl->st;
+    qxl_state->egl_display = egl_display;
+}
+
+SPICE_GNUC_VISIBLE
 void spice_qxl_gl_scanout(QXLInstance *qxl,
                           int fd,
                           uint32_t width, uint32_t height,
diff --git a/server/spice-qxl.h b/server/spice-qxl.h
index b8910bf..07da0dc 100644
--- a/server/spice-qxl.h
+++ b/server/spice-qxl.h
@@ -114,6 +114,9 @@  void spice_qxl_gl_draw_async(QXLInstance *instance,
                              uint32_t x, uint32_t y,
                              uint32_t w, uint32_t h,
                              uint64_t cookie);
+/* since spice 0.13.4 */
+void spice_qxl_gl_setup(QXLInstance *instance,
+                        void *egl_display);
 
 typedef struct QXLDrawArea {
     uint8_t *buf;
diff --git a/server/spice-server.syms b/server/spice-server.syms
index edf04a4..8aeb40f 100644
--- a/server/spice-server.syms
+++ b/server/spice-server.syms
@@ -173,3 +173,8 @@  SPICE_SERVER_0.13.2 {
 global:
     spice_server_set_video_codecs;
 } SPICE_SERVER_0.13.1;
+
+SPICE_SERVER_0.13.4 {
+global:
+    spice_qxl_gl_setup;
+} SPICE_SERVER_0.13.2;

Comments

Hi

----- Original Message -----
> The new interface pass directly the EGL display to make
> possible to extract texture data if necessary.
> Also allows to use the same device using hardware
> encoders.

I would like to see how this is going to be used before amending it, but a few questions below:

> 
> Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
> ---
>  server/red-qxl.c         | 10 ++++++++++
>  server/spice-qxl.h       |  3 +++
>  server/spice-server.syms |  5 +++++
>  3 files changed, 18 insertions(+)
> 
> diff --git a/server/red-qxl.c b/server/red-qxl.c
> index b6b3770..367a428 100644
> --- a/server/red-qxl.c
> +++ b/server/red-qxl.c
> @@ -60,6 +60,8 @@ struct QXLState {
>      RedsState *reds;
>      RedWorker *worker;
>  
> +    void *egl_display;
> +

Why not use EGLDisplay type?

>      pthread_mutex_t scanout_mutex;
>      SpiceMsgDisplayGlScanoutUnix scanout;
>      struct AsyncCommand *gl_draw_async;
> @@ -865,6 +867,14 @@ void red_qxl_put_gl_scanout(QXLInstance *qxl,
> SpiceMsgDisplayGlScanoutUnix *scan
>  }
>  
>  SPICE_GNUC_VISIBLE
> +void spice_qxl_gl_setup(QXLInstance *qxl,
> +                        void *egl_display)
> +{
> +    QXLState *qxl_state = qxl->st;
> +    qxl_state->egl_display = egl_display;
> +}

I would rather name the function spice_qxl_set_egl_display()

> +
> +SPICE_GNUC_VISIBLE
>  void spice_qxl_gl_scanout(QXLInstance *qxl,
>                            int fd,
>                            uint32_t width, uint32_t height,
> diff --git a/server/spice-qxl.h b/server/spice-qxl.h
> index b8910bf..07da0dc 100644
> --- a/server/spice-qxl.h
> +++ b/server/spice-qxl.h
> @@ -114,6 +114,9 @@ void spice_qxl_gl_draw_async(QXLInstance *instance,
>                               uint32_t x, uint32_t y,
>                               uint32_t w, uint32_t h,
>                               uint64_t cookie);
> +/* since spice 0.13.4 */
> +void spice_qxl_gl_setup(QXLInstance *instance,
> +                        void *egl_display);
>  
>  typedef struct QXLDrawArea {
>      uint8_t *buf;
> diff --git a/server/spice-server.syms b/server/spice-server.syms
> index edf04a4..8aeb40f 100644
> --- a/server/spice-server.syms
> +++ b/server/spice-server.syms
> @@ -173,3 +173,8 @@ SPICE_SERVER_0.13.2 {
>  global:
>      spice_server_set_video_codecs;
>  } SPICE_SERVER_0.13.1;
> +
> +SPICE_SERVER_0.13.4 {
> +global:
> +    spice_qxl_gl_setup;
> +} SPICE_SERVER_0.13.2;
> --
> 2.9.3
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/spice-devel
>
> 
> Hi
> 
> ----- Original Message -----
> > The new interface pass directly the EGL display to make
> > possible to extract texture data if necessary.
> > Also allows to use the same device using hardware
> > encoders.
> 
> I would like to see how this is going to be used before amending it, but a
> few questions below:
> 

https://cgit.freedesktop.org/~fziglio/spice-server/commit/?h=virgl-spice&id=a0b6ba1130e79ca59484462a2a4b7a64d301b474
http://gstreamer-devel.966125.n4.nabble.com/Sharing-EGL-context-with-glimagesink-td4673980.html

> > 
> > Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
> > ---
> >  server/red-qxl.c         | 10 ++++++++++
> >  server/spice-qxl.h       |  3 +++
> >  server/spice-server.syms |  5 +++++
> >  3 files changed, 18 insertions(+)
> > 
> > diff --git a/server/red-qxl.c b/server/red-qxl.c
> > index b6b3770..367a428 100644
> > --- a/server/red-qxl.c
> > +++ b/server/red-qxl.c
> > @@ -60,6 +60,8 @@ struct QXLState {
> >      RedsState *reds;
> >      RedWorker *worker;
> >  
> > +    void *egl_display;
> > +
> 
> Why not use EGLDisplay type?
> 

It's the same type so don't require any header include.

> >      pthread_mutex_t scanout_mutex;
> >      SpiceMsgDisplayGlScanoutUnix scanout;
> >      struct AsyncCommand *gl_draw_async;
> > @@ -865,6 +867,14 @@ void red_qxl_put_gl_scanout(QXLInstance *qxl,
> > SpiceMsgDisplayGlScanoutUnix *scan
> >  }
> >  
> >  SPICE_GNUC_VISIBLE
> > +void spice_qxl_gl_setup(QXLInstance *qxl,
> > +                        void *egl_display)
> > +{
> > +    QXLState *qxl_state = qxl->st;
> > +    qxl_state->egl_display = egl_display;
> > +}
> 
> I would rather name the function spice_qxl_set_egl_display()
> 
> > +
> > +SPICE_GNUC_VISIBLE
> >  void spice_qxl_gl_scanout(QXLInstance *qxl,
> >                            int fd,
> >                            uint32_t width, uint32_t height,
> > diff --git a/server/spice-qxl.h b/server/spice-qxl.h
> > index b8910bf..07da0dc 100644
> > --- a/server/spice-qxl.h
> > +++ b/server/spice-qxl.h
> > @@ -114,6 +114,9 @@ void spice_qxl_gl_draw_async(QXLInstance *instance,
> >                               uint32_t x, uint32_t y,
> >                               uint32_t w, uint32_t h,
> >                               uint64_t cookie);
> > +/* since spice 0.13.4 */
> > +void spice_qxl_gl_setup(QXLInstance *instance,
> > +                        void *egl_display);
> >  
> >  typedef struct QXLDrawArea {
> >      uint8_t *buf;
> > diff --git a/server/spice-server.syms b/server/spice-server.syms
> > index edf04a4..8aeb40f 100644
> > --- a/server/spice-server.syms
> > +++ b/server/spice-server.syms
> > @@ -173,3 +173,8 @@ SPICE_SERVER_0.13.2 {
> >  global:
> >      spice_server_set_video_codecs;
> >  } SPICE_SERVER_0.13.1;
> > +
> > +SPICE_SERVER_0.13.4 {
> > +global:
> > +    spice_qxl_gl_setup;
> > +} SPICE_SERVER_0.13.2;

Frediano