feat(reMarkable): Oxide/libblight support (#15611)

Companion PR to koreader/koreader-base#2417.
This commit is contained in:
Noa Himesaka authored and GitHub committed 2026-07-09 09:27:16 +02:00
1 parent c49ab9f8f1
commit cf9c59a4a8
4 files changed
+28 -11

No files matched your search

+2
View File
@@ -234,6 +234,8 @@ function Input:init()
self.input = require("ffi/input_pocketbook")
elseif self.device:isRemarkable() and os.getenv("KO_USE_QTFB") == "1" then
self.input = require("ffi/input_qtfb")
elseif self.device:isRemarkable() and os.getenv("KO_USE_BLIGHT") == "1" then
self.input = require("ffi/input_blight")
else
self.input = require("libs/libkoreader-input")
end
+15 -7
View File
@@ -34,6 +34,7 @@ local is_rmppure = rm_model == "reMarkable Tatsu"
local has_csl = util.which("csl")
local is_qtfb_shimmed = (os.getenv("LD_PRELOAD") or ""):find("qtfb%-shim") ~= nil
local is_qtfb_native = os.getenv("KO_USE_QTFB") ~= nil
local is_blight_native = os.getenv("KO_USE_BLIGHT") ~= nil
if is_rmpp then
screen_width = 1620 -- unscaled_size_check: ignore
@@ -232,7 +233,14 @@ function Remarkable:init()
-- os.execute("ps | grep $PPID")
-- logger.info(string.format("parent process is oxide?: %s", parent_process_is_oxide))
local fb_module = os.getenv("KO_USE_QTFB") and "ffi/framebuffer_qtfb" or "ffi/framebuffer_mxcfb"
local fb_module
if is_qtfb_native then
fb_module = "ffi/framebuffer_qtfb"
elseif is_blight_native then
fb_module = "ffi/framebuffer_blight"
else
fb_module = "ffi/framebuffer_mxcfb"
end
self.screen = require(fb_module):new{
device = self,
debug = logger.dbg,
@@ -247,7 +255,7 @@ function Remarkable:init()
local event_map = dofile("frontend/device/remarkable/event_map.lua")
-- If we are launched while Oxide or xochitl is running, remove Power from the event map
if oxide_running or is_qtfb_shimmed or is_qtfb_native then
if oxide_running or is_qtfb_shimmed or is_qtfb_native or is_blight_native then
event_map[116] = nil
event_map[143] = nil
event_map[20001] = nil
@@ -343,7 +351,7 @@ function Remarkable:init()
self.screen.native_rotation_mode = rotation_mode
self.screen.cur_rotation_mode = rotation_mode
if oxide_running or is_qtfb_shimmed or is_qtfb_native then
if oxide_running or is_qtfb_shimmed or is_qtfb_native or is_blight_native then
-- Disable autosuspend on this device
PluginShare.pause_auto_suspend = true
end
@@ -487,13 +495,13 @@ function Remarkable:setEventHandlers(UIManager)
end
if is_rm2 then
if is_qtfb_native then return Remarkable2 end
if is_qtfb_native or is_blight_native then return Remarkable2 end
if not os.getenv("RM2FB_SHIM") and not is_qtfb_shimmed then
error("reMarkable 2 requires a RM2FB server and client to work (https://github.com/ddvk/remarkable2-framebuffer or https://github.com/asivery/rmpp-qtfb-shim)")
end
return Remarkable2
elseif is_rmpp then
if is_qtfb_native then return RemarkablePaperPro end
if is_qtfb_native or is_blight_native then return RemarkablePaperPro end
if not is_qtfb_shimmed then
error("reMarkable Paper Pro requires a RM2FB server and client to work (https://github.com/asivery/rm-appload)")
end
@@ -502,7 +510,7 @@ elseif is_rmpp then
end
return RemarkablePaperPro
elseif is_rmppm then
if is_qtfb_native then return RemarkablePaperProMove end
if is_qtfb_native or is_blight_native then return RemarkablePaperProMove end
if not is_qtfb_shimmed then
error("reMarkable Paper Pro Move requires a RM2FB server and client to work (https://github.com/asivery/rm-appload)")
end
@@ -511,7 +519,7 @@ elseif is_rmppm then
end
return RemarkablePaperProMove
elseif is_rmppure then
if is_qtfb_native then return RemarkablePaperPure end
if is_qtfb_native or is_blight_native then return RemarkablePaperPure end
if not is_qtfb_shimmed then
error("reMarkable Paper Pure requires a RM2FB server and client to work (https://github.com/asivery/rm-appload)")
end
+8 -4
View File
@@ -20,10 +20,11 @@ fi
# we're always starting from our working directory
cd "${KOREADER_DIR}" || exit
# reMarkable QTFB setup
if [ -n "${KO_USE_QTFB}" ]; then
# reMarkable QTFB/Blight setup
if [ -n "${KO_USE_QTFB}" ] || [ -n "${KO_USE_BLIGHT}" ]; then
export KO_DONT_GRAB_INPUT=1
export KO_DONT_SET_DEPTH=1
export LD_LIBRARY_PATH="${KOREADER_DIR}/libs:/home/root/.vellum/lib:${LD_LIBRARY_PATH}"
fi
fbink_wrapped() {
@@ -34,6 +35,9 @@ fbink_wrapped() {
QTFB_SHIM_MODE="N_RGB565" \
QTFB_SHIM_RESPECT_FULL_REFRESH_REQUESTS="1" \
./fbink "$@"
elif [ -n "${KO_USE_BLIGHT}" ]; then
# fbink can't do deferred rendering via blight-client (each invocation creates a separate surface)
true
else
./fbink "$@"
fi
@@ -110,7 +114,7 @@ export STARDICT_DATA_DIR="data/dict"
ORIG_FB_BPP=""
ORIG_FB_ROTA=""
if [ -z "${KO_DONT_SET_DEPTH}" ] && [ -z "${KO_USE_QTFB}" ]; then
if [ -z "${KO_DONT_SET_DEPTH}" ] && [ -z "${KO_USE_QTFB}" ] && [ -z "${KO_USE_BLIGHT}" ]; then
# We'll want to ensure Portrait rotation to allow us to use faster blitting codepaths @ 8bpp,
# so remember the current one before fbdepth does its thing.
ORIG_FB_ROTA="$(./fbdepth -o)"
@@ -275,7 +279,7 @@ done
# Restore original fb bitdepth if need be...
# Since we also (almost) always enforce Portrait, we also have to restore the original rotation no matter what ;).
if [ -z "${KO_DONT_SET_DEPTH}" ] && [ -z "${KO_USE_QTFB}" ]; then
if [ -z "${KO_DONT_SET_DEPTH}" ] && [ -z "${KO_USE_QTFB}" ] && [ -z "${KO_USE_BLIGHT}" ]; then
if [ -n "${ORIG_FB_BPP}" ]; then
echo "Restoring original fb bitdepth @ ${ORIG_FB_BPP}bpp & rotation @ ${ORIG_FB_ROTA}" >>crash.log 2>&1
./fbdepth -d "${ORIG_FB_BPP}" -r "${ORIG_FB_ROTA}" >>crash.log 2>&1
+3
View File
@@ -20,6 +20,9 @@ fbink_wrapped() {
QTFB_SHIM_MODE="N_RGB565" \
QTFB_SHIM_RESPECT_FULL_REFRESH_REQUESTS="1" \
./fbink "$@"
elif [ -n "${KO_USE_BLIGHT}" ]; then
# fbink can't do deferred rendering via blight-client (each invocation creates a separate surface)
true
else
./fbink "$@"
fi