Skip to content

Commit bb2cd03

Browse files
chore: fixup deckhd patch (ublue-os#1200)
1 parent 43bf687 commit bb2cd03

File tree

1 file changed

+183
-34
lines changed

1 file changed

+183
-34
lines changed

spec_files/gamescope/deckhd.patch

+183-34
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,218 @@
1+
From 90f972dfb4de9c8245f6fc5370a294653de828cc Mon Sep 17 00:00:00 2001
2+
From: Marco Rodolfi <[email protected]>
3+
Date: Thu, 2 May 2024 14:16:40 +0200
4+
Subject: [PATCH 1/2] Rebase DHD on latest gamescope master
5+
6+
---
7+
src/drm.cpp | 11 +++++++++--
8+
src/gamescope_shared.h | 1 +
9+
src/modegen.cpp | 34 ++++++++++++++++++++++++++++++----
10+
3 files changed, 40 insertions(+), 6 deletions(-)
11+
112
diff --git a/src/drm.cpp b/src/drm.cpp
2-
index 7776422..b7d822c 100644
13+
index 511a571..6ee3bd3 100644
314
--- a/src/drm.cpp
415
+++ b/src/drm.cpp
5-
@@ -2122,6 +2122,8 @@ namespace gamescope
16+
@@ -2121,6 +2121,7 @@ namespace gamescope
17+
( m_Mutable.szMakePNP == "WLC"sv && m_Mutable.szModel == "ANX7530 U"sv ) ||
18+
( m_Mutable.szMakePNP == "ANX"sv && m_Mutable.szModel == "ANX7530 U"sv ) ||
619
( m_Mutable.szMakePNP == "VLV"sv && m_Mutable.szModel == "ANX7530 U"sv ) ||
20+
+ ( m_Mutable.szMakePNP == "DHD"sv && m_Mutable.szModel == "DeckHD-1200p"sv ) ||
721
( m_Mutable.szMakePNP == "VLV"sv && m_Mutable.szModel == "Jupiter"sv ) ||
822
( m_Mutable.szMakePNP == "VLV"sv && m_Mutable.szModel == "Galileo"sv );
9-
+ const bool bDeckHDDisplay =
10-
+ ( m_Mutable.szMakePNP == "DHD"sv && m_Mutable.szModel == "DeckHD-1200p"sv );
1123
const bool bLegionGoDisplay =
12-
( m_Mutable.szMakePNP == "LEN"sv && m_Mutable.szModel == "Go Display"sv );
13-
const bool bLokiDisplay =
14-
@@ -2148,6 +2150,11 @@ namespace gamescope
15-
m_Mutable.ValidDynamicRefreshRates = std::span( s_kSteamDeckLCDRates );
24+
@@ -2132,6 +2133,7 @@ namespace gamescope
25+
{
26+
static constexpr uint32_t kPIDGalileoSDC = 0x3003;
27+
static constexpr uint32_t kPIDGalileoBOE = 0x3004;
28+
+ static constexpr uint32_t kPIDJupiterDHD = 0x4001;
29+
30+
if ( pProduct->product == kPIDGalileoSDC )
31+
{
32+
@@ -2120,6 +2122,10 @@ namespace gamescope
33+
m_Mutable.eKnownDisplay = GAMESCOPE_KNOWN_DISPLAY_STEAM_DECK_OLED_BOE;
34+
m_Mutable.ValidDynamicRefreshRates = std::span( s_kSteamDeckOLEDRates );
1635
}
36+
+ else if (pProduct-> product == kPIDJupiterDHD ) {
37+
+ m_Mutable.eKnownDisplay = GAMESCOPE_KNOWN_DISPLAY_STEAM_DECK_LCD_DHD;
38+
+ m_Mutable.ValidDynamicRefreshRates = std::span( s_kSteamDeckLCDRates );
39+
+ }
40+
else
41+
{
42+
m_Mutable.eKnownDisplay = GAMESCOPE_KNOWN_DISPLAY_STEAM_DECK_LCD;
43+
@@ -2149,7 +2155,8 @@ namespace gamescope
44+
drm_log.infof( "[colorimetry]: Steam Deck LCD detected. Using known colorimetry" );
45+
m_Mutable.DisplayColorimetry = displaycolorimetry_steamdeck_measured;
1746
}
18-
+ else if ( bDeckHDDisplay )
19-
+ {
20-
+ m_Mutable.eKnownDisplay = GAMESCOPE_KNOWN_DISPLAY_STEAM_DECK_LCD_DHD;
21-
+ m_Mutable.ValidDynamicRefreshRates = std::span( s_kSteamDeckLCDRates );
22-
+ }
23-
else if ( bLegionGoDisplay )
47+
- else
48+
+ else if (m_Mutable.eKnownDisplay == GAMESCOPE_KNOWN_DISPLAY_STEAM_DECK_OLED_BOE ||
49+
+ m_Mutable.eKnownDisplay == GAMESCOPE_KNOWN_DISPLAY_STEAM_DECK_OLED_SDC )
2450
{
25-
m_Mutable.ValidDynamicRefreshRates = std::span( s_kLegionGoRates );
26-
@@ -2309,7 +2316,7 @@ namespace gamescope
51+
// Steam Deck OLED has calibrated chromaticity coordinates in the EDID
52+
// for each unit.
53+
@@ -2279,7 +2286,7 @@ namespace gamescope
2754
.uMinContentLightLevel = nits_to_u16_dark( 0 ),
2855
};
2956
}
3057
- else if ( eKnownDisplay == GAMESCOPE_KNOWN_DISPLAY_STEAM_DECK_LCD )
31-
+ else if ( eKnownDisplay == GAMESCOPE_KNOWN_DISPLAY_STEAM_DECK_LCD || GAMESCOPE_KNOWN_DISPLAY_STEAM_DECK_LCD_DHD )
58+
+ else if ( eKnownDisplay == GAMESCOPE_KNOWN_DISPLAY_STEAM_DECK_LCD || eKnownDisplay == GAMESCOPE_KNOWN_DISPLAY_STEAM_DECK_LCD_DHD )
3259
{
3360
// Set up some HDR fallbacks for undocking
3461
return BackendConnectorHDRInfo
3562
diff --git a/src/gamescope_shared.h b/src/gamescope_shared.h
36-
index ed30d8c..f53ed4a 100644
63+
index f34174e59..3b11e82f6 100644
3764
--- a/src/gamescope_shared.h
3865
+++ b/src/gamescope_shared.h
3966
@@ -8,6 +8,7 @@ namespace gamescope
4067
{
4168
GAMESCOPE_KNOWN_DISPLAY_UNKNOWN,
4269
GAMESCOPE_KNOWN_DISPLAY_STEAM_DECK_LCD, // Jupiter
43-
+ GAMESCOPE_KNOWN_DISPLAY_STEAM_DECK_LCD_DHD, // Jupiter DeckHD
70+
+ GAMESCOPE_KNOWN_DISPLAY_STEAM_DECK_LCD_DHD, // Jupiter Deck HD
4471
GAMESCOPE_KNOWN_DISPLAY_STEAM_DECK_OLED_SDC, // Galileo SDC
4572
GAMESCOPE_KNOWN_DISPLAY_STEAM_DECK_OLED_BOE, // Galileo BOE
4673
};
4774
diff --git a/src/modegen.cpp b/src/modegen.cpp
48-
index d174c2d..bfb782d 100644
75+
index d174c2d21..d08622555 100644
4976
--- a/src/modegen.cpp
5077
+++ b/src/modegen.cpp
51-
@@ -356,6 +356,18 @@ void generate_fixed_mode(drmModeModeInfo *mode, const drmModeModeInfo *base, int
52-
mode->vsync_end = 1314;
53-
mode->vtotal = 1322;
54-
}
55-
+ else if ( eKnownDisplay = gamescope::GAMESCOPE_KNOWN_DISPLAY_STEAM_DECK_LCD_DHD )
56-
+ {
78+
@@ -293,6 +293,21 @@ unsigned int galileo_boe_vfp[] =
79+
172,152,136,120,100,84,68,52,36,20,8
80+
};
81+
82+
+#define JUPITER_BOE_PID 0x3001
83+
+#define JUPITER_B_PID 0x3002
84+
+#define JUPITER_HFP 40
85+
+#define JUPITER_HSYNC 4
86+
+#define JUPITER_HBP 0
87+
+#define JUPITER_VFP 30
88+
+#define JUPITER_VSYNC 4
89+
+#define JUPITER_VBP 8
90+
+#define JUPITER_DHD_PID 0x4001
91+
+#define JUPITER_DHD_HFP 40
92+
+#define JUPITER_DHD_HSYNC 20
93+
+#define JUPITER_DHD_HBP 40
94+
+#define JUPITER_DHD_VFP 18
95+
+#define JUPITER_DHD_VSYNC 2
96+
+#define JUPITER_DHD_VBP 20
97+
#define GALILEO_MIN_REFRESH 45
98+
#define GALILEO_SDC_PID 0x3003
99+
#define GALILEO_SDC_VSYNC 1
100+
@@ -344,7 +359,18 @@ void generate_fixed_mode(drmModeModeInfo *mode, const drmModeModeInfo *base, int
101+
mode->vsync_end = mode->vsync_start + vsync;
102+
mode->vtotal = mode->vsync_end + vbp;
103+
} else {
104+
- if ( eKnownDisplay == gamescope::GAMESCOPE_KNOWN_DISPLAY_STEAM_DECK_LCD )
105+
+ if ( eKnownDisplay == gamescope:: GAMESCOPE_KNOWN_DISPLAY_STEAM_DECK_LCD_DHD ) {
57106
+ mode->hdisplay = 1200;
58-
+ mode->hsync_start = 1240;
59-
+ mode->hsync_end = 1260;
60-
+ mode->htotal = 1300;
107+
+ mode->hsync_start = mode->hdisplay + JUPITER_DHD_HFP;
108+
+ mode->hsync_end = mode->hsync_start + JUPITER_DHD_HSYNC;
109+
+ mode->htotal = mode->hsync_end + JUPITER_DHD_HBP;
61110
+
62111
+ mode->vdisplay = 1920;
63-
+ mode->vsync_start = 1938;
64-
+ mode->vsync_end = 1940;
65-
+ mode->vtotal = 1960;
112+
+ mode->vsync_start = mode->vdisplay + JUPITER_DHD_VFP;
113+
+ mode->vsync_end = mode->vsync_start + JUPITER_DHD_VSYNC;
114+
+ mode->vtotal = mode->vsync_end + JUPITER_DHD_VBP;
66115
+ }
67-
116+
+ else if ( eKnownDisplay == gamescope::GAMESCOPE_KNOWN_DISPLAY_STEAM_DECK_LCD )
117+
{
118+
mode->hdisplay = 800;
119+
mode->hsync_start = 840;
120+
@@ -352,9 +378,9 @@ void generate_fixed_mode(drmModeModeInfo *mode, const drmModeModeInfo *base, int
121+
mode->htotal = 884;
122+
123+
mode->vdisplay = 1280;
124+
- mode->vsync_start = 1310;
125+
- mode->vsync_end = 1314;
126+
- mode->vtotal = 1322;
127+
+ mode->vsync_start = mode->vdisplay + JUPITER_VFP;
128+
+ mode->vsync_end = mode->vsync_start + JUPITER_VSYNC;
129+
+ mode->vtotal = mode->vsync_end + JUPITER_VBP;
130+
}
131+
68132
mode->clock = ( ( mode->htotal * mode->vtotal * vrefresh ) + 999 ) / 1000;
69-
}
133+
134+
From a01b1937fe2f898d3aa8628ca6a38465da29e78b Mon Sep 17 00:00:00 2001
135+
From: Marco Rodolfi <[email protected]>
136+
Date: Fri, 3 May 2024 10:23:30 +0200
137+
Subject: [PATCH 2/2] Couple of stylistic fixes and corrected a timing typo
138+
from the original patch
139+
140+
---
141+
src/gamescope_shared.h | 2 +-
142+
src/modegen.cpp | 16 ++++++++++------
143+
2 files changed, 11 insertions(+), 7 deletions(-)
144+
145+
diff --git a/src/gamescope_shared.h b/src/gamescope_shared.h
146+
index 3b11e82f6..60e38293c 100644
147+
--- a/src/gamescope_shared.h
148+
+++ b/src/gamescope_shared.h
149+
@@ -8,7 +8,7 @@ namespace gamescope
150+
{
151+
GAMESCOPE_KNOWN_DISPLAY_UNKNOWN,
152+
GAMESCOPE_KNOWN_DISPLAY_STEAM_DECK_LCD, // Jupiter
153+
- GAMESCOPE_KNOWN_DISPLAY_STEAM_DECK_LCD_DHD, // Jupiter Deck HD
154+
+ GAMESCOPE_KNOWN_DISPLAY_STEAM_DECK_LCD_DHD, // Jupiter Deck HD
155+
GAMESCOPE_KNOWN_DISPLAY_STEAM_DECK_OLED_SDC, // Galileo SDC
156+
GAMESCOPE_KNOWN_DISPLAY_STEAM_DECK_OLED_BOE, // Galileo BOE
157+
};
158+
diff --git a/src/modegen.cpp b/src/modegen.cpp
159+
index d08622555..5dd113697 100644
160+
--- a/src/modegen.cpp
161+
+++ b/src/modegen.cpp
162+
@@ -293,14 +293,16 @@ unsigned int galileo_boe_vfp[] =
163+
172,152,136,120,100,84,68,52,36,20,8
164+
};
165+
166+
+//SD LCD Stock Timings
167+
#define JUPITER_BOE_PID 0x3001
168+
#define JUPITER_B_PID 0x3002
169+
#define JUPITER_HFP 40
170+
#define JUPITER_HSYNC 4
171+
-#define JUPITER_HBP 0
172+
+#define JUPITER_HBP 40
173+
#define JUPITER_VFP 30
174+
#define JUPITER_VSYNC 4
175+
#define JUPITER_VBP 8
176+
+//SD LCD DeckHD Timings
177+
#define JUPITER_DHD_PID 0x4001
178+
#define JUPITER_DHD_HFP 40
179+
#define JUPITER_DHD_HSYNC 20
180+
@@ -308,13 +310,15 @@ unsigned int galileo_boe_vfp[] =
181+
#define JUPITER_DHD_VFP 18
182+
#define JUPITER_DHD_VSYNC 2
183+
#define JUPITER_DHD_VBP 20
184+
-#define GALILEO_MIN_REFRESH 45
185+
+//SD OLED SDC Timings
186+
#define GALILEO_SDC_PID 0x3003
187+
#define GALILEO_SDC_VSYNC 1
188+
#define GALILEO_SDC_VBP 22
189+
+//SD OLED BOE Timings
190+
#define GALILEO_BOE_PID 0x3004
191+
#define GALILEO_BOE_VSYNC 2
192+
#define GALILEO_BOE_VBP 30
193+
+#define GALILEO_MIN_REFRESH 45
194+
#define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
195+
196+
unsigned int get_galileo_vfp( int vrefresh, unsigned int * vfp_array, unsigned int num_rates )
197+
@@ -359,7 +363,7 @@ void generate_fixed_mode(drmModeModeInfo *mode, const drmModeModeInfo *base, int
198+
mode->vsync_end = mode->vsync_start + vsync;
199+
mode->vtotal = mode->vsync_end + vbp;
200+
} else {
201+
- if ( eKnownDisplay == gamescope:: GAMESCOPE_KNOWN_DISPLAY_STEAM_DECK_LCD_DHD ) {
202+
+ if ( eKnownDisplay == gamescope::GAMESCOPE_KNOWN_DISPLAY_STEAM_DECK_LCD_DHD ) {
203+
mode->hdisplay = 1200;
204+
mode->hsync_start = mode->hdisplay + JUPITER_DHD_HFP;
205+
mode->hsync_end = mode->hsync_start + JUPITER_DHD_HSYNC;
206+
@@ -373,9 +377,9 @@ void generate_fixed_mode(drmModeModeInfo *mode, const drmModeModeInfo *base, int
207+
else if ( eKnownDisplay == gamescope::GAMESCOPE_KNOWN_DISPLAY_STEAM_DECK_LCD )
208+
{
209+
mode->hdisplay = 800;
210+
- mode->hsync_start = 840;
211+
- mode->hsync_end = 844;
212+
- mode->htotal = 884;
213+
+ mode->hsync_start = mode->hdisplay + JUPITER_HFP;
214+
+ mode->hsync_end = mode->hsync_start + JUPITER_HSYNC;
215+
+ mode->htotal = mode->hsync_end + JUPITER_HBP;
216+
217+
mode->vdisplay = 1280;
218+
mode->vsync_start = mode->vdisplay + JUPITER_VFP;

0 commit comments

Comments
 (0)