mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
Clean up C blitbuffer kludges. (#6696)
CBB now handles nightmode correctly (by deferring to Lua), so we no longer need to do monkey dances about disabling it when hw invert is missing. canUseCBB cap is resolved by generic device re-configuring blitbuffer on the go, so as to avoid repeating the same thing in every device driver. The dev setting can now flip cbb on the go, so one can gloat at the near meaningless perf difference - 2Mp draw is 15ms Lua / 10ms C on 1GHz Cortex A7.
This commit is contained in:
21
reader.lua
21
reader.lua
@@ -37,23 +37,12 @@ if lang_locale then
|
||||
_.changeLang(lang_locale)
|
||||
end
|
||||
|
||||
-- Make the C blitter optional (ffi/blitbuffer.lua will check that env var)
|
||||
local ffi = require("ffi")
|
||||
local dummy = require("ffi/posix_h")
|
||||
local C = ffi.C
|
||||
if G_reader_settings:isTrue("dev_no_c_blitter") then
|
||||
if ffi.os == "Windows" then
|
||||
C._putenv("KO_NO_CBB=true")
|
||||
else
|
||||
C.setenv("KO_NO_CBB", "true", 1)
|
||||
end
|
||||
else
|
||||
if ffi.os == "Windows" then
|
||||
C._putenv("KO_NO_CBB=false")
|
||||
else
|
||||
C.unsetenv("KO_NO_CBB")
|
||||
end
|
||||
end
|
||||
|
||||
-- Try to turn the C blitter on/off, and synchronize setting so that UI config reflects real state
|
||||
local bb = require("ffi/blitbuffer")
|
||||
local is_cbb_enabled = bb:enableCBB(G_reader_settings:nilOrFalse("dev_no_c_blitter"))
|
||||
G_reader_settings:saveSetting("dev_no_c_blitter", not is_cbb_enabled)
|
||||
|
||||
-- Should check DEBUG option in arg and turn on DEBUG before loading other
|
||||
-- modules, otherwise DEBUG in some modules may not be printed.
|
||||
|
||||
Reference in New Issue
Block a user