From fc4f2749db4efe796abb9b371ead0fb121585429 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=83=B1=E3=83=83=E3=82=B8?= Date: Fri, 6 Dec 2024 10:20:51 -0600 Subject: [PATCH] Display scripts for testing --- .../displays/testing/AYA-AYANEO-OLED.lua | 84 ++++++++++++++++++ .../displays/testing/MSF-W0550U99GE-D.lua | 85 +++++++++++++++++++ .../scripts/displays/testing/RTK-7911D.lua | 84 ++++++++++++++++++ 3 files changed, 253 insertions(+) create mode 100644 PKGBUILD/steamfork-device-support/src/etc/gamescope/scripts/displays/testing/AYA-AYANEO-OLED.lua create mode 100644 PKGBUILD/steamfork-device-support/src/etc/gamescope/scripts/displays/testing/MSF-W0550U99GE-D.lua create mode 100644 PKGBUILD/steamfork-device-support/src/etc/gamescope/scripts/displays/testing/RTK-7911D.lua diff --git a/PKGBUILD/steamfork-device-support/src/etc/gamescope/scripts/displays/testing/AYA-AYANEO-OLED.lua b/PKGBUILD/steamfork-device-support/src/etc/gamescope/scripts/displays/testing/AYA-AYANEO-OLED.lua new file mode 100644 index 0000000..65bb142 --- /dev/null +++ b/PKGBUILD/steamfork-device-support/src/etc/gamescope/scripts/displays/testing/AYA-AYANEO-OLED.lua @@ -0,0 +1,84 @@ +-- Ayaneo Air 1S + +local panel_id = "ayaneo_hd_oled" +local panel_name = "Ayaneo HD OLED Panel" + +local panel_models = { + { vendor = "AYA", model = "AYANEO-OLED" }, +} + +local panel_colorimetry = { + r = { x = 0.6503, y = 0.3388 }, + g = { x = 0.3242, y = 0.6132 }, + b = { x = 0.1572, y = 0.0488 }, + w = { x = 0.3134, y = 0.3291 } +} + +local panel_resolutions = { + { width = 1080, height = 1920 }, + { width = 720, height = 1280 }, + { width = 600, height = 1066 }, +} + +local panel_refresh_rates = {} +for hz = 31, 60 do + table.insert(panel_refresh_rates, hz) +end + +local panel_hdr = { + supported = false, + force_enabled = false, + eotf = gamescope.eotf.gamma22, + max_content_light_level = 500, + max_frame_average_luminance = 500, + min_content_light_level = 0.5 +} + + +gamescope.config.known_displays[panel_id] = { + pretty_name = panel_name, + dynamic_refresh_rates = panel_refresh_rates, + hdr = panel_hdr, + colorimetry = panel_colorimetry, + + dynamic_modegen = function(base_mode, refresh) + local mode = base_mode + 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 + set_res = res + break + end + end + + if not set_res then + debug("["..panel_id.."] Mode not found. Aborting.") + return mode + end + + 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 + debug("["..panel_id.."] Matched vendor: "..display.vendor.." model: "..display.model) + return 4000 + end + end + + return -1 + end +} diff --git a/PKGBUILD/steamfork-device-support/src/etc/gamescope/scripts/displays/testing/MSF-W0550U99GE-D.lua b/PKGBUILD/steamfork-device-support/src/etc/gamescope/scripts/displays/testing/MSF-W0550U99GE-D.lua new file mode 100644 index 0000000..8c01584 --- /dev/null +++ b/PKGBUILD/steamfork-device-support/src/etc/gamescope/scripts/displays/testing/MSF-W0550U99GE-D.lua @@ -0,0 +1,85 @@ +-- Ayaneo Air +-- Ayaneo Air Pro + +local panel_id = "ayaneo_air_oled" +local panel_name = "Ayaneo Air OLED Panel" + +local panel_models = { + { vendor = "MSF", model = "W0550U99GE-D" }, +} + +local panel_colorimetry = { + r = { x = 0.6503, y = 0.3388 }, + g = { x = 0.3242, y = 0.6132 }, + b = { x = 0.1572, y = 0.0488 }, + w = { x = 0.3134, y = 0.3291 } +} + +local panel_resolutions = { + { width = 1080, height = 1920 }, + { width = 720, height = 1280 }, + { width = 600, height = 960 }, +} + +local panel_refresh_rates = {} +for hz = 31, 60 do + table.insert(panel_refresh_rates, hz) +end + +local panel_hdr = { + supported = false, + force_enabled = false, + eotf = gamescope.eotf.gamma22, + max_content_light_level = 500, + max_frame_average_luminance = 500, + min_content_light_level = 0.5 +} + + +gamescope.config.known_displays[panel_id] = { + pretty_name = panel_name, + dynamic_refresh_rates = panel_refresh_rates, + hdr = panel_hdr, + colorimetry = panel_colorimetry, + + dynamic_modegen = function(base_mode, refresh) + local mode = base_mode + 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 + set_res = res + break + end + end + + if not set_res then + debug("["..panel_id.."] Mode not found. Aborting.") + return mode + end + + 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 + debug("["..panel_id.."] Matched vendor: "..display.vendor.." model: "..display.model) + return 4000 + end + end + + return -1 + end +} diff --git a/PKGBUILD/steamfork-device-support/src/etc/gamescope/scripts/displays/testing/RTK-7911D.lua b/PKGBUILD/steamfork-device-support/src/etc/gamescope/scripts/displays/testing/RTK-7911D.lua new file mode 100644 index 0000000..a73fccf --- /dev/null +++ b/PKGBUILD/steamfork-device-support/src/etc/gamescope/scripts/displays/testing/RTK-7911D.lua @@ -0,0 +1,84 @@ +-- Anbernic Win600 + +local panel_id = "anbernic_win600_lcd" +local panel_name = "Anbernic Win600 LCD Panel" + +local panel_models = { + { vendor = "RTK", model = "7911D" }, +} + +local panel_colorimetry = { + r = { x = 0.6796, y = 0.3095 }, + g = { x = 0.2060, y = 0.6933 }, + b = { x = 0.1513, y = 0.0546 }, + w = { x = 0.3134, y = 0.3291 } +} + +local panel_resolutions = { + { width = 720, height = 1280 }, + { width = 600, height = 800 }, + { width = 544, height = 960 }, +} + +local panel_refresh_rates = {} +for hz = 31, 60 do + table.insert(panel_refresh_rates, hz) +end + +local panel_hdr = { + supported = false, + force_enabled = false, + eotf = gamescope.eotf.gamma22, + max_content_light_level = 500, + max_frame_average_luminance = 500, + min_content_light_level = 0.5 +} + + +gamescope.config.known_displays[panel_id] = { + pretty_name = panel_name, + dynamic_refresh_rates = panel_refresh_rates, + hdr = panel_hdr, + colorimetry = panel_colorimetry, + + dynamic_modegen = function(base_mode, refresh) + local mode = base_mode + 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 + set_res = res + break + end + end + + if not set_res then + debug("["..panel_id.."] Mode not found. Aborting.") + return mode + end + + 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 + debug("["..panel_id.."] Matched vendor: "..display.vendor.." model: "..display.model) + return 4000 + end + end + + return -1 + end +}