mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-21 21:17:19 +00:00
[client] spice: delay showing the spice display until spice is ready
This commit is contained in:
parent
c0da28247d
commit
d1e421f8a8
@ -24,6 +24,7 @@
|
|||||||
#include "core.h"
|
#include "core.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "clipboard.h"
|
#include "clipboard.h"
|
||||||
|
#include "render_queue.h"
|
||||||
|
|
||||||
#include "kb.h"
|
#include "kb.h"
|
||||||
|
|
||||||
@ -1043,6 +1044,13 @@ void app_useSpiceDisplay(bool enable)
|
|||||||
if (!g_params.useSpice || lastState == enable)
|
if (!g_params.useSpice || lastState == enable)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// if spice is not yet ready, flag the state we want for when it is
|
||||||
|
if (!g_state.spiceReady)
|
||||||
|
{
|
||||||
|
g_state.initialSpiceDisplay = enable;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!purespice_hasChannel(PS_CHANNEL_DISPLAY))
|
if (!purespice_hasChannel(PS_CHANNEL_DISPLAY))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -1054,11 +1062,11 @@ void app_useSpiceDisplay(bool enable)
|
|||||||
if (enable)
|
if (enable)
|
||||||
{
|
{
|
||||||
purespice_connectChannel(PS_CHANNEL_DISPLAY);
|
purespice_connectChannel(PS_CHANNEL_DISPLAY);
|
||||||
RENDERER(spiceShow, true);
|
renderQueue_spiceShow(true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
renderQueue_spiceShow(false);
|
||||||
purespice_disconnectChannel(PS_CHANNEL_DISPLAY);
|
purespice_disconnectChannel(PS_CHANNEL_DISPLAY);
|
||||||
RENDERER(spiceShow, false);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -845,6 +845,10 @@ static void checkUUID(void)
|
|||||||
|
|
||||||
void spiceReady(void)
|
void spiceReady(void)
|
||||||
{
|
{
|
||||||
|
g_state.spiceReady = true;
|
||||||
|
if (g_state.initialSpiceDisplay)
|
||||||
|
app_useSpiceDisplay(true);
|
||||||
|
|
||||||
// set the intial mouse mode
|
// set the intial mouse mode
|
||||||
purespice_mouseMode(true);
|
purespice_mouseMode(true);
|
||||||
|
|
||||||
@ -864,7 +868,6 @@ void spiceReady(void)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
memcpy(g_state.spiceUUID, info.uuid, sizeof(g_state.spiceUUID));
|
memcpy(g_state.spiceUUID, info.uuid, sizeof(g_state.spiceUUID));
|
||||||
g_state.spiceReady = true;
|
|
||||||
checkUUID();
|
checkUUID();
|
||||||
|
|
||||||
if (g_params.useSpiceInput)
|
if (g_params.useSpiceInput)
|
||||||
@ -962,6 +965,11 @@ int spiceThread(void * arg)
|
|||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* use the spice display until we get frames from the LG host application
|
||||||
|
* it is safe to call this before connect as it will be delayed until
|
||||||
|
* spiceReady is called */
|
||||||
|
app_useSpiceDisplay(true);
|
||||||
|
|
||||||
if (!purespice_connect(&config))
|
if (!purespice_connect(&config))
|
||||||
{
|
{
|
||||||
DEBUG_ERROR("Failed to connect to spice server");
|
DEBUG_ERROR("Failed to connect to spice server");
|
||||||
@ -1317,9 +1325,6 @@ static int lg_run(void)
|
|||||||
if (g_state.cbAvailable)
|
if (g_state.cbAvailable)
|
||||||
g_state.cbRequestList = ll_new();
|
g_state.cbRequestList = ll_new();
|
||||||
|
|
||||||
// use the spice display until we get frames from the LG host application
|
|
||||||
app_useSpiceDisplay(true);
|
|
||||||
|
|
||||||
LGMP_STATUS status;
|
LGMP_STATUS status;
|
||||||
|
|
||||||
while(g_state.state == APP_STATE_RUNNING)
|
while(g_state.state == APP_STATE_RUNNING)
|
||||||
|
@ -71,6 +71,7 @@ struct AppState
|
|||||||
|
|
||||||
uint8_t spiceUUID[16];
|
uint8_t spiceUUID[16];
|
||||||
bool spiceReady;
|
bool spiceReady;
|
||||||
|
bool initialSpiceDisplay;
|
||||||
uint8_t guestUUID[16];
|
uint8_t guestUUID[16];
|
||||||
bool guestUUIDValid;
|
bool guestUUIDValid;
|
||||||
KVMFROS guestOS;
|
KVMFROS guestOS;
|
||||||
|
@ -47,7 +47,7 @@ void renderQueue_clear(void)
|
|||||||
while(ll_shift(l_renderQueue, (void **)&cmd))
|
while(ll_shift(l_renderQueue, (void **)&cmd))
|
||||||
{
|
{
|
||||||
if (cmd->op == SPICE_OP_DRAW_BITMAP)
|
if (cmd->op == SPICE_OP_DRAW_BITMAP)
|
||||||
free(cmd->drawBitmap.data);
|
free(cmd->spiceDrawBitmap.data);
|
||||||
free(cmd);
|
free(cmd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -58,9 +58,9 @@ void renderQueue_spiceConfigure(int width, int height)
|
|||||||
renderQueue_clear();
|
renderQueue_clear();
|
||||||
|
|
||||||
RenderCommand * cmd = malloc(sizeof(*cmd));
|
RenderCommand * cmd = malloc(sizeof(*cmd));
|
||||||
cmd->op = SPICE_OP_CONFIGURE;
|
cmd->op = SPICE_OP_CONFIGURE;
|
||||||
cmd->configure.width = width;
|
cmd->spiceConfigure.width = width;
|
||||||
cmd->configure.height = height;
|
cmd->spiceConfigure.height = height;
|
||||||
ll_push(l_renderQueue, cmd);
|
ll_push(l_renderQueue, cmd);
|
||||||
app_invalidateWindow(true);
|
app_invalidateWindow(true);
|
||||||
}
|
}
|
||||||
@ -69,12 +69,12 @@ void renderQueue_spiceDrawFill(int x, int y, int width, int height,
|
|||||||
uint32_t color)
|
uint32_t color)
|
||||||
{
|
{
|
||||||
RenderCommand * cmd = malloc(sizeof(*cmd));
|
RenderCommand * cmd = malloc(sizeof(*cmd));
|
||||||
cmd->op = SPICE_OP_DRAW_FILL;
|
cmd->op = SPICE_OP_DRAW_FILL;
|
||||||
cmd->fillRect.x = x;
|
cmd->spiceFillRect.x = x;
|
||||||
cmd->fillRect.y = y;
|
cmd->spiceFillRect.y = y;
|
||||||
cmd->fillRect.width = width;
|
cmd->spiceFillRect.width = width;
|
||||||
cmd->fillRect.height = height;
|
cmd->spiceFillRect.height = height;
|
||||||
cmd->fillRect.color = color;
|
cmd->spiceFillRect.color = color;
|
||||||
ll_push(l_renderQueue, cmd);
|
ll_push(l_renderQueue, cmd);
|
||||||
app_invalidateWindow(true);
|
app_invalidateWindow(true);
|
||||||
}
|
}
|
||||||
@ -83,15 +83,24 @@ void renderQueue_spiceDrawBitmap(int x, int y, int width, int height, int stride
|
|||||||
void * data, bool topDown)
|
void * data, bool topDown)
|
||||||
{
|
{
|
||||||
RenderCommand * cmd = malloc(sizeof(*cmd));
|
RenderCommand * cmd = malloc(sizeof(*cmd));
|
||||||
cmd->op = SPICE_OP_DRAW_BITMAP;
|
cmd->op = SPICE_OP_DRAW_BITMAP;
|
||||||
cmd->drawBitmap.x = x;
|
cmd->spiceDrawBitmap.x = x;
|
||||||
cmd->drawBitmap.y = y;
|
cmd->spiceDrawBitmap.y = y;
|
||||||
cmd->drawBitmap.width = width;
|
cmd->spiceDrawBitmap.width = width;
|
||||||
cmd->drawBitmap.height = height;
|
cmd->spiceDrawBitmap.height = height;
|
||||||
cmd->drawBitmap.stride = stride;
|
cmd->spiceDrawBitmap.stride = stride;
|
||||||
cmd->drawBitmap.data = malloc(height * stride);
|
cmd->spiceDrawBitmap.data = malloc(height * stride);
|
||||||
cmd->drawBitmap.topDown = topDown;
|
cmd->spiceDrawBitmap.topDown = topDown;
|
||||||
memcpy(cmd->drawBitmap.data, data, height * stride);
|
memcpy(cmd->spiceDrawBitmap.data, data, height * stride);
|
||||||
|
ll_push(l_renderQueue, cmd);
|
||||||
|
app_invalidateWindow(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void renderQueue_spiceShow(bool show)
|
||||||
|
{
|
||||||
|
RenderCommand * cmd = malloc(sizeof(*cmd));
|
||||||
|
cmd->op = SPICE_OP_SHOW;
|
||||||
|
cmd->spiceShow.show = show;
|
||||||
ll_push(l_renderQueue, cmd);
|
ll_push(l_renderQueue, cmd);
|
||||||
app_invalidateWindow(true);
|
app_invalidateWindow(true);
|
||||||
}
|
}
|
||||||
@ -105,23 +114,27 @@ void renderQueue_process(void)
|
|||||||
{
|
{
|
||||||
case SPICE_OP_CONFIGURE:
|
case SPICE_OP_CONFIGURE:
|
||||||
RENDERER(spiceConfigure,
|
RENDERER(spiceConfigure,
|
||||||
cmd->configure.width, cmd->configure.height);
|
cmd->spiceConfigure.width, cmd->spiceConfigure.height);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SPICE_OP_DRAW_FILL:
|
case SPICE_OP_DRAW_FILL:
|
||||||
RENDERER(spiceDrawFill,
|
RENDERER(spiceDrawFill,
|
||||||
cmd->fillRect.x , cmd->fillRect.y,
|
cmd->spiceFillRect.x , cmd->spiceFillRect.y,
|
||||||
cmd->fillRect.width, cmd->fillRect.height,
|
cmd->spiceFillRect.width, cmd->spiceFillRect.height,
|
||||||
cmd->fillRect.color);
|
cmd->spiceFillRect.color);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SPICE_OP_DRAW_BITMAP:
|
case SPICE_OP_DRAW_BITMAP:
|
||||||
RENDERER(spiceDrawBitmap,
|
RENDERER(spiceDrawBitmap,
|
||||||
cmd->drawBitmap.x , cmd->drawBitmap.y,
|
cmd->spiceDrawBitmap.x , cmd->spiceDrawBitmap.y,
|
||||||
cmd->drawBitmap.width , cmd->drawBitmap.height,
|
cmd->spiceDrawBitmap.width , cmd->spiceDrawBitmap.height,
|
||||||
cmd->drawBitmap.stride, cmd->drawBitmap.data,
|
cmd->spiceDrawBitmap.stride, cmd->spiceDrawBitmap.data,
|
||||||
cmd->drawBitmap.topDown);
|
cmd->spiceDrawBitmap.topDown);
|
||||||
free(cmd->drawBitmap.data);
|
free(cmd->spiceDrawBitmap.data);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SPICE_OP_SHOW:
|
||||||
|
RENDERER(spiceShow, cmd->spiceShow.show);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
free(cmd);
|
free(cmd);
|
||||||
|
@ -26,7 +26,8 @@ typedef struct
|
|||||||
{
|
{
|
||||||
SPICE_OP_CONFIGURE,
|
SPICE_OP_CONFIGURE,
|
||||||
SPICE_OP_DRAW_FILL,
|
SPICE_OP_DRAW_FILL,
|
||||||
SPICE_OP_DRAW_BITMAP
|
SPICE_OP_DRAW_BITMAP,
|
||||||
|
SPICE_OP_SHOW
|
||||||
}
|
}
|
||||||
op;
|
op;
|
||||||
|
|
||||||
@ -36,7 +37,7 @@ typedef struct
|
|||||||
{
|
{
|
||||||
int width, height;
|
int width, height;
|
||||||
}
|
}
|
||||||
configure;
|
spiceConfigure;
|
||||||
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
@ -44,7 +45,7 @@ typedef struct
|
|||||||
int width, height;
|
int width, height;
|
||||||
uint32_t color;
|
uint32_t color;
|
||||||
}
|
}
|
||||||
fillRect;
|
spiceFillRect;
|
||||||
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
@ -54,7 +55,13 @@ typedef struct
|
|||||||
uint8_t * data;
|
uint8_t * data;
|
||||||
bool topDown;
|
bool topDown;
|
||||||
}
|
}
|
||||||
drawBitmap;
|
spiceDrawBitmap;
|
||||||
|
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
bool show;
|
||||||
|
}
|
||||||
|
spiceShow;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
RenderCommand;
|
RenderCommand;
|
||||||
@ -71,3 +78,5 @@ void renderQueue_spiceDrawFill(int x, int y, int width, int height,
|
|||||||
|
|
||||||
void renderQueue_spiceDrawBitmap(int x, int y, int width, int height, int stride,
|
void renderQueue_spiceDrawBitmap(int x, int y, int width, int height, int stride,
|
||||||
void * data, bool topDown);
|
void * data, bool topDown);
|
||||||
|
|
||||||
|
void renderQueue_spiceShow(bool show);
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit d58cb4acd3e2dc7d7d117bb25e8a67a078416d6b
|
Subproject commit 5936cd4f1d887ca49a168c5c996d81c9e78ba10f
|
Loading…
Reference in New Issue
Block a user