Fix SSD2092 wake, fuel-gauge jump, XLibre rotation, media keys, and popup rendering

This commit is contained in:
Luxferre committed 2026-11-24 11:05:18 +02:00
1 parent 7f3b3c2c0c
commit dbc0275979
43 files changed
+3388 -115

No files matched your search

+113 -9
View File
@@ -163,23 +163,23 @@ int main(void) {
geminux_profile_params_t eco = geminux_policy_params(POWER_PROFILE_ECO, false);
assert(strcmp(eco.governor, "schedutil") == 0);
assert(!eco.a72_online);
assert(eco.a53_ll_max_khz == 624000UL);
assert(eco.a53_max_khz == 832000UL);
assert(eco.a53_ll_max_khz == 715000UL);
assert(eco.a53_max_khz == 962000UL);
assert(eco.suspend_timeout_s > 0);
geminux_profile_params_t bal = geminux_policy_params(POWER_PROFILE_BALANCED, false);
assert(strcmp(bal.governor, "schedutil") == 0);
assert(bal.a72_online);
assert(bal.a53_ll_max_khz == 806000UL);
assert(bal.a53_max_khz == 1092000UL);
assert(bal.a53_ll_max_khz == 897000UL);
assert(bal.a53_max_khz == 1209000UL);
geminux_profile_params_t bal_ac = geminux_policy_params(POWER_PROFILE_BALANCED, true);
assert(strcmp(bal_ac.governor, "schedutil") == 0);
assert(bal_ac.a53_ll_max_khz == 897000UL);
assert(bal_ac.a53_max_khz == 1209000UL);
assert(bal_ac.a53_ll_max_khz == 1547000UL);
assert(bal_ac.a53_max_khz == 1846000UL);
geminux_profile_params_t perf = geminux_policy_params(POWER_PROFILE_PERFORMANCE, true);
assert(strcmp(perf.governor, "schedutil") == 0);
assert(strcmp(perf.governor, "performance") == 0);
assert(perf.a72_online);
assert(perf.a53_ll_max_khz == 1547000UL);
assert(perf.a53_max_khz == 1846000UL);
@@ -521,6 +521,92 @@ int main(void) {
int rc_cnt = geminux_parse_resolv_conf("# Generated\nnameserver 88.198.92.222\nnameserver 192.71.166.92 # rad\n",
rsum, sizeof(rsum));
assert(rc_cnt == 2 && strcmp(rsum, "88.198.92.222, 192.71.166.92") == 0);
/* MT6351 fuel-gauge persisted state serialization & bounds validation */
char fg_buf[128];
uint32_t fg_r = 0, fg_full = 0;
assert(geminux_fg_state_format(245000U, 3812000U, fg_buf, sizeof(fg_buf)) == 0);
assert(strcmp(fg_buf, "learned_resistance_uohm=245000\nlearned_full_uah=3812000\n") == 0);
assert(geminux_fg_state_parse(fg_buf, &fg_r, &fg_full));
assert(fg_r == 245000U && fg_full == 3812000U);
assert(geminux_fg_state_parse("learned_full_uah=3500000\n learned_resistance_uohm=180000 \r\n", &fg_r, &fg_full));
assert(fg_r == 180000U && fg_full == 3500000U);
assert(!geminux_fg_state_parse("learned_resistance_uohm=49999\nlearned_full_uah=3500000\n", &fg_r, &fg_full));
assert(!geminux_fg_state_parse("learned_resistance_uohm=1500001\nlearned_full_uah=3500000\n", &fg_r, &fg_full));
assert(!geminux_fg_state_parse("learned_resistance_uohm=200000\nlearned_full_uah=999999\n", &fg_r, &fg_full));
assert(!geminux_fg_state_parse("learned_resistance_uohm=200000\n", &fg_r, &fg_full));
assert(geminux_fg_state_format(10000U, 3800000U, fg_buf, sizeof(fg_buf)) < 0);
/* Verify 16x16 tiled 32bpp 90/180/270 rotation math on asymmetric geometry + sub-rects */
{
enum { SRC_W = 120, SRC_H = 110, CRTC_X = 7, CRTC_Y = 11, W = 53, H = 97 };
static uint32_t src_fb[SRC_H * SRC_W];
static uint32_t dst_fast[H * W];
static uint32_t dst_ref[H * W];
for (int y = 0; y < SRC_H; y++) {
for (int x = 0; x < SRC_W; x++) {
src_fb[y * SRC_W + x] = ((uint32_t)(y + 1) << 16) | (uint32_t)(x + 1);
}
}
const int rots[3] = { 90, 180, 270 };
const int bx1[3] = { 0, 13, 32 };
const int by1[3] = { 0, 15, 48 };
const int bx2[3] = { W, 51, 53 };
const int by2[3] = { H, 81, 97 };
for (int ri = 0; ri < 3; ri++) {
int deg = rots[ri];
memset(dst_fast, 0xaa, sizeof(dst_fast));
memset(dst_ref, 0xaa, sizeof(dst_ref));
for (int bi = 0; bi < 3; bi++) {
int x1 = bx1[bi], y1 = by1[bi], x2 = bx2[bi], y2 = by2[bi];
for (int dy = y1; dy < y2; dy++) {
for (int dx = x1; dx < x2; dx++) {
int sx = CRTC_X + ((deg == 270) ? dy : (deg == 90) ? (H - 1 - dy) : (W - 1 - dx));
int sy = CRTC_Y + ((deg == 270) ? (W - 1 - dx) : (deg == 90) ? dx : (H - 1 - dy));
dst_ref[dy * W + dx] = src_fb[sy * SRC_W + sx];
}
}
if (deg == 270) {
for (int ty = y1; ty < y2; ty += 16) {
int bh = (y2 - ty < 16) ? (y2 - ty) : 16;
for (int tx = x1; tx < x2; tx += 16) {
int bw = (x2 - tx < 16) ? (x2 - tx) : 16;
uint32_t tile[16][16];
for (int bx = 0; bx < bw; bx++) {
const uint32_t *srow = src_fb + (size_t)(CRTC_Y + W - 1 - (tx + bx)) * SRC_W + (size_t)(CRTC_X + ty);
for (int by = 0; by < bh; by++) tile[by][bx] = srow[by];
}
for (int by = 0; by < bh; by++) {
memcpy(dst_fast + (size_t)(ty + by) * W + tx, tile[by], (size_t)bw * sizeof(uint32_t));
}
}
}
} else if (deg == 90) {
for (int ty = y1; ty < y2; ty += 16) {
int bh = (y2 - ty < 16) ? (y2 - ty) : 16;
for (int tx = x1; tx < x2; tx += 16) {
int bw = (x2 - tx < 16) ? (x2 - tx) : 16;
uint32_t tile[16][16];
for (int bx = 0; bx < bw; bx++) {
const uint32_t *srow = src_fb + (size_t)(CRTC_Y + tx + bx) * SRC_W + (size_t)(CRTC_X + H - ty - bh);
for (int k = 0; k < bh; k++) tile[bh - 1 - k][bx] = srow[k];
}
for (int by = 0; by < bh; by++) {
memcpy(dst_fast + (size_t)(ty + by) * W + tx, tile[by], (size_t)bw * sizeof(uint32_t));
}
}
}
} else {
for (int dy = y1; dy < y2; dy++) {
const uint32_t *srow = src_fb + (size_t)(CRTC_Y + H - 1 - dy) * SRC_W + (size_t)(CRTC_X + W - 1);
uint32_t *drow = dst_fast + (size_t)dy * W;
for (int dx = x1; dx < x2; dx++) drow[dx] = srow[-dx];
}
}
}
assert(memcmp(dst_fast, dst_ref, sizeof(dst_ref)) == 0);
}
}
return 0;
}
"""
@@ -577,10 +663,16 @@ def main():
'GEMINUX_ENABLE_CPUFREQ="yes"',
'GEMINUX_ENABLE_SENSORS="no"',
'GEMINUX_GATE_UNUSED_CLOCKS="yes"',
'GEMINUX_ENABLE_SPM_SLEEP="yes"',
),
os.path.join(overlay_dir, "etc", "modprobe.d", "geminux.conf"): (
"blacklist stk3310",
"softdep cpufreq_dt pre: clk_mt6797_mcusys",
"options mt6797_spm_sleep sodi_idle=0 pmic_modes=1 timer_sec=600",
"options mt6797_wlan power_save=0",
),
os.path.join(BASE_DIR, "patches", "kernel", "series"): (
"0009-mt6797-wlan-drop-free-stability.patch",
),
os.path.join(overlay_dir, "etc", "profile.d", "10-geminux-env.sh"): (
"export NO_AT_BRIDGE=1",
@@ -606,13 +698,25 @@ def main():
assert trig_idx >= 0, "trigger_suspend missing in geminux-powerd.c"
trig_src = powerd_src[trig_idx:]
prep_idx = trig_src.find("prepare_consys_for_suspend(")
cpu_prep_idx = trig_src.find("prepare_cpus_for_suspend(")
susp_idx = trig_src.find('"/sys/power/state"')
cpu_rest_idx = trig_src.find("restore_cpus_after_resume(")
rest_idx = trig_src.find("restore_consys_after_resume(")
if prep_idx < 0 or susp_idx < 0 or rest_idx < 0 or not (prep_idx < susp_idx < rest_idx):
raise AssertionError("trigger_suspend must unload CONSYS before /sys/power/state and restore it after")
if min(prep_idx, cpu_prep_idx, susp_idx, cpu_rest_idx, rest_idx) < 0 or not (
prep_idx < cpu_prep_idx < susp_idx < cpu_rest_idx < rest_idx):
raise AssertionError("trigger_suspend must quiesce CONSYS and CPUs before /sys/power/state and restore after")
if '"mt6797_consys"' not in powerd_src or '"mt6797-consys"' not in powerd_src:
raise AssertionError("geminux-powerd.c must unload mt6797_consys and reload mt6797-consys")
with open(os.path.join(APPS_DIR, "geminux-control.c"), "r", encoding="utf-8") as handle:
ctrl_src = handle.read()
if "st->bl_path" not in ctrl_src or "flush_vol_helper(" not in ctrl_src:
raise AssertionError("geminux-control.c must write backlight directly via bl_path and throttle wpctl")
with open(os.path.join(BASE_DIR, "src", "libgemui", "gemui.c"), "r", encoding="utf-8") as handle:
gemui_src = handle.read()
if "XPeekEvent(" not in gemui_src:
raise AssertionError("gemui.c must coalesce consecutive MotionNotify events with XPeekEvent")
print("[PASS] Zero-poll daemon loops, power/lid policy, and touch gestures verified")
return 0