diff options
author | Marc-André Lureau <marcandre.lureau@gmail.com> | 2016-02-09 14:35:02 +0100 |
---|---|---|
committer | Frediano Ziglio <fziglio@redhat.com> | 2016-02-09 14:01:12 +0000 |
commit | ebf461b8e699536a600a15d600dc9a28e865cb90 (patch) | |
tree | d30f91c563b9154e1bc7b38db912a11d46b88873 | |
parent | 9766619dfffaebc82728624e6d0a0c3083ee2906 (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>
-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 | 6 |
5 files changed, 54 insertions, 0 deletions
diff --git a/server/red-dispatcher.c b/server/red-dispatcher.c index 374d5a98..009c377b 100644 --- a/server/red-dispatcher.c +++ b/server/red-dispatcher.c @@ -960,6 +960,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 7ccf0f1b..5f370c04 100644 --- a/server/reds.c +++ b/server/reds.c @@ -3185,6 +3185,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 8ff4491b..3182382d 100644 --- a/server/reds.h +++ b/server/reds.h @@ -36,6 +36,8 @@ extern RedsState *reds; 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 3faa3a4f..b8910bf4 100644 --- a/server/spice-qxl.h +++ b/server/spice-qxl.h @@ -104,6 +104,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..7987d51a 100644 --- a/server/spice-server.syms +++ b/server/spice-server.syms @@ -167,3 +167,9 @@ SPICE_SERVER_0.12.7 { global: spice_server_set_keepalive_timeout; } SPICE_SERVER_0.12.6; + +SPICE_SERVER_0.13.1 { +global: + spice_qxl_gl_scanout; + spice_qxl_gl_draw_async; +} SPICE_SERVER_0.12.7; |