Skip to content

Commit 47ffe00

Browse files
committed
Scrollable OSD section under the WebUI, compiler flags on older ARM platforms, advancements on CVITEK
1 parent 4852123 commit 47ffe00

File tree

17 files changed

+279
-139
lines changed

17 files changed

+279
-139
lines changed

res/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ <h2 class="unl">Media</h2>
371371
</div>
372372
<div class="c cont">
373373
<h2 class="unl">OSD</h2>
374-
<div class="row scrollx">
374+
<div class="scrollx">
375375
<table class="tc w-100">
376376
<tr>
377377
<th>ID</th>

src/hal/hisi/v1_hal.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#if defined(__ARM_PCS)
1+
#if defined(__arm__) && !defined(__ARM_PCS_VFP)
22

33
#include "v1_hal.h"
44

src/hal/hisi/v2_hal.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#if defined(__ARM_PCS)
1+
#if defined(__arm__) && !defined(__ARM_PCS_VFP)
22

33
#include "v2_hal.h"
44

src/hal/hisi/v3_hal.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#if defined(__ARM_PCS)
1+
#if defined(__arm__) && !defined(__ARM_PCS_VFP)
22

33
#include "v3_hal.h"
44

src/hal/hisi/v4_hal.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#if defined(__ARM_PCS)
1+
#if defined(__arm__) && !defined(__ARM_PCS_VFP)
22

33
#include "v4_hal.h"
44

src/hal/plus/ak_hal.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#if defined(__ARM_PCS)
1+
#if defined(__arm__) && !defined(__ARM_PCS_VFP)
22

33
#include "ak_hal.h"
44

src/hal/plus/aw_sys.h

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
#pragma once
2+
3+
#include "aw_common.h"
4+
5+
#define AW_SYS_API "1.0"
6+
7+
typedef enum {
8+
AW_SYS_MOD_CMPI,
9+
AW_SYS_MOD_VB,
10+
AW_SYS_MOD_SYS,
11+
AW_SYS_MOD_RGN,
12+
AW_SYS_MOD_CHNL,
13+
AW_SYS_MOD_VDEC,
14+
AW_SYS_MOD_GROUP,
15+
AW_SYS_MOD_VPSS,
16+
AW_SYS_MOD_VENC,
17+
AW_SYS_MOD_VDA,
18+
AW_SYS_MOD_H264E,
19+
AW_SYS_MOD_JPEGE,
20+
AW_SYS_MOD_MPEG4E,
21+
AW_SYS_MOD_H264D,
22+
AW_SYS_MOD_JPEGD,
23+
AW_SYS_MOD_VOU,
24+
AW_SYS_MOD_VIU,
25+
AW_SYS_MOD_DSU,
26+
AW_SYS_MOD_VALG,
27+
AW_SYS_MOD_RC,
28+
AW_SYS_MOD_AIO,
29+
AW_SYS_MOD_AI,
30+
AW_SYS_MOD_AO,
31+
AW_SYS_MOD_AENC,
32+
AW_SYS_MOD_ADEC,
33+
AW_SYS_MOD_AVENC,
34+
AW_SYS_MOD_PCIV,
35+
AW_SYS_MOD_PCIVFMW,
36+
AW_SYS_MOD_ISP,
37+
AW_SYS_MOD_IVE,
38+
AW_SYS_MOD_UVC,
39+
AW_SYS_MOD_DCCM,
40+
AW_SYS_MOD_DCCS,
41+
AW_SYS_MOD_PROC,
42+
AW_SYS_MOD_LOG,
43+
AW_SYS_MOD_MSTLOG,
44+
AW_SYS_MOD_VD,
45+
AW_SYS_MOD_VCMP = 38,
46+
AW_SYS_MOD_FB,
47+
AW_SYS_MOD_HDMI,
48+
AW_SYS_MOD_VOIE,
49+
AW_SYS_MOD_TDE,
50+
AW_SYS_MOD_USR,
51+
AW_SYS_MOD_VEDU,
52+
AW_SYS_MOD_VGS,
53+
AW_SYS_MOD_H265E,
54+
AW_SYS_MOD_FD,
55+
AW_SYS_MOD_ODT,
56+
AW_SYS_MOD_VQA,
57+
AW_SYS_MOD_LPR,
58+
AW_SYS_MOD_COMPCORE = 100,
59+
AW_SYS_MOD_DEMUX,
60+
AW_SYS_MOD_MUX,
61+
AW_SYS_MOD_CLOCK,
62+
AW_SYS_MOD_CSI,
63+
AW_SYS_MOD_ISE = 229,
64+
AW_SYS_MOD_EIS,
65+
AW_SYS_MOD_TENC,
66+
AW_SYS_MOD_END
67+
} aw_sys_mod;
68+
69+
typedef struct {
70+
aw_sys_mod module;
71+
int device;
72+
int channel;
73+
} aw_sys_bind;
74+
75+
typedef struct {
76+
char version[64];
77+
} aw_sys_ver;
78+
79+
typedef struct {
80+
void *handle;
81+
82+
int (*fnExit)(void);
83+
int (*fnInit)(void);
84+
85+
int (*fnBind)(aw_sys_bind *source, aw_sys_bind *dest);
86+
int (*fnUnbind)(aw_sys_bind *source, aw_sys_bind *dest);
87+
} aw_sys_impl;
88+
89+
static int aw_sys_load(aw_sys_impl *sys_lib) {
90+
if (!(sys_lib->handle = dlopen("libaw_mpp.so", RTLD_LAZY | RTLD_GLOBAL)))
91+
HAL_ERROR("aw_sys", "Failed to load library!\nError: %s\n", dlerror());
92+
93+
if (!(sys_lib->fnExit = (int(*)(void))
94+
hal_symbol_load("aw_sys", sys_lib->handle, "AW_MPI_SYS_Exit")))
95+
return EXIT_FAILURE;
96+
97+
if (!(sys_lib->fnInit = (int(*)(void))
98+
hal_symbol_load("aw_sys", sys_lib->handle, "AW_MPI_SYS_Init")))
99+
return EXIT_FAILURE;
100+
101+
if (!(sys_lib->fnBind = (int(*)(aw_sys_bind *source, aw_sys_bind *dest))
102+
hal_symbol_load("aw_sys", sys_lib->handle, "AW_MPI_SYS_Bind")))
103+
return EXIT_FAILURE;
104+
105+
if (!(sys_lib->fnUnbind = (int(*)(aw_sys_bind *source, aw_sys_bind *dest))
106+
hal_symbol_load("aw_sys", sys_lib->handle, "AW_MPI_SYS_UnBind")))
107+
return EXIT_FAILURE;
108+
109+
return EXIT_SUCCESS;
110+
}
111+
112+
static void aw_sys_unload(aw_sys_impl *sys_lib) {
113+
if (sys_lib->handle) dlclose(sys_lib->handle);
114+
sys_lib->handle = NULL;
115+
memset(sys_lib, 0, sizeof(*sys_lib));
116+
}

