加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0001-uos-startdde-fix-kvm-gpu-message-pci-error.patch 1.61 KB
一键复制 编辑 原始数据 按行查看 历史
Venland 提交于 2023-08-03 11:21 . upgrade to version 5.9.61
diff -Nuar startdde-5.9.61/display/util.go startdde-5.9.61.new/display/util.go
--- startdde-5.9.61/display/util.go 2022-12-09 11:19:18.000000000 +0800
+++ startdde-5.9.61.new/display/util.go 2023-04-12 11:21:51.145365556 +0800
@@ -15,6 +15,7 @@
"sort"
"strconv"
"strings"
+ "os/exec"
"github.com/godbus/dbus"
hostname1 "github.com/linuxdeepin/go-dbus-factory/org.freedesktop.hostname1"
@@ -333,6 +334,32 @@
return chassis, nil
}
+func CheckKvm() string {
+ var maty string
+ out, err := exec.Command("systemd-detect-virt").Output()
+ if err != nil {
+ maty = ""
+ }else {
+ maty = string(out)
+ maty = strings.Replace(maty, "\n", "", -1)
+ }
+ return maty
+}
+
+func CheckArch() string {
+ var KArch string
+ out, err := exec.Command("arch").Output()
+
+ if err != nil {
+ KArch = ""
+ }else {
+ KArch = string(out)
+ KArch = strings.Replace(KArch,"\n","",-1)
+ }
+ return KArch
+}
+
+
func getGraphicsCardPciId() string {
var pciId string
subsystems := []string{"drm"}
@@ -362,6 +389,27 @@
}
}
}
+//qxl not support in arm/loongarch
+//just try drm/card0
+ if pciId == "" {
+ maty := CheckKvm()
+ KArch := CheckArch()
+ if maty == "kvm" {
+ if KArch == "aarch64" || KArch == "loongarch64" {
+ for _, dev := range devices {
+ name := dev.GetName()
+ if name == "card0" {
+ cardDevice := dev.GetParent()
+ parentDevice := cardDevice.GetParent()
+ pciId = parentDevice.GetProperty("PCI_ID")
+ cardDevice.Unref()
+ parentDevice.Unref()
+ break
+ }
+ }
+ }
+ }
+ }
return pciId
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化