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

Sync dfsg with icamerasrc_slim_api branch #55

Merged
merged 1 commit into from
Oct 21, 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
16 changes: 2 additions & 14 deletions .github/workflows/build-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ jobs:
cd "${GITHUB_WORKSPACE}/hal"

mkdir -p build && cd build
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr ../src/hal/hal_adaptor
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_INSTALL_LIBDIR=lib -DBUILD_CAMHAL_ADAPTOR=ON -DBUILD_CAMHAL_PLUGIN=ON -DIPU_VERSIONS="ipu6;ipu6ep;ipu6epmtl" -DUSE_PG_LITE_PIPE=ON ..
make -j$(nproc) install

- uses: actions/checkout@v3
Expand All @@ -77,18 +77,6 @@ jobs:
env:
CHROME_SLIM_CAMHAL: ON
run: |
case "${{ matrix.os }}" in
("ubuntu:24.04")
fortify_level=3
;;
("ubuntu:22.04"|"ubuntu:20.04")
fortify_level=2
;;
(*)
echo "${{ matrix.os }} is unsupported yet. Please find the default fortify_level in /usr/share/perl5/Dpkg/Vendor/Ubuntu.pm or /usr/share/perl5/Dpkg/Vendor/Debian.pm."
exit 1
;;
esac
cd "${GITHUB_WORKSPACE}/icamerasrc"

CPPFLAGS="-D_FORTIFY_SOURCE=$fortify_level" ./autogen.sh && make -j$(nproc) install
./autogen.sh && make -j$(nproc) install
19 changes: 13 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,29 @@ This repository supports MIPI cameras through the IPU6/IPU6EP/IPU6SE on Intel Ti

## Build instructions:
* Prerequisites: ipu6-camera-bins and ipu6-camera-hal installed
* Prerequisites: libdrm-dev
* Prerequisites: libdrm-dev libva-dev libgstreamer-plugins-bad1.0-dev

```sh
export CHROME_SLIM_CAMHAL=ON
# for libdrm.pc
export PKG_CONFIG_PATH="/usr/lib/x86_64-linux-gnu/pkgconfig"
# only for yocto
export PKG_CONFIG_PATH="/usr/lib/pkgconfig"
./autogen.sh
make -j8
./configure --prefix=/usr
make
# binary install
sudo make install
# build rpm package and then install
make rpm
rpm -ivh --force --nodeps icamerasrc-*.rpm
```

NOTE:
For gstreamer version > 1.22.0, add support for drm dma buffer.
It depends on libdrm, please install it when build icamerasrc
and add option "--enable-gstdrmformat=yes" to enable drm dma buffer.
```sh
sudo apt install libdrm-dev
./configure --prefix=/usr --enable-gstdrmformat=yes
```

## Pipeline examples
* Ensure `${GST_PLUGIN_PATH}` includes icamerasrc installation path
* Testpattern generator (no sensor)
Expand Down Expand Up @@ -64,4 +70,5 @@ sudo -E gst-launch-1.0 icamerasrc device-name=ov13858-uf af-mode=2 ! video/x-raw
* Sensor ar0234
```
sudo -E gst-launch-1.0 icamerasrc device-name=ar0234 ! video/x-raw,format=NV12,width=1280,height=960 ! videoconvert ! glimagesink
sudo -E gst-launch-1.0 icamerasrc device-name=ar0234 io-mode=dma_mode ! 'video/x-raw(memory:DMABuf),drm-format=NV12,width=1280,height=960' ! glimagesink
```
3 changes: 1 addition & 2 deletions autogen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ autoreconf --verbose --force --install --make || {
exit 1;
}

args="--prefix=/usr \
--libdir=/usr/lib"
args="--prefix=/usr"

