Skip to content

Commit

Permalink
Getting rid of the Ingenic code as it will need a complete rewrite, e…
Browse files Browse the repository at this point in the history
…ither as a proper Majestic plugin, a LD_PRELOADed wrapper library that can push its own calls or part of a streamer app
  • Loading branch information
wberube committed May 11, 2024
1 parent 980c1f2 commit 8ef03ae
Show file tree
Hide file tree
Showing 24 changed files with 3 additions and 9,951 deletions.
10 changes: 2 additions & 8 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
#!/bin/bash
DL="https://github.com/openipc/firmware/releases/download/latest"

if [ "$1" = "osd-inge" ]; then
CC=mips_xburst-gcc13-musl-3_10
elif [[ "$1" == *"-star6b0" ]]; then
if [[ "$1" == *"-star6b0" ]]; then
CC=cortex_a7_thumb2_hf-gcc13-musl-4_9
elif [[ "$1" == *"-star6e" ]]; then
CC=cortex_a7_thumb2_hf-gcc13-glibc-4_9
Expand All @@ -30,17 +28,13 @@ if [ "$1" = "osd-goke" ]; then
elif [ "$1" = "osd-hisi" ]; then
DRV=$PWD/firmware/general/package/hisilicon-osdrv-hi3516ev200/files/lib
make -C osd -B CC=$GCC DRV=$DRV $1
elif [ "$1" = "osd-inge" ]; then
DRV=$PWD/firmware/general/package/ingenic-osdrv-t31/files/lib
GCC=$PWD/toolchain/$CC/bin/mipsel-linux-gcc
make -C osd -B CC=$GCC DRV=$DRV $1
elif [ "$1" = "osd-star6b0" ]; then
DRV=$PWD/firmware/general/package/sigmastar-osdrv-infinity6b0/files/lib
make -C osd -B CC=$GCC DRV=$DRV $1
elif [ "$1" = "osd-star6e" ]; then
DRV=$PWD/firmware/general/package/sigmastar-osdrv-infinity6e/files/lib
make -C osd -B CC=$GCC DRV=$DRV $1
else
echo "Usage: $0 [osd-goke|osd-hisi|osd-inge|osd-star6b0|osd-star6e]"
echo "Usage: $0 [osd-goke|osd-hisi|osd-star6b0|osd-star6e]"
exit 1
fi
5 changes: 0 additions & 5 deletions osd/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@ osd-hisi:
$(eval LIB = -ldnvqe -lmpi -lsecurec -lupvqe -lVoiceEngine)
$(BUILD)

osd-inge:
$(eval SDK = ../sdk/ingenic)
$(eval LIB = -D__INGENIC__ -lalog -limp)
$(BUILD)

osd-star6b0:
$(eval SDK = ../sdk/infinity6)
$(eval LIB = -D__SIGMASTAR__ -D__INFINITY6__ -D__INFINITY6B0__ -lcam_os_wrapper -lm -lmi_rgn -lmi_sys)
Expand Down
16 changes: 1 addition & 15 deletions osd/compat.c
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
#include <stdio.h>

#ifdef __INGENIC__
#include <sys/syscall.h>
#include <unistd.h>
#endif

void __ctype_b(void) {}

int __fgetc_unlocked(FILE *stream) {
Expand All @@ -15,15 +10,6 @@ size_t _stdlib_mb_cur_max(void) {
return 0;
}

#ifdef __INGENIC__
void __assert(void) {}
void __ctype_tolower(void) {}
void __pthread_register_cancel(void) {}
void __pthread_unregister_cancel(void) {}

void *mmap(void *start, size_t len, int prot, int flags, int fd, unsigned int off) {
return (void *)syscall(SYS_mmap2, start, len, prot, flags, fd, off >> 12);
}
#elif defined(__SIGMASTAR__) && defined(__INFINITY6B0__)
#if defined(__SIGMASTAR__) && defined(__INFINITY6B0__)
void __stdin(void) {}
#endif
17 changes: 0 additions & 17 deletions osd/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ static void fill(char* str)
strcat(out, s);
opos += strlen(s);
}
#ifndef __INGENIC__
else if (str[ipos + 1] == 'T')
{
ipos++;
Expand All @@ -105,7 +104,6 @@ static void fill(char* str)
strcat(out, t);
opos += strlen(t);
}
#endif
else if (str[ipos + 1] == '$') {
ipos++;
strcat(out, "$");
Expand Down Expand Up @@ -296,20 +294,10 @@ void route()
);
}

