Merge branch 'CR_1165_Libcamera_Kevin.xie' into 'jh7110-mm-devel'

Cr 1165 libcamera kevin.xie

See merge request sdk/buildroot!10
This commit is contained in:
andy.hu
2022-06-24 02:05:34 +00:00
committed by Andy Hu
3 changed files with 416 additions and 0 deletions
@@ -0,0 +1,195 @@
From 43ac4b2e62f6998a24b6b42e2ce25917f674b18b Mon Sep 17 00:00:00 2001
From: liuxl0327 <liuxl0327@starfivetech.com>
Date: Fri, 8 Apr 2022 09:27:55 +0800
Subject: [PATCH] libcamera support isp driver
---
src/libcamera/pipeline/starfive/starfive.cpp | 94 ++++++++++++++------
1 file changed, 65 insertions(+), 29 deletions(-)
diff --git a/src/libcamera/pipeline/starfive/starfive.cpp b/src/libcamera/pipeline/starfive/starfive.cpp
index 0de22f2c..1689ad9d 100644
--- a/src/libcamera/pipeline/starfive/starfive.cpp
+++ b/src/libcamera/pipeline/starfive/starfive.cpp
@@ -73,55 +73,61 @@ std::vector<SensorConfig> sensorConfigs;
typedef struct {
std::string source;
- std::string link;
+ unsigned int sourceIdx;
+ std::string sink;
+ unsigned int sinkIdx;
} PipelineConfigLink;
const std::vector<PipelineConfigLink> dvpyuvConfig = {
- {"stf_dvp0", "stf_vin0_wr"},
+ {"stf_dvp0", 1, "stf_vin0_wr", 0},
};
const std::vector<PipelineConfigLink> mipicsi0yuvConfig = {
- {"stf_csiphy0", "stf_csi0"},
- {"stf_csi0", "stf_vin0_wr"}
+ {"stf_csiphy0", 1, "stf_csi0", 0},
+ {"stf_csi0", 1, "stf_vin0_wr", 0}
};
const std::vector<PipelineConfigLink> mipicsi1yuvConfig = {
- {"stf_csiphy1", "stf_csi1"},
- {"stf_csi1", "stf_vin0_wr"}
+ {"stf_csiphy1", 1, "stf_csi1", 0},
+ {"stf_csi1", 1, "stf_vin0_wr", 0}
};
const std::vector<PipelineConfigLink> dvpraw0Config = {
- {"stf_dvp0", "stf_isp0"},
- {"stf_isp0", "stf_vin0_isp0"}
+ {"stf_dvp0", 1, "stf_isp0", 0},
};
const std::vector<PipelineConfigLink> mipicsi0raw0Config = {
- {"stf_csiphy0", "stf_csi0"},
- {"stf_csi0", "stf_isp0"},
- {"stf_isp0", "stf_vin0_isp0"}
+ {"stf_csiphy0", 1, "stf_csi0", 0},
+ {"stf_csi0", 1, "stf_isp0", 0},
};
const std::vector<PipelineConfigLink> mipicsi1raw0Config = {
- {"stf_csiphy1", "stf_csi1"},
- {"stf_csi1", "stf_isp0"},
- {"stf_isp0", "stf_vin0_isp0"}
+ {"stf_csiphy1", 1, "stf_csi1", 0},
+ {"stf_csi1", 1, "stf_isp0", 0},
};
const std::vector<PipelineConfigLink> dvpraw1Config = {
- {"stf_dvp0", "stf_isp1"},
- {"stf_isp1", "stf_vin0_isp1"}
+ {"stf_dvp0", 1, "stf_isp1", 0},
};
const std::vector<PipelineConfigLink> mipicsi0raw1Config = {
- {"stf_csiphy0", "stf_csi0"},
- {"stf_csi0", "stf_isp1"},
- {"stf_isp1", "stf_vin0_isp1"}
+ {"stf_csiphy0", 1, "stf_csi0", 0},
+ {"stf_csi0", 1, "stf_isp1", 0},
};
const std::vector<PipelineConfigLink> mipicsi1raw1Config = {
- {"stf_csiphy1", "stf_csi1"},
- {"stf_csi1", "stf_isp1"},
- {"stf_isp1", "stf_vin0_isp1"}
+ {"stf_csiphy1", 1, "stf_csi1", 0},
+ {"stf_csi1", 1, "stf_isp1", 0},
+};
+
+const std::vector<PipelineConfigLink> isp0Config = {
+ {"stf_isp0", 1, "stf_vin0_isp0", 0},
+ {"stf_isp0", 6, "stf_vin0_isp0_raw", 0}
+};
+
+const std::vector<PipelineConfigLink> isp1Config = {
+ {"stf_isp1", 1, "stf_vin0_isp1", 0},
+ {"stf_isp1", 6, "stf_vin0_isp1_raw", 0}
};
const std::vector<PipelineConfigLink> pipelineConfigs[SENSORTYPE_MAX] = {
@@ -248,9 +254,9 @@ private:
{
LOG(STARFIVE, Debug) << __func__;
if ( videoEntityName_ == "stf_vin0_isp0_video1")
- return "stf_vin0_isp0_raw_video3";
+ return "stf_vin0_isp0_raw_video11";
else if (videoEntityName_ == "stf_vin0_isp1_video2")
- return "stf_vin0_isp1_raw_video4";
+ return "stf_vin0_isp1_raw_video12";
else
return "unknow";
}
@@ -438,6 +444,7 @@ private:
int registerCameras();
std::string getVideoEntityNameById(unsigned int id);
std::string findSensorEntityName(std::string entityName);
+ int enableLinks(int sensorType);
int enableLinks(std::vector<PipelineConfigLink> config);
MediaDevice *starFiveMediaDev_;
@@ -544,7 +551,7 @@ PipelineHandlerStarFive::generateConfiguration(Camera *camera,
if (roles.empty())
return config;
- int ret = enableLinks(pipelineConfigs[sensorConfig.sensorType_]);
+ int ret = enableLinks(sensorConfig.sensorType_);
if (ret < 0) {
LOG(STARFIVE, Error)
<< sensorConfig.sensorEntityName_
@@ -942,9 +949,9 @@ std::string PipelineHandlerStarFive::getVideoEntityNameById(unsigned int id)
case 2:
return "stf_vin0_isp1_video2";
case 3:
- return "stf_vin0_isp0_raw_video3";
+ return "stf_vin0_isp0_raw_video11";
case 4:
- return "stf_vin0_isp1_raw_video4";
+ return "stf_vin0_isp1_raw_video12";
default:
return "unknow";
}
@@ -1028,7 +1035,7 @@ int PipelineHandlerStarFive::registerCameras()
MediaEntity *sensorEntity =
starFiveMediaDev_->getEntityByName(it.sensorEntityName_);
if (sensorEntity != nullptr) {
- int ret = enableLinks(pipelineConfigs[it.sensorType_]);
+ int ret = enableLinks(it.sensorType_);
if (ret < 0) {
LOG(STARFIVE, Error)
<< it.sensorEntityName_
@@ -1097,7 +1104,7 @@ int PipelineHandlerStarFive::enableLinks(std::vector<PipelineConfigLink> config)
LOG(STARFIVE, Debug) << __func__;
for (PipelineConfigLink it : config) {
- MediaLink *link = starFiveMediaDev_->link(it.source, 1, it.link, 0);
+ MediaLink *link = starFiveMediaDev_->link(it.source, it.sourceIdx, it.sink, it.sinkIdx);
if (!link)
return -ENODEV;
@@ -1126,6 +1133,35 @@ int PipelineHandlerStarFive::enableLinks(std::vector<PipelineConfigLink> config)
return ret;
}
+int PipelineHandlerStarFive::enableLinks(int sensorType)
+{
+ int ret = 0;
+
+ LOG(STARFIVE, Debug) << __func__;
+ if (sensorType > SENSORTYPE_MAX || sensorType < DVP_YUV)
+ return -ENODEV;
+
+ ret = enableLinks(pipelineConfigs[sensorType]);
+ if (ret)
+ return ret;
+ switch (sensorType) {
+ case DVP_ISP0:
+ case MIPICSI0_ISP0:
+ case MIPICSI1_ISP0:
+ ret = enableLinks(isp0Config);
+ break;
+ case DVP_ISP1:
+ case MIPICSI0_ISP1:
+ case MIPICSI1_ISP1:
+ ret = enableLinks(isp1Config);
+ break;
+ default:
+ break;
+ }
+
+ return ret;
+}
+
static void loaddefaultSensorConfig(void)
{
LOG(STARFIVE, Debug) << __func__;
--
2.17.1
@@ -0,0 +1,63 @@
From 6d4c962f44084b0e01ec49d37818fcdd10e9c01d Mon Sep 17 00:00:00 2001
From: "Kevin.xie" <kevin.xie@starfivetech.com>
Date: Wed, 8 Jun 2022 14:38:08 +0800
Subject: [PATCH] Adjust StarFive pipeline video device entity name
Signed-off-by: Kevin.xie <kevin.xie@starfivetech.com>
---
src/libcamera/pipeline/starfive/starfive.cpp | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/src/libcamera/pipeline/starfive/starfive.cpp b/src/libcamera/pipeline/starfive/starfive.cpp
index 7f02baf..03f0949 100755
--- a/src/libcamera/pipeline/starfive/starfive.cpp
+++ b/src/libcamera/pipeline/starfive/starfive.cpp
@@ -199,7 +199,7 @@ public:
videoEntityName_ = entityName;
if ( videoEntityName_ == "stf_vin0_isp0_video1")
ispEntityName_ = "stf_isp0";
- else if (videoEntityName_ == "stf_vin0_isp1_video2")
+ else if (videoEntityName_ == "stf_vin0_isp1_video8")
ispEntityName_ = "stf_isp1";
else
ispEntityName_ = "unknow";
@@ -258,9 +258,9 @@ private:
{
LOG(STARFIVE, Debug) << __func__;
if ( videoEntityName_ == "stf_vin0_isp0_video1")
- return "stf_vin0_isp0_raw_video11";
- else if (videoEntityName_ == "stf_vin0_isp1_video2")
- return "stf_vin0_isp1_raw_video12";
+ return "stf_vin0_isp0_raw_video6";
+ else if (videoEntityName_ == "stf_vin0_isp1_video8")
+ return "stf_vin0_isp1_raw_video13";
else
return "unknow";
}
@@ -983,11 +983,11 @@ std::string PipelineHandlerStarFive::getVideoEntityNameById(unsigned int id)
case 1:
return "stf_vin0_isp0_video1";
case 2:
- return "stf_vin0_isp1_video2";
+ return "stf_vin0_isp1_video8";
case 3:
- return "stf_vin0_isp0_raw_video11";
+ return "stf_vin0_isp0_raw_video6";
case 4:
- return "stf_vin0_isp1_raw_video12";
+ return "stf_vin0_isp1_raw_video13";
default:
return "unknow";
}
@@ -1255,7 +1255,7 @@ bool PipelineHandlerStarFive::match(DeviceEnumerator *enumerator)
DeviceMatch dm("stf-vin");
dm.add("stf_vin0_wr_video0");
dm.add("stf_vin0_isp0_video1");
- dm.add("stf_vin0_isp1_video2");
+ dm.add("stf_vin0_isp1_video8");
LOG(STARFIVE, Debug) << __func__;
starFiveMediaDev_ = acquireMediaDevice(enumerator, dm);
--
2.17.1
@@ -0,0 +1,158 @@
From 3c0db39c0acd04c9ddfd37279efb9bf47bf1f74c Mon Sep 17 00:00:00 2001
From: "Kevin.xie" <kevin.xie@starfivetech.com>
Date: Thu, 9 Jun 2022 19:08:14 +0800
Subject: [PATCH] Removed isp1 config from pipeline & modified imx219 config
Signed-off-by: Kevin.xie <kevin.xie@starfivetech.com>
---
.../pipeline/starfive/sensors_pipeline.yaml | 6 +--
src/libcamera/pipeline/starfive/starfive.cpp | 47 +------------------
2 files changed, 2 insertions(+), 51 deletions(-)
diff --git a/src/libcamera/pipeline/starfive/sensors_pipeline.yaml b/src/libcamera/pipeline/starfive/sensors_pipeline.yaml
index 3446b0a..dc4fc63 100644
--- a/src/libcamera/pipeline/starfive/sensors_pipeline.yaml
+++ b/src/libcamera/pipeline/starfive/sensors_pipeline.yaml
@@ -25,11 +25,7 @@
#
---
sensors:
- - sensorentity: "imx219 0-0010"
+ - sensorentity: "imx219 4-0010"
ispfwimage: "stf_isp0_fw_dump.bin"
sensortype: 4
-
- - sensorentity: "imx219 2-0010"
- ispfwimage: "stf_isp0_fw_dump.bin"
- sensortype: 8
...
diff --git a/src/libcamera/pipeline/starfive/starfive.cpp b/src/libcamera/pipeline/starfive/starfive.cpp
index cc4cd1e..7f97069 100644
--- a/src/libcamera/pipeline/starfive/starfive.cpp
+++ b/src/libcamera/pipeline/starfive/starfive.cpp
@@ -55,9 +55,6 @@ typedef enum {
DVP_ISP0, // ISP0
MIPICSI0_ISP0,
MIPICSI1_ISP0,
- DVP_ISP1, // ISP1
- MIPICSI0_ISP1,
- MIPICSI1_ISP1,
SENSORTYPE_MAX
} SensorType;
@@ -68,8 +65,7 @@ typedef struct {
} SensorConfig;
const std::vector<SensorConfig> defaultSensorConfigs = {
- { "imx219 0-0010", "stf_isp0_fw_dump.bin", MIPICSI0_ISP0 },
- { "imx219 2-0010", "stf_isp0_fw_dump.bin", MIPICSI1_ISP1 },
+ { "imx219 4-0010", "stf_isp0_fw_dump.bin", MIPICSI0_ISP0 },
};
std::vector<SensorConfig> sensorConfigs;
@@ -109,30 +105,11 @@ const std::vector<PipelineConfigLink> mipicsi1raw0Config = {
{"stf_csi1", 1, "stf_isp0", 0},
};
-const std::vector<PipelineConfigLink> dvpraw1Config = {
- {"stf_dvp0", 1, "stf_isp1", 0},
-};
-
-const std::vector<PipelineConfigLink> mipicsi0raw1Config = {
- {"stf_csiphy0", 1, "stf_csi0", 0},
- {"stf_csi0", 1, "stf_isp1", 0},
-};
-
-const std::vector<PipelineConfigLink> mipicsi1raw1Config = {
- {"stf_csiphy1", 1, "stf_csi1", 0},
- {"stf_csi1", 1, "stf_isp1", 0},
-};
-
const std::vector<PipelineConfigLink> isp0Config = {
{"stf_isp0", 1, "stf_vin0_isp0", 0},
{"stf_isp0", 6, "stf_vin0_isp0_raw", 0}
};
-const std::vector<PipelineConfigLink> isp1Config = {
- {"stf_isp1", 1, "stf_vin0_isp1", 0},
- {"stf_isp1", 6, "stf_vin0_isp1_raw", 0}
-};
-
const std::vector<PipelineConfigLink> pipelineConfigs[SENSORTYPE_MAX] = {
dvpyuvConfig,
mipicsi0yuvConfig,
@@ -140,9 +117,6 @@ const std::vector<PipelineConfigLink> pipelineConfigs[SENSORTYPE_MAX] = {
dvpraw0Config,
mipicsi0raw0Config,
mipicsi1raw0Config,
- dvpraw1Config,
- mipicsi0raw1Config,
- mipicsi1raw1Config,
};
} /* namespace */
@@ -199,8 +173,6 @@ public:
videoEntityName_ = entityName;
if ( videoEntityName_ == "stf_vin0_isp0_video1")
ispEntityName_ = "stf_isp0";
- else if (videoEntityName_ == "stf_vin0_isp1_video8")
- ispEntityName_ = "stf_isp1";
else
ispEntityName_ = "unknow";
@@ -260,8 +232,6 @@ private:
LOG(STARFIVE, Debug) << __func__;
if ( videoEntityName_ == "stf_vin0_isp0_video1")
return "stf_vin0_isp0_raw_video6";
- else if (videoEntityName_ == "stf_vin0_isp1_video8")
- return "stf_vin0_isp1_raw_video13";
else
return "unknow";
}
@@ -984,11 +954,7 @@ std::string PipelineHandlerStarFive::getVideoEntityNameById(unsigned int id)
case 1:
return "stf_vin0_isp0_video1";
case 2:
- return "stf_vin0_isp1_video8";
- case 3:
return "stf_vin0_isp0_raw_video6";
- case 4:
- return "stf_vin0_isp1_raw_video13";
default:
return "unknow";
}
@@ -1060,11 +1026,6 @@ int PipelineHandlerStarFive::registerCameras()
case MIPICSI1_ISP0:
id = 1;
break;
- case DVP_ISP1:
- case MIPICSI0_ISP1:
- case MIPICSI1_ISP1:
- id = 2;
- break;
default:
continue;
}
@@ -1187,11 +1148,6 @@ int PipelineHandlerStarFive::enableLinks(int sensorType)
case MIPICSI1_ISP0:
ret = enableLinks(isp0Config);
break;
- case DVP_ISP1:
- case MIPICSI0_ISP1:
- case MIPICSI1_ISP1:
- ret = enableLinks(isp1Config);
- break;
default:
break;
}
@@ -1256,7 +1212,6 @@ bool PipelineHandlerStarFive::match(DeviceEnumerator *enumerator)
DeviceMatch dm("stf-vin");
dm.add("stf_vin0_wr_video0");
dm.add("stf_vin0_isp0_video1");
- dm.add("stf_vin0_isp1_video8");
LOG(STARFIVE, Debug) << __func__;
starFiveMediaDev_ = acquireMediaDevice(enumerator, dm);
--
2.17.1