Skip to content

Commit

Permalink
Merge pull request intel#101 from hao-yao/dfsg
Browse files Browse the repository at this point in the history
Fix build on Ubuntu 24.04
  • Loading branch information
hao-yao authored Apr 11, 2024
2 parents 87ce886 + 5517ff9 commit 2c65e66
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 6 deletions.
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ set (CMAKE_CXX_STANDARD 11)
add_compile_options(-Wall -Werror
-fstack-protector
-fPIE -fPIC
-U_FORTIFY_SOURCE
-D_FORTIFY_SOURCE=2
-DDCHECK_ALWAYS_ON
-Wformat -Wformat-security
Expand Down Expand Up @@ -151,7 +152,7 @@ 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 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Wl,-z,relro -Wl,-z,now")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${LIBCAMHAL_LD_FLAGS}")

add_subdirectory(src)
Expand Down
2 changes: 1 addition & 1 deletion config/linux/ipu6epmtl/sensors/ov01a1s-uf.xml
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@
<pslOutputMapForRotation value="1280x720@1280x720,640x480@640x480,320x240@640x480"/>

<maxRequestsInflight value="5"/>
<supportPrivacy value="1"/> <!-- privacy mode, 0: off, 1: CVF privacy 2: AE-based privacy -->
<supportPrivacy value="0"/> <!-- privacy mode, 0: off, 1: CVF privacy 2: AE-based privacy -->
</Sensor>
</CameraSettings>

6 changes: 3 additions & 3 deletions config/linux/ipu6epmtl/sensors/ov02c10-uf.xml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
<enableAiqd value = "true"/>
<useCrlModule value = "false"/>
<maxRequestsInflight value="5"/>
<supportPrivacy value="1"/> <!-- privacy mode, 0: off, 1: CVF privacy 2: AE-based privacy -->
<supportPrivacy value="0"/> <!-- privacy mode, 0: off, 1: CVF privacy 2: AE-based privacy -->
</Sensor>
<Sensor name="ov02c10-uf" description="OV02C10 sensor.">
<MediaCtlConfig id="0" ConfigMode="AUTO" outputWidth="1928" outputHeight="1092" format="V4L2_PIX_FMT_SGRBG10"><!-- RAW10 BE capture -->
Expand Down Expand Up @@ -147,7 +147,7 @@
<enableAiqd value = "true"/>
<useCrlModule value = "false"/>
<maxRequestsInflight value="5"/>
<supportPrivacy value="1"/> <!-- privacy mode, 0: off, 1: CVF privacy 2: AE-based privacy -->
<supportPrivacy value="0"/> <!-- privacy mode, 0: off, 1: CVF privacy 2: AE-based privacy -->
</Sensor>
<Sensor name="ov02c10-uf" description="OV02C10 sensor.">
<MediaCtlConfig id="0" ConfigMode="AUTO" outputWidth="1928" outputHeight="1092" format="V4L2_PIX_FMT_SGRBG10"><!-- RAW10 BE capture -->
Expand Down Expand Up @@ -214,7 +214,7 @@
<enableAiqd value = "true"/>
<useCrlModule value = "false"/>
<maxRequestsInflight value="5"/>
<supportPrivacy value="1"/> <!-- privacy mode, 0: off, 1: CVF privacy 2: AE-based privacy -->
<supportPrivacy value="0"/> <!-- privacy mode, 0: off, 1: CVF privacy 2: AE-based privacy -->
</Sensor>
</CameraSettings>

30 changes: 29 additions & 1 deletion src/v4l2/MediaControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ struct MediaEntity {
char devname[32];
};

static const string ivscName = "Intel IVSC CSI";
MediaControl* MediaControl::sInstance = nullptr;
Mutex MediaControl::sLock;

Expand Down Expand Up @@ -868,6 +869,29 @@ int MediaControl::mediaCtlSetup(int cameraId, MediaCtlConf* mc, int width, int h
}
}

MediaEntity* ivsc = getEntityByName(ivscName.c_str());
if (ivsc) {
for (uint32_t i = 0; i < ivsc->numLinks; ++i) {
if (ivsc->links[i].sink->entity == ivsc) {
MediaEntity* sensor = ivsc->links[i].source->entity;
int sensor_entity_id = sensor->info.id;
LOG1("@%s, found %s -> %s", __func__,
sensor->info.name, ivscName.c_str());
for (McLink& link : mc->links) {
if (link.srcEntity == sensor_entity_id) {
LOG1("@%s, skip %s, link %s -> %s",
__func__, link.srcEntityName.c_str(),
ivscName.c_str(), link.sinkEntityName.c_str());
link.srcEntity = ivsc->info.id;
link.srcEntityName = ivscName;
break;
}
}
break;
}
}
}

/* Set link in format Configuration */
ret = setMediaMcLink(mc->links);
CheckAndLogError(ret != OK, ret, "set MediaCtlConf McLink failed: ret = %d", ret);
Expand Down Expand Up @@ -938,7 +962,8 @@ bool MediaControl::checkAvailableSensor(const std::string& sensorEntityName,
int linksCount = entity.info.links;
MediaLink* links = entity.links;
for (int i = 0; i < linksCount; i++) {
if (strcmp(links[i].sink->entity->info.name, sinkEntityName.c_str()) == 0) {
if (strcmp(links[i].sink->entity->info.name, sinkEntityName.c_str()) == 0 ||
strcmp(links[i].sink->entity->info.name, ivscName.c_str()) == 0) {
char* entityName = entity.info.name;
if (strncmp(entityName, sensorEntityNameTmp.c_str(), nameLen) == 0) {
return true;
Expand All @@ -965,6 +990,9 @@ int MediaControl::getI2CBusAddress(const string& sensorEntityName, const string&
for (int i = 0; i < linksCount; i++) {
if (strcmp(links[i].sink->entity->info.name, sinkEntityName.c_str()) == 0) {
entityName = entity.info.name;
if (strcmp(entityName, ivscName.c_str()) == 0) {
return getI2CBusAddress(sensorEntityName, ivscName, i2cBus);
}
break;
}
}
Expand Down

0 comments on commit 2c65e66

Please sign in to comment.