mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-25 14:57:20 +00:00
[client] app: new options to reduce CPU usage
This patch increases the default cursor and frame polling interval from 1us to 1000us which for most use cases should be more then fast enough. It also adds two new configuration options to adjust these should it be required: * app:cursorPollInterval * app:framePollInterval
This commit is contained in:
parent
fc66a4a19c
commit
84b2917706
@ -86,6 +86,20 @@ static struct Option options[] =
|
||||
.type = OPTION_TYPE_BOOL,
|
||||
.value.x_bool = false,
|
||||
},
|
||||
{
|
||||
.module = "app",
|
||||
.name = "cursorPollInterval",
|
||||
.description = "How often to check for a cursor update in microseconds",
|
||||
.type = OPTION_TYPE_INT,
|
||||
.value.x_int = 1000
|
||||
},
|
||||
{
|
||||
.module = "app",
|
||||
.name = "framePollInterval",
|
||||
.description = "How often to check for a frame update in microseconds",
|
||||
.type = OPTION_TYPE_INT,
|
||||
.value.x_int = 1000
|
||||
},
|
||||
|
||||
// window options
|
||||
{
|
||||
@ -344,8 +358,10 @@ bool config_load(int argc, char * argv[])
|
||||
}
|
||||
|
||||
// setup the application params for the basic types
|
||||
params.shmFile = option_get_string("app", "shmFile");
|
||||
params.shmSize = option_get_int ("app", "shmSize") * 1048576;
|
||||
params.shmFile = option_get_string("app", "shmFile" );
|
||||
params.shmSize = option_get_int ("app", "shmSize" ) * 1048576;
|
||||
params.cursorPollInterval = option_get_int ("app", "cursorPollInterval");
|
||||
params.framePollInterval = option_get_int ("app", "framePollInterval" );
|
||||
|
||||
params.windowTitle = option_get_string("win", "title" );
|
||||
params.autoResize = option_get_bool ("win", "autoResize" );
|
||||
|
@ -171,8 +171,7 @@ static int cursorThread(void * unused)
|
||||
{
|
||||
if (!state.running)
|
||||
return 0;
|
||||
|
||||
usleep(1);
|
||||
usleep(params.cursorPollInterval);
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -285,7 +284,7 @@ static int frameThread(void * unused)
|
||||
if (!state.running)
|
||||
break;
|
||||
|
||||
usleep(1);
|
||||
usleep(params.framePollInterval);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -96,6 +96,9 @@ struct AppParams
|
||||
SDL_Scancode escapeKey;
|
||||
bool showAlerts;
|
||||
|
||||
unsigned int cursorPollInterval;
|
||||
unsigned int framePollInterval;
|
||||
|
||||
bool forceRenderer;
|
||||
unsigned int forceRendererIndex;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user