mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/spice
synced 2026-01-05 23:35:51 +00:00
Use QXLInstance instead of QXLState in red_qxl_*
This seems to make more sense this way, QXLInstance is the 'main' object with QXLState being its private data. External users then use QXLInstance rather than passing a pointer to the private data to red-qxl.h methods. Acked-by: Frediano Ziglio <fziglio@redhat.com>
This commit is contained in:
parent
768ec149db
commit
e45ab9cf23
@ -2307,12 +2307,12 @@ static void marshall_gl_scanout(RedChannelClient *rcc,
|
||||
DisplayChannel *display_channel = DCC_TO_DC(dcc);
|
||||
QXLInstance* qxl = display_channel->common.qxl;
|
||||
|
||||
SpiceMsgDisplayGlScanoutUnix *scanout = red_qxl_get_gl_scanout(qxl->st);
|
||||
SpiceMsgDisplayGlScanoutUnix *scanout = red_qxl_get_gl_scanout(qxl);
|
||||
if (scanout != NULL) {
|
||||
red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_GL_SCANOUT_UNIX, NULL);
|
||||
spice_marshall_msg_display_gl_scanout_unix(m, scanout);
|
||||
}
|
||||
red_qxl_put_gl_scanout(qxl->st, scanout);
|
||||
red_qxl_put_gl_scanout(qxl, scanout);
|
||||
}
|
||||
|
||||
static void marshall_gl_draw(RedChannelClient *rcc,
|
||||
|
||||
@ -2163,7 +2163,7 @@ static void set_gl_draw_async_count(DisplayChannel *display, int num)
|
||||
display->gl_draw_async_count = num;
|
||||
|
||||
if (num == 0) {
|
||||
red_qxl_gl_draw_async_complete(qxl->st);
|
||||
red_qxl_gl_draw_async_complete(qxl);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
123
server/red-qxl.c
123
server/red-qxl.c
@ -63,10 +63,10 @@ struct QXLState {
|
||||
struct AsyncCommand *gl_draw_async;
|
||||
};
|
||||
|
||||
static int red_qxl_check_qxl_version(QXLState *rq, int major, int minor)
|
||||
static int red_qxl_check_qxl_version(QXLInstance *qxl, int major, int minor)
|
||||
{
|
||||
int qxl_major = qxl_get_interface(rq->qxl)->base.major_version;
|
||||
int qxl_minor = qxl_get_interface(rq->qxl)->base.minor_version;
|
||||
int qxl_major = qxl_get_interface(qxl)->base.major_version;
|
||||
int qxl_minor = qxl_get_interface(qxl)->base.minor_version;
|
||||
|
||||
return ((qxl_major > major) ||
|
||||
((qxl_major == major) && (qxl_minor >= minor)));
|
||||
@ -208,19 +208,18 @@ static void red_qxl_update_area(QXLState *qxl_state, uint32_t surface_id,
|
||||
&payload);
|
||||
}
|
||||
|
||||
gboolean red_qxl_use_client_monitors_config(QXLState *qxl_state)
|
||||
gboolean red_qxl_use_client_monitors_config(QXLInstance *qxl)
|
||||
{
|
||||
return (red_qxl_check_qxl_version(qxl_state, 3, 3) &&
|
||||
qxl_get_interface(qxl_state->qxl)->client_monitors_config &&
|
||||
qxl_get_interface(qxl_state->qxl)->client_monitors_config(qxl_state->qxl, NULL));
|
||||
return (red_qxl_check_qxl_version(qxl, 3, 3) &&
|
||||
qxl_get_interface(qxl)->client_monitors_config &&
|
||||
qxl_get_interface(qxl)->client_monitors_config(qxl, NULL));
|
||||
}
|
||||
|
||||
gboolean red_qxl_client_monitors_config(QXLState *qxl_state,
|
||||
gboolean red_qxl_client_monitors_config(QXLInstance *qxl,
|
||||
VDAgentMonitorsConfig *monitors_config)
|
||||
{
|
||||
return (qxl_get_interface(qxl_state->qxl)->client_monitors_config &&
|
||||
qxl_get_interface(qxl_state->qxl)->client_monitors_config(qxl_state->qxl,
|
||||
monitors_config));
|
||||
return (qxl_get_interface(qxl)->client_monitors_config &&
|
||||
qxl_get_interface(qxl)->client_monitors_config(qxl, monitors_config));
|
||||
}
|
||||
|
||||
static AsyncCommand *async_command_alloc(QXLState *qxl_state,
|
||||
@ -560,18 +559,19 @@ static void qxl_worker_oom(QXLWorker *qxl_worker)
|
||||
red_qxl_oom((QXLState*)qxl_worker);
|
||||
}
|
||||
|
||||
void red_qxl_start(QXLState *qxl_state)
|
||||
void red_qxl_start(QXLInstance *qxl)
|
||||
{
|
||||
RedWorkerMessageStart payload;
|
||||
|
||||
dispatcher_send_message(&qxl_state->dispatcher,
|
||||
dispatcher_send_message(&qxl->st->dispatcher,
|
||||
RED_WORKER_MESSAGE_START,
|
||||
&payload);
|
||||
}
|
||||
|
||||
static void qxl_worker_start(QXLWorker *qxl_worker)
|
||||
{
|
||||
red_qxl_start((QXLState*)qxl_worker);
|
||||
QXLState *state = (QXLState *)qxl_worker;
|
||||
red_qxl_start(state->qxl);
|
||||
}
|
||||
|
||||
static void red_qxl_flush_surfaces_async(QXLState *qxl_state, uint64_t cookie)
|
||||
@ -608,18 +608,19 @@ static void red_qxl_driver_unload(QXLState *qxl_state)
|
||||
&payload);
|
||||
}
|
||||
|
||||
void red_qxl_stop(QXLState *qxl_state)
|
||||
void red_qxl_stop(QXLInstance *qxl)
|
||||
{
|
||||
RedWorkerMessageStop payload;
|
||||
|
||||
dispatcher_send_message(&qxl_state->dispatcher,
|
||||
dispatcher_send_message(&qxl->st->dispatcher,
|
||||
RED_WORKER_MESSAGE_STOP,
|
||||
&payload);
|
||||
}
|
||||
|
||||
static void qxl_worker_stop(QXLWorker *qxl_worker)
|
||||
{
|
||||
red_qxl_stop((QXLState*)qxl_worker);
|
||||
QXLState *state = (QXLState *)qxl_worker;
|
||||
red_qxl_stop(state->qxl);
|
||||
}
|
||||
|
||||
static void red_qxl_loadvm_commands(QXLState *qxl_state,
|
||||
@ -643,26 +644,28 @@ static void qxl_worker_loadvm_commands(QXLWorker *qxl_worker,
|
||||
red_qxl_loadvm_commands((QXLState*)qxl_worker, ext, count);
|
||||
}
|
||||
|
||||
void red_qxl_set_mm_time(QXLState *qxl_state, uint32_t mm_time)
|
||||
void red_qxl_set_mm_time(QXLInstance *qxl, uint32_t mm_time)
|
||||
{
|
||||
qxl_get_interface(qxl_state->qxl)->set_mm_time(qxl_state->qxl, mm_time);
|
||||
QXLInterface *interface = qxl_get_interface(qxl);
|
||||
interface->set_mm_time(qxl, mm_time);
|
||||
}
|
||||
|
||||
void red_qxl_attach_worker(QXLState *qxl_state)
|
||||
void red_qxl_attach_worker(QXLInstance *qxl)
|
||||
{
|
||||
QXLInstance *qxl = qxl_state->qxl;
|
||||
qxl_get_interface(qxl_state->qxl)->attache_worker(qxl, &qxl_state->base);
|
||||
QXLInterface *interface = qxl_get_interface(qxl);
|
||||
interface->attache_worker(qxl, &qxl->st->base);
|
||||
}
|
||||
|
||||
void red_qxl_set_compression_level(QXLState *qxl_state, int level)
|
||||
void red_qxl_set_compression_level(QXLInstance *qxl, int level)
|
||||
{
|
||||
qxl_get_interface(qxl_state->qxl)->set_compression_level(qxl_state->qxl, level);
|
||||
QXLInterface *interface = qxl_get_interface(qxl);
|
||||
interface->set_compression_level(qxl, level);
|
||||
}
|
||||
|
||||
uint32_t red_qxl_get_ram_size(QXLState *qxl_state)
|
||||
uint32_t red_qxl_get_ram_size(QXLInstance *qxl)
|
||||
{
|
||||
QXLDevInitInfo qxl_info;
|
||||
qxl_get_interface(qxl_state->qxl)->get_init_info(qxl_state->qxl, &qxl_info);
|
||||
qxl_get_interface(qxl)->get_init_info(qxl, &qxl_info);
|
||||
return qxl_info.qxl_ram_size;
|
||||
}
|
||||
|
||||
@ -681,13 +684,13 @@ void spice_qxl_oom(QXLInstance *instance)
|
||||
SPICE_GNUC_VISIBLE
|
||||
void spice_qxl_start(QXLInstance *instance)
|
||||
{
|
||||
red_qxl_start(instance->st);
|
||||
red_qxl_start(instance);
|
||||
}
|
||||
|
||||
SPICE_GNUC_VISIBLE
|
||||
void spice_qxl_stop(QXLInstance *instance)
|
||||
{
|
||||
red_qxl_stop(instance->st);
|
||||
red_qxl_stop(instance);
|
||||
}
|
||||
|
||||
SPICE_GNUC_VISIBLE
|
||||
@ -824,20 +827,20 @@ void spice_qxl_driver_unload(QXLInstance *instance)
|
||||
red_qxl_driver_unload(instance->st);
|
||||
}
|
||||
|
||||
SpiceMsgDisplayGlScanoutUnix *red_qxl_get_gl_scanout(QXLState *qxl_state)
|
||||
SpiceMsgDisplayGlScanoutUnix *red_qxl_get_gl_scanout(QXLInstance *qxl)
|
||||
{
|
||||
pthread_mutex_lock(&qxl_state->scanout_mutex);
|
||||
if (qxl_state->scanout.drm_dma_buf_fd >= 0) {
|
||||
return &qxl_state->scanout;
|
||||
pthread_mutex_lock(&qxl->st->scanout_mutex);
|
||||
if (qxl->st->scanout.drm_dma_buf_fd >= 0) {
|
||||
return &qxl->st->scanout;
|
||||
}
|
||||
pthread_mutex_unlock(&qxl_state->scanout_mutex);
|
||||
pthread_mutex_unlock(&qxl->st->scanout_mutex);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void red_qxl_put_gl_scanout(QXLState *qxl_state, SpiceMsgDisplayGlScanoutUnix *scanout)
|
||||
void red_qxl_put_gl_scanout(QXLInstance *qxl, SpiceMsgDisplayGlScanoutUnix *scanout)
|
||||
{
|
||||
if (scanout) {
|
||||
pthread_mutex_unlock(&qxl_state->scanout_mutex);
|
||||
pthread_mutex_unlock(&qxl->st->scanout_mutex);
|
||||
}
|
||||
}
|
||||
|
||||
@ -899,9 +902,10 @@ void spice_qxl_gl_draw_async(QXLInstance *qxl,
|
||||
dispatcher_send_message(&qxl_state->dispatcher, message, &draw);
|
||||
}
|
||||
|
||||
void red_qxl_async_complete(QXLState *qxl_state,
|
||||
AsyncCommand *async_command)
|
||||
void red_qxl_async_complete(QXLInstance *qxl, AsyncCommand *async_command)
|
||||
{
|
||||
QXLInterface *interface = qxl_get_interface(qxl);
|
||||
|
||||
spice_debug("%p: cookie %" PRId64, async_command, async_command->cookie);
|
||||
switch (async_command->message) {
|
||||
case RED_WORKER_MESSAGE_UPDATE_ASYNC:
|
||||
@ -913,25 +917,24 @@ void red_qxl_async_complete(QXLState *qxl_state,
|
||||
case RED_WORKER_MESSAGE_GL_DRAW_ASYNC:
|
||||
break;
|
||||
case RED_WORKER_MESSAGE_CREATE_PRIMARY_SURFACE_ASYNC:
|
||||
red_qxl_create_primary_surface_complete(qxl_state);
|
||||
red_qxl_create_primary_surface_complete(qxl->st);
|
||||
break;
|
||||
case RED_WORKER_MESSAGE_DESTROY_PRIMARY_SURFACE_ASYNC:
|
||||
red_qxl_destroy_primary_surface_complete(qxl_state);
|
||||
red_qxl_destroy_primary_surface_complete(qxl->st);
|
||||
break;
|
||||
default:
|
||||
spice_warning("unexpected message %d", async_command->message);
|
||||
}
|
||||
qxl_get_interface(qxl_state->qxl)->async_complete(qxl_state->qxl,
|
||||
async_command->cookie);
|
||||
interface->async_complete(qxl, async_command->cookie);
|
||||
free(async_command);
|
||||
}
|
||||
|
||||
void red_qxl_gl_draw_async_complete(QXLState *qxl_state)
|
||||
void red_qxl_gl_draw_async_complete(QXLInstance *qxl)
|
||||
{
|
||||
/* this reset before usage prevent a possible race condition */
|
||||
struct AsyncCommand *async = qxl_state->gl_draw_async;
|
||||
qxl_state->gl_draw_async = NULL;
|
||||
red_qxl_async_complete(qxl_state, async);
|
||||
struct AsyncCommand *async = qxl->st->gl_draw_async;
|
||||
qxl->st->gl_draw_async = NULL;
|
||||
red_qxl_async_complete(qxl, async);
|
||||
}
|
||||
|
||||
void red_qxl_init(RedsState *reds, QXLInstance *qxl)
|
||||
@ -1003,9 +1006,9 @@ void red_qxl_init(RedsState *reds, QXLInstance *qxl)
|
||||
red_worker_run(worker);
|
||||
}
|
||||
|
||||
struct Dispatcher *red_qxl_get_dispatcher(QXLState *qxl_state)
|
||||
struct Dispatcher *red_qxl_get_dispatcher(QXLInstance *qxl)
|
||||
{
|
||||
return &qxl_state->dispatcher;
|
||||
return &qxl->st->dispatcher;
|
||||
}
|
||||
|
||||
void red_qxl_clear_pending(QXLState *qxl_state, int pending)
|
||||
@ -1015,45 +1018,45 @@ void red_qxl_clear_pending(QXLState *qxl_state, int pending)
|
||||
clear_bit(pending, &qxl_state->pending);
|
||||
}
|
||||
|
||||
gboolean red_qxl_get_primary_active(QXLState *qxl_state)
|
||||
gboolean red_qxl_get_primary_active(QXLInstance *qxl)
|
||||
{
|
||||
return qxl_state->primary_active;
|
||||
return qxl->st->primary_active;
|
||||
}
|
||||
|
||||
gboolean red_qxl_get_allow_client_mouse(QXLState *qxl_state, gint *x_res, gint *y_res)
|
||||
gboolean red_qxl_get_allow_client_mouse(QXLInstance *qxl, gint *x_res, gint *y_res)
|
||||
{
|
||||
if (qxl_state->use_hardware_cursor) {
|
||||
if (qxl->st->use_hardware_cursor) {
|
||||
if (x_res)
|
||||
*x_res = qxl_state->x_res;
|
||||
*x_res = qxl->st->x_res;
|
||||
if (y_res)
|
||||
*y_res = qxl_state->y_res;
|
||||
*y_res = qxl->st->y_res;
|
||||
}
|
||||
return qxl_state->use_hardware_cursor;
|
||||
return qxl->st->use_hardware_cursor;
|
||||
}
|
||||
|
||||
void red_qxl_on_ic_change(QXLState *qxl_state, SpiceImageCompression ic)
|
||||
void red_qxl_on_ic_change(QXLInstance *qxl, SpiceImageCompression ic)
|
||||
{
|
||||
RedWorkerMessageSetCompression payload;
|
||||
payload.image_compression = ic;
|
||||
dispatcher_send_message(&qxl_state->dispatcher,
|
||||
dispatcher_send_message(&qxl->st->dispatcher,
|
||||
RED_WORKER_MESSAGE_SET_COMPRESSION,
|
||||
&payload);
|
||||
}
|
||||
|
||||
void red_qxl_on_sv_change(QXLState *qxl_state, int sv)
|
||||
void red_qxl_on_sv_change(QXLInstance *qxl, int sv)
|
||||
{
|
||||
RedWorkerMessageSetStreamingVideo payload;
|
||||
payload.streaming_video = sv;
|
||||
dispatcher_send_message(&qxl_state->dispatcher,
|
||||
dispatcher_send_message(&qxl->st->dispatcher,
|
||||
RED_WORKER_MESSAGE_SET_STREAMING_VIDEO,
|
||||
&payload);
|
||||
}
|
||||
|
||||
void red_qxl_set_mouse_mode(QXLState *qxl_state, uint32_t mode)
|
||||
void red_qxl_set_mouse_mode(QXLInstance *qxl, uint32_t mode)
|
||||
{
|
||||
RedWorkerMessageSetMouseMode payload;
|
||||
payload.mode = mode;
|
||||
dispatcher_send_message(&qxl_state->dispatcher,
|
||||
dispatcher_send_message(&qxl->st->dispatcher,
|
||||
RED_WORKER_MESSAGE_SET_MOUSE_MODE,
|
||||
&payload);
|
||||
}
|
||||
|
||||
@ -26,24 +26,24 @@ typedef struct AsyncCommand AsyncCommand;
|
||||
|
||||
void red_qxl_init(SpiceServer *reds, QXLInstance *qxl);
|
||||
|
||||
void red_qxl_set_mm_time(QXLState *qxl_state, uint32_t);
|
||||
void red_qxl_on_ic_change(QXLState *qxl_state, SpiceImageCompression ic);
|
||||
void red_qxl_on_sv_change(QXLState *qxl_state, int sv);
|
||||
void red_qxl_set_mouse_mode(QXLState *qxl_state, uint32_t mode);
|
||||
void red_qxl_attach_worker(QXLState *qxl_state);
|
||||
void red_qxl_set_compression_level(QXLState *qxl_state, int level);
|
||||
void red_qxl_stop(QXLState *qxl_state);
|
||||
void red_qxl_start(QXLState *qxl_state);
|
||||
uint32_t red_qxl_get_ram_size(QXLState *qxl_state);
|
||||
void red_qxl_async_complete(QXLState *qxl_state, AsyncCommand *cmd);
|
||||
struct Dispatcher *red_qxl_get_dispatcher(QXLState *qxl_state);
|
||||
gboolean red_qxl_use_client_monitors_config(QXLState *qxl_state);
|
||||
gboolean red_qxl_client_monitors_config(QXLState *qxl_state, VDAgentMonitorsConfig *monitors_config);
|
||||
gboolean red_qxl_get_primary_active(QXLState *qxl_state);
|
||||
gboolean red_qxl_get_allow_client_mouse(QXLState *qxl_state, gint *x_res, gint *y_res);
|
||||
SpiceMsgDisplayGlScanoutUnix *red_qxl_get_gl_scanout(QXLState *qxl_state);
|
||||
void red_qxl_put_gl_scanout(QXLState *qxl_state, SpiceMsgDisplayGlScanoutUnix *scanout);
|
||||
void red_qxl_gl_draw_async_complete(QXLState *qxl);
|
||||
void red_qxl_set_mm_time(QXLInstance *qxl, uint32_t);
|
||||
void red_qxl_on_ic_change(QXLInstance *qxl, SpiceImageCompression ic);
|
||||
void red_qxl_on_sv_change(QXLInstance *qxl, int sv);
|
||||
void red_qxl_set_mouse_mode(QXLInstance *qxl, uint32_t mode);
|
||||
void red_qxl_attach_worker(QXLInstance *qxl);
|
||||
void red_qxl_set_compression_level(QXLInstance *qxl, int level);
|
||||
void red_qxl_stop(QXLInstance *qxl);
|
||||
void red_qxl_start(QXLInstance *qxl);
|
||||
uint32_t red_qxl_get_ram_size(QXLInstance *qxl);
|
||||
void red_qxl_async_complete(QXLInstance *qxl, AsyncCommand *async_command);
|
||||
struct Dispatcher *red_qxl_get_dispatcher(QXLInstance *qxl);
|
||||
gboolean red_qxl_use_client_monitors_config(QXLInstance *qxl);
|
||||
gboolean red_qxl_client_monitors_config(QXLInstance *qxl, VDAgentMonitorsConfig *monitors_config);
|
||||
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);
|
||||
void red_qxl_gl_draw_async_complete(QXLInstance *qxl);
|
||||
SpiceServer* red_qxl_get_server(QXLState *qxl);
|
||||
|
||||
typedef uint32_t RedWorkerMessage;
|
||||
|
||||
@ -1197,7 +1197,7 @@ static void worker_handle_dispatcher_async_done(void *opaque,
|
||||
RedWorkerMessageAsync *msg_async = payload;
|
||||
|
||||
spice_debug(NULL);
|
||||
red_qxl_async_complete(worker->qxl->st, msg_async->cmd);
|
||||
red_qxl_async_complete(worker->qxl, msg_async->cmd);
|
||||
}
|
||||
|
||||
static void worker_dispatcher_record(void *opaque, uint32_t message_type, void *payload)
|
||||
@ -1491,7 +1491,7 @@ RedWorker* red_worker_new(QXLInstance *qxl)
|
||||
spice_error("failed to write replay header");
|
||||
}
|
||||
}
|
||||
dispatcher = red_qxl_get_dispatcher(qxl->st);
|
||||
dispatcher = red_qxl_get_dispatcher(qxl);
|
||||
dispatcher_set_opaque(dispatcher, worker);
|
||||
|
||||
worker->qxl = qxl;
|
||||
|
||||
@ -231,7 +231,7 @@ struct RedsState {
|
||||
|
||||
RedSSLParameters ssl_parameters;
|
||||
SpiceCoreInterfaceInternal *core;
|
||||
GList *qxl_states;
|
||||
GList *qxl_instances;
|
||||
MainDispatcher *main_dispatcher;
|
||||
};
|
||||
|
||||
|
||||
@ -570,8 +570,10 @@ static void reds_set_mouse_mode(RedsState *reds, uint32_t mode)
|
||||
}
|
||||
reds->mouse_mode = mode;
|
||||
|
||||
for (l = reds->qxl_states; l != NULL; l = l->next)
|
||||
red_qxl_set_mouse_mode((QXLState*) l->data, mode);
|
||||
for (l = reds->qxl_instances; l != NULL; l = l->next) {
|
||||
QXLInstance *qxl = (QXLInstance *)l->data;
|
||||
red_qxl_set_mouse_mode(qxl, mode);
|
||||
}
|
||||
|
||||
main_channel_push_mouse_mode(reds->main_channel, reds->mouse_mode, reds->is_client_mouse_allowed);
|
||||
}
|
||||
@ -584,7 +586,7 @@ gboolean reds_get_agent_mouse(const RedsState *reds)
|
||||
static void reds_update_mouse_mode(RedsState *reds)
|
||||
{
|
||||
int allowed = 0;
|
||||
int qxl_count = g_list_length(reds->qxl_states);
|
||||
int qxl_count = g_list_length(reds->qxl_instances);
|
||||
|
||||
if ((reds->agent_mouse && reds->vdagent) ||
|
||||
(inputs_channel_has_tablet(reds->inputs_channel) && qxl_count == 1)) {
|
||||
@ -1681,7 +1683,7 @@ static void reds_handle_main_link(RedsState *reds, RedLinkInfo *link)
|
||||
}
|
||||
|
||||
if (!mig_target) {
|
||||
main_channel_push_init(mcc, g_list_length(reds->qxl_states),
|
||||
main_channel_push_init(mcc, g_list_length(reds->qxl_instances),
|
||||
reds->mouse_mode, reds->is_client_mouse_allowed,
|
||||
reds_get_mm_time() - MM_TIME_DELTA,
|
||||
reds_qxl_ram_size(reds));
|
||||
@ -1827,7 +1829,7 @@ void reds_on_client_semi_seamless_migrate_complete(RedsState *reds, RedClient *c
|
||||
mcc = red_client_get_main(client);
|
||||
|
||||
// TODO: not doing net test. consider doing it on client_migrate_info
|
||||
main_channel_push_init(mcc, g_list_length(reds->qxl_states),
|
||||
main_channel_push_init(mcc, g_list_length(reds->qxl_instances),
|
||||
reds->mouse_mode, reds->is_client_mouse_allowed,
|
||||
reds_get_mm_time() - MM_TIME_DELTA,
|
||||
reds_qxl_ram_size(reds));
|
||||
@ -3175,7 +3177,6 @@ SPICE_GNUC_VISIBLE int spice_server_add_interface(SpiceServer *s,
|
||||
}
|
||||
} else if (strcmp(interface->type, SPICE_INTERFACE_QXL) == 0) {
|
||||
QXLInstance *qxl;
|
||||
QXLState *qxl_state;
|
||||
|
||||
spice_info("SPICE_INTERFACE_QXL");
|
||||
if (interface->major_version != SPICE_INTERFACE_QXL_MAJOR ||
|
||||
@ -3186,16 +3187,15 @@ SPICE_GNUC_VISIBLE int spice_server_add_interface(SpiceServer *s,
|
||||
|
||||
qxl = SPICE_CONTAINEROF(sin, QXLInstance, base);
|
||||
red_qxl_init(reds, qxl);
|
||||
qxl_state = qxl->st;
|
||||
reds->qxl_states = g_list_prepend(reds->qxl_states, qxl_state);
|
||||
reds->qxl_instances = g_list_prepend(reds->qxl_instances, qxl);
|
||||
|
||||
/* this function has to be called after the qxl is on the list
|
||||
* as QXLInstance clients expect the qxl to be on the list when
|
||||
* this callback is called. This as clients assume they can start the
|
||||
* qxl_states. Also note that this should be the first callback to
|
||||
* qxl_instances. Also note that this should be the first callback to
|
||||
* be called. */
|
||||
red_qxl_attach_worker(qxl_state);
|
||||
red_qxl_set_compression_level(qxl_state, calc_compression_level(reds));
|
||||
red_qxl_attach_worker(qxl);
|
||||
red_qxl_set_compression_level(qxl, calc_compression_level(reds));
|
||||
} else if (strcmp(interface->type, SPICE_INTERFACE_TABLET) == 0) {
|
||||
SpiceTabletInstance *tablet = SPICE_CONTAINEROF(sin, SpiceTabletInstance, base);
|
||||
spice_info("SPICE_INTERFACE_TABLET");
|
||||
@ -4109,15 +4109,14 @@ void reds_update_client_mouse_allowed(RedsState *reds)
|
||||
int x_res = 0;
|
||||
int y_res = 0;
|
||||
GList *l;
|
||||
int num_active_workers = g_list_length(reds->qxl_states);
|
||||
int num_active_workers = g_list_length(reds->qxl_instances);
|
||||
|
||||
if (num_active_workers > 0) {
|
||||
allow_now = TRUE;
|
||||
for (l = reds->qxl_states; l != NULL && allow_now; l = l->next) {
|
||||
|
||||
QXLState *now = l->data;
|
||||
if (red_qxl_get_primary_active(now)) {
|
||||
allow_now = red_qxl_get_allow_client_mouse(now, &x_res, &y_res);
|
||||
for (l = reds->qxl_instances; l != NULL && allow_now; l = l->next) {
|
||||
QXLInstance *qxl = l->data;
|
||||
if (red_qxl_get_primary_active(qxl)) {
|
||||
allow_now = red_qxl_get_allow_client_mouse(qxl, &x_res, &y_res);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -4133,14 +4132,14 @@ gboolean reds_use_client_monitors_config(RedsState *reds)
|
||||
{
|
||||
GList *l;
|
||||
|
||||
if (reds->qxl_states == NULL) {
|
||||
if (reds->qxl_instances == NULL) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
for (l = reds->qxl_states; l != NULL ; l = l->next) {
|
||||
QXLState *now = l->data;
|
||||
for (l = reds->qxl_instances; l != NULL ; l = l->next) {
|
||||
QXLInstance *qxl = l->data;
|
||||
|
||||
if (!red_qxl_use_client_monitors_config(now))
|
||||
if (!red_qxl_use_client_monitors_config(qxl))
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
@ -4150,9 +4149,9 @@ void reds_client_monitors_config(RedsState *reds, VDAgentMonitorsConfig *monitor
|
||||
{
|
||||
GList *l;
|
||||
|
||||
for (l = reds->qxl_states; l != NULL; l = l->next) {
|
||||
QXLState *now = l->data;
|
||||
if (!red_qxl_client_monitors_config(now, monitors_config)) {
|
||||
for (l = reds->qxl_instances; l != NULL; l = l->next) {
|
||||
QXLInstance *qxl = l->data;
|
||||
if (!red_qxl_client_monitors_config(qxl, monitors_config)) {
|
||||
/* this is a normal condition, some qemu devices might not implement it */
|
||||
spice_debug("QXLInterface::client_monitors_config failed\n");
|
||||
}
|
||||
@ -4163,9 +4162,9 @@ void reds_set_mm_time(RedsState *reds, uint32_t mm_time)
|
||||
{
|
||||
GList *l;
|
||||
|
||||
for (l = reds->qxl_states; l != NULL; l = l->next) {
|
||||
QXLState *now = l->data;
|
||||
red_qxl_set_mm_time(now, mm_time);
|
||||
for (l = reds->qxl_instances; l != NULL; l = l->next) {
|
||||
QXLInstance *qxl = l->data;
|
||||
red_qxl_set_mm_time(qxl, mm_time);
|
||||
}
|
||||
}
|
||||
|
||||
@ -4186,10 +4185,10 @@ void reds_on_ic_change(RedsState *reds)
|
||||
int compression_level = calc_compression_level(reds);
|
||||
GList *l;
|
||||
|
||||
for (l = reds->qxl_states; l != NULL; l = l->next) {
|
||||
QXLState *q = l->data;
|
||||
red_qxl_set_compression_level(q, compression_level);
|
||||
red_qxl_on_ic_change(q, spice_server_get_image_compression(reds));
|
||||
for (l = reds->qxl_instances; l != NULL; l = l->next) {
|
||||
QXLInstance *qxl = l->data;
|
||||
red_qxl_set_compression_level(qxl, compression_level);
|
||||
red_qxl_on_ic_change(qxl, spice_server_get_image_compression(reds));
|
||||
}
|
||||
}
|
||||
|
||||
@ -4198,10 +4197,10 @@ void reds_on_sv_change(RedsState *reds)
|
||||
int compression_level = calc_compression_level(reds);
|
||||
GList *l;
|
||||
|
||||
for (l = reds->qxl_states; l != NULL; l = l->next) {
|
||||
QXLState *q = l->data;
|
||||
red_qxl_set_compression_level(q, compression_level);
|
||||
red_qxl_on_sv_change(q, reds_get_streaming_video(reds));
|
||||
for (l = reds->qxl_instances; l != NULL; l = l->next) {
|
||||
QXLInstance *qxl = l->data;
|
||||
red_qxl_set_compression_level(qxl, compression_level);
|
||||
red_qxl_on_sv_change(qxl, reds_get_streaming_video(reds));
|
||||
}
|
||||
}
|
||||
|
||||
@ -4209,26 +4208,30 @@ void reds_on_vm_stop(RedsState *reds)
|
||||
{
|
||||
GList *l;
|
||||
|
||||
for (l = reds->qxl_states; l != NULL; l = l->next)
|
||||
red_qxl_stop((QXLState*) l->data);
|
||||
for (l = reds->qxl_instances; l != NULL; l = l->next) {
|
||||
QXLInstance *qxl = l->data;
|
||||
red_qxl_stop(qxl);
|
||||
}
|
||||
}
|
||||
|
||||
void reds_on_vm_start(RedsState *reds)
|
||||
{
|
||||
GList *l;
|
||||
|
||||
for (l = reds->qxl_states; l != NULL; l = l->next)
|
||||
red_qxl_start((QXLState*) l->data);
|
||||
for (l = reds->qxl_instances; l != NULL; l = l->next) {
|
||||
QXLInstance *qxl = l->data;
|
||||
red_qxl_start(qxl);
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t reds_qxl_ram_size(RedsState *reds)
|
||||
{
|
||||
QXLState *first;
|
||||
if (!reds->qxl_states) {
|
||||
QXLInstance *first;
|
||||
if (!reds->qxl_instances) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
first = reds->qxl_states->data;
|
||||
first = reds->qxl_instances->data;
|
||||
return red_qxl_get_ram_size(first);
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user