mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/spice
synced 2026-01-11 08:07:16 +00:00
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>
This commit is contained in:
parent
9766619dff
commit
ebf461b8e6
@ -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)
|
||||
{
|
||||
|
||||
@ -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);
|
||||
|
||||
|
||||
@ -36,6 +36,8 @@ extern RedsState *reds;
|
||||
struct QXLState {
|
||||
QXLInterface *qif;
|
||||
struct RedDispatcher *dispatcher;
|
||||
SpiceMsgDisplayGlScanoutUnix scanout;
|
||||
struct AsyncCommand *gl_draw_async;
|
||||
};
|
||||
|
||||
struct TunnelWorker;
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user