Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions deepin-devicemanager/assets/org.deepin.devicemanager.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,16 @@
"permissions": "readwrite",
"visibility": "private"
},
"specialVRAMType": {
"value": 0,
"serial": 0,
"flags": ["global"],
"name": "Special VRAM Type",
"name[zh_CN]": "定制VRAM类型",
"description": "Special VRAM Type: VRAM type(value:0)",
"permissions": "readwrite",
"visibility": "private"
},
"TomlFilesName": {
"value": "tomlFilesName",
"serial": 0,
Expand Down
16 changes: 15 additions & 1 deletion deepin-devicemanager/src/GenerateDevice/CmdTool.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2026 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

Expand Down Expand Up @@ -425,7 +425,21 @@ void CmdTool::loadDmesgInfo(const QString &debugfile)
// 获取显存大小信息
QMap<QString, QString> mapInfo;
QStringList lines = deviceInfo.split("\n");
const bool isSpecialVRAM = Common::curVRAMType == Common::kSpecialVRAMType1;
bool hasCustomVRAMSize = false;
QRegExp regCustom(".*([0-9a-z]{4}:[0-9a-z]{2}:[0-9a-z]{2}\\.[0-9]{1}):.*Video RAM[^0-9]*([0-9]+)[\\s]{0,1}M.*");
foreach (const QString &line, lines) {
if (isSpecialVRAM && regCustom.exactMatch(line)) {
double size = regCustom.cap(2).toDouble();
QString sizeS = QString("%1GB").arg(size / 1024);
mapInfo["Size"] = regCustom.cap(1) + "=" + sizeS;
hasCustomVRAMSize = true;
continue;
}

if (hasCustomVRAMSize)
continue;

// DeviceCdrom m_HwinfoToLshw 值为0000:01:00.0 此处同步修改,否则显存大小无法显示
QRegExp reg(".*([0-9a-z]{4}:[0-9a-z]{2}:[0-9a-z]{2}.[0-9]{1}):.*VRAM([=:]{1}) ([0-9]*)[\\s]{0,1}M.*");
if (reg.exactMatch(line)) {
Expand Down
1 change: 1 addition & 0 deletions deepin-devicemanager/src/commonfunction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ static bool initBoardVendorFlag = false;
static QString boardVendorKey = "";
int Common::specialComType = -1;
Common::SpecialCpuType Common::curCpuType = Common::SpecialCpuType::kUnknowCpuType;
Common::SpecialVRAMType Common::curVRAMType = Common::SpecialVRAMType::kNormalVRAMType;
static QString tomlFilesName = "tomlFilesName";
QString Common::getArch()
{
Expand Down
7 changes: 7 additions & 0 deletions deepin-devicemanager/src/commonfunction.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ class Common
kSpecialCpuType1
};

enum SpecialVRAMType {
kNormalVRAMType = 0,
kSpecialVRAMType1,
kSpecialVRAMTypeMax
};

static QString getArch();

static QString getArchStore();
Expand All @@ -53,6 +59,7 @@ class Common
*/
static int specialComType;
static SpecialCpuType curCpuType;
static SpecialVRAMType curVRAMType;

static QByteArray executeClientCmd(const QString& cmd, const QStringList& args = QStringList(), const QString& workPath = QString(), int msecsWaiting = 30000);

Expand Down
7 changes: 7 additions & 0 deletions deepin-devicemanager/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,13 @@ int main(int argc, char *argv[])
}
if (dconfig->keyList().contains("specialCpuType"))
Common::curCpuType = static_cast<Common::SpecialCpuType>(dconfig->value("specialCpuType").toInt());
if (dconfig->keyList().contains("specialVRAMType")) {
const int vramTypeValue = dconfig->value("specialVRAMType").toInt();
if (vramTypeValue >= Common::kNormalVRAMType && vramTypeValue < Common::kSpecialVRAMTypeMax)
Common::curVRAMType = static_cast<Common::SpecialVRAMType>(vramTypeValue);
else
Common::curVRAMType = Common::kNormalVRAMType;
}
}

// 特殊机型,提前缓存GPU信息
Expand Down
Loading