gen_default_modes: Add more refresh rates to fallback modes
Refresh rates >60Hz become ever more common. In order to allow users to keep hight refresh rates when not running at a natively advertized resolution, add common refresh rates to our fallback modes. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2189>
This commit is contained in:
parent
fb9564b87b
commit
36481b8d21
@ -55,6 +55,15 @@ common_resolutions = [
|
|||||||
(5120, 2880),
|
(5120, 2880),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
common_refresh_rates = [
|
||||||
|
60,
|
||||||
|
90,
|
||||||
|
120,
|
||||||
|
144,
|
||||||
|
165,
|
||||||
|
240,
|
||||||
|
]
|
||||||
|
|
||||||
output_lines = [
|
output_lines = [
|
||||||
"/* Generated by gen-default-modes.py */\n",
|
"/* Generated by gen-default-modes.py */\n",
|
||||||
"static const drmModeModeInfo meta_default_landscape_drm_mode_infos[] = {",
|
"static const drmModeModeInfo meta_default_landscape_drm_mode_infos[] = {",
|
||||||
@ -84,7 +93,7 @@ def drm_mode_info_from_modeline(line):
|
|||||||
|
|
||||||
def portrait_drm_mode_info_from_modeline(line):
|
def portrait_drm_mode_info_from_modeline(line):
|
||||||
sline = line.split()
|
sline = line.split()
|
||||||
return "{ %d, %d, %d, %d, %d, 0, %d, %d, %d, %d, 0, 0, %s, DRM_MODE_TYPE_DEFAULT, \"%dx%d_60.00\" }," % \
|
return "{ %d, %d, %d, %d, %d, 0, %d, %d, %d, %d, 0, 0, %s, DRM_MODE_TYPE_DEFAULT, \"%dx%d_%s }," % \
|
||||||
(int(float(sline[2]) * 1000),
|
(int(float(sline[2]) * 1000),
|
||||||
int(sline[7]),
|
int(sline[7]),
|
||||||
int(sline[8]),
|
int(sline[8]),
|
||||||
@ -95,10 +104,11 @@ def portrait_drm_mode_info_from_modeline(line):
|
|||||||
int(sline[5]),
|
int(sline[5]),
|
||||||
int(sline[6]),
|
int(sline[6]),
|
||||||
sync_flags(sline[12], sline[11]),
|
sync_flags(sline[12], sline[11]),
|
||||||
int(sline[7]), int(sline[3]))
|
int(sline[7]), int(sline[3]), sline[1].split("_")[1])
|
||||||
|
|
||||||
for resolution in common_resolutions:
|
for resolution in common_resolutions:
|
||||||
cvt = os.popen("%s %s %s" % ('cvt', resolution[0], resolution[1]))
|
for refresh_rate in common_refresh_rates:
|
||||||
|
cvt = os.popen("%s %s %s %s" % ('cvt', resolution[0], resolution[1], refresh_rate))
|
||||||
cvt.readline() # discard comment line
|
cvt.readline() # discard comment line
|
||||||
line = cvt.readline()
|
line = cvt.readline()
|
||||||
output_lines.append(drm_mode_info_from_modeline(line))
|
output_lines.append(drm_mode_info_from_modeline(line))
|
||||||
@ -108,7 +118,8 @@ output_lines.append("};")
|
|||||||
output_lines.append("")
|
output_lines.append("")
|
||||||
output_lines.append("static const drmModeModeInfo meta_default_portrait_drm_mode_infos[] = {")
|
output_lines.append("static const drmModeModeInfo meta_default_portrait_drm_mode_infos[] = {")
|
||||||
for resolution in common_resolutions:
|
for resolution in common_resolutions:
|
||||||
cvt = os.popen("%s %s %s" % ('cvt', resolution[0], resolution[1]))
|
for refresh_rate in common_refresh_rates:
|
||||||
|
cvt = os.popen("%s %s %s %s" % ('cvt', resolution[0], resolution[1], refresh_rate))
|
||||||
cvt.readline() # discard comment line
|
cvt.readline() # discard comment line
|
||||||
line = cvt.readline()
|
line = cvt.readline()
|
||||||
output_lines.append(portrait_drm_mode_info_from_modeline(line))
|
output_lines.append(portrait_drm_mode_info_from_modeline(line))
|
||||||
|
Loading…
Reference in New Issue
Block a user