diff --git a/README.md b/README.md index ebae08c18800d3194cc854b324c4cf9174b806b6..a67a8ac3208fe87a9ceb0c13341134cacd2585bb 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,7 @@ spark-webapp-runtime 应用标题 目标网址 应用窗口宽度 应用窗口 -c, --cfg 设置应用的配置文件。 -r, --root 设置内置 WebServer 的根路径。 -P, --port 设置内置 WebServer 的监听端口号。 + -G, --GPU <0/1> 设置启用 GPU 渲染加速,默认开启。 需要注意的是, 命令行会覆盖配置文件信息。 diff --git a/spark-webapp-runtime/globaldefine.h b/spark-webapp-runtime/globaldefine.h index 95b04687f39987357718f18b60719752d34e2140..276638f8df91e8a06677bfcc95a09fe1e85ce28e 100644 --- a/spark-webapp-runtime/globaldefine.h +++ b/spark-webapp-runtime/globaldefine.h @@ -16,7 +16,8 @@ #define DEFAULT_ROOT QString() #define DEFAULT_PORT 0 +#define DEFAULT_GPU 1 -#define CURRENT_VER QString("1.6.3") +#define CURRENT_VER QString("1.6.4") #endif // GLOBALDEFINE_H diff --git a/spark-webapp-runtime/help/help.html b/spark-webapp-runtime/help/help.html index 81730eca300e4e63b28a4c1a4a47b3f1f5996ad3..3bfc6286faaf8d9e354756d108a27053756ed912 100644 --- a/spark-webapp-runtime/help/help.html +++ b/spark-webapp-runtime/help/help.html @@ -37,6 +37,7 @@ -c, --cfg 设置应用的配置文件。 -r, --root 设置内置 WebServer 的根路径。 -P, --port 设置内置 WebServer 的监听端口号。 + -G, --GPU <0/1> 设置启用 GPU 渲染加速,默认开启。
需要注意的是, 命令行会覆盖配置文件信息。 @@ -74,6 +75,7 @@ -c, --cfg The Configuration file of Application. -r, --root The root path of the program web service. -P, --port The port number of the program web service. + -G, --GPU <0/1> To use GPU instead of CPU to decoding. Default True.
It should be noticed that the command line parsers will overwrite the configuration from the config file. diff --git a/spark-webapp-runtime/main.cpp b/spark-webapp-runtime/main.cpp index 1e6b51d281f37a7bf9be51f2fef65e6a12d349be..82c442889bed35ff703b6188d362c8b0b14e5e72 100644 --- a/spark-webapp-runtime/main.cpp +++ b/spark-webapp-runtime/main.cpp @@ -177,6 +177,14 @@ int main(int argc, char *argv[]) DEFAULT_PORT); parser.addOption(optPort); + + QCommandLineOption useGPU(QStringList() << "G" + << "GPU", + QObject::tr("To use GPU instead of CPU to decoding. Default True."), + "GPU", + QString::number(DEFAULT_GPU)); + parser.addOption(useGPU); + #if SSL_SERVER QCommandLineOption optSSLPort(QStringList() << "s" << "sslport", @@ -200,6 +208,7 @@ int main(int argc, char *argv[]) QString szDesc = DEFAULT_DESC; QString szRootPath = DEFAULT_ROOT; quint16 u16Port = DEFAULT_PORT; + bool toUseGPU = DEFAULT_GPU; #if SSL_SERVER quint16 u16sslPort = 0; #endif @@ -270,6 +279,17 @@ int main(int argc, char *argv[]) u16Port = parser.value(optPort).toUInt(); } + if (parser.isSet(useGPU)) { + toUseGPU = parser.value(useGPU).toUInt(); + } + if (toUseGPU == true){ + qputenv("QTWEBENGINE_CHROMIUM_FLAGS", "--ignore-gpu-blacklist --enable-gpu-rasterization --enable-native-gpu-memory-buffers --enable-accelerated-video-decode"); + #ifdef __sw_64__ + qputenv("QTWEBENGINE_CHROMIUM_FLAGS", "--ignore-gpu-blacklist --enable-gpu-rasterization --enable-native-gpu-memory-buffers --enable-accelerated-video-decode --no-sandbox"); + #endif + qDebug() << "Setting GPU to True."; + } + #if SSL_SERVER if (parser.isSet(optSSLPort)) { u16sslPort = parser.value(optSSLPort).toUInt(); diff --git a/spark-webapp-runtime/translations/spark-webapp-runtime_zh_CN.qm b/spark-webapp-runtime/translations/spark-webapp-runtime_zh_CN.qm index e8b5034608cb90fb941b1343b4a8d1c0702229a0..b87ba60ec40b8eb72da2c5ae022eb8dca932f144 100644 Binary files a/spark-webapp-runtime/translations/spark-webapp-runtime_zh_CN.qm and b/spark-webapp-runtime/translations/spark-webapp-runtime_zh_CN.qm differ diff --git a/spark-webapp-runtime/translations/spark-webapp-runtime_zh_CN.ts b/spark-webapp-runtime/translations/spark-webapp-runtime_zh_CN.ts index 58840cc285cb116158dca4a974730f685da6d49d..8849e49bc0a3dee8229f2153b63c6b9500a557f3 100644 --- a/spark-webapp-runtime/translations/spark-webapp-runtime_zh_CN.ts +++ b/spark-webapp-runtime/translations/spark-webapp-runtime_zh_CN.ts @@ -165,32 +165,37 @@ 隐藏控制按钮。默认关闭该此功能。 - + The ICON of Application. 设置应用的图标。 - + The Description of Application. 设置应用的描述信息。 - + The Configuration file of Application. 设置应用的配置文件。 - + The root path of the program web service. 设置内置 WebServer 的根路径。 - + The port number of the program web service. 设置内置 WebServer 的监听端口号。 - + + To use GPU instead of CPU to decoding. Default True. + 启用GPU渲染,默认开启。 + + + The ssl port number of the program web service. 设置内置 WebServer 的 SSL 协议的监听端口号。