Skip to content

Commit

Permalink
Merge pull request #111 from zouxiaoh/iotg_ipu6
Browse files Browse the repository at this point in the history
release for imx390 on MTL, kernel 6.6
  • Loading branch information
zouxiaoh authored Jun 6, 2024
2 parents d40599c + 32c376f commit 3080683
Show file tree
Hide file tree
Showing 37 changed files with 9,150 additions and 596 deletions.
27 changes: 24 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (C) 2017-2023 Intel Corporation
# Copyright (C) 2017-2024 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -90,7 +90,6 @@ set (CMAKE_CXX_STANDARD 11)
add_compile_options(-Wall -Werror
-fstack-protector
-fPIE -fPIC
-D_FORTIFY_SOURCE=2
-DDCHECK_ALWAYS_ON
-Wformat -Wformat-security
)
Expand Down Expand Up @@ -157,7 +156,21 @@ include_directories(include
src/image_process
)

set(LIBCAMHAL_LD_FLAGS "-fPIE -fPIC -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Wl,-z,relro -Wl,-z,now")
set(LIBCAMHAL_LD_FLAGS "-fPIE -fPIC -Wformat -Wformat-security -Wl,-z,relro -Wl,-z,now")

# check if _FORTIFY_SOURCE is default defined with -O
include(CheckFortifyLevel)
set(FORTIFY_SOURCE_VALUE)
check_fortify_source(FORTIFY_SOURCE_VALUE)
if(FORTIFY_SOURCE_VALUE)
message(STATUS "compiler default _FORTIFY_SOURCE=${FORTIFY_SOURCE_VALUE}")
else()
message(STATUS "_FORTIFY_SOURCE is not defined or could not be determined.")
add_compile_options(-D_FORTIFY_SOURCE=2)
set(LIBCAMHAL_LD_FLAGS "${LIBCAMHAL_LD_FLAGS} -D_FORTIFY_SOURCE=2")
message(STATUS "define _FORTIFY_SOURCE=2")
endif()

set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${LIBCAMHAL_LD_FLAGS}")

add_subdirectory(src)
Expand Down Expand Up @@ -308,6 +321,14 @@ else()
target_link_libraries(camhal_static ${LIBIACSS_LIBS})
endif()

find_package(LIBDRM)
if(LIBDRM_FOUND AND ("${LIBDRM_VERSION}" VERSION_GREATER_EQUAL 2.4.114))
include_directories(${LIBDRM_INCLUDE_DIRS})
target_link_libraries(camhal ${LIBDRM_LIBS})
target_link_libraries(camhal_static ${LIBDRM_LIBS})
add_definitions(-DLIBDRM_SUPPORT_MMAP_OFFSET)
endif()