./configure $args || {
echo 'configure failed';
Expand Down
66 changes: 65 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#
# GStreamer
# Copyright (C) 2015-2023 Intel Corporation
# Copyright (C) 2015-2024 Intel Corporation
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
Expand Down Expand Up @@ -94,6 +94,15 @@ AC_ARG_WITH([androidstubs],
[],
[with_androidstubs=no])

AC_ARG_WITH([haladaptor],
AC_HELP_STRING([--with-haladaptor], [Link hal adaptor library [default=no]]))

AC_ARG_ENABLE([gstdrmformat],
AC_HELP_STRING([--enable-gstdrmformat], [Enable DRM format [default=no]]))

AC_ARG_ENABLE([internalbuild],
AC_HELP_STRING([--enable-internalbuild], [Internal build [default=no]]))

AC_ARG_VAR([DEFAULT_CAMERA],
[the default camera ID])

Expand Down Expand Up @@ -180,6 +189,29 @@ PKG_CHECK_MODULES(LIBDRM, [libdrm libdrm_intel], [
AC_MSG_ERROR([Cannot find libdrm pkgconfig])
])

AS_IF([test "x$enable_gstdrmformat" = "xyes"], [
PKG_CHECK_MODULES(GST_1_23, [gstreamer-1.0 >= 1.23], [ have_gstdrmformat=yes ], [
PKG_CHECK_MODULES(GST_1_22_6, [gstreamer-1.0 = 1.22.6], [ have_gstdrmformat=yes ], [ have_gstdrmformat=no ])
])

AS_IF([test "x$have_gstdrmformat" = "xyes"], [
PKG_CHECK_MODULES(DEP_GSTDRMFORMAT, [gstreamer-va-1.0 libva libva-drm], [
AC_SUBST(DEP_GSTDRMFORMAT_CFLAGS)
AC_SUBST(DEP_GSTDRMFORMAT_LIBS)
], [
have_gstdrmformat=no
AC_MSG_ERROR([Need gstreamer-va-1.0 libva libva-drm to enable GstVaDisplay])
])
], [
AC_MSG_ERROR([Need GStreamer >= 1.23 or == 1.22.6, and gstreamer-va-1.0 libva libva-drm to enable GstVaDisplay])
])

AS_IF([test "x$have_gstdrmformat" = "xyes"], [
AC_DEFINE([GST_DRM_FORMAT], [1], [GStreamer at least 1.23 or exactly 1.22.6 supports DRM format])
AC_MSG_NOTICE(Define GST_DRM_FORMAT)
])
], [])

dnl check if compiler understands -Wall (if yes, add -Wall to GST_CFLAGS)
AC_MSG_CHECKING([to see if compiler understands -Wall])
save_CFLAGS="$CFLAGS"
Expand All @@ -190,6 +222,38 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ ], [ ])], [
], [
AC_MSG_RESULT([no])
])
CFLAGS="$save_CFLAGS"

AC_DEFUN([AC_CHECK_FORTIFY_SOURCE], [
AC_MSG_CHECKING([for _FORTIFY_SOURCE value with -O2])
old_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -O2"
AC_RUN_IFELSE(
[AC_LANG_SOURCE([[
#include <stdio.h>
#ifndef _FORTIFY_SOURCE
#error
#endif
int main() { printf("%d\n", _FORTIFY_SOURCE); return 0; }
]])],
[
fortify_source_value=`./conftest$EXEEXT`
],
[
AC_MSG_RESULT([no])
fortify_source_value=0
],
[
AC_MSG_CHECKING([for cross-compiling _FORTIFY_SOURCE depends on toolchain])
AC_MSG_RESULT([no])
fortify_source_value=0
]
)
CFLAGS="$old_CFLAGS"
AC_SUBST([fortify_source_value])
])
AC_CHECK_FORTIFY_SOURCE
AM_CONDITIONAL([NO_FORTIFY_SOURCE], [test "x$fortify_source_value" = "x0"])

dnl set the plugindir where plugins should be installed (for src/Makefile.am)
if test "x${prefix}" = "x$HOME"; then
Expand Down
10 changes: 9 additions & 1 deletion src/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#
# GStreamer
# Copyright (C) 2015-2023 Intel Corporation
# Copyright (C) 2015-2024 Intel Corporation
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
Expand Down Expand Up @@ -73,6 +73,7 @@ libgsticamerasrc_la_CPPFLAGS = \
$(GST_CFLAGS) \
$(CAMHAL_CFLAGS) \
$(LIBDRM_CFLAGS) \
$(DEP_GSTDRMFORMAT_CFLAGS) \
-std=c++11 \
-Werror \
$(LIBUTILS_CFLAGS) \
Expand All @@ -91,12 +92,19 @@ libgsticamerasrc_la_LIBADD = $(GST_LIBS) \
-lgstvideo-$(GST_API_VERSION) \
interfaces/libgsticamerainterface-$(GST_API_VERSION).la \
$(LIBDRM_LIBS) \
$(DEP_GSTDRMFORMAT_LIBS) \
$(CAMHAL_LIBS)

libgsticamerasrc_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
# for hardening-check
libgsticamerasrc_la_LDFLAGS += -fPIE -fPIC -Wformat -Wformat-security -Wl,-z,relro -Wl,-z,now

# test default fortify level
if NO_FORTIFY_SOURCE
libgsticamerasrc_la_CPPFLAGS+= -D_FORTIFY_SOURCE=2
libgsticamerasrc_la_LDFLAGS+= -D_FORTIFY_SOURCE=2
endif

# headers we need but don't want installed
noinst_HEADERS = gstcamerasrc.h \
gstcameraformat.h \
Expand Down
Loading
Loading