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 9892ea6 commit fc4f274
Show file tree
Hide file tree
Showing 3 changed files with 253 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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
}
Original file line number Diff line number Diff line change
@@ -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
}
Original file line number Diff line number Diff line change
@@ -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
}

0 comments on commit fc4f274

Please sign in to comment.