mirror of
https://github.com/siemens-mobile-hacks/elfloader3-linux.git
synced 2026-11-25 23:57:20 +00:00
limit redraw freq, fix mopi timers
This commit is contained in:
parent
258e365ec7
commit
6b8be8a498
9 changed files with 40 additions and 28 deletions
|
|
@ -96,7 +96,7 @@ add_executable(elfloader3
|
|||
)
|
||||
|
||||
target_compile_options(elfloader3 PUBLIC -Wall -Werror -Wno-unused-function -Wsign-compare -Wno-psabi -g)
|
||||
target_compile_definitions(elfloader3 PUBLIC -DNEWSGOLD=1 -DELKA=1)
|
||||
target_compile_definitions(elfloader3 PUBLIC -DNEWSGOLD=1 -DELKA=1 -DSWILIB_LINUX_SIMULATOR=1)
|
||||
target_link_options(elfloader3 PUBLIC -Wl,--dynamic-linker=/usr/arm-linux-gnueabihf/lib/ld-linux-armhf.so.3 -Wl,-rpath=/usr/arm-linux-gnueabihf/lib/)
|
||||
target_link_libraries(elfloader3 PUBLIC ssl crypto png z argparse spdlog)
|
||||
|
||||
|
|
|
|||
|
|
@ -43,7 +43,6 @@ void AppWindow::parseRxBuffer() {
|
|||
void AppWindow::handleIpcCommand(IpcPacket *pkt) {
|
||||
switch (pkt->cmd) {
|
||||
case IPC_CMD_REDRAW:
|
||||
qDebug("renderNow");
|
||||
renderNow();
|
||||
break;
|
||||
|
||||
|
|
|
|||
|
|
@ -318,11 +318,11 @@ void MOPIProcessGroup::run() {
|
|||
MOPI_FreeMessage(&msg);
|
||||
} else if ((MOPI_GetMessageFlags(&msg) & MOPI_MSG_FLAG_GTIMER)) {
|
||||
switch (MOPI_GetMessageType(&msg)) {
|
||||
case MOPI_MSG_TYPE_GTIMER_CALLBACK:
|
||||
case MOPI_MSG_TYPE_GTIMER_MSG:
|
||||
proc->handler();
|
||||
break;
|
||||
|
||||
case MOPI_MSG_TYPE_GTIMER_MSG:
|
||||
case MOPI_MSG_TYPE_GTIMER_CALLBACK:
|
||||
{
|
||||
auto *gtimer_msg = MOPI_GetPayload<MOPI_GTIMER_MSG>(&msg);
|
||||
gtimer_msg->callback(gtimer_msg->tmr);
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
#include "src/swi/ll.h"
|
||||
#include "src/swi/gui.h"
|
||||
#include "src/swi/csm.h"
|
||||
#include "swilib/gbs.h"
|
||||
|
||||
#include <cstdint>
|
||||
#include <cstdio>
|
||||
|
|
@ -10,16 +11,19 @@
|
|||
#include <cassert>
|
||||
#include <cstring>
|
||||
#include <queue>
|
||||
#include <spdlog/common.h>
|
||||
#include <unordered_map>
|
||||
#include <spdlog/spdlog.h>
|
||||
#include <swilib/gui.h>
|
||||
#include <swilib/system.h>
|
||||
|
||||
static std::queue<int> gui_to_redraw;
|
||||
static std::queue<GUI_RAM *> gui_to_destroy;
|
||||
static std::unordered_map<int, GUI_RAM *> id2gui = {};
|
||||
static std::unordered_map<int, CSM_RAM *> id2csm = {};
|
||||
static std::unordered_map<int, size_t> id2gui_index = {};
|
||||
static std::vector<GUI_RAM *> sorted_gui_list = {};
|
||||
std::atomic<bool> redraw_requested = false;
|
||||
static Painter *painter = nullptr;
|
||||
|
||||
static int global_gui_id = 1;
|
||||
|
|
@ -165,6 +169,8 @@ void GUI_HandleKeyPress(GBS_MSG *msg) {
|
|||
GBS_RunInContext(MMI_CEPID, [id]() {
|
||||
GeneralFunc_flag1(id, 1);
|
||||
});
|
||||
} else {
|
||||
spdlog::debug("[GUI:{}] onKey ret={}", gui_ram->id, ret);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -307,6 +313,7 @@ void GeneralFunc_flag0(int id, int cmd) {
|
|||
}
|
||||
|
||||
void DirectRedrawGUI(void) {
|
||||
redraw_requested = false;
|
||||
DirectRedrawGUI_ID(GUI_GetTopID());
|
||||
}
|
||||
|
||||
|
|
@ -322,7 +329,8 @@ void DirectRedrawGUI_ID(int id) {
|
|||
if (prev_gui_ram)
|
||||
DirectRedrawGUI_ID(prev_gui_ram->id);
|
||||
|
||||
spdlog::debug("[GUI:{}] onRedraw", gui_ram->id);
|
||||
if (spdlog::get_level() <= spdlog::level::debug)
|
||||
spdlog::debug("[GUI:{}] onRedraw", gui_ram->id);
|
||||
|
||||
auto *layer = LCD_GetCurrentLayer();
|
||||
layer->rect = *gui_ram->gui->canvas;
|
||||
|
|
@ -335,9 +343,10 @@ void DirectRedrawGUI_ID(int id) {
|
|||
}
|
||||
|
||||
void PendedRedrawGUI(void) {
|
||||
GBS_RunInContext(MMI_CEPID, []() {
|
||||
DirectRedrawGUI_ID(GUI_GetTopID());
|
||||
});
|
||||
if (!redraw_requested) {
|
||||
redraw_requested = true;
|
||||
GBS_SendMessage(MMI_CEPID, MMI_CMD_REDRAW);
|
||||
}
|
||||
}
|
||||
|
||||
GUI *GetTopGUI(void) {
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
#define LCD_DISPLAYQUEUE_CEPID 0x4200
|
||||
#define LCD_DISPLAYQUEUE_CMD_REDRAW 0x6423
|
||||
#define MMI_CMD_REDRAW 0x6404
|
||||
|
||||
enum {
|
||||
DRWOBJ_RECT_FLAG_INVERT_BG = 0x20,
|
||||
|
|
@ -136,6 +137,7 @@ GUI_RAM *GUI_GetPrev(int id);
|
|||
GUI_RAM *GUI_GetNext(int id);
|
||||
void GUI_Close(int id);
|
||||
void GUI_HandleKeyPress(GBS_MSG *msg);
|
||||
void GUI_HandlePendedRedraws();
|
||||
uint32_t GUI_Color2Int(const char *color);
|
||||
Painter *GUI_GetPainter();
|
||||
|
||||
|
|
|
|||
|
|
@ -263,7 +263,6 @@ static int _ellipseHelperFlagsToPainter(int type) {
|
|||
|
||||
void DrawObject(DRWOBJ *drwobj) {
|
||||
LCDLAYER *layer = LCD_GetCurrentLayer();
|
||||
spdlog::debug("DrawObject layer={:08X}", (uint32_t) layer);
|
||||
if (layer)
|
||||
DrawObject2Layer(layer, drwobj);
|
||||
}
|
||||
|
|
@ -282,7 +281,7 @@ int PushDRWOBJOnLAYER(DRWOBJ *drwobj, LCDLAYER *layer) {
|
|||
// TODO: merge DRWOBJ rect + LCDLAYER rect?
|
||||
|
||||
RECT *rect = &drw->rect;
|
||||
spdlog::debug("DRAW [ {}, {}, {}, {} ]", rect->x, rect->y, rect->x2, rect->y2);
|
||||
// spdlog::debug("DRAW [ {}, {}, {}, {} ]", rect->x, rect->y, rect->x2, rect->y2);
|
||||
painter.setBuffer(reinterpret_cast<uint8_t *>(layer->buffer), layer->w, layer->h, LCDLAYER_GetBitmapType(layer));
|
||||
painter.setWindow(rect->x, rect->y, rect->x2, rect->y2);
|
||||
|
||||
|
|
|
|||
|
|
@ -92,7 +92,6 @@ void LCDLAYER_Flush(LCDLAYER *layer) {
|
|||
int index = y * w;
|
||||
for (int x = x1; x <= x2; x++) {
|
||||
target[index + x] = Bitmap::getBitmapPixel(type, x, y, w, h, source);
|
||||
// target[index + x] = 0xFFFF0000;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,14 +7,15 @@
|
|||
void Helper_Init() {
|
||||
CreateGBSproc(HELPER_CEPID, "HELPER", +[]() {
|
||||
GBS_MSG msg;
|
||||
if (GBS_RecActDstMessage(&msg)) {
|
||||
if (msg.msg == MSG_HELPER_RUN) {
|
||||
if (msg.data0) {
|
||||
((void (*)(int, void *))(msg.data0))(msg.submess, msg.data1);
|
||||
}
|
||||
} else {
|
||||
GBS_SendMessage(MMI_CEPID, MSG_HELPER_TRANSLATOR, msg.pid_from, (void *) msg.msg, (void *) msg.submess);
|
||||
if (!GBS_RecActDstMessage(&msg))
|
||||
return;
|
||||
if (msg.msg == MSG_HELPER_RUN) {
|
||||
if (msg.data0) {
|
||||
spdlog::debug("run subproc");
|
||||
((void (*)(int, void *))(msg.data0))(msg.submess, msg.data1);
|
||||
}
|
||||
} else {
|
||||
GBS_SendMessage(MMI_CEPID, MSG_HELPER_TRANSLATOR, msg.pid_from, (void *) msg.msg, (void *) msg.submess);
|
||||
}
|
||||
}, 0, 0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,21 +15,24 @@ static int _getKeyCodeFromEvent(IpcPacketKeyEvent *ev);
|
|||
void MMI_Init() {
|
||||
CreateGBSproc(LCD_DISPLAYQUEUE_CEPID, "LCD_DISPLAYQUEUE", +[]() {
|
||||
GBS_MSG msg;
|
||||
while (GBS_RecActDstMessage(&msg)) {
|
||||
if (msg.msg == LCD_DISPLAYQUEUE_CMD_REDRAW) {
|
||||
auto *layer = reinterpret_cast<LCDLAYER *>(msg.data0);
|
||||
LCDLAYER_Flush(layer);
|
||||
layer->redraw_requested = 0;
|
||||
} else {
|
||||
spdlog::debug("[LCD_DISPLAYQUEUE] unknown cmd {:04X}", toUnsigned(msg.msg));
|
||||
}
|
||||
if (!GBS_RecActDstMessage(&msg))
|
||||
return;
|
||||
if (msg.msg == LCD_DISPLAYQUEUE_CMD_REDRAW) {
|
||||
auto *layer = reinterpret_cast<LCDLAYER *>(msg.data0);
|
||||
LCDLAYER_Flush(layer);
|
||||
layer->redraw_requested = 0;
|
||||
} else {
|
||||
spdlog::debug("[LCD_DISPLAYQUEUE] unknown cmd {:04X}", toUnsigned(msg.msg));
|
||||
}
|
||||
}, 0, 0);
|
||||
|
||||
|
||||
CreateGBSproc(MMI_CEPID, "MMI", +[]() {
|
||||
GBS_MSG msg;
|
||||
while (GBS_RecActDstMessage(&msg)) {
|
||||
if (!GBS_RecActDstMessage(&msg))
|
||||
return;
|
||||
if (msg.msg == MMI_CMD_REDRAW) {
|
||||
DirectRedrawGUI();
|
||||
} else {
|
||||
spdlog::debug("[MMI] {:04X} {:04X}", toUnsigned(msg.msg), toUnsigned(msg.submess));
|
||||
|
||||
CSM_RAM *cursor = reinterpret_cast<CSM_RAM *>(CSM_root()->csm_q->csm.last);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue