Skip to content

Commit 85bf156

Browse files
lichangzeKT-lcz
authored andcommitted
fix: 修复X100显卡不显示色温调节项的问题
部分显卡lspci没有VGA compatible controller相关数据,需要特殊处理 Log: 修复X100显卡不显示色温调节项的问题 Bug: https://pms.uniontech.com/bug-view-177571.html Influence: 色温显示 Change-Id: I58a700046eaff5ef4b2fece3574b8e59dd8035ec
1 parent 4726010 commit 85bf156

2 files changed

Lines changed: 41 additions & 8 deletions

File tree

display/manager.go

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ const (
108108
DSettingsDisplayName = "org.deepin.Display"
109109
DSettingsKeyHDMIIsBuiltinConfig = "HDMI-is-builtin"
110110
DSettingsKeyBackLightMaxBrightnessChooseBigConfig = "backLight-max-brightness-choose-big"
111+
DSettingsKeySpecialGPUVendorListConfig = "special-gpu-vendor-list"
111112
)
112113

113114
var (
@@ -235,6 +236,7 @@ type Manager struct {
235236
dsBackLightMaxBrightnessChooseBigConfig []string
236237
dmiInfo systeminfo.DMIInfo
237238
pciVendor []string
239+
dsSpecialGPUVendorList []string
238240
}
239241

240242
type monitorSizeInfo struct {
@@ -2946,14 +2948,20 @@ func (m *Manager) detectDrmSupportGamma() (bool, error) {
29462948
}
29472949
}
29482950
if !vgaSupportGamma {
2949-
args := []string{"-d 1ed5:"}
2950-
specifiedVendorInfo, err := getLspci(args)
2951-
if err != nil {
2952-
logger.Warning(err)
2953-
return false, err
2954-
}
2955-
if specifiedVendorInfo != "" {
2956-
vgaSupportGamma = true
2951+
// 部分显卡lspci没有VGA compatible controller相关数据,需要特殊处理
2952+
specialGPUVendorList := m.dsSpecialGPUVendorList
2953+
for _, vendor := range specialGPUVendorList {
2954+
args := []string{fmt.Sprintf("-d %s", vendor)}
2955+
specifiedVendorInfo, err := getLspci(args)
2956+
if err != nil {
2957+
logger.Warning(err)
2958+
vgaSupportGamma = false
2959+
continue
2960+
}
2961+
if specifiedVendorInfo != "" {
2962+
vgaSupportGamma = true
2963+
break
2964+
}
29572965
}
29582966
}
29592967
return vgaSupportGamma, nil
@@ -2996,8 +3004,20 @@ func (m *Manager) initDSettings(sysBus *dbus.Conn) {
29963004
m.dsBackLightMaxBrightnessChooseBigConfig = append(m.dsBackLightMaxBrightnessChooseBigConfig, i.Value().(string))
29973005
}
29983006
}
3007+
getSpecialGPUVendorList := func() {
3008+
v, err := dsDisplay.Value(0, DSettingsKeySpecialGPUVendorListConfig)
3009+
if err != nil {
3010+
logger.Warning(err)
3011+
return
3012+
}
3013+
itemList := v.Value().([]dbus.Variant)
3014+
for _, i := range itemList {
3015+
m.dsSpecialGPUVendorList = append(m.dsSpecialGPUVendorList, i.Value().(string))
3016+
}
3017+
}
29993018
getHDMIIsBuiltinConfig()
30003019
getBackLightMaxBrightnessChooseBigConfig()
3020+
getSpecialGPUVendorList()
30013021

30023022
dsDisplay.InitSignalExt(m.sysSigLoop, true)
30033023
_, err = dsDisplay.ConnectValueChanged(func(key string) {
@@ -3006,6 +3026,8 @@ func (m *Manager) initDSettings(sysBus *dbus.Conn) {
30063026
getHDMIIsBuiltinConfig()
30073027
case DSettingsKeyBackLightMaxBrightnessChooseBigConfig:
30083028
getBackLightMaxBrightnessChooseBigConfig()
3029+
case DSettingsKeySpecialGPUVendorListConfig:
3030+
getSpecialGPUVendorList()
30093031
}
30103032
})
30113033
if err != nil {

misc/dsettings/org.deepin.Display.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,17 @@
2323
"description": "",
2424
"permissions": "readwrite",
2525
"visibility": "private"
26+
},
27+
"special-gpu-vendor-list": {
28+
"value": ["1ed5:","1db7:"],
29+
"serial": 0,
30+
"flags": [
31+
"global"
32+
],
33+
"name": "special gpu vendor list",
34+
"description": "",
35+
"permissions": "readwrite",
36+
"visibility": "private"
2637
}
2738
}
2839
}

0 commit comments

Comments
 (0)