mirror of
https://github.com/gnif/LookingGlass.git
synced 2025-11-17 23:42:20 +00:00
Compare commits
8 Commits
frame-timi
...
Release/B6
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
188f25c6bf | ||
|
|
8619f787b9 | ||
|
|
60ac03ebaf | ||
|
|
e1ebde3cd2 | ||
|
|
f519904c38 | ||
|
|
fa6f1abaac | ||
|
|
875242fe15 | ||
|
|
20b5957999 |
@@ -65,15 +65,30 @@ static const struct xdg_surface_listener xdgSurfaceListener = {
|
||||
static void xdgToplevelConfigure(void * data, struct xdg_toplevel * xdgToplevel,
|
||||
int32_t width, int32_t height, struct wl_array * states)
|
||||
{
|
||||
wlWm.width = width;
|
||||
wlWm.height = height;
|
||||
wlWm.width = width;
|
||||
wlWm.height = height;
|
||||
wlWm.fullscreen = false;
|
||||
wlWm.floating = true;
|
||||
|
||||
enum xdg_toplevel_state * state;
|
||||
wl_array_for_each(state, states)
|
||||
{
|
||||
if (*state == XDG_TOPLEVEL_STATE_FULLSCREEN)
|
||||
switch (*state)
|
||||
{
|
||||
case XDG_TOPLEVEL_STATE_FULLSCREEN:
|
||||
wlWm.fullscreen = true;
|
||||
// fallthrough
|
||||
case XDG_TOPLEVEL_STATE_MAXIMIZED:
|
||||
case XDG_TOPLEVEL_STATE_TILED_LEFT:
|
||||
case XDG_TOPLEVEL_STATE_TILED_RIGHT:
|
||||
case XDG_TOPLEVEL_STATE_TILED_TOP:
|
||||
case XDG_TOPLEVEL_STATE_TILED_BOTTOM:
|
||||
wlWm.floating = false;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -156,5 +171,14 @@ void waylandMinimize(void)
|
||||
|
||||
void waylandShellResize(int w, int h)
|
||||
{
|
||||
//TODO: Implement resize for XDG.
|
||||
if (!wlWm.floating)
|
||||
return;
|
||||
|
||||
wlWm.width = w;
|
||||
wlWm.height = h;
|
||||
xdg_surface_set_window_geometry(wlWm.xdgSurface, 0, 0, w, h);
|
||||
|
||||
wlWm.needsResize = true;
|
||||
app_invalidateWindow(true);
|
||||
waylandStopWaitFrame();
|
||||
}
|
||||
|
||||
@@ -112,6 +112,7 @@ struct WaylandDSState
|
||||
bool fractionalScale;
|
||||
bool needsResize;
|
||||
bool fullscreen;
|
||||
bool floating;
|
||||
uint32_t resizeSerial;
|
||||
bool configured;
|
||||
bool warpSupport;
|
||||
|
||||
@@ -1433,7 +1433,8 @@ restart:
|
||||
initialSpiceEnable = 0;
|
||||
}
|
||||
|
||||
status = lgmpClientSessionInit(g_state.lgmp, &udataSize, (uint8_t **)&udata);
|
||||
status = lgmpClientSessionInit(g_state.lgmp, &udataSize, (uint8_t **)&udata,
|
||||
NULL);
|
||||
switch(status)
|
||||
{
|
||||
case LGMP_OK:
|
||||
|
||||
@@ -316,43 +316,55 @@ static bool nvfbc_init(void)
|
||||
}
|
||||
|
||||
int adapterIndex = option_get_int("nvfbc", "adapterIndex");
|
||||
// NOTE: Calling this on hardware that doesn't support NvFBC such as GeForce
|
||||
// causes a substantial performance pentalty even if it fails! As such we only
|
||||
// attempt NvFBC as a last resort, or if configured via the app:capture
|
||||
// option.
|
||||
if (adapterIndex < 0)
|
||||
|
||||
bool created = false;
|
||||
for(int retry = 0; retry < 2; ++retry)
|
||||
{
|
||||
IDirect3D9 * d3d = Direct3DCreate9(D3D_SDK_VERSION);
|
||||
int adapterCount = IDirect3D9_GetAdapterCount(d3d);
|
||||
for(int i = 0; i < adapterCount; ++i)
|
||||
{
|
||||
D3DADAPTER_IDENTIFIER9 ident;
|
||||
IDirect3D9_GetAdapterIdentifier(d3d, i, 0, &ident);
|
||||
if (ident.VendorId != 0x10DE)
|
||||
continue;
|
||||
|
||||
if (NvFBCToSysCreate(i, privData, privDataLen, &this->nvfbc,
|
||||
&this->maxWidth, &this->maxHeight))
|
||||
{
|
||||
adapterIndex = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
IDirect3D9_Release(d3d);
|
||||
|
||||
// NOTE: Calling this on hardware that doesn't support NvFBC such as GeForce
|
||||
// causes a substantial performance pentalty even if it fails! As such we only
|
||||
// attempt NvFBC as a last resort, or if configured via the app:capture
|
||||
// option.
|
||||
if (adapterIndex < 0)
|
||||
{
|
||||
free(privData);
|
||||
return false;
|
||||
IDirect3D9 * d3d = Direct3DCreate9(D3D_SDK_VERSION);
|
||||
int adapterCount = IDirect3D9_GetAdapterCount(d3d);
|
||||
for(int i = 0; i < adapterCount; ++i)
|
||||
{
|
||||
D3DADAPTER_IDENTIFIER9 ident;
|
||||
IDirect3D9_GetAdapterIdentifier(d3d, i, 0, &ident);
|
||||
if (ident.VendorId != 0x10DE)
|
||||
continue;
|
||||
|
||||
if (NvFBCToSysCreate(i, privData, privDataLen, &this->nvfbc,
|
||||
&this->maxWidth, &this->maxHeight))
|
||||
{
|
||||
adapterIndex = i;
|
||||
created = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
IDirect3D9_Release(d3d);
|
||||
}
|
||||
}
|
||||
else
|
||||
if (!NvFBCToSysCreate(adapterIndex, privData, privDataLen, &this->nvfbc, &this->maxWidth, &this->maxHeight))
|
||||
else
|
||||
{
|
||||
free(privData);
|
||||
return false;
|
||||
if (!NvFBCToSysCreate(adapterIndex, privData, privDataLen, &this->nvfbc, &this->maxWidth, &this->maxHeight))
|
||||
continue;
|
||||
created = true;
|
||||
}
|
||||
|
||||
if (created)
|
||||
break;
|
||||
|
||||
//1000ms delay before retry
|
||||
nsleep(1000000000);
|
||||
}
|
||||
|
||||
if (!created)
|
||||
{
|
||||
free(privData);
|
||||
return false;
|
||||
}
|
||||
|
||||
int diffRes = option_get_int("nvfbc", "diffRes");
|
||||
enum DiffMapBlockSize blockSize;
|
||||
NvFBCGetDiffMapBlockSize(diffRes, &blockSize, &this->diffShift, privData, privDataLen);
|
||||
|
||||
@@ -526,7 +526,13 @@ bool app_init(void)
|
||||
|
||||
// redirect stderr to a file
|
||||
if (logFile && strcmp(logFile, "stderr") != 0)
|
||||
freopen(logFile, "a", stderr);
|
||||
{
|
||||
DEBUG_INFO("Logs will be written to: %s", logFile);
|
||||
DEBUG_INFO("Please see there for any further information");
|
||||
|
||||
if (!freopen(logFile, "a", stderr))
|
||||
DEBUG_WARN("Failed to open log file, will log to stderr");
|
||||
}
|
||||
|
||||
// always flush stderr
|
||||
setbuf(stderr, NULL);
|
||||
|
||||
@@ -748,7 +748,7 @@ int app_main(int argc, char * argv[])
|
||||
if (option_load(configFile))
|
||||
DEBUG_INFO("Configuration file loaded");
|
||||
else
|
||||
DEBUG_INFO("Configuration file not found or invalid");
|
||||
DEBUG_INFO("Configuration file not found or invalid, continuing anyway...");
|
||||
|
||||
// parse the command line arguments
|
||||
if (!option_parse(argc, argv))
|
||||
@@ -901,19 +901,20 @@ int app_main(int argc, char * argv[])
|
||||
LG_UNLOCK(app.pointerLock);
|
||||
}
|
||||
|
||||
const uint64_t now = microtime();
|
||||
const uint64_t delta = now - previousFrameTime;
|
||||
const uint64_t delta = microtime() - previousFrameTime;
|
||||
if (delta < throttleUs)
|
||||
{
|
||||
nsleep((throttleUs - delta) * 1000);
|
||||
previousFrameTime = microtime();
|
||||
const uint64_t us = throttleUs - delta;
|
||||
// only delay if the time is reasonable
|
||||
if (us > 1000)
|
||||
nsleep(us * 1000);
|
||||
}
|
||||
else
|
||||
previousFrameTime = now;
|
||||
|
||||
const uint64_t captureStart = microtime();
|
||||
switch(iface->capture())
|
||||
{
|
||||
case CAPTURE_RESULT_OK:
|
||||
previousFrameTime = captureStart;
|
||||
break;
|
||||
|
||||
case CAPTURE_RESULT_TIMEOUT:
|
||||
|
||||
2
obs/lg.c
2
obs/lg.c
@@ -421,7 +421,7 @@ static void lgUpdate(void * data, obs_data_t * settings)
|
||||
|
||||
usleep(200000);
|
||||
|
||||
if (lgmpClientSessionInit(this->lgmp, &udataSize, (uint8_t **)&udata)
|
||||
if (lgmpClientSessionInit(this->lgmp, &udataSize, (uint8_t **)&udata, NULL)
|
||||
!= LGMP_OK)
|
||||
return;
|
||||
|
||||
|
||||
Submodule repos/LGMP updated: 66ac3bae0b...1b170ad8d7
Reference in New Issue
Block a user