src/hal/plus/cvi_hal.c

Lines changed: 38 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,9 @@ int cvi_channel_bind(char index)
143143
if (ret = cvi_vpss.fnEnableChannel(_cvi_vpss_grp, index))
144144
return ret;
145145

146+
if (ret = cvi_vpss.fnAttachChannelPool(_cvi_vpss_grp, index, index))
147+
return ret;
148+
146149
{
147150
cvi_sys_bind source = { .module = CVI_SYS_MOD_VPSS,
148151
.device = _cvi_vpss_grp, .channel = index };
@@ -169,7 +172,8 @@ int cvi_channel_create(char index, short width, short height, char mirror, char
169172
channel.dstFps = -1;
170173
channel.mirror = mirror;
171174
channel.flip = flip;
172-
channel.depth = 0;
175+
channel.depth = 1;
176+
channel.aspectRatio = 1;
173177
if (ret = cvi_vpss.fnSetChannelConfig(_cvi_vpss_grp, index, &channel))
174178
return ret;
175179
}
@@ -198,6 +202,8 @@ int cvi_channel_unbind(char index)
198202
{
199203
int ret;
200204

205+
cvi_vpss.fnDetachChannelPool(_cvi_vpss_grp, index);
206+
201207
if (ret = cvi_vpss.fnDisableChannel(_cvi_vpss_grp, index))
202208
return ret;
203209

@@ -231,7 +237,7 @@ int cvi_pipeline_create(void)
231237
{
232238
cvi_sys_vimd mode[4];
233239
cvi_sys.fnGetViVpssMode((cvi_sys_vimd**)&mode);
234-
mode[0] = CVI_SYS_VIMD_VION_VPSSON;
240+
mode[0] = CVI_SYS_VIMD_VIOFF_VPSSON;
235241
if (ret = cvi_sys.fnSetViVpssMode((cvi_sys_vimd**)&mode))
236242
return ret;
237243
}
@@ -241,9 +247,12 @@ int cvi_pipeline_create(void)
241247
if (ret = cvi_vi.fnEnableDevice(_cvi_vi_dev))
242248
return ret;
243249

250+
if (ret = cvi_snr_drv.obj->pfnRegisterCallback(_cvi_vi_pipe, &cvi_ae_lib, &cvi_awb_lib))
251+
return ret;
252+
244253
{
245254
cvi_vi_bind bind;
246-
bind.num = 1;
255+
bind.num = 0;
247256
bind.pipeId[0] = _cvi_vi_pipe;
248257
if (ret = cvi_vi.fnBindPipe(_cvi_vi_dev, &bind))
249258
return ret;
@@ -259,7 +268,7 @@ int cvi_pipeline_create(void)
259268
pipe.pixFmt = CVI_PIXFMT_RGB_BAYER_8BPP + cvi_config.mipi.prec;
260269
pipe.compress = CVI_COMPR_NONE;
261270
pipe.prec = cvi_config.mipi.prec;
262-
pipe.nRedOn = 0;
271+
pipe.nRedOn = 1;
263272
pipe.sharpenOn = 0;
264273
pipe.srcFps = -1;
265274
pipe.dstFps = -1;
@@ -268,6 +277,20 @@ int cvi_pipeline_create(void)
268277
}
269278
if (ret = cvi_vi.fnStartPipe(_cvi_vi_pipe))
270279
return ret;
280+
281+
if (ret = cvi_isp.fnRegisterAE(_cvi_vi_pipe, &cvi_ae_lib))
282+
return ret;
283+
if (ret = cvi_isp.fnRegisterAWB(_cvi_vi_pipe, &cvi_awb_lib))
284+
return ret;
285+
if (ret = cvi_isp.fnMemInit(_cvi_vi_pipe))
286+
return ret;
287+
288+
cvi_config.isp.capt.x = 0;
289+
cvi_config.isp.capt.y = 0;
290+
if (ret = cvi_isp.fnSetDeviceConfig(_cvi_vi_pipe, &cvi_config.isp))
291+
return ret;
292+
if (ret = cvi_isp.fnInit(_cvi_vi_pipe))
293+
return ret;
271294

272295
{
273296
cvi_vi_chn channel;
@@ -287,28 +310,11 @@ int cvi_pipeline_create(void)
287310
if (ret = cvi_vi.fnEnableChannel(_cvi_vi_pipe, _cvi_vi_chn))
288311
return ret;
289312

290-
if (ret = cvi_snr_drv.obj->pfnRegisterCallback(_cvi_vi_pipe, &cvi_ae_lib, &cvi_awb_lib))
291-
return ret;
292-
293-
if (ret = cvi_isp.fnRegisterAE(_cvi_vi_pipe, &cvi_ae_lib))
294-
return ret;
295-
if (ret = cvi_isp.fnRegisterAWB(_cvi_vi_pipe, &cvi_awb_lib))
296-
return ret;
297-
if (ret = cvi_isp.fnMemInit(_cvi_vi_pipe))
298-
return ret;
299-
300-
cvi_config.isp.capt.x = 0;
301-
cvi_config.isp.capt.y = 0;
302-
if (ret = cvi_isp.fnSetDeviceConfig(_cvi_vi_pipe, &cvi_config.isp))
303-
return ret;
304-
if (ret = cvi_isp.fnInit(_cvi_vi_pipe))
305-
return ret;
306-
307313
{
308314
cvi_sys_vpcf config = {
309-
.mode = CVI_SYS_VPSS_SINGLE,
310-
.inputIsIsp = {1, 0},
311-
.pipeId = {_cvi_vi_pipe, 0}
315+
.mode = CVI_SYS_VPSS_DUAL,
316+
.inputIsIsp = {0, 1},
317+
.pipeId = {0, _cvi_vi_pipe}
312318
};
313319
if (ret = cvi_sys.fnSetVpssMode(&config))
314320
return ret;
@@ -589,7 +595,7 @@ int cvi_video_create(char index, hal_vidconfig *config)
589595
} else HAL_ERROR("cvi_venc", "This codec is not supported by the hardware!");
590596
channel.attrib.maxPic.width = config->width;
591597
channel.attrib.maxPic.height = config->height;
592-
channel.attrib.bufSize = ALIGN_UP(config->height * config->width * 3 / 4, 64);
598+
channel.attrib.bufSize = ALIGN_UP(config->height, 64) * ALIGN_UP(config->width, 64) * 3 / 2;
593599
if (channel.attrib.codec == CVI_VENC_CODEC_H264)
594600
channel.attrib.profile = MAX(config->profile, 2);
595601
channel.attrib.byFrame = 1;
@@ -881,26 +887,26 @@ int cvi_system_init(char *snrConfig)
881887
puts(version.version);
882888
}
883889

890+
cvi_sys.fnExit();
891+
cvi_vb.fnExit();
892+
884893
if (cvi_parse_sensor_config(snrConfig, &cvi_config) != CONFIG_OK)
885894
HAL_ERROR("cvi_sys", "Can't load sensor config\n");
886895

887896
if (ret = cvi_sensor_init(cvi_config.dll_file, cvi_config.sensor_type))
888897
return ret;
889898

890-
cvi_sys.fnExit();
891-
cvi_vb.fnExit();
892-
893899
{
894900
cvi_vb_pool pool;
895901
memset(&pool, 0, sizeof(pool));
896902

897903
pool.count = 2;
898-
pool.comm[0].blockSize = cvi_config.videv.size.width *
899-
cvi_config.videv.size.height * 3 / 2;
904+
pool.comm[0].blockSize = ALIGN_UP(cvi_config.videv.size.width, 64) *
905+
ALIGN_UP(cvi_config.videv.size.height, 64) * 3 / 2;
900906
pool.comm[0].blockCnt = 3;
901907
pool.comm[0].rempVirt = 2;
902-
pool.comm[1].blockSize = cvi_config.videv.size.width *
903-
cvi_config.videv.size.height * 3 / 2;
908+
pool.comm[1].blockSize = ALIGN_UP(cvi_config.videv.size.width, 64) *
909+
ALIGN_UP(cvi_config.videv.size.height, 64) * 3 / 2;
904910
pool.comm[1].blockCnt = 3;
905911
pool.comm[1].rempVirt = 2;
906912

src/hal/plus/cvi_snr.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,14 @@ typedef struct {
166166
cvi_common_dim dest;
167167
} cvi_snr_dev;
168168

169+
typedef struct {
170+
unsigned int mipiDev;
171+
short laneId[CVI_SNR_MIPI_LANE_NUM + 1];
172+
signed char pnSwap[CVI_SNR_MIPI_LANE_NUM + 1];
173+
unsigned char mclk;
174+
char mclkOn;
175+
} cvi_snr_rx;
176+
169177
typedef union {
170178
signed char i2c;
171179
struct {
@@ -203,7 +211,7 @@ typedef struct {
203211
int (*pfnWriteReg)(int pipe, int addr, int data);
204212
int (*pfnReadReg)(int pipe, int addr);
205213
int (*pfnSetInit)(int pipe, cvi_snr_init *config);
206-
int (*pfnPatchRxAttr)(cvi_snr_init *config);
214+
int (*pfnPatchRxAttr)(cvi_snr_rx *config);
207215
void (*pfnPatchI2cAddr)(int addr);
208216
int (*pfnGetRxAttr)(int pipe, cvi_snr_dev *device);
209217
int (*pfnExpSensorCb)(void *config);

src/hal/plus/cvi_vpss.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ typedef struct {
4141
int (*fnDisableChannel)(int group, int channel);
4242
int (*fnEnableChannel)(int group, int channel);
4343
int (*fnSetChannelConfig)(int group, int channel, cvi_vpss_chn *config);
44+
int (*fnAttachChannelPool)(int group, int channel, int pool);
45+
int (*fnDetachChannelPool)(int group, int channel);
4446
} cvi_vpss_impl;
4547

4648
static int cvi_vpss_load(cvi_vpss_impl *vpss_lib) {
@@ -82,6 +84,14 @@ static int cvi_vpss_load(cvi_vpss_impl *vpss_lib) {
8284
if (!(vpss_lib->fnSetChannelConfig = (int(*)(int group, int channel, cvi_vpss_chn *config))
8385
hal_symbol_load("cvi_vpss", vpss_lib->handle, "CVI_VPSS_SetChnAttr")))
8486
return EXIT_FAILURE;
87+
88+
if (!(vpss_lib->fnAttachChannelPool = (int(*)(int group, int channel, int pool))
89+
hal_symbol_load("cvi_vpss", vpss_lib->handle, "CVI_VPSS_AttachVbPool")))
90+
return EXIT_FAILURE;
91+
92+
if (!(vpss_lib->fnDetachChannelPool = (int(*)(int group, int channel))
93+
hal_symbol_load("cvi_vpss", vpss_lib->handle, "CVI_VPSS_DetachVbPool")))
94+
return EXIT_FAILURE;
8595

8696
return EXIT_SUCCESS;
8797
}

0 commit comments

Comments
 (0)