Skip to content

Commit 5051829

Browse files
committed
feat: update github actions
1 parent 8c225ce commit 5051829

File tree

8 files changed

+81
-103
lines changed

8 files changed

+81
-103
lines changed

.github/workflows/build.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,13 @@ jobs:
1616
steps:
1717
- name: Checkout
1818
uses: actions/checkout@v4
19+
- name: Set up Cmake cache
20+
uses: buildjet/cache@v4
21+
with:
22+
path: internal/native/cgo/build
23+
key: jetkvm-cgo-${{ hashFiles('internal/native/cgo/**/*.c', 'internal/native/cgo/**/*.h', 'internal/native/cgo/**/*.patch', 'internal/native/cgo/**/*.txt', 'internal/native/cgo/**/*.sh', '!internal/native/cgo/build/**') }}
24+
restore-keys: |
25+
jetkvm-cgo-${{ hashFiles('internal/native/cgo/**/*.c', 'internal/native/cgo/**/*.h', 'internal/native/cgo/**/*.patch', 'internal/native/cgo/**/*.txt', 'internal/native/cgo/**/*.sh', '!internal/native/cgo/build/**') }}
1926
- name: Set up Node.js
2027
uses: actions/setup-node@v4
2128
with:

internal/native/cgo/CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,10 @@ FetchContent_Declare(
3232
GIT_REPOSITORY https://github.com/lvgl/lvgl.git
3333
GIT_TAG v8.3.11
3434
GIT_SHALLOW 1
35-
PATCH_COMMAND git apply ${CMAKE_CURRENT_SOURCE_DIR}/lvgl-no-examples.patch
35+
UPDATE_DISCONNECTED 1
36+
PATCH_COMMAND
37+
git apply ${CMAKE_CURRENT_SOURCE_DIR}/lvgl-no-examples.patch
38+
COMMAND rm -rf demos examples
3639
)
3740
FetchContent_MakeAvailable(lvgl)
3841

@@ -41,6 +44,7 @@ FetchContent_Declare(
4144
lv_drivers
4245
GIT_REPOSITORY https://github.com/lvgl/lv_drivers.git
4346
GIT_TAG v8.3.0
47+
UPDATE_DISCONNECTED 1
4448
)
4549
FetchContent_MakeAvailable(lv_drivers)
4650

internal/native/cgo/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ VERBOSE=1 cmake -B build \
1414
-DCMAKE_CROSSCOMPILING=1 \
1515
-DCMAKE_TOOLCHAIN_FILE=$CMAKE_TOOLCHAIN_FILE \
1616
-DSKIP_GLIBC_NAMES=ON \
17-
-DMAKE_BUILD_TYPE=Release
17+
-DCMAKE_BUILD_TYPE=Release
1818

1919
cmake --build build

internal/native/cgo/ctrl.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ void jetkvm_set_video_handler(jetkvm_video_handler_t *handler) {
3030
video_handler = handler;
3131
}
3232

33-
void report_video_format(bool ready, const char *error, u_int16_t width, u_int16_t height, double frame_per_second)
33+
void video_report_format(bool ready, const char *error, u_int16_t width, u_int16_t height, double frame_per_second)
3434
{
3535
state.ready = ready;
3636
state.error = error;
@@ -42,19 +42,14 @@ void report_video_format(bool ready, const char *error, u_int16_t width, u_int16
4242
}
4343
}
4444

45-
int socket_send_frame(const uint8_t *frame, ssize_t len)
45+
int video_send_frame(const uint8_t *frame, ssize_t len)
4646
{
4747
if (video_handler != NULL) {
4848
(*video_handler)(frame, len);
4949
} else {
5050
log_error("video handler is not set");
5151
}
5252
return 0;
53-
// if (video_client_fd <= 0)
54-
// {
55-
// return -1;
56-
// }
57-
// return send(video_client_fd, frame, len, 0);
5853
}
5954

