DisplayServer: add option --ds-force-drm

Fixes #505
This commit is contained in:
李通洲
2023-07-31 23:11:39 +08:00
parent 9e64e66254
commit 674618930d
8 changed files with 39 additions and 15 deletions
+7 -1
View File
@@ -240,9 +240,15 @@
"type": "string",
"title": "Set the path to the file containing OS information. Linux only"
},
"dsForceDrm": {
"type": "boolean",
"title": "Force display detection to use `/sys/class/drm`. Linux only",
"default": false
},
"wmiTimeout": {
"type": "integer",
"title": "Set the timeout (ms) for WMI queries, `-1` for no timeout. Windows only"
"title": "Set the timeout (ms) for WMI queries, `-1` for no timeout. Windows only",
"default": 5000
}
},
"additionalProperties": false
+1
View File
@@ -41,6 +41,7 @@ static void defaultConfig(void)
#if defined(__linux__) || defined(__FreeBSD__)
ffStrbufInit(&instance.config.playerName);
ffStrbufInit(&instance.config.osFile);
instance.config.dsForceDrm = false;
#elif defined(_WIN32)
instance.config.wmiTimeout = 5000;
#endif
+2
View File
@@ -318,6 +318,8 @@ const char* ffParseGeneralJsonConfig(void)
ffStrbufSetS(&config->playerName, yyjson_get_str(val));
else if (ffStrEqualsIgnCase(key, "osFile"))
ffStrbufSetS(&config->osFile, yyjson_get_str(val));
else if (ffStrEqualsIgnCase(key, "dsForceDrm"))
config->dsForceDrm = yyjson_get_bool(val);
#elif defined(_WIN32)
else if (ffStrEqualsIgnCase(key, "wmiTimeout"))
config->wmiTimeout = (int32_t) yyjson_get_int(val);
+8
View File
@@ -250,6 +250,14 @@
# Default is the first match starting with org.mpris.MediaPlayer2.
#--player-name spotify
# Display server force DRM option
# Sets if fastfetch should only use `/sys/class/drm` to detect displays if you get issues with the default behavior.
# Note DRM doesn't support refresh rate or scaled resolution detection.
# Only supported on Linux.
# Must be true or false.
# Default is false.
#--ds-force-drm false
# Escape bedrock option
# Sets if fastfetch should escape the bedrock jail, if it detectes that it is running in one
# Must be true or false.
+1
View File
@@ -26,6 +26,7 @@ General options:
--pipe <?value>: Disable logo and all escape sequences
--wmi-timeout <num>: Set the timeout (ms) for WMI queries. Windows only. Default is 5000
--processing-timeout <num>: Set the timeout (ms) when waiting for child processes. Default is 1000
--ds-force-drm <?value>: Set if only DRM should be used to detect displays. Default is false
Logo options:
-l,--logo <logo>: Set the logo; if default, the name of a builtin logo or a path to a file
@@ -75,25 +75,28 @@ void ffConnectDisplayServerImpl(FFDisplayServerResult* ds)
ffStrbufInit(&ds->deVersion);
ffListInitA(&ds->displays, sizeof(FFDisplayResult), 4);
//We try wayland as our prefered display server, as it supports the most features.
//This method can't detect the name of our WM / DE
ffdsConnectWayland(ds);
if (!instance.config.dsForceDrm)
{
//We try wayland as our prefered display server, as it supports the most features.
//This method can't detect the name of our WM / DE
ffdsConnectWayland(ds);
//Try the x11 libs, from most feature rich to least.
//We use the display list to detect if a connection is needed.
//They respect wmProtocolName, and only detect display if it is set.
//Try the x11 libs, from most feature rich to least.
//We use the display list to detect if a connection is needed.
//They respect wmProtocolName, and only detect display if it is set.
if(ds->displays.length == 0)
ffdsConnectXcbRandr(ds);
if(ds->displays.length == 0)
ffdsConnectXcbRandr(ds);
if(ds->displays.length == 0)
ffdsConnectXrandr(ds);
if(ds->displays.length == 0)
ffdsConnectXrandr(ds);
if(ds->displays.length == 0)
ffdsConnectXcb(ds);
if(ds->displays.length == 0)
ffdsConnectXcb(ds);
if(ds->displays.length == 0)
ffdsConnectXlib(ds);
if(ds->displays.length == 0)
ffdsConnectXlib(ds);
}
//This display detection method is display server independent.
//Use it if all connections failed
+2
View File
@@ -869,6 +869,8 @@ static void parseOption(FFdata* data, const char* key, const char* value)
ffOptionParseString(key, value, &instance.config.playerName);
else if (ffStrEqualsIgnCase(key, "--os-file"))
ffOptionParseString(key, value, &instance.config.osFile);
else if(ffStrEqualsIgnCase(key, "--ds-force-drm"))
instance.config.dsForceDrm = ffOptionParseBoolean(value);
#elif defined(_WIN32)
else if (ffStrEqualsIgnCase(key, "--wmi-timeout"))
instance.config.wmiTimeout = ffOptionParseInt32(key, value);
+1
View File
@@ -61,6 +61,7 @@ typedef struct FFconfig
#if defined(__linux__) || defined(__FreeBSD__)
FFstrbuf playerName;
FFstrbuf osFile;
bool dsForceDrm;
#elif defined(_WIN32)
int32_t wmiTimeout;
#endif