Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add check for hisilicon libraries #11

Merged
merged 1 commit into from
May 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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));
}
}