6055
/**

internal/native/cgo/ctrl.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,7 @@ int jetkvm_video_set_edid(const char *edid_hex);
5151
char *jetkvm_video_get_edid_hex();
5252
jetkvm_video_state_t *jetkvm_video_get_status();
5353

54+
void video_report_format(bool ready, const char *error, u_int16_t width, u_int16_t height, double frame_per_second);
55+
int video_send_frame(const uint8_t *frame, ssize_t len);
56+
5457
#endif //VIDEO_DAEMON_CTRL_H

internal/native/cgo/log.h

Lines changed: 47 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -16,44 +16,12 @@
1616
void jetkvm_log(const char *message);
1717

1818
/* Log to screen */
19-
#define emit_log(level, file, func, line, ...) do { \
20-
/* call the log handler */ \
21-
char msg_buffer[1024]; \
22-
sprintf(msg_buffer, __VA_ARGS__); \
23-
log_message(level, file, func, line, msg_buffer); \
19+
#define emit_log(level, file, func, line, ...) do { \
20+
/* call the log handler */ \
21+
char msg_buffer[1024]; \
22+
sprintf(msg_buffer, __VA_ARGS__); \
23+
log_message(level, file, func, line, msg_buffer); \
2424
} while (0)
25-
// /* display the level */ \
26-
// printf("%10s%s", level, " "); \
27-
// \
28-
// /* display the function doing the logging */ \
29-
// printf("%s%s", func, " " : ""); \
30-
// \
31-
// /* display the file and/or the line number */ \
32-
// printf( \
33-
// "%s%s%s%.d%s%s", \
34-
// DISPLAY_FUNC && (DISPLAY_FILE || DISPLAY_LINE) ? "(" : "", \
35-
// DISPLAY_FILE ? file : "", \
36-
// DISPLAY_FILE && DISPLAY_LINE ? ":" : "", \
37-
// DISPLAY_LINE ? line : 0, \
38-
// DISPLAY_FUNC && (DISPLAY_FILE || DISPLAY_LINE) ? ") " : "", \
39-
// !DISPLAY_FUNC && (DISPLAY_FILE || DISPLAY_LINE) ? " " : "" \
40-
// ); \
41-
// \
42-
// /* display message border */ \
43-
// printf("%s%s", DISPLAY_BORDER ? BORDER : "", DISPLAY_BORDER ? " " : ""); \
44-
// \
45-
// /* display the callee's message */ \
46-
// if (DISPLAY_MESSAGE) printf(__VA_ARGS__); \
47-
// \
48-
// /* add the message ending (usually '\n') */ \
49-
// printf("%s", DISPLAY_ENDING ? MSG_ENDING : ""); \
50-
// \
51-
// /* reset the colour */ \
52-
// printf("%s", DISPLAY_RESET ? RESET_COLOUR : ""); \
53-
// \
54-
// /* add a newline */ \
55-
// printf("\n"); \
56-
// fflush(stdout); \
5725

5826
/* Level enum */
5927
#define LEVEL_PANIC 5
@@ -65,66 +33,66 @@ void jetkvm_log(const char *message);
6533
#define LEVEL_TRACE -1
6634

6735
/* TRACE LOG */
68-
#define log_trace(...) do { \
69-
if (LOG_LEVEL <= LEVEL_TRACE) { \
70-
emit_log( \
71-
LEVEL_TRACE, __FILENAME__, __func__, __LINE__, __VA_ARGS__ \
72-
); \
73-
} \
36+
#define log_trace(...) do { \
37+
if (LOG_LEVEL <= LEVEL_TRACE) { \
38+
emit_log( \
39+
LEVEL_TRACE, __FILENAME__, __func__, __LINE__, __VA_ARGS__ \
40+
); \
41+
} \
7442
} while (0)
7543

