Skip to content

Commit

Permalink
Display scripts for testing
Browse files Browse the repository at this point in the history
  • Loading branch information
uejji committed Dec 8, 2024
1 parent e7cd7f4 commit cb5c223
Show file tree
Hide file tree
Showing 3 changed files with 205 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
-- 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_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


gamescope.config.known_displays[panel_id] = {
pretty_name = panel_name,
colorimetry = (panel_colorimetry ~= nil) and panel_colorimetry,
dynamic_refresh_rates = (panel_refresh_rates ~= nil) and panel_refresh_rates,
hdr = (panel_hdr ~= nil) and panel_hdr,

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
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
-- 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_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


gamescope.config.known_displays[panel_id] = {
pretty_name = panel_name,
colorimetry = (panel_colorimetry ~= nil) and panel_colorimetry,
dynamic_refresh_rates = (panel_refresh_rates ~= nil) and panel_refresh_rates,
hdr = (panel_hdr ~= nil) and panel_hdr,

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
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
-- Anbernic Win600

local panel_id = "anbernic_win600_lcd"
local panel_name = "Anbernic Win600 LCD Panel"

local panel_models = {
{ vendor = "RTK", model = "7911D" },
}

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


gamescope.config.known_displays[panel_id] = {
pretty_name = panel_name,
colorimetry = (panel_colorimetry ~= nil) and panel_colorimetry,
dynamic_refresh_rates = (panel_refresh_rates ~= nil) and panel_refresh_rates,
hdr = (panel_hdr ~= nil) and panel_hdr,

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
}

0 comments on commit cb5c223

Please sign in to comment.