mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-10 08:38:20 +00:00
[host] app: calculate and report the required IVSHMEM size
One of the most common issues reported in the support channels is the IVSHMEM size being too small. This change adds a calculation to determine an optimal size and uses the new `os_showMessage` platform method to display a message box to the user with the error.
This commit is contained in:
parent
75a9e38e3a
commit
fb1b30b728
@ -40,5 +40,6 @@ void app_quit();
|
||||
// these must be implemented for each OS
|
||||
const char * os_getExecutable();
|
||||
const char * os_getDataPath();
|
||||
void os_showMessage(const char * caption, const char * msg);
|
||||
|
||||
bool os_blockScreensaver();
|
||||
|
@ -537,3 +537,8 @@ bool os_blockScreensaver()
|
||||
}
|
||||
return lastResult;
|
||||
}
|
||||
|
||||
void os_showMessage(const char * caption, const char * msg)
|
||||
{
|
||||
MessageBoxA(NULL, msg, caption, MB_OK | MB_ICONINFORMATION);
|
||||
}
|
||||
|
@ -30,6 +30,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#include "common/ivshmem.h"
|
||||
#include "common/sysinfo.h"
|
||||
#include "common/time.h"
|
||||
#include "common/stringutils.h"
|
||||
|
||||
#include <lgmp/host.h>
|
||||
|
||||
@ -38,6 +39,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
||||
#define CONFIG_FILE "looking-glass-host.ini"
|
||||
#define POINTER_SHAPE_BUFFERS 3
|
||||
@ -295,7 +297,16 @@ static bool captureStart(void)
|
||||
const unsigned int maxFrameSize = app.iface->getMaxFrameSize();
|
||||
if (maxFrameSize > app.maxFrameSize)
|
||||
{
|
||||
DEBUG_ERROR("Maximum frame size of %d bytes excceds maximum space available", maxFrameSize);
|
||||
DEBUG_ERROR("Maximum frame size of %d bytes exceeds maximum space available", maxFrameSize);
|
||||
|
||||
const float needed = ((maxFrameSize * 2) / 1048576.0f) + 10.0f;
|
||||
const int size = (int)powf(2.0f, ceilf(logf(needed) / logf(2.0f)));
|
||||
|
||||
char * msg;
|
||||
alloc_sprintf(&msg, "IVSHMEM size too small, increase to %d MiB", size);
|
||||
os_showMessage("Looking Glass Error", msg);
|
||||
free(msg);
|
||||
|
||||
return false;
|
||||
}
|
||||
DEBUG_INFO("Capture Size : %u MiB (%u)", maxFrameSize / 1048576, maxFrameSize);
|
||||
|
Loading…
Reference in New Issue
Block a user