7644
/* DEBUG LOG */
77-
#define log_debug(...) do { \
78-
if (LOG_LEVEL <= LEVEL_DEBUG) { \
79-
emit_log( \
80-
LEVEL_DEBUG, __FILENAME__, __func__, __LINE__, __VA_ARGS__ \
81-
); \
82-
} \
45+
#define log_debug(...) do { \
46+
if (LOG_LEVEL <= LEVEL_DEBUG) { \
47+
emit_log( \
48+
LEVEL_DEBUG, __FILENAME__, __func__, __LINE__, __VA_ARGS__ \
49+
); \
50+
} \
8351
} while (0)
8452

8553
/* INFO LOG */
86-
#define log_info(...) do { \
87-
if (LOG_LEVEL <= LEVEL_INFO) { \
88-
emit_log( \
89-
LEVEL_INFO, __FILENAME__, __func__, __LINE__, __VA_ARGS__ \
90-
); \
91-
} \
54+
#define log_info(...) do { \
55+
if (LOG_LEVEL <= LEVEL_INFO) { \
56+
emit_log( \
57+
LEVEL_INFO, __FILENAME__, __func__, __LINE__, __VA_ARGS__ \
58+
); \
59+
} \
9260
} while (0)
9361

9462
/* NOTICE LOG */
95-
#define log_notice(...) do { \
96-
if (LOG_LEVEL <= LEVEL_NOTICE) { \
97-
emit_log( \
98-
LEVEL_NOTICE, __FILENAME__, __func__, __LINE__, __VA_ARGS__ \
99-
); \
100-
} \
63+
#define log_notice(...) do { \
64+
if (LOG_LEVEL <= LEVEL_INFO) { \
65+
emit_log( \
66+
LEVEL_INFO, __FILENAME__, __func__, __LINE__, __VA_ARGS__ \
67+
); \
68+
} \
10169
} while (0)
10270

10371
/* WARN LOG */
104-
#define log_warn(...) do { \
105-
if (LOG_LEVEL <= LEVEL_WARN) { \
106-
emit_log( \
107-
LEVEL_WARN, __FILENAME__, __func__, __LINE__, __VA_ARGS__ \
108-
); \
109-
} \
72+
#define log_warn(...) do { \
73+
if (LOG_LEVEL <= LEVEL_WARN) { \
74+
emit_log( \
75+
LEVEL_WARN, __FILENAME__, __func__, __LINE__, __VA_ARGS__ \
76+
); \
77+
} \
11078
} while (0)
11179

11280
/* ERROR LOG */
113-
#define log_error(...) do { \
114-
if (LOG_LEVEL <= LEVEL_ERROR) { \
115-
emit_log( \
116-
LEVEL_ERROR, __FILENAME__, __func__, __LINE__, __VA_ARGS__ \
117-
); \
118-
} \
81+
#define log_error(...) do { \
82+
if (LOG_LEVEL <= LEVEL_ERROR) { \
83+
emit_log( \
84+
LEVEL_ERROR, __FILENAME__, __func__, __LINE__, __VA_ARGS__ \
85+
); \
86+
} \
11987
} while (0)
12088

12189
/* PANIC LOG */
122-
#define log_panic(...) do { \
123-
if (LOG_LEVEL <= LEVEL_PANIC) { \
124-
emit_log( \
125-
LEVEL_PANIC, __FILENAME__, __func__, __LINE__, __VA_ARGS__\
126-
); \
127-
} \
90+
#define log_panic(...) do { \
91+
if (LOG_LEVEL <= LEVEL_PANIC) { \
92+
emit_log( \
93+
LEVEL_PANIC, __FILENAME__, __func__, __LINE__, __VA_ARGS__ \
94+
); \
95+
} \
12896
} while (0)
12997

13098
#endif //VIDEO_DAEMON_LOG_H

internal/native/cgo/lv_conf.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -477,31 +477,31 @@ e.g. "stm32f769xx.h" or "stm32f429xx.h"*/
477477
# define LV_USE_CALENDAR_HEADER_DROPDOWN 1
478478
#endif /*LV_USE_CALENDAR*/
479479

