[PATCH RFC 04/12] Save and allow to retrieve texture information in Qxl

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Similar interface for storing/retrieving scanout.

Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx>
---
 server/red-qxl.c | 20 ++++++++++++++++++++
 server/red-qxl.h | 11 +++++++++++
 2 files changed, 31 insertions(+)

diff --git a/server/red-qxl.c b/server/red-qxl.c
index 7a68144..1a951f8 100644
--- a/server/red-qxl.c
+++ b/server/red-qxl.c
@@ -64,6 +64,7 @@ struct QXLState {
 
     pthread_mutex_t scanout_mutex;
     SpiceMsgDisplayGlScanoutUnix scanout;
+    RedGlTexture texture;
     struct AsyncCommand *gl_draw_async;
 };
 
@@ -857,6 +858,25 @@ void red_qxl_put_gl_scanout(QXLInstance *qxl, SpiceMsgDisplayGlScanoutUnix *scan
     }
 }
 
+RedGlTexture *red_qxl_get_gl_texture(QXLInstance *qxl)
+{
+    QXLState *st = qxl->st;
+
+    pthread_mutex_lock(&st->scanout_mutex);
+    if (st->texture.egl_display && st->texture.tex_id) {
+        return &st->texture;
+    }
+    pthread_mutex_unlock(&st->scanout_mutex);
+    return NULL;
+}
+
+void red_qxl_put_gl_texture(QXLInstance *qxl, RedGlTexture *texture)
+{
+    if (texture) {
+        pthread_mutex_unlock(&qxl->st->scanout_mutex);
+    }
+}
+
 SPICE_GNUC_VISIBLE
 void spice_qxl_gl_init(QXLInstance *qxl,
                        void *egl_display,
diff --git a/server/red-qxl.h b/server/red-qxl.h
index 00c5486..412afe2 100644
--- a/server/red-qxl.h
+++ b/server/red-qxl.h
@@ -23,6 +23,15 @@
 
 typedef struct AsyncCommand AsyncCommand;
 
+typedef struct {
+    void *egl_display;
+    void *egl_context;
+    uint32_t tex_id;
+    uint32_t width;
+    uint32_t height;
+    uint32_t flags;
+} RedGlTexture;
+
 void red_qxl_init(SpiceServer *reds, QXLInstance *qxl);
 
 void red_qxl_on_ic_change(QXLInstance *qxl, SpiceImageCompression ic);
@@ -42,6 +51,8 @@ gboolean red_qxl_get_primary_active(QXLInstance *qxl);
 gboolean red_qxl_get_allow_client_mouse(QXLInstance *qxl, gint *x_res, gint *y_res);
 SpiceMsgDisplayGlScanoutUnix *red_qxl_get_gl_scanout(QXLInstance *qxl);
 void red_qxl_put_gl_scanout(QXLInstance *qxl, SpiceMsgDisplayGlScanoutUnix *scanout);
+RedGlTexture *red_qxl_get_gl_texture(QXLInstance *qxl);
+void red_qxl_put_gl_texture(QXLInstance *qxl, RedGlTexture *texture);
 void red_qxl_gl_draw_async_complete(QXLInstance *qxl);
 int red_qxl_check_qxl_version(QXLInstance *qxl, int major, int minor);
 SpiceServer* red_qxl_get_server(QXLState *qxl);
-- 
2.7.4

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]