diff options
author | Marc-André Lureau <marcandre.lureau@gmail.com> | 2016-02-09 14:35:02 +0100 |
---|---|---|
committer | Pavel Grunt <pgrunt@redhat.com> | 2016-03-14 13:44:59 +0100 |
commit | 4f1cfb36dec2a5e05e2ae762944bf27ed4884af7 (patch) | |
tree | 251342733677f1f2d4dfb326b5e71a687e580efb | |
parent | ab183645cb6e2f6dadbb752181e886d7f3a0e2bb (diff) |
Add new spice-gl stubs API
- spice_qxl_gl_scanout() to take the current scanout
- spice_qxl_gl_draw_async() to draw the scanout, is like other Spice async
functions, it takes a cookie and will return in the
QXLInterface.async_complete()
Two new fields are also added to QXLState, in order to save the current
scanout, and the pending async.
A scanout can't be updated if there are pending draw atm. Discarding
outdated draws is left as a future improvement to allow updating the
scanout without waiting for draw async to be done.
Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com>
[make QXL function names more coherent - Frediano Ziglio]
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
(cherry picked from commit ebf461b8e699536a600a15d600dc9a28e865cb90)
-rw-r--r-- | server/red_dispatcher.c | 35 | ||||
-rw-r--r-- | server/reds.c | 1 | ||||
-rw-r--r-- | server/reds.h | 2 | ||||
-rw-r--r-- | server/spice-qxl.h | 10 | ||||
-rw-r--r-- | server/spice-server.syms | 2 |
5 files changed, 50 insertions, 0 deletions
diff --git a/server/red_dispatcher.c b/server/red_dispatcher.c index b11cd423..992f9c1d 100644 --- a/server/red_dispatcher.c +++ b/server/red_dispatcher.c @@ -1000,6 +1000,41 @@ void spice_qxl_driver_unload(QXLInstance *instance) red_dispatcher_driver_unload(instance->st->dispatcher); } +SPICE_GNUC_VISIBLE +void spice_qxl_gl_scanout(QXLInstance *qxl, + int fd, + uint32_t width, uint32_t height, + uint32_t stride, uint32_t format, + int y_0_top) +{ + spice_return_if_fail(qxl != NULL); + spice_return_if_fail(qxl->st->gl_draw_async == NULL); + + if (qxl->st->scanout.drm_dma_buf_fd != -1) { + close(qxl->st->scanout.drm_dma_buf_fd); + } + + qxl->st->scanout = (SpiceMsgDisplayGlScanoutUnix) { + .flags = y_0_top ? SPICE_GL_SCANOUT_FLAGS_Y0TOP : 0, + .drm_dma_buf_fd = fd, + .width = width, + .height = height, + .stride = stride, + .drm_fourcc_format = format + }; +} + +SPICE_GNUC_VISIBLE +void spice_qxl_gl_draw_async(QXLInstance *qxl, + uint32_t x, uint32_t y, + uint32_t w, uint32_t h, + uint64_t cookie) +{ + spice_return_if_fail(qxl != NULL); + spice_return_if_fail(qxl->st->scanout.drm_dma_buf_fd != -1); + spice_return_if_fail(qxl->st->gl_draw_async == NULL); +} + void red_dispatcher_async_complete(struct RedDispatcher *dispatcher, AsyncCommand *async_command) { diff --git a/server/reds.c b/server/reds.c index fc391ea1..690748fa 100644 --- a/server/reds.c +++ b/server/reds.c @@ -3173,6 +3173,7 @@ SPICE_GNUC_VISIBLE int spice_server_add_interface(SpiceServer *s, qxl = SPICE_CONTAINEROF(sin, QXLInstance, base); qxl->st = spice_new0(QXLState, 1); + qxl->st->scanout.drm_dma_buf_fd = -1; qxl->st->qif = SPICE_CONTAINEROF(interface, QXLInterface, base); red_dispatcher_init(qxl); diff --git a/server/reds.h b/server/reds.h index a9c2df9b..572315c3 100644 --- a/server/reds.h +++ b/server/reds.h @@ -33,6 +33,8 @@ struct QXLState { QXLInterface *qif; struct RedDispatcher *dispatcher; + SpiceMsgDisplayGlScanoutUnix scanout; + struct AsyncCommand *gl_draw_async; }; struct TunnelWorker; diff --git a/server/spice-qxl.h b/server/spice-qxl.h index dd49a860..b94b23e1 100644 --- a/server/spice-qxl.h +++ b/server/spice-qxl.h @@ -100,6 +100,16 @@ void spice_qxl_driver_unload(QXLInstance *instance); /* since spice 0.12.6 */ void spice_qxl_set_max_monitors(QXLInstance *instance, unsigned int max_monitors); +/* since spice 0.13.1 */ +void spice_qxl_gl_scanout(QXLInstance *instance, + int fd, + uint32_t width, uint32_t height, + uint32_t stride, uint32_t format, + int y_0_top); +void spice_qxl_gl_draw_async(QXLInstance *instance, + uint32_t x, uint32_t y, + uint32_t w, uint32_t h, + uint64_t cookie); typedef struct QXLDrawArea { uint8_t *buf; diff --git a/server/spice-server.syms b/server/spice-server.syms index 4137546c..d915b274 100644 --- a/server/spice-server.syms +++ b/server/spice-server.syms @@ -166,4 +166,6 @@ global: SPICE_SERVER_0.12.7 { global: spice_server_set_keepalive_timeout; + spice_qxl_gl_scanout; + spice_qxl_gl_draw_async; } SPICE_SERVER_0.12.6; |