480-
#define LV_USE_CHART 1
480+
#define LV_USE_CHART 0
481481

482-
#define LV_USE_COLORWHEEL 1
482+
#define LV_USE_COLORWHEEL 0
483483

484484
#define LV_USE_IMGBTN 1
485485

486486
#define LV_USE_KEYBOARD 1
487487

488-
#define LV_USE_LED 1
488+
#define LV_USE_LED 0
489489

490490
#define LV_USE_LIST 1
491491

492-
#define LV_USE_METER 1
492+
#define LV_USE_METER 0
493493

494-
#define LV_USE_MSGBOX 1
494+
#define LV_USE_MSGBOX 0
495495

496-
#define LV_USE_SPINBOX 1
496+
#define LV_USE_SPINBOX 0
497497

498-
#define LV_USE_SPINNER 1
498+
#define LV_USE_SPINNER 0
499499

500-
#define LV_USE_TABVIEW 1
500+
#define LV_USE_TABVIEW 0
501501

502-
#define LV_USE_TILEVIEW 1
502+
#define LV_USE_TILEVIEW 0
503503

504-
#define LV_USE_WIN 1
504+
#define LV_USE_WIN 0
505505

506506
#define LV_USE_SPAN 1
507507
#if LV_USE_SPAN

internal/native/cgo/video.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include <time.h>
44
#include <rk_type.h>
55
#include <rk_mpi_venc.h>
6+
#include <rk_mpi_sys.h>
67
#include <string.h>
78
#include <rk_debug.h>
89
#include <malloc.h>
@@ -276,7 +277,7 @@ static void *venc_read_stream(void *arg)
276277
// loopCount, stFrame.u32Seq, stFrame.pstPack->u32Len,
277278
// stFrame.pstPack->u64PTS, nowUs - stFrame.pstPack->u64PTS);
278279
pData = RK_MPI_MB_Handle2VirAddr(stFrame.pstPack->pMbBlk);
279-
socket_send_frame(pData, (ssize_t)stFrame.pstPack->u32Len);
280+
video_send_frame(pData, (ssize_t)stFrame.pstPack->u32Len);
280281
s32Ret = RK_MPI_VENC_ReleaseStream(VENC_CHANNEL, &stFrame);
281282
if (s32Ret != RK_SUCCESS)
282283
{
@@ -645,19 +646,19 @@ void *run_detect_format(void *arg)
645646
{
646647
// No timings could be detected because no signal was found.
647648
log_info("HDMI status: no signal");
648-
report_video_format(false, "no_signal", 0, 0, 0);
649+
video_report_format(false, "no_signal", 0, 0, 0);
649650
}
650651
else if (errno == ENOLCK)
651652
{
652653
// The signal was unstable and the hardware could not lock on to it.
653654
log_info("HDMI status: no lock");
654-
report_video_format(false, "no_lock", 0, 0, 0);
655+
video_report_format(false, "no_lock", 0, 0, 0);
655656
}
656657
else if (errno == ERANGE)
657658
{
658659
// Timings were found, but they are out of range of the hardware capabilities.
659660
printf("HDMI status: out of range\n");
660-
report_video_format(false, "out_of_range", 0, 0, 0);
661+
video_report_format(false, "out_of_range", 0, 0, 0);
661662
}
662663
else
663664
{
@@ -679,7 +680,7 @@ void *run_detect_format(void *arg)
679680
detected_width = dv_timings.bt.width;
680681
detected_height = dv_timings.bt.height;
681682
detected_signal = true;
682-
report_video_format(true, NULL, detected_width, detected_height, frames_per_second);
683+
video_report_format(true, NULL, detected_width, detected_height, frames_per_second);
683684
if (streaming_flag == true)
684685
{
685686
log_info("restarting on going video streaming");

0 commit comments

Comments
 (0)