Skip to content

Commit

Permalink
Add check for hisilicon libraries
Browse files Browse the repository at this point in the history
  • Loading branch information
viktorxda committed May 31, 2024
1 parent 4c2ce04 commit 1b899b6
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 5 deletions.
3 changes: 2 additions & 1 deletion src/hal/hisi/v4_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/select.h>

#include "../types.h"
Expand Down Expand Up @@ -164,4 +165,4 @@ typedef struct {
int y;
unsigned int width;
unsigned int height;
} v4_common_rect;
} v4_common_rect;
9 changes: 7 additions & 2 deletions src/hal/hisi/v4_hal.c
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,12 @@ int v4_pipeline_create(void)
if (ret = v4_snr_drv.obj->pfnSetBusInfo(_v4_vi_pipe, bus))
return ret;
}

if (!v4_isp.handleGoke) {
strcpy(v4_ae_lib.libName, "hisi_ae_lib");
strcpy(v4_awb_lib.libName, "hisi_awb_lib");
}

if (ret = v4_snr_drv.obj->pfnRegisterCallback(_v4_vi_pipe, &v4_ae_lib, &v4_awb_lib))
return ret;

Expand Down Expand Up @@ -412,7 +418,6 @@ int v4_sensor_config(void) {
else if (config.input == V4_SNR_INPUT_LVDS)
memcpy(&config.lvds, &v4_config.lvds, sizeof(v4_snr_lvds));


if (!access(v4_snr_endp, F_OK))
fd = open(v4_snr_endp, O_RDWR);
else fd = open("/dev/mipi", O_RDWR);
Expand Down Expand Up @@ -878,4 +883,4 @@ int v4_system_init(char *snrConfig)
return ret;

return EXIT_SUCCESS;
}
}
15 changes: 13 additions & 2 deletions src/hal/hisi/v4_isp.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,17 @@ typedef struct {
} v4_isp_impl;

static int v4_isp_load(v4_isp_impl *isp_lib) {
if ((!(isp_lib->handleAe = dlopen("lib_hiae.so", RTLD_LAZY | RTLD_GLOBAL)) ||
if (!access("/usr/lib/libisp.so", 0) &&
!(isp_lib->handle = dlopen("libisp.so", RTLD_LAZY | RTLD_GLOBAL)) ||
!(isp_lib->handleAe = dlopen("lib_hiae.so", RTLD_LAZY | RTLD_GLOBAL)) ||
!(isp_lib->handleAwb = dlopen("lib_hiawb.so", RTLD_LAZY | RTLD_GLOBAL))) {

fprintf(stderr, "[v4_isp] Failed to load library!\nError: %s\n", dlerror());
return EXIT_FAILURE;
}

if (!access("/usr/lib/libgk_isp.so", 0) &&
(!(isp_lib->handleAe = dlopen("lib_hiae.so", RTLD_LAZY | RTLD_GLOBAL)) ||
!(isp_lib->handleAwb = dlopen("lib_hiawb.so", RTLD_LAZY | RTLD_GLOBAL)) ||
!(isp_lib->handleLdci = dlopen("lib_hildci.so", RTLD_LAZY | RTLD_GLOBAL)) ||
!(isp_lib->handleDehaze = dlopen("lib_hidehaze.so", RTLD_LAZY | RTLD_GLOBAL)) ||
Expand All @@ -64,6 +74,7 @@ static int v4_isp_load(v4_isp_impl *isp_lib) {
!(isp_lib->handleDrc = dlopen("libdrc.so", RTLD_LAZY | RTLD_GLOBAL)) ||
!(isp_lib->handleDehaze = dlopen("libdehaze.so", RTLD_LAZY | RTLD_GLOBAL)) ||
!(isp_lib->handle = dlopen("libhi_isp.so", RTLD_LAZY | RTLD_GLOBAL)))) {

fprintf(stderr, "[v4_isp] Failed to load library!\nError: %s\n", dlerror());
return EXIT_FAILURE;
}
Expand Down Expand Up @@ -171,4 +182,4 @@ static void v4_isp_unload(v4_isp_impl *isp_lib) {
if (isp_lib->handle) dlclose(isp_lib->handle);
isp_lib->handle = NULL;
memset(isp_lib, 0, sizeof(*isp_lib));
}
}

0 comments on commit 1b899b6

Please sign in to comment.