#ifdef __INGENIC__
extern int IMP_OSD_SetPoolSize(int size);
#endif

int main(int argc, char *argv[])
{
#ifndef __INGENIC__
int fd_mem = open("/dev/mem", O_RDWR);
io_map = mmap(NULL, IO_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, fd_mem, IO_BASE);
#else
fprintf(stderr, "IMP_System_Init ret:%d\n", IMP_System_Init());
fprintf(stderr, "IMP_OSD_SetPoolSize ret:%d\n", IMP_OSD_SetPoolSize(512 * 1024));
fprintf(stderr, "IMP_OSD_CreateGroup ret:%d\n", IMP_OSD_CreateGroup(0));
#endif

#ifdef __SIGMASTAR__
static MI_RGN_PaletteTable_t g_stPaletteTable = {{{0, 0, 0, 0}}};
Expand Down Expand Up @@ -344,13 +332,8 @@ int main(int argc, char *argv[])
printf("[%s:%d]RGN_DeInit failed with %#x!\n", __func__, __LINE__, s32Ret);
#endif

#ifndef __INGENIC__
munmap(io_map, IO_SIZE);
close(fd_mem);
#else
IMP_OSD_DestroyGroup(0);
fprintf(stderr, "IMP_System_Exit ret:%d\n", IMP_System_Exit());
#endif

return 0;
}
55 changes: 0 additions & 55 deletions osd/region.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,29 +24,6 @@ int create_region(int *handle, int x, int y, int width, int height)
stRegion.stOsdInitParam.ePixelFmt = PIXEL_FORMAT_1555;

s32Ret = MI_RGN_GetAttr(*handle, &stRegionCurrent);
#elif defined(__INGENIC__)
IMPOSDRgnAttr stRegionCurrent;
IMPOSDRgnAttr stRegion;

IMPOSDGrpRgnAttr stChnAttr;
IMPOSDGrpRgnAttr stChnAttrCurrent;

stRegion.type = OSD_REG_PIC;
stRegion.rect.p0.x = x;
stRegion.rect.p0.y = y;
stRegion.rect.p1.x = x + width - 1;
stRegion.rect.p1.y = y + height - 1;
stRegion.fmt = PIXEL_FORMAT_1555;
stRegion.data.picData.pData = NULL;

if (*handle != -1)
s32Ret = IMP_OSD_GetRgnAttr(*handle, &stRegionCurrent);
else
{
*handle = IMP_OSD_CreateRgn(NULL);
fprintf(stderr, "handle=%d\n", *handle);
IMP_OSD_RegisterRgn(*handle, 0, NULL);
}
#else
MPP_CHN_S stChn;

