Skip to content

Commit

Permalink
Replace shims with functions calling pointers to dlsym-loaded funcs f…
Browse files Browse the repository at this point in the history
…rom hisi libs

VI pipe still receives nothing, venc main loop times out
  • Loading branch information
wberube committed May 23, 2024
1 parent ce456c5 commit c063f80
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 9 deletions.
5 changes: 0 additions & 5 deletions src/compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@ void _MI_PRINT_GetDebugLevel(void) {}
void __stdin(void) {}
void _stdlib_mb_cur_max(void) {}

void ISP_AlgRegisterDehaze(void) {}
void ISP_AlgRegisterDrc(void) {}
void ISP_AlgRegisterLdci(void) {}
void MPI_ISP_IrAutoRunOnce(void) {}

float __expf_finite(float x) { return expf(x); }
int __fgetc_unlocked(FILE *stream) { return fgetc(stream); }
double __log_finite(double x) { return log(x); }
Expand Down
2 changes: 1 addition & 1 deletion src/hal/hisi/v4_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ static enum ConfigError v4_parse_sensor_config(char *path, v4_config_impl *confi
if (!config->videv.bayerSize.height)
config->videv.bayerSize.height = config->isp.capt.height;

config->videv.wdrCacheLine = v4_config.isp.capt.width;
config->videv.wdrCacheLine = v4_config.isp.capt.height;

if (!config->isp.wdr)
config->isp.wdr = config->mode;
Expand Down
2 changes: 1 addition & 1 deletion src/hal/hisi/v4_hal.c
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ int v4_region_setbitmap(int handle, hal_bitmap *bitmap)
int v4_sensor_config(void) {
int fd;
v4_snr_dev config;
memset(&config, 0, sizeof(config));
//memset(&config, 0, sizeof(config));
config.device = 0;
config.input = v4_config.input_mode;
config.rect.width = v4_config.isp.capt.width;
Expand Down
29 changes: 29 additions & 0 deletions src/hal/hisi/v4_isp.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

#include "v4_common.h"

extern int (*fnISP_AlgRegisterDehaze)(int);
extern int (*fnISP_AlgRegisterDrc)(int);
extern int (*fnISP_AlgRegisterLdci)(int);
extern int (*fnMPI_ISP_IrAutoRunOnce)(int, void*);

typedef enum {
V4_ISP_DIR_NORMAL,
V4_ISP_DIR_MIRROR,
Expand Down Expand Up @@ -63,6 +68,30 @@ static int v4_isp_load(v4_isp_impl *isp_lib) {
return EXIT_FAILURE;
}

if (!(fnISP_AlgRegisterDehaze = (int(*)(int))
dlsym(isp_lib->handleDehaze, "ISP_AlgRegisterDehaze"))) {
fprintf(stderr, "[v4_isp] Failed to acquire symbol ISP_AlgRegisterDehaze!\n");
return EXIT_FAILURE;
}

if (!(fnISP_AlgRegisterDrc = (int(*)(int))
dlsym(isp_lib->handleDrc, "ISP_AlgRegisterDrc"))) {
fprintf(stderr, "[v4_isp] Failed to acquire symbol ISP_AlgRegisterDrc!\n");
return EXIT_FAILURE;
}

if (!(fnISP_AlgRegisterLdci = (int(*)(int))
dlsym(isp_lib->handleLdci, "ISP_AlgRegisterLdci"))) {
fprintf(stderr, "[v4_isp] Failed to acquire symbol ISP_AlgRegisterLdci!\n");
return EXIT_FAILURE;
}

if (!(fnMPI_ISP_IrAutoRunOnce = (int(*)(int, void*))
dlsym(isp_lib->handleIrAuto, "MPI_ISP_IrAutoRunOnce"))) {
fprintf(stderr, "[v4_isp] Failed to acquire symbol MPI_ISP_IrAutoRunOnce!\n");
return EXIT_FAILURE;
}

if (!(isp_lib->fnExit = (int(*)(int pipe))
dlsym(isp_lib->handle, "HI_MPI_ISP_Exit"))) {
fprintf(stderr, "[v4_isp] Failed to acquire symbol HI_MPI_ISP_Exit!\n");
Expand Down
17 changes: 17 additions & 0 deletions src/hal/hisi/v4_quirks.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
int (*fnISP_AlgRegisterDehaze)(int);
int (*fnISP_AlgRegisterDrc)(int);
int (*fnISP_AlgRegisterLdci)(int);
int (*fnMPI_ISP_IrAutoRunOnce)(int, void*);

int ISP_AlgRegisterDehaze(int pipeId) {
return fnISP_AlgRegisterDehaze(pipeId);
}
int ISP_AlgRegisterDrc(int pipeId) {
return fnISP_AlgRegisterDrc(pipeId);
}
int ISP_AlgRegisterLdci(int pipeId) {
return fnISP_AlgRegisterLdci(pipeId);
}
int MPI_ISP_IrAutoRunOnce(int pipeId, void *irAttr) {
return fnMPI_ISP_IrAutoRunOnce(pipeId, irAttr);
}
1 change: 0 additions & 1 deletion src/hal/hisi/v4_snr.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,6 @@ typedef struct {
int (*pfnRegisterCallback)(int pipe, v4_isp_alg *aeLibrary, v4_isp_alg *awbLibrary);
int (*pfnUnRegisterCallback)(int pipe, v4_isp_alg *aeLibrary, v4_isp_alg *awbLibrary);
int (*pfnSetBusInfo)(int pipe, v4_snr_bus unSNSBusInfo);
int (*pfnSetBusExInfo)(int pipe, char *address);
void (*pfnStandby)(int pipe);
void (*pfnRestart)(int pipe);
void (*pfnMirrorFlip)(int pipe, v4_isp_dir mode);
Expand Down
1 change: 0 additions & 1 deletion src/video.c
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,6 @@ int start_sdk() {
}
pthread_attr_destroy(&thread_attr);
}
usleep(1000);

if (app_config.mp4_enable) {
int index = take_next_free_channel(true);
Expand Down

0 comments on commit c063f80

Please sign in to comment.