From 9892ea686176e885d5e09ccd7753eba58c702d15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=83=B1=E3=83=83=E3=82=B8?= Date: Sat, 7 Dec 2024 12:20:39 -0600 Subject: [PATCH] Overhaul display scripts --- .../scripts/displays/AYA-AYANEOFHD.lua | 25 +++++----- .../scripts/displays/AYA-AYANEOHD.lua | 40 +++++++--------- .../scripts/displays/AYA-AYANEOWUXGA.lua | 48 +++++++------------ .../scripts/displays/AYN-LK-GOLSPV58.lua | 48 +++++++------------ 4 files changed, 64 insertions(+), 97 deletions(-) diff --git a/PKGBUILD/steamfork-device-support/src/etc/gamescope/scripts/displays/AYA-AYANEOFHD.lua b/PKGBUILD/steamfork-device-support/src/etc/gamescope/scripts/displays/AYA-AYANEOFHD.lua index b4b39fb..9b4ce31 100755 --- a/PKGBUILD/steamfork-device-support/src/etc/gamescope/scripts/displays/AYA-AYANEOFHD.lua +++ b/PKGBUILD/steamfork-device-support/src/etc/gamescope/scripts/displays/AYA-AYANEOFHD.lua @@ -15,9 +15,7 @@ local panel_colorimetry = { } local panel_resolutions = { - { width = 1080, height = 1920, - hfront = 90, hsync = 18, hback = 72, - vfront = 14, vsync = 2, vback = 8 }, + { width = 1080, height = 1920 }, } local panel_refresh_rates = { 60, 120 } @@ -40,32 +38,33 @@ gamescope.config.known_displays[panel_id] = { dynamic_modegen = function(base_mode, refresh) local mode = base_mode - local found_res = false - local set_res = panel_resolutions[1] - debug("["..panel_id.."] Generating mode "..mode.hdisplay.."x"..mode.vdisplay.."@"..refresh.."Hz") + local set_res = false + debug("["..panel_id.."] Switching mode to "..mode.hdisplay.."x"..mode.vdisplay.."@"..refresh.."Hz") for i, res in ipairs(panel_resolutions) do if res.width == mode.hdisplay and res.height == mode.vdisplay then - found_res = true set_res = res break end end - if not found_res then - debug("["..panel_id.."] Generating mode failed. Setting default resolution of "..set_res.width.."x"..set_res.height) - gamescope.modegen.set_resolution(mode, set_res.width, set_res.height) + if not set_res then + debug("["..panel_id.."] Mode not found. Aborting.") + return mode end - gamescope.modegen.set_h_timings(mode, set_res.hfront, set_res.hsync, set_res.hback) - gamescope.modegen.set_v_timings(mode, set_res.vfront, set_res.vsync, set_res.vback) + if set_res.hfp ~= nil and set_res.hsync ~= nil and set_res.hbp ~= nil then + gamescope.modegen.set_h_timings(mode, set_res.hfp, set_res.hsync, set_res.hbp) + end + if set_res.vfp ~= nil and set_res.vsync ~= nil and set_res.vbp ~= nil then + gamescope.modegen.set_v_timings(mode, set_res.vfp, set_res.vsync, set_res.vbp) + end mode.clock = gamescope.modegen.calc_max_clock(mode, refresh) mode.vrefresh = gamescope.modegen.calc_vrefresh(mode) return mode end, - matches = function(display) for i, panel in ipairs(panel_models) do if panel.vendor == display.vendor and panel.model == display.model then diff --git a/PKGBUILD/steamfork-device-support/src/etc/gamescope/scripts/displays/AYA-AYANEOHD.lua b/PKGBUILD/steamfork-device-support/src/etc/gamescope/scripts/displays/AYA-AYANEOHD.lua index ff90933..f354dec 100644 --- a/PKGBUILD/steamfork-device-support/src/etc/gamescope/scripts/displays/AYA-AYANEOHD.lua +++ b/PKGBUILD/steamfork-device-support/src/etc/gamescope/scripts/displays/AYA-AYANEOHD.lua @@ -17,21 +17,11 @@ local panel_colorimetry = { } local panel_resolutions = { - { width = 1080, height = 1920, - hfront = 116, hsync = 4, hback = 34, - vfront = 20, vsync = 2, vback = 6 }, - { width = 600, height = 1066, - hfront = 64, hsync = 8, hback = 88, - vfront = 20, vsync = 8, vback = 12 }, - { width = 768, height = 1024, - hfront = 64, hsync = 8, hback = 88, - vfront = 20, vsync = 8, vback = 12 }, - { width = 600, height = 800, - hfront = 64, hsync = 8, hback = 88, - vfront = 20, vsync = 8, vback = 12 }, - { width = 720, height = 1280, - hfront = 68, hsync = 8, hback = 88, - vfront = 12, vsync = 4, vback = 8 }, + { width = 1080, height = 1920 }, + { width = 768, height = 1024 }, + { width = 720, height = 1280 }, + { width = 600, height = 1066 }, + { width = 600, height = 800 }, } local panel_refresh_rates = {} @@ -57,25 +47,27 @@ gamescope.config.known_displays[panel_id] = { dynamic_modegen = function(base_mode, refresh) local mode = base_mode - local found_res = false - local set_res = panel_resolutions[1] - debug("["..panel_id.."] Generating mode "..mode.hdisplay.."x"..mode.vdisplay.."@"..refresh.."Hz") + local set_res = false + debug("["..panel_id.."] Switching mode to "..mode.hdisplay.."x"..mode.vdisplay.."@"..refresh.."Hz") for i, res in ipairs(panel_resolutions) do if res.width == mode.hdisplay and res.height == mode.vdisplay then - found_res = true set_res = res break end end - if not found_res then - debug("["..panel_id.."] Generating mode failed. Setting default resolution of "..set_res.width.."x"..set_res.height) - gamescope.modegen.set_resolution(mode, set_res.width, set_res.height) + if not set_res then + debug("["..panel_id.."] Mode not found. Aborting.") + return mode end - gamescope.modegen.set_h_timings(mode, set_res.hfront, set_res.hsync, set_res.hback) - gamescope.modegen.set_v_timings(mode, set_res.vfront, set_res.vsync, set_res.vback) + if set_res.hfp ~= nil and set_res.hsync ~= nil and set_res.hbp ~= nil then + gamescope.modegen.set_h_timings(mode, set_res.hfp, set_res.hsync, set_res.hbp) + end + if set_res.vfp ~= nil and set_res.vsync ~= nil and set_res.vbp ~= nil then + gamescope.modegen.set_v_timings(mode, set_res.vfp, set_res.vsync, set_res.vbp) + end mode.clock = gamescope.modegen.calc_max_clock(mode, refresh) mode.vrefresh = gamescope.modegen.calc_vrefresh(mode) diff --git a/PKGBUILD/steamfork-device-support/src/etc/gamescope/scripts/displays/AYA-AYANEOWUXGA.lua b/PKGBUILD/steamfork-device-support/src/etc/gamescope/scripts/displays/AYA-AYANEOWUXGA.lua index f586d95..2b2e27d 100644 --- a/PKGBUILD/steamfork-device-support/src/etc/gamescope/scripts/displays/AYA-AYANEOWUXGA.lua +++ b/PKGBUILD/steamfork-device-support/src/etc/gamescope/scripts/displays/AYA-AYANEOWUXGA.lua @@ -16,27 +16,13 @@ local panel_colorimetry = { } local panel_resolutions = { - { width = 1200, height = 1920, - hfront = 64, hsync = 24, hback = 32, - vfront = 60, vsync = 8, vback = 32 }, - { width = 1080, height = 1920, - hfront = 40, hsync = 8, hback = 120, - vfront = 8, vsync = 16, vback = 44 }, - { width = 720, height = 1152, - hfront = 64, hsync = 8, hback = 88, - vfront = 8, vsync = 20, vback = 12 }, - { width = 800, height = 1280, - hfront = 32, hsync = 10, hback = 118, - vfront = 10, vsync = 16, vback = 20 }, - { width = 720, height = 1280, - hfront = 64, hsync = 8, hback = 68, - vfront = 10, vsync = 16, vback = 14 }, - { width = 768, height = 1024, - hfront = 48, hsync = 10, hback = 82, - vfront = 10, vsync = 24, vback = 22 }, - { width = 600, height = 960, - hfront = 68, hsync = 8, hback = 88, - vfront = 12, vsync = 4, vback = 8 }, + { width = 1200, height = 1920 }, + { width = 1080, height = 1920 }, + { width = 800, height = 1280 }, + { width = 768, height = 1024 }, + { width = 720, height = 1280 }, + { width = 720, height = 1152 }, + { width = 600, height = 960 }, } local panel_refresh_rates = {} @@ -62,25 +48,27 @@ gamescope.config.known_displays[panel_id] = { dynamic_modegen = function(base_mode, refresh) local mode = base_mode - local found_res = false - local set_res = panel_resolutions[1] - debug("["..panel_id.."] Generating mode "..mode.hdisplay.."x"..mode.vdisplay.."@"..refresh.."Hz") + local set_res = false + debug("["..panel_id.."] Switching mode to "..mode.hdisplay.."x"..mode.vdisplay.."@"..refresh.."Hz") for i, res in ipairs(panel_resolutions) do if res.width == mode.hdisplay and res.height == mode.vdisplay then - found_res = true set_res = res break end end - if not found_res then - debug("["..panel_id.."] Generating mode failed. Setting default resolution of "..set_res.width.."x"..set_res.height) - gamescope.modegen.set_resolution(mode, set_res.width, set_res.height) + if not set_res then + debug("["..panel_id.."] Mode not found. Aborting.") + return mode end - gamescope.modegen.set_h_timings(mode, set_res.hfront, set_res.hsync, set_res.hback) - gamescope.modegen.set_v_timings(mode, set_res.vfront, set_res.vsync, set_res.vback) + if set_res.hfp ~= nil and set_res.hsync ~= nil and set_res.hbp ~= nil then + gamescope.modegen.set_h_timings(mode, set_res.hfp, set_res.hsync, set_res.hbp) + end + if set_res.vfp ~= nil and set_res.vsync ~= nil and set_res.vbp ~= nil then + gamescope.modegen.set_v_timings(mode, set_res.vfp, set_res.vsync, set_res.vbp) + end mode.clock = gamescope.modegen.calc_max_clock(mode, refresh) mode.vrefresh = gamescope.modegen.calc_vrefresh(mode) diff --git a/PKGBUILD/steamfork-device-support/src/etc/gamescope/scripts/displays/AYN-LK-GOLSPV58.lua b/PKGBUILD/steamfork-device-support/src/etc/gamescope/scripts/displays/AYN-LK-GOLSPV58.lua index 6fd42c2..6c38605 100644 --- a/PKGBUILD/steamfork-device-support/src/etc/gamescope/scripts/displays/AYN-LK-GOLSPV58.lua +++ b/PKGBUILD/steamfork-device-support/src/etc/gamescope/scripts/displays/AYN-LK-GOLSPV58.lua @@ -17,27 +17,13 @@ local panel_colorimetry = { } local panel_resolutions = { - { width = 1080, height = 1920, - hfront = 25, hsync = 10, hback = 15, - vfront = 3, vsync = 16, vback = 20 }, - { width = 810, height = 1440, - hfront = 144, hsync = 80, hback = 64, - vfront = 40, vsync = 10, vback = 3 }, - { width = 768, height = 1024, - hfront = 48, hsync = 10, hback = 82, - vfront = 10, vsync = 24, vback = 22 }, - { width = 720, height = 1280, - hfront = 128, hsync = 72, hback = 56, - vfront = 34, vsync = 10, vback = 3 }, - { width = 648, height = 1152, - hfront = 112, hsync = 64, hback = 48, - vfront = 30, vsync = 10, vback = 3 }, - { width = 600, height = 800, - hfront = 88, hsync = 56, hback = 31, - vfront = 18, vsync = 10, vback = 3 }, - { width = 768, height = 1366, - hfront = 136, hsync = 80, hback = 56, - vfront = 37, vsync = 10, vback = 3 }, + { width = 1080, height = 1920 }, + { width = 810, height = 1440 }, + { width = 768, height = 1366 }, + { width = 768, height = 1024 }, + { width = 720, height = 1280 }, + { width = 648, height = 1152 }, + { width = 600, height = 800 }, } @@ -64,25 +50,27 @@ gamescope.config.known_displays[panel_id] = { dynamic_modegen = function(base_mode, refresh) local mode = base_mode - local found_res = false - local set_res = panel_resolutions[1] - debug("["..panel_id.."] Generating mode "..mode.hdisplay.."x"..mode.vdisplay.."@"..refresh.."Hz") + local set_res = false + debug("["..panel_id.."] Switching mode to "..mode.hdisplay.."x"..mode.vdisplay.."@"..refresh.."Hz") for i, res in ipairs(panel_resolutions) do if res.width == mode.hdisplay and res.height == mode.vdisplay then - found_res = true set_res = res break end end - if not found_res then - debug("["..panel_id.."] Generating mode failed. Setting default resolution of "..set_res.width.."x"..set_res.height) - gamescope.modegen.set_resolution(mode, set_res.width, set_res.height) + if not set_res then + debug("["..panel_id.."] Mode not found. Aborting.") + return mode end - gamescope.modegen.set_h_timings(mode, set_res.hfront, set_res.hsync, set_res.hback) - gamescope.modegen.set_v_timings(mode, set_res.vfront, set_res.vsync, set_res.vback) + if set_res.hfp ~= nil and set_res.hsync ~= nil and set_res.hbp ~= nil then + gamescope.modegen.set_h_timings(mode, set_res.hfp, set_res.hsync, set_res.hbp) + end + if set_res.vfp ~= nil and set_res.vsync ~= nil and set_res.vbp ~= nil then + gamescope.modegen.set_v_timings(mode, set_res.vfp, set_res.vsync, set_res.vbp) + end mode.clock = gamescope.modegen.calc_max_clock(mode, refresh) mode.vrefresh = gamescope.modegen.calc_vrefresh(mode)