[feat, Kobo] On Kobo, drop fb to 8bpp on startup (#4637)
* The Great 8bpp Experiment Swap to 8bpp on Kobo, because we're 'effing grayscale, for pete's sake! * Always swap to 8bpp, no matter the launch method. Because it turned out that, even when restarting Nickel, we had to restore the expected bitdepth ourselves, because pickel/Nickel didn't do the job completely. (I'm going to guess the grayscale flag wasn't getting flipped properly). * Dither every non-transparent icon to the eInk palette * Make sure hasBGRFrameBuffer is only enabled when the Kobo fb actually is @ 32bpp... * Re-process badly grayscaled icons * And re-grayscale that one w/ gamma correction so the squares show up better. * Allow the fbdepth switch to be disabled (in Developer settings). Also, allow setting debug mode that way. Also, forcibly disable verbose logging when disabling debug. * Update setting name to piggyback on the existing check in reader.lua * Update icons postprocessing info
@@ -217,8 +217,52 @@ function FileManagerMenu:setUpdateItemTable()
|
||||
})
|
||||
end,
|
||||
},
|
||||
{
|
||||
text = _("Enable debug logging"),
|
||||
checked_func = function()
|
||||
return G_reader_settings:isTrue("debug")
|
||||
end,
|
||||
callback = function()
|
||||
G_reader_settings:flipNilOrFalse("debug")
|
||||
if G_reader_settings:isTrue("debug") then
|
||||
dbg:turnOn()
|
||||
else
|
||||
dbg:setVerbose(false)
|
||||
dbg:turnOff()
|
||||
G_reader_settings:flipTrue("debug_verbose")
|
||||
end
|
||||
end,
|
||||
},
|
||||
{
|
||||
text = _("Enable verbose debug logging"),
|
||||
enabled_func = function()
|
||||
return G_reader_settings:isTrue("debug")
|
||||
end,
|
||||
checked_func = function()
|
||||
return G_reader_settings:isTrue("debug_verbose")
|
||||
end,
|
||||
callback = function()
|
||||
G_reader_settings:flipNilOrFalse("debug_verbose")
|
||||
if G_reader_settings:isTrue("debug_verbose") then
|
||||
dbg:setVerbose(true)
|
||||
else
|
||||
dbg:setVerbose(false)
|
||||
end
|
||||
end,
|
||||
},
|
||||
}
|
||||
}
|
||||
if Device:isKobo() then
|
||||
table.insert(self.menu_items.developer_options.sub_item_table, {
|
||||
text = _("Disable forced 8-bit color space"),
|
||||
checked_func = function()
|
||||
return G_reader_settings:isTrue("dev_startup_no_fbdepth")
|
||||
end,
|
||||
callback = function()
|
||||
G_reader_settings:flipNilOrFalse("dev_startup_no_fbdepth")
|
||||
end,
|
||||
})
|
||||
end
|
||||
self.menu_items.cloud_storage = {
|
||||
text = _("Cloud storage"),
|
||||
callback = function()
|
||||
|
||||
@@ -23,7 +23,6 @@ local Kobo = Generic:new{
|
||||
model = "Kobo",
|
||||
isKobo = yes,
|
||||
isTouchDevice = yes, -- all of them are
|
||||
hasBGRFrameBuffer = yes, -- True when >16bpp (i.e., on current FW)
|
||||
hasOTAUpdates = yes,
|
||||
hasWifiManager = yes,
|
||||
|
||||
@@ -260,7 +259,9 @@ function Kobo:init()
|
||||
if self.screen.fb_bpp == 16 then
|
||||
logger.info("Enabling Kobo @ 16bpp tweaks")
|
||||
jit.opt.start("loopunroll=45")
|
||||
self.hasBGRFrameBuffer = no
|
||||
elseif self.screen.fb_bpp == 32 then
|
||||
-- Ensure we decode images properly, as our framebuffer is BGRA...
|
||||
self.hasBGRFrameBuffer = yes
|
||||
end
|
||||
self.powerd = require("device/kobo/powerd"):new{device = self}
|
||||
-- NOTE: For the Forma, with the buttons on the right, 193 is Top, 194 Bottom.
|
||||
|
||||
@@ -151,6 +151,41 @@ if [ "${PRODUCT}" = "frost" ]; then
|
||||
fi
|
||||
# NOTE: We don't have to restore anything on exit, nickel's startup process will take care of everything (pickel -> nickel).
|
||||
|
||||
# In the same vein, swap to 8bpp,
|
||||
# because 16bpp is the worst idea in the history of time, as RGB565 is generally a PITA without hardware blitting,
|
||||
# and 32bpp usually gains us nothing except a performance hit (we're not Qt5 with its QPainter constraints).
|
||||
# The reduced size & complexity should hopefully make things snappier,
|
||||
# (and hopefully prevent the JIT for going crazy on high-density screens...).
|
||||
# NOTE: Even though pickel/Nickel appear to restore their preferred fb setup, we'll have to do it ourselves,
|
||||
# because things are a bit wonky otherwise. Plus, we get to play nice with every launch method that way.
|
||||
# So, remember the current bitdepth, so we can restore it on exit.
|
||||
ORIG_FB_BPP="$(./fbdepth -g)"
|
||||
# Sanity check...
|
||||
case "${ORIG_FB_BPP}" in
|
||||
16) ;;
|
||||
32) ;;
|
||||
*)
|
||||
# Hu oh? Don't do anything...
|
||||
unset ORIG_FB_BPP
|
||||
;;
|
||||
esac
|
||||
|
||||
# The actual swap is done in a function, because we can disable it in the Developer settings, and we want to honor it on restart.
|
||||
ko_do_fbdepth() {
|
||||
# Check if the swap has been disabled...
|
||||
if grep -q '\["dev_startup_no_fbdepth"\] = true' 'settings.reader.lua' 2>/dev/null; then
|
||||
# Swap back to the original bitdepth (in case this was a restart)
|
||||
if [ -n "${ORIG_FB_BPP}" ]; then
|
||||
./fbdepth -d "${ORIG_FB_BPP}" >>crash.log 2>&1
|
||||
fi
|
||||
else
|
||||
# Swap to 8bpp if things looke sane
|
||||
if [ -n "${ORIG_FB_BPP}" ]; then
|
||||
./fbdepth -d 8 >>crash.log 2>&1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# Remount the SD card RW if it's inserted and currently RO
|
||||
if awk '$4~/(^|,)ro($|,)/' /proc/mounts | grep ' /mnt/sd '; then
|
||||
mount -o remount,rw /mnt/sd
|
||||
@@ -166,11 +201,18 @@ RETURN_VALUE=85
|
||||
while [ $RETURN_VALUE -eq 85 ]; do
|
||||
# Do an update check now, so we can actually update KOReader via the "Restart KOReader" menu entry ;).
|
||||
ko_update_check
|
||||
# Do the fb depth switch, unless it's been disabled
|
||||
ko_do_fbdepth
|
||||
|
||||
./reader.lua "${args}" >>crash.log 2>&1
|
||||
RETURN_VALUE=$?
|
||||
done
|
||||
|
||||
# Restore original fb bitdepth if need be...
|
||||
if [ -n "${ORIG_FB_BPP}" ]; then
|
||||
./fbdepth -d "${ORIG_FB_BPP}" >>crash.log 2>&1
|
||||
fi
|
||||
|
||||
# Restore original CPUFreq governor if need be...
|
||||
if [ -n "${ORIG_CPUFREQ_GOV}" ]; then
|
||||
echo "${ORIG_CPUFREQ_GOV}" >"/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor"
|
||||
|
||||
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 32 KiB |
|
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 33 KiB |
@@ -62,7 +62,8 @@ end
|
||||
-- should check DEBUG option in arg and turn on DEBUG before loading other
|
||||
-- modules, otherwise DEBUG in some modules may not be printed.
|
||||
local dbg = require("dbg")
|
||||
if G_reader_settings:readSetting("debug") then dbg:turnOn() end
|
||||
if G_reader_settings:isTrue("debug") then dbg:turnOn() end
|
||||
if G_reader_settings:isTrue("debug") and G_reader_settings:isTrue("debug_verbose") then dbg:setVerbose(true) end
|
||||
|
||||
local Profiler = nil
|
||||
local ARGV = arg
|
||||
|
||||
|
Before Width: | Height: | Size: 599 B After Width: | Height: | Size: 1.4 KiB |
@@ -1,5 +1,11 @@
|
||||
menu-icon.png is post-processed with:
|
||||
|
||||
```bash
|
||||
convert menu-icon.png -set colorspace Gray -separate -average menu-icon-grayscale.png
|
||||
convert menu-icon.png -grayscale Rec709Luma -dither Riemersma -remap eink_cmap.gif -quality 75 png:menu-icon-grayscale.png
|
||||
```
|
||||
|
||||
The intent being to grayscale, dither down to the 16c eInk palette, and save as a 16c paletted grayscale PNG.
|
||||
Start from an RGB copy of the image if you end up with a 256c or sRGB PNG (check via IM's identify tool).
|
||||
|
||||
See https://www.mobileread.com/forums/showpost.php?p=3728291&postcount=17 for more details ;).
|
||||
|
||||
|
||||
|
Before Width: | Height: | Size: 166 B After Width: | Height: | Size: 518 B |
|
Before Width: | Height: | Size: 178 B After Width: | Height: | Size: 521 B |
|
Before Width: | Height: | Size: 159 B After Width: | Height: | Size: 528 B |
|
Before Width: | Height: | Size: 181 B After Width: | Height: | Size: 582 B |
|
Before Width: | Height: | Size: 183 B After Width: | Height: | Size: 412 B |
|
Before Width: | Height: | Size: 294 B After Width: | Height: | Size: 471 B |
|
Before Width: | Height: | Size: 429 B After Width: | Height: | Size: 455 B |
|
Before Width: | Height: | Size: 259 B After Width: | Height: | Size: 356 B |
|
Before Width: | Height: | Size: 207 B After Width: | Height: | Size: 353 B |
|
Before Width: | Height: | Size: 461 B After Width: | Height: | Size: 642 B |
|
Before Width: | Height: | Size: 448 B After Width: | Height: | Size: 614 B |
|
Before Width: | Height: | Size: 440 B After Width: | Height: | Size: 625 B |
|
Before Width: | Height: | Size: 390 B After Width: | Height: | Size: 538 B |
|
Before Width: | Height: | Size: 387 B After Width: | Height: | Size: 537 B |
|
Before Width: | Height: | Size: 389 B After Width: | Height: | Size: 536 B |
|
Before Width: | Height: | Size: 295 B After Width: | Height: | Size: 509 B |
|
Before Width: | Height: | Size: 159 B After Width: | Height: | Size: 525 B |
|
Before Width: | Height: | Size: 164 B After Width: | Height: | Size: 555 B |
|
Before Width: | Height: | Size: 178 B After Width: | Height: | Size: 369 B |
|
Before Width: | Height: | Size: 161 B After Width: | Height: | Size: 542 B |
|
Before Width: | Height: | Size: 201 B After Width: | Height: | Size: 407 B |
|
Before Width: | Height: | Size: 184 B After Width: | Height: | Size: 391 B |
|
Before Width: | Height: | Size: 501 B After Width: | Height: | Size: 643 B |
|
Before Width: | Height: | Size: 356 B After Width: | Height: | Size: 583 B |
|
Before Width: | Height: | Size: 458 B After Width: | Height: | Size: 606 B |
|
Before Width: | Height: | Size: 593 B After Width: | Height: | Size: 690 B |
|
Before Width: | Height: | Size: 884 B After Width: | Height: | Size: 847 B |
|
Before Width: | Height: | Size: 365 B After Width: | Height: | Size: 549 B |
|
Before Width: | Height: | Size: 702 B After Width: | Height: | Size: 856 B |
|
Before Width: | Height: | Size: 199 B After Width: | Height: | Size: 379 B |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 942 B After Width: | Height: | Size: 891 B |
|
Before Width: | Height: | Size: 777 B After Width: | Height: | Size: 849 B |
|
Before Width: | Height: | Size: 144 B After Width: | Height: | Size: 343 B |
|
Before Width: | Height: | Size: 763 B After Width: | Height: | Size: 806 B |
|
Before Width: | Height: | Size: 1014 B After Width: | Height: | Size: 891 B |
|
Before Width: | Height: | Size: 475 B After Width: | Height: | Size: 744 B |
|
Before Width: | Height: | Size: 484 B After Width: | Height: | Size: 604 B |
|
Before Width: | Height: | Size: 192 B After Width: | Height: | Size: 366 B |
BIN
resources/icons/eink_cmap.gif
Normal file
|
After Width: | Height: | Size: 377 B |
|
Before Width: | Height: | Size: 737 B After Width: | Height: | Size: 802 B |
|
Before Width: | Height: | Size: 928 B After Width: | Height: | Size: 683 B |
|
Before Width: | Height: | Size: 761 B After Width: | Height: | Size: 610 B |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 858 B After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 950 B After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 626 B After Width: | Height: | Size: 735 B |
|
Before Width: | Height: | Size: 844 B After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 2.3 KiB |