Add v210 staging memory probe
This commit is contained in:
@@ -15,6 +15,9 @@
|
||||
std::optional<PresentModeConfig> parsePresentMode(
|
||||
std::string_view text);
|
||||
|
||||
std::optional<V210StagingMemoryMode> parseV210StagingMemoryMode(
|
||||
std::string_view text);
|
||||
|
||||
namespace
|
||||
{
|
||||
struct JsonValue
|
||||
@@ -588,6 +591,20 @@ bool applyConfigFile(
|
||||
config.presentMode = mode.value();
|
||||
}
|
||||
|
||||
if (const std::string* memoryMode =
|
||||
jsonString(objectField(*root, "v210StagingMemory")))
|
||||
{
|
||||
const std::optional<V210StagingMemoryMode> mode =
|
||||
parseV210StagingMemoryMode(*memoryMode);
|
||||
if (!mode.has_value())
|
||||
{
|
||||
error = "v210StagingMemory must be default, cached, "
|
||||
"or device-local";
|
||||
return false;
|
||||
}
|
||||
config.v210StagingMemoryMode = mode.value();
|
||||
}
|
||||
|
||||
const JsonValue::Array* feeds =
|
||||
jsonArray(objectField(*root, "feeds"));
|
||||
if (feeds == nullptr)
|
||||
@@ -721,6 +738,27 @@ std::optional<PresentModeConfig> parsePresentMode(std::string_view text)
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
std::optional<V210StagingMemoryMode> parseV210StagingMemoryMode(
|
||||
std::string_view text)
|
||||
{
|
||||
if (text == "default")
|
||||
{
|
||||
return V210StagingMemoryMode::Default;
|
||||
}
|
||||
|
||||
if (text == "cached")
|
||||
{
|
||||
return V210StagingMemoryMode::Cached;
|
||||
}
|
||||
|
||||
if (text == "device-local" || text == "device_local")
|
||||
{
|
||||
return V210StagingMemoryMode::DeviceLocal;
|
||||
}
|
||||
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
std::string_view feedKindName(FeedKind kind)
|
||||
{
|
||||
switch (kind)
|
||||
@@ -743,6 +781,23 @@ std::string_view feedKindName(FeedKind kind)
|
||||
}
|
||||
}
|
||||
|
||||
std::string_view v210StagingMemoryModeName(
|
||||
V210StagingMemoryMode mode)
|
||||
{
|
||||
switch (mode)
|
||||
{
|
||||
case V210StagingMemoryMode::Cached:
|
||||
return "cached";
|
||||
|
||||
case V210StagingMemoryMode::DeviceLocal:
|
||||
return "device-local";
|
||||
|
||||
case V210StagingMemoryMode::Default:
|
||||
default:
|
||||
return "default";
|
||||
}
|
||||
}
|
||||
|
||||
void printUsage(const char* executableName)
|
||||
{
|
||||
std::cout
|
||||
@@ -758,6 +813,7 @@ void printUsage(const char* executableName)
|
||||
<< " --grid <cols>x<rows> Set multiview grid (default 2x2, max 16 feeds)\n"
|
||||
<< " --fps-cap <fps> Limit render loop FPS (default 60)\n"
|
||||
<< " --max-v210-uploads <n> Limit v210 uploads per frame (0 = unlimited)\n"
|
||||
<< " --v210-staging-memory <mode> Memory: default, cached, device-local\n"
|
||||
<< " --present <mode> Present mode: fifo, mailbox, immediate (default mailbox)\n"
|
||||
<< " --feed <idx> <kind> Set feed slot kind explicitly\n"
|
||||
<< " --domain <idx> <path> Set MXL domain for feed slot\n"
|
||||
@@ -899,6 +955,36 @@ ConfigParseResult parseAppConfig(
|
||||
continue;
|
||||
}
|
||||
|
||||
if (arg == "--v210-staging-memory")
|
||||
{
|
||||
if (i + 1 >= argc)
|
||||
{
|
||||
std::cerr << "--v210-staging-memory requires <mode>"
|
||||
<< std::endl;
|
||||
result.shouldExit = true;
|
||||
result.exitCode = 1;
|
||||
return result;
|
||||
}
|
||||
|
||||
const std::optional<V210StagingMemoryMode> mode =
|
||||
parseV210StagingMemoryMode(argv[i + 1]);
|
||||
|
||||
if (!mode.has_value())
|
||||
{
|
||||
std::cerr
|
||||
<< "--v210-staging-memory must be default, cached, "
|
||||
<< "or device-local"
|
||||
<< std::endl;
|
||||
result.shouldExit = true;
|
||||
result.exitCode = 1;
|
||||
return result;
|
||||
}
|
||||
|
||||
result.config.v210StagingMemoryMode = mode.value();
|
||||
++i;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (arg == "--grid")
|
||||
{
|
||||
++i;
|
||||
|
||||
Reference in New Issue
Block a user