nested: plumb some more output options.

Output window size, scaling filter, border.

TODO: make output dynamically resizeable, and some settings reloadable.
This commit is contained in:
Pierre-Loup A. Griffais 2020-01-18 16:05:19 -08:00
parent 19e2e511b6
commit 90fa0770e8
3 changed files with 36 additions and 8 deletions

View file

@ -28,6 +28,10 @@ uint32_t g_nOutputHeight = 720;
bool g_bIsNested = false;
bool g_bFilterGameWindow = true;
bool g_bBorderlessOutputWindow = false;
int BIsNested()
{
return g_bIsNested == true;
@ -41,7 +45,7 @@ int main(int argc, char **argv)
bool bSleepAtStartup = false;
while ((o = getopt (argc, argv, ":w:h:r:sl")) != -1)
while ((o = getopt (argc, argv, ":w:h:W:H:r:slnb")) != -1)
{
switch (o) {
case 'w':
@ -50,6 +54,12 @@ int main(int argc, char **argv)
case 'h':
g_nNestedHeight = atoi( optarg );
break;
case 'W':
g_nOutputWidth = atoi( optarg );
break;
case 'H':
g_nOutputHeight = atoi( optarg );
break;
case 'r':
g_nNestedRefresh = atoi( optarg );
break;
@ -59,6 +69,12 @@ int main(int argc, char **argv)
case 'l':
g_bUseLayers = true;
break;
case 'n':
g_bFilterGameWindow = false;
break;
case 'b':
g_bBorderlessOutputWindow = true;
break;
default:
break;
}
@ -101,10 +117,20 @@ void initOutput(void)
if ( g_bIsNested == true )
{
inputsdl_init();
uint32_t nSDLWindowFlags = SDL_WINDOW_VULKAN;
if ( g_bBorderlessOutputWindow == true )
{
nSDLWindowFlags |= SDL_WINDOW_BORDERLESS;
}
window = SDL_CreateWindow( "gamescope", SDL_WINDOWPOS_UNDEFINED,
SDL_WINDOWPOS_UNDEFINED, g_nOutputWidth,
g_nOutputHeight, SDL_WINDOW_VULKAN );
window = SDL_CreateWindow( "gamescope",
SDL_WINDOWPOS_UNDEFINED,
SDL_WINDOWPOS_UNDEFINED,
g_nOutputWidth,
g_nOutputHeight,
nSDLWindowFlags );
unsigned int extCount;

View file

@ -31,6 +31,8 @@ extern int g_nNestedRefresh;
extern uint32_t g_nOutputWidth;
extern uint32_t g_nOutputHeight;
extern bool g_bFilterGameWindow;
int BIsNested( void );
#ifndef C_SIDE

View file

@ -597,7 +597,7 @@ paint_window (Display *dpy, win *w, struct Composite_t *pComposite, struct Vulka
pPipeline->layerBindings[ curLayer ].tex = w->vulkanTex;
pPipeline->layerBindings[ curLayer ].fbid = w->fb_id;
pPipeline->layerBindings[ curLayer ].bFilter = w->isOverlay ? true : false;
pPipeline->layerBindings[ curLayer ].bFilter = w->isOverlay ? true : g_bFilterGameWindow;
pPipeline->layerBindings[ curLayer ].bBlackBorder = notificationMode ? false : true;
pComposite->flLayerCount += 1.0f;
@ -816,7 +816,7 @@ paint_all (Display *dpy)
pipeline.layerBindings[ 0 ].surfaceHeight = g_nOutputHeight;
pipeline.layerBindings[ 0 ].fbid = vulkan_get_last_composite_fbid();
pipeline.layerBindings[ 0 ].bFilter = true;
pipeline.layerBindings[ 0 ].bFilter = false;
bool bFlip = drm_can_avoid_composite( &g_DRM, &composite, &pipeline );
@ -1674,13 +1674,13 @@ steamcompmgr_main (int argc, char **argv)
// :/
optind = 1;
while ((o = getopt (argc, argv, ":R:nSvVec")) != -1)
while ((o = getopt (argc, argv, ":R:NSvVec")) != -1)
{
switch (o) {
case 'R':
readyPipeFD = open( optarg, O_WRONLY );
break;
case 'n':
case 'N':
doRender = False;
break;
case 'S':