diff options
author | Alon Levy <alevy@redhat.com> | 2011-07-07 17:25:19 +0200 |
---|---|---|
committer | Alon Levy <alevy@redhat.com> | 2011-07-20 16:00:19 +0300 |
commit | 2a4d97fb780cf3ce2d9060751d0bec2fdc9800a9 (patch) | |
tree | 72885e849ea35eb95a7e10d2ada5aa49952bebe5 /server/red_dispatcher.c | |
parent | b26f0532c170068e91e4946592eab2fd9d6cbae5 (diff) | |
download | spice-2a4d97fb780cf3ce2d9060751d0bec2fdc9800a9.tar.gz spice-2a4d97fb780cf3ce2d9060751d0bec2fdc9800a9.tar.xz spice-2a4d97fb780cf3ce2d9060751d0bec2fdc9800a9.zip |
server: add QXLWorker.flush_surfaces_async for S3/S4 support
This does the following, all to remove any referenced memory on the pci bars:
flush_all_qxl_commands(worker);
flush_all_surfaces(worker);
red_wait_outgoing_item((RedChannel *)worker->display_channel);
red_wait_outgoing_item((RedChannel *)worker->cursor_channel);
The added api is specifically async, i.e. it calls async_complete
when done.
Diffstat (limited to 'server/red_dispatcher.c')
-rw-r--r-- | server/red_dispatcher.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/server/red_dispatcher.c b/server/red_dispatcher.c index 7f3efe87..7792d90a 100644 --- a/server/red_dispatcher.c +++ b/server/red_dispatcher.c @@ -541,6 +541,18 @@ static void qxl_worker_start(QXLWorker *qxl_worker) red_dispatcher_start((RedDispatcher*)qxl_worker); } +static void red_dispatcher_flush_surfaces_async(RedDispatcher *dispatcher, uint64_t cookie) +{ + RedWorkerMessage message = red_dispatcher_async_start(dispatcher, + RED_WORKER_MESSAGE_FLUSH_SURFACES_ASYNC); + + if (message == RED_WORKER_MESSAGE_NOP) { + return; + } + write_message(dispatcher->channel, &message); + send_data(dispatcher->channel, &cookie, sizeof(cookie)); +} + static void red_dispatcher_stop(RedDispatcher *dispatcher) { RedWorkerMessage message = RED_WORKER_MESSAGE_STOP; @@ -788,6 +800,12 @@ void spice_qxl_destroy_surface_async(QXLInstance *instance, uint32_t surface_id, red_dispatcher_destroy_surface_wait(instance->st->dispatcher, surface_id, 1, cookie); } +SPICE_GNUC_VISIBLE +void spice_qxl_flush_surfaces_async(QXLInstance *instance, uint64_t cookie) +{ + red_dispatcher_flush_surfaces_async(instance->st->dispatcher, cookie); +} + void red_dispatcher_async_complete(struct RedDispatcher *dispatcher, uint64_t cookie) { pthread_mutex_lock(&dispatcher->async_lock); @@ -806,6 +824,8 @@ void red_dispatcher_async_complete(struct RedDispatcher *dispatcher, uint64_t co break; case RED_WORKER_MESSAGE_DESTROY_SURFACE_WAIT_ASYNC: break; + case RED_WORKER_MESSAGE_FLUSH_SURFACES_ASYNC: + break; default: red_printf("unexpected message"); } |