Lua-based operating system, based on LuPI2, with a focus on PowerPC based Macintosh machines
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

48 lines
973 B

local gpudetect = {}
local function tryText()
lprint("Trying text-mode gpu")
loadModule("textgpu")
local textgpuAddr, tgfail = modules.textgpu.start()
if not textgpuAddr then
lprint("Couldn't initialize text gpu: " .. tostring(tgfail))
return false
end
return true
end
local function tryFb()
lprint("Trying framebuffer-mode gpu")
if framebuffer.isReady() then
loadModule("fbgpu")
modules.fbgpu.start()
return true
end
return false
end
local function tryWindows()
loadModule("winapigpu")
return modules.winapigpu.start() and true or false
end
function gpudetect.run()
local s = false
if hasOpt("-t", "--text") then
s = tryText()
return
end
if hasOpt("-f", "--fb") or native.isinit() then
s = tryFb()
end
if not s then
lprint("Falling back to text gpu")
s = tryText()
end
if not s and winapigpu then
lprint("Falling back to windows gpu")
s = tryWindows()
end
end
return gpudetect