mirror of
https://github.com/gnif/LookingGlass.git
synced 2026-07-28 10:52:02 +00:00
[client] spice: check and track the primary surface format & validity
This commit is contained in:
@@ -993,9 +993,31 @@ void spiceReady(void)
|
|||||||
static void spice_surfaceCreate(unsigned int surfaceId, PSSurfaceFormat format,
|
static void spice_surfaceCreate(unsigned int surfaceId, PSSurfaceFormat format,
|
||||||
unsigned int width, unsigned int height)
|
unsigned int width, unsigned int height)
|
||||||
{
|
{
|
||||||
DEBUG_INFO("Create SPICE surface: id: %d, size: %dx%d",
|
if (surfaceId != 0)
|
||||||
|
{
|
||||||
|
DEBUG_INFO("Ignoring secondary SPICE surface: id: %u, size: %ux%u",
|
||||||
|
surfaceId, width, height);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch(format)
|
||||||
|
{
|
||||||
|
case PS_SURFACE_FMT_32_xRGB:
|
||||||
|
case PS_SURFACE_FMT_32_ARGB:
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
DEBUG_ERROR("Unsupported primary SPICE surface format: %d", format);
|
||||||
|
g_state.spicePrimarySurfaceValid = false;
|
||||||
|
app_useSpiceDisplay(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
DEBUG_INFO("Create primary SPICE surface: id: %u, size: %ux%u",
|
||||||
surfaceId, width, height);
|
surfaceId, width, height);
|
||||||
|
|
||||||
|
g_state.spicePrimarySurfaceValid = true;
|
||||||
|
|
||||||
g_state.srcSize.x = width;
|
g_state.srcSize.x = width;
|
||||||
g_state.srcSize.y = height;
|
g_state.srcSize.y = height;
|
||||||
g_state.haveSrcSize = true;
|
g_state.haveSrcSize = true;
|
||||||
@@ -1007,19 +1029,44 @@ static void spice_surfaceCreate(unsigned int surfaceId, PSSurfaceFormat format,
|
|||||||
|
|
||||||
static void spice_surfaceDestroy(unsigned int surfaceId)
|
static void spice_surfaceDestroy(unsigned int surfaceId)
|
||||||
{
|
{
|
||||||
DEBUG_INFO("Destroy spice surface %d", surfaceId);
|
if (!g_state.spicePrimarySurfaceValid || surfaceId != 0)
|
||||||
|
{
|
||||||
|
DEBUG_INFO("Ignoring destruction of inactive or secondary SPICE surface %u",
|
||||||
|
surfaceId);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
DEBUG_INFO("Destroy primary SPICE surface %u", surfaceId);
|
||||||
|
g_state.spicePrimarySurfaceValid = false;
|
||||||
app_useSpiceDisplay(false);
|
app_useSpiceDisplay(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void spice_drawFill(unsigned int surfaceId, int x, int y, int width,
|
static void spice_drawFill(unsigned int surfaceId, int x, int y, int width,
|
||||||
int height, uint32_t color)
|
int height, uint32_t color)
|
||||||
{
|
{
|
||||||
|
if (!g_state.spicePrimarySurfaceValid || surfaceId != 0)
|
||||||
|
return;
|
||||||
|
|
||||||
renderQueue_spiceDrawFill(x, y, width, height, color);
|
renderQueue_spiceDrawFill(x, y, width, height, color);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void spice_drawBitmap(unsigned int surfaceId, PSBitmapFormat format,
|
static void spice_drawBitmap(unsigned int surfaceId, PSBitmapFormat format,
|
||||||
bool topDown, int x, int y, int width, int height, int stride, void * data)
|
bool topDown, int x, int y, int width, int height, int stride, void * data)
|
||||||
{
|
{
|
||||||
|
if (!g_state.spicePrimarySurfaceValid || surfaceId != 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
switch(format)
|
||||||
|
{
|
||||||
|
case PS_BITMAP_FMT_32BIT:
|
||||||
|
case PS_BITMAP_FMT_RGBA:
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
DEBUG_ERROR("Unsupported SPICE bitmap format: %d", format);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
renderQueue_spiceDrawBitmap(x, y, width, height, stride, data, topDown);
|
renderQueue_spiceDrawBitmap(x, y, width, height, stride, data, topDown);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -81,6 +81,7 @@ struct AppState
|
|||||||
uint8_t spiceUUID[16];
|
uint8_t spiceUUID[16];
|
||||||
bool spiceReady;
|
bool spiceReady;
|
||||||
bool initialSpiceDisplay;
|
bool initialSpiceDisplay;
|
||||||
|
bool spicePrimarySurfaceValid;
|
||||||
uint8_t guestUUID[16];
|
uint8_t guestUUID[16];
|
||||||
bool guestUUIDValid;
|
bool guestUUIDValid;
|
||||||
KVMFROS guestOS;
|
KVMFROS guestOS;
|
||||||
|
|||||||
Reference in New Issue
Block a user