Expand Down Expand Up @@ -74,8 +51,6 @@ int create_region(int *handle, int x, int y, int width, int height)
fprintf(stderr, "[%s:%d]RGN_GetAttr failed with %#x , creating region %d...\n", __func__, __LINE__, s32Ret, *handle);
#ifdef __SIGMASTAR__
s32Ret = MI_RGN_Create(*handle, &stRegion);
#elif defined(__INGENIC__)
s32Ret = IMP_OSD_SetRgnAttr(*handle, &stRegion);
#else
s32Ret = HI_MPI_RGN_Create(*handle, &stRegion);
#endif
Expand All @@ -89,8 +64,6 @@ int create_region(int *handle, int x, int y, int width, int height)
{
#ifdef __SIGMASTAR__
if (stRegionCurrent.stOsdInitParam.stSize.u32Height != stRegion.stOsdInitParam.stSize.u32Height || stRegionCurrent.stOsdInitParam.stSize.u32Width != stRegion.stOsdInitParam.stSize.u32Width)
#elif defined(__INGENIC__)
if (stRegionCurrent.rect.p1.x - stRegionCurrent.rect.p0.x != width || stRegionCurrent.rect.p1.y - stRegionCurrent.rect.p0.y != height)
#else
if (stRegionCurrent.unAttr.stOverlay.stSize.u32Height != stRegion.unAttr.stOverlay.stSize.u32Height || stRegionCurrent.unAttr.stOverlay.stSize.u32Width != stRegion.unAttr.stOverlay.stSize.u32Width)
#endif
Expand All @@ -103,8 +76,6 @@ int create_region(int *handle, int x, int y, int width, int height)
MI_RGN_DetachFromChn(*handle, &stChn);
MI_RGN_Destroy(*handle);
s32Ret = MI_RGN_Create(*handle, &stRegion);
#elif defined(__INGENIC__)
s32Ret = IMP_OSD_SetRgnAttr(*handle, &stRegion);
#else
HI_MPI_RGN_DetachFromChn(*handle, &stChn);
HI_MPI_RGN_Destroy(*handle);
Expand All @@ -120,14 +91,11 @@ int create_region(int *handle, int x, int y, int width, int height)

#ifdef __SIGMASTAR__
s32Ret = MI_RGN_GetDisplayAttr(*handle, &stChn, &stChnAttrCurrent);
#elif defined(__INGENIC__)
s32Ret = IMP_OSD_GetGrpRgnAttr(*handle, 0, &stChnAttrCurrent);
#else
s32Ret = HI_MPI_RGN_GetDisplayAttr(*handle, &stChn, &stChnAttrCurrent);
#endif
if (s32Ret)
fprintf(stderr, "[%s:%d]RGN_GetDisplayAttr failed with %#x %d, attaching...\n", __func__, __LINE__, s32Ret, *handle);
#ifndef __INGENIC__
#ifdef __SIGMASTAR__
else if (stChnAttrCurrent.stPoint.u32X != x || stChnAttrCurrent.stPoint.u32Y != y)
#else
Expand All @@ -144,7 +112,6 @@ int create_region(int *handle, int x, int y, int width, int height)
HI_MPI_RGN_DetachFromChn(*handle, &stChn);
#endif
}
#endif

#ifdef __SIGMASTAR__
memset(&stChnAttr, 0, sizeof(MI_RGN_ChnPortParam_t));
Expand All @@ -160,14 +127,6 @@ int create_region(int *handle, int x, int y, int width, int height)
MI_RGN_AttachToChn(*handle, &stChn, &stChnAttr);
stChn.s32OutputPortId = 1;
MI_RGN_AttachToChn(*handle, &stChn, &stChnAttr);
#elif defined(__INGENIC__)
memset(&stChnAttr, 0, sizeof(IMPOSDGrpRgnAttr));
stChnAttr.show = 1;
stChnAttr.gAlphaEn = 1;
stChnAttr.fgAlhpa = 255;

IMP_OSD_RegisterRgn(*handle, 0, &stChnAttr);
IMP_OSD_Start(0);
#else
memset(&stChnAttr, 0, sizeof(RGN_CHN_ATTR_S));
stChnAttr.bShow = 1;
Expand Down Expand Up @@ -321,15 +280,6 @@ int set_bitmap(int handle, BITMAP *bitmap)
{
#ifdef __SIGMASTAR__
int s32Ret = MI_RGN_SetBitMap(handle, (MI_RGN_Bitmap_t *)(bitmap));
#elif defined(__INGENIC__)
IMPOSDRgnAttr stRegion;
IMP_OSD_GetRgnAttr(handle, &stRegion);
stRegion.type = OSD_REG_PIC;
stRegion.rect.p1.x = stRegion.rect.p0.x + bitmap->u32Width - 1;
stRegion.rect.p1.y = stRegion.rect.p0.y + bitmap->u32Height - 1;
stRegion.fmt = bitmap->enPixelFormat;
stRegion.data.picData.pData = bitmap->pData;
int s32Ret = IMP_OSD_SetRgnAttr(handle, &stRegion);
#else
int s32Ret = HI_MPI_RGN_SetBitMap(handle, (BITMAP_S *)(bitmap));
#endif
Expand All @@ -354,11 +304,6 @@ void unload_region(int *handle)
stChn.s32OutputPortId = 0;
MI_RGN_DetachFromChn(*handle, &stChn);
int s32Ret = MI_RGN_Destroy(*handle);
#elif defined(__INGENIC__)
IMP_OSD_UnRegisterRgn(*handle, 0);
IMP_OSD_DestroyRgn(*handle);
*handle = -1;
int s32Ret = 0;
#else
MPP_CHN_S stChn;
stChn.s32DevId = 0;
Expand Down
Loading

0 comments on commit 8ef03ae

Please sign in to comment.