Skip to content

Commit 6e24360

Browse files
QSchulzpinchartl
authored andcommitted
Revert "libcamera: rkisp1: Eliminate hard-coded resizer limits"
This reverts commit e85c7dd. Linux kernel predating 6.4 (specifically commit 7cfb35d3a800 ("media: rkisp1: Implement ENUM_FRAMESIZES") do not have the ioctl in rkisp1 driver required to dynamically query the resizer limits. Because of that, maxResolution and minResolution are both {0, 0} (default value for Size objects) which means filterSensorResolution() will create an entry for the sensor in sensorSizesMap_ but because the sensor resolution cannot fit inside the min and max resolution of the rkisp1, no size is put into this entry in sensorSizesMap_. On the next call to filterSensorResolution(), sensorSizesMap_.find(sensor) will return the entry but when attempting to call back() on iter->second, it'll trigger an assert because the size array is empty. Linux kernel 6.1 is supported until December 2027, so it seems premature to get rid of those hard-coded resizer limits before this happens. Let's restore the hard-coded resizer limits as fallbacks, actual limits are still queried from the driver on recent enough kernels. Fixes: 7615454 ("pipeline: rkisp1: Filter out sensor sizes not supported by the pipeline") Signed-off-by: Quentin Schulz <[email protected]> Reviewed-by: Jacopo Mondi <[email protected]> Reviewed-by: Laurent Pinchart <[email protected]> Signed-off-by: Laurent Pinchart <[email protected]>
1 parent 5b73d25 commit 6e24360

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

src/libcamera/pipeline/rkisp1/rkisp1_path.cpp

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,11 @@ const std::map<PixelFormat, uint32_t> formatToMediaBus = {
5454

5555
} /* namespace */
5656

57-
RkISP1Path::RkISP1Path(const char *name, const Span<const PixelFormat> &formats)
58-
: name_(name), running_(false), formats_(formats), link_(nullptr)
57+
RkISP1Path::RkISP1Path(const char *name, const Span<const PixelFormat> &formats,
58+
const Size &minResolution, const Size &maxResolution)
59+
: name_(name), running_(false), formats_(formats),
60+
minResolution_(minResolution), maxResolution_(maxResolution),
61+
link_(nullptr)
5962
{
6063
}
6164

@@ -517,10 +520,12 @@ void RkISP1Path::stop()
517520
}
518521

519522
/*
520-
* \todo Remove the hardcoded formats once all users will have migrated to a
521-
* recent enough kernel.
523+
* \todo Remove the hardcoded resolutions and formats once kernels older than
524+
* v6.4 will stop receiving LTS support (scheduled for December 2027 for v6.1).
522525
*/
523526
namespace {
527+
constexpr Size RKISP1_RSZ_MP_SRC_MIN{ 32, 16 };
528+
constexpr Size RKISP1_RSZ_MP_SRC_MAX{ 4416, 3312 };
524529
constexpr std::array<PixelFormat, 18> RKISP1_RSZ_MP_FORMATS{
525530
formats::YUYV,
526531
formats::NV16,
@@ -542,6 +547,8 @@ constexpr std::array<PixelFormat, 18> RKISP1_RSZ_MP_FORMATS{
542547
formats::SRGGB12,
543548
};
544549

550+
constexpr Size RKISP1_RSZ_SP_SRC_MIN{ 32, 16 };
551+
constexpr Size RKISP1_RSZ_SP_SRC_MAX{ 1920, 1920 };
545552
constexpr std::array<PixelFormat, 8> RKISP1_RSZ_SP_FORMATS{
546553
formats::YUYV,
547554
formats::NV16,
@@ -555,12 +562,14 @@ constexpr std::array<PixelFormat, 8> RKISP1_RSZ_SP_FORMATS{
555562
} /* namespace */
556563

557564
RkISP1MainPath::RkISP1MainPath()
558-
: RkISP1Path("main", RKISP1_RSZ_MP_FORMATS)
565+
: RkISP1Path("main", RKISP1_RSZ_MP_FORMATS,
566+
RKISP1_RSZ_MP_SRC_MIN, RKISP1_RSZ_MP_SRC_MAX)
559567
{
560568
}
561569

562570
RkISP1SelfPath::RkISP1SelfPath()
563-
: RkISP1Path("self", RKISP1_RSZ_SP_FORMATS)
571+
: RkISP1Path("self", RKISP1_RSZ_SP_FORMATS,
572+
RKISP1_RSZ_SP_SRC_MIN, RKISP1_RSZ_SP_SRC_MAX)
564573
{
565574
}
566575

src/libcamera/pipeline/rkisp1/rkisp1_path.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ struct V4L2SubdeviceFormat;
3434
class RkISP1Path
3535
{
3636
public:
37-
RkISP1Path(const char *name, const Span<const PixelFormat> &formats);
37+
RkISP1Path(const char *name, const Span<const PixelFormat> &formats,
38+
const Size &minResolution, const Size &maxResolution);
3839

3940
bool init(MediaDevice *media);
4041

0 commit comments

Comments
 (0)