# Include libipu(4) headers
find_package(LIBIPU)
include_directories(${LIBIPU_INCLUDE_DIRS})
Expand Down
42 changes: 42 additions & 0 deletions cmake/CheckFortifyLevel.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# CheckFortifySource.cmake
function(check_fortify_source output_variable)
# Create a simple C++ source file to check _FORTIFY_SOURCE
set(CHECK_SOURCE_CODE "#include <stdio.h>
#ifndef _FORTIFY_SOURCE
#define _FORTIFY_SOURCE 0
#endif
int main(){printf(\"%d\", _FORTIFY_SOURCE);return 0;}")

# Set the full path for the source file
set(SOURCE_FILE_NAME "${CMAKE_BINARY_DIR}/check_fortify_source.c")
file(WRITE "${SOURCE_FILE_NAME}" "${CHECK_SOURCE_CODE}")

# Try to compile the source file
try_compile(FORTIFY_SOURCE_COMPILED
"${CMAKE_BINARY_DIR}/temp" "${SOURCE_FILE_NAME}"
COMPILE_DEFINITIONS "-O2"
COPY_FILE "${CMAKE_BINARY_DIR}/check_fortify_source.out"
OUTPUT_VARIABLE COMPILE_OUTPUT
)

# Check if compilation was successful
if(FORTIFY_SOURCE_COMPILED)
# Run the compiled program to get the value of _FORTIFY_SOURCE
execute_process(COMMAND "${CMAKE_BINARY_DIR}/check_fortify_source.out"
RESULT_VARIABLE RUN_RESULT
OUTPUT_VARIABLE FORTIFY_SOURCE_VALUE
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(RUN_RESULT EQUAL 0)
# Set the variable outside the function
set(${output_variable} "${FORTIFY_SOURCE_VALUE}" PARENT_SCOPE)
else()
message(STATUS "Failed to run the compiled test program.")
set(${output_variable} "" PARENT_SCOPE)
endif()
else()
message(STATUS "Compilation failed; _FORTIFY_SOURCE is not defined.")
message(STATUS "Compiler output: ${COMPILE_OUTPUT}")
set(${output_variable} "" PARENT_SCOPE)
endif()
endfunction()
8 changes: 0 additions & 8 deletions config/linux/ipu6/sensors/ar0234.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
<link srcName="Intel IPU6 CSI-2 1" srcPad="1" sinkName="Intel IPU6 CSI2 BE SOC" sinkPad="0" enable="true"/>
<link srcName="Intel IPU6 CSI2 BE SOC" srcPad="16" sinkName="Intel IPU6 BE SOC capture 0" sinkPad="0" enable="true"/>

<control name="ar0234 b" ctrlId="V4L2_CID_MIPI_LANES" value="2" ctrlName="set mipi lane"/>
<control name="ar0234 b" ctrlId="V4L2_CID_VFLIP" value="1" ctrlName="set vflip"/>
<control name="ar0234 b" ctrlId="V4L2_CID_HFLIP" value="1" ctrlName="set hflip"/>

Expand All @@ -42,7 +41,6 @@
<link srcName="Intel IPU6 CSI-2 1" srcPad="1" sinkName="Intel IPU6 CSI2 BE SOC" sinkPad="0" enable="true"/>
<link srcName="Intel IPU6 CSI2 BE SOC" srcPad="16" sinkName="Intel IPU6 BE SOC capture 0" sinkPad="0" enable="true"/>

<control name="ar0234 b" ctrlId="V4L2_CID_MIPI_LANES" value="2" ctrlName="set mipi lane"/>
<control name="ar0234 b" ctrlId="V4L2_CID_VFLIP" value="1" ctrlName="set vflip"/>
<control name="ar0234 b" ctrlId="V4L2_CID_HFLIP" value="1" ctrlName="set hflip"/>

Expand Down Expand Up @@ -106,7 +104,6 @@
<link srcName="Intel IPU6 CSI-2 2" srcPad="1" sinkName="Intel IPU6 CSI2 BE SOC" sinkPad="1" enable="true"/>
<link srcName="Intel IPU6 CSI2 BE SOC" srcPad="17" sinkName="Intel IPU6 BE SOC capture 1" sinkPad="0" enable="true"/>

<control name="ar0234 c" ctrlId="V4L2_CID_MIPI_LANES" value="2" ctrlName="set mipi lane"/>
<control name="ar0234 c" ctrlId="V4L2_CID_VFLIP" value="1" ctrlName="set vflip"/>
<control name="ar0234 c" ctrlId="V4L2_CID_HFLIP" value="1" ctrlName="set hflip"/>

Expand All @@ -123,7 +120,6 @@
<link srcName="Intel IPU6 CSI-2 2" srcPad="1" sinkName="Intel IPU6 CSI2 BE SOC" sinkPad="1" enable="true"/>
<link srcName="Intel IPU6 CSI2 BE SOC" srcPad="17" sinkName="Intel IPU6 BE SOC capture 1" sinkPad="0" enable="true"/>

<control name="ar0234 c" ctrlId="V4L2_CID_MIPI_LANES" value="2" ctrlName="set mipi lane"/>
<control name="ar0234 c" ctrlId="V4L2_CID_VFLIP" value="1" ctrlName="set vflip"/>
<control name="ar0234 c" ctrlId="V4L2_CID_HFLIP" value="1" ctrlName="set hflip"/>

Expand Down Expand Up @@ -187,7 +183,6 @@
<link srcName="Intel IPU6 CSI-2 4" srcPad="1" sinkName="Intel IPU6 CSI2 BE SOC" sinkPad="2" enable="true"/>
<link srcName="Intel IPU6 CSI2 BE SOC" srcPad="18" sinkName="Intel IPU6 BE SOC capture 2" sinkPad="0" enable="true"/>

<control name="ar0234 e" ctrlId="V4L2_CID_MIPI_LANES" value="2" ctrlName="set mipi lane"/>
<control name="ar0234 e" ctrlId="V4L2_CID_VFLIP" value="1" ctrlName="set vflip"/>
<control name="ar0234 e" ctrlId="V4L2_CID_HFLIP" value="1" ctrlName="set hflip"/>

Expand All @@ -204,7 +199,6 @@
<link srcName="Intel IPU6 CSI-2 4" srcPad="1" sinkName="Intel IPU6 CSI2 BE SOC" sinkPad="2" enable="true"/>
<link srcName="Intel IPU6 CSI2 BE SOC" srcPad="18" sinkName="Intel IPU6 BE SOC capture 2" sinkPad="0" enable="true"/>

<control name="ar0234 e" ctrlId="V4L2_CID_MIPI_LANES" value="2" ctrlName="set mipi lane"/>
<control name="ar0234 e" ctrlId="V4L2_CID_VFLIP" value="1" ctrlName="set vflip"/>
<control name="ar0234 e" ctrlId="V4L2_CID_HFLIP" value="1" ctrlName="set hflip"/>

Expand Down Expand Up @@ -267,7 +261,6 @@
<link srcName="Intel IPU6 CSI-2 5" srcPad="1" sinkName="Intel IPU6 CSI2 BE SOC" sinkPad="3" enable="true"/>
<link srcName="Intel IPU6 CSI2 BE SOC" srcPad="19" sinkName="Intel IPU6 BE SOC capture 3" sinkPad="0" enable="true"/>

<control name="ar0234 f" ctrlId="V4L2_CID_MIPI_LANES" value="2" ctrlName="set mipi lane"/>
<control name="ar0234 f" ctrlId="V4L2_CID_VFLIP" value="1" ctrlName="set vflip"/>
<control name="ar0234 f" ctrlId="V4L2_CID_HFLIP" value="1" ctrlName="set hflip"/>

Expand All @@ -284,7 +277,6 @@
<link srcName="Intel IPU6 CSI-2 5" srcPad="1" sinkName="Intel IPU6 CSI2 BE SOC" sinkPad="3" enable="true"/>
<link srcName="Intel IPU6 CSI2 BE SOC" srcPad="19" sinkName="Intel IPU6 BE SOC capture 3" sinkPad="0" enable="true"/>

<control name="ar0234 f" ctrlId="V4L2_CID_MIPI_LANES" value="2" ctrlName="set mipi lane"/>
<control name="ar0234 f" ctrlId="V4L2_CID_VFLIP" value="1" ctrlName="set vflip"/>
<control name="ar0234 f" ctrlId="V4L2_CID_HFLIP" value="1" ctrlName="set hflip"/>

Expand Down
Binary file not shown.
8 changes: 0 additions & 8 deletions config/linux/ipu6ep/sensors/ar0234.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
<link srcName="Intel IPU6 CSI-2 1" srcPad="1" sinkName="Intel IPU6 CSI2 BE SOC 0" sinkPad="0" enable="true"/>
<link srcName="Intel IPU6 CSI2 BE SOC 0" srcPad="1" sinkName="Intel IPU6 BE SOC capture 0" sinkPad="0" enable="true"/>

<control name="ar0234 b" ctrlId="V4L2_CID_MIPI_LANES" value="2" ctrlName="set mipi lane"/>
<control name="ar0234 b" ctrlId="V4L2_CID_VFLIP" value="1" ctrlName="set vflip"/>
<control name="ar0234 b" ctrlId="V4L2_CID_HFLIP" value="1" ctrlName="set hflip"/>

Expand All @@ -42,7 +41,6 @@
<link srcName="Intel IPU6 CSI-2 1" srcPad="1" sinkName="Intel IPU6 CSI2 BE SOC 0" sinkPad="0" enable="true"/>
<link srcName="Intel IPU6 CSI2 BE SOC 0" srcPad="1" sinkName="Intel IPU6 BE SOC capture 0" sinkPad="0" enable="true"/>

<control name="ar0234 b" ctrlId="V4L2_CID_MIPI_LANES" value="2" ctrlName="set mipi lane"/>
<control name="ar0234 b" ctrlId="V4L2_CID_VFLIP" value="1" ctrlName="set vflip"/>
<control name="ar0234 b" ctrlId="V4L2_CID_HFLIP" value="1" ctrlName="set hflip"/>

Expand Down Expand Up @@ -107,7 +105,6 @@
<link srcName="Intel IPU6 CSI-2 2" srcPad="1" sinkName="Intel IPU6 CSI2 BE SOC 1" sinkPad="0" enable="true"/>
<link srcName="Intel IPU6 CSI2 BE SOC 1" srcPad="1" sinkName="Intel IPU6 BE SOC 1 capture 0" sinkPad="0" enable="true"/>

<control name="ar0234 c" ctrlId="V4L2_CID_MIPI_LANES" value="2" ctrlName="set mipi lane"/>
<control name="ar0234 c" ctrlId="V4L2_CID_VFLIP" value="1" ctrlName="set vflip"/>
<control name="ar0234 c" ctrlId="V4L2_CID_HFLIP" value="1" ctrlName="set hflip"/>

Expand All @@ -124,7 +121,6 @@
<link srcName="Intel IPU6 CSI-2 2" srcPad="1" sinkName="Intel IPU6 CSI2 BE SOC 1" sinkPad="0" enable="true"/>
<link srcName="Intel IPU6 CSI2 BE SOC 1" srcPad="1" sinkName="Intel IPU6 BE SOC 1 capture 0" sinkPad="0" enable="true"/>

<control name="ar0234 c" ctrlId="V4L2_CID_MIPI_LANES" value="2" ctrlName="set mipi lane"/>
<control name="ar0234 c" ctrlId="V4L2_CID_VFLIP" value="1" ctrlName="set vflip"/>
<control name="ar0234 c" ctrlId="V4L2_CID_HFLIP" value="1" ctrlName="set hflip"/>

Expand Down Expand Up @@ -189,7 +185,6 @@
<link srcName="Intel IPU6 CSI-2 4" srcPad="1" sinkName="Intel IPU6 CSI2 BE SOC 2" sinkPad="0" enable="true"/>
<link srcName="Intel IPU6 CSI2 BE SOC 2" srcPad="1" sinkName="Intel IPU6 BE SOC 2 capture 0" sinkPad="0" enable="true"/>

<control name="ar0234 e" ctrlId="V4L2_CID_MIPI_LANES" value="2" ctrlName="set mipi lane"/>
<control name="ar0234 e" ctrlId="V4L2_CID_VFLIP" value="1" ctrlName="set vflip"/>
<control name="ar0234 e" ctrlId="V4L2_CID_HFLIP" value="1" ctrlName="set hflip"/>

Expand All @@ -206,7 +201,6 @@
<link srcName="Intel IPU6 CSI-2 4" srcPad="1" sinkName="Intel IPU6 CSI2 BE SOC 2" sinkPad="0" enable="true"/>
<link srcName="Intel IPU6 CSI2 BE SOC 2" srcPad="1" sinkName="Intel IPU6 BE SOC 2 capture 0" sinkPad="0" enable="true"/>

<control name="ar0234 e" ctrlId="V4L2_CID_MIPI_LANES" value="2" ctrlName="set mipi lane"/>
<control name="ar0234 e" ctrlId="V4L2_CID_VFLIP" value="1" ctrlName="set vflip"/>
<control name="ar0234 e" ctrlId="V4L2_CID_HFLIP" value="1" ctrlName="set hflip"/>

Expand Down Expand Up @@ -270,7 +264,6 @@
<link srcName="Intel IPU6 CSI-2 5" srcPad="1" sinkName="Intel IPU6 CSI2 BE SOC 3" sinkPad="0" enable="true"/>
<link srcName="Intel IPU6 CSI2 BE SOC 3" srcPad="1" sinkName="Intel IPU6 BE SOC 3 capture 0" sinkPad="0" enable="true"/>

<control name="ar0234 f" ctrlId="V4L2_CID_MIPI_LANES" value="2" ctrlName="set mipi lane"/>
<control name="ar0234 f" ctrlId="V4L2_CID_VFLIP" value="1" ctrlName="set vflip"/>
<control name="ar0234 f" ctrlId="V4L2_CID_HFLIP" value="1" ctrlName="set hflip"/>

Expand All @@ -287,7 +280,6 @@
<link srcName="Intel IPU6 CSI-2 5" srcPad="1" sinkName="Intel IPU6 CSI2 BE SOC 3" sinkPad="0" enable="true"/>
<link srcName="Intel IPU6 CSI2 BE SOC 3" srcPad="1" sinkName="Intel IPU6 BE SOC 3 capture 0" sinkPad="0" enable="true"/>

<control name="ar0234 f" ctrlId="V4L2_CID_MIPI_LANES" value="2" ctrlName="set mipi lane"/>
<control name="ar0234 f" ctrlId="V4L2_CID_VFLIP" value="1" ctrlName="set vflip"/>
<control name="ar0234 f" ctrlId="V4L2_CID_HFLIP" value="1" ctrlName="set hflip"/>

Expand Down
Loading

0 comments on commit 3080683

Please sign in to comment.