@@ -136,7 +136,7 @@ int KMSSink::configure(const libcamera::CameraConfiguration &config)
return 0;
}
-int KMSSink::configurePipeline(const libcamera::PixelFormat &format)
+int KMSSink::selectPipeline(const libcamera::PixelFormat &format)
{
/*
* If the requested format has an alpha channel, also consider the X
@@ -174,25 +174,31 @@ int KMSSink::configurePipeline(const libcamera::PixelFormat &format)
crtc_ = crtc;
plane_ = plane;
format_ = format;
- break;
+ return 0;
}
if (plane->supportsFormat(xFormat)) {
crtc_ = crtc;
plane_ = plane;
format_ = xFormat;
- break;
+ return 0;
}
}
}
}
- if (!crtc_) {
+ return -EPIPE;
+}
+
+int KMSSink::configurePipeline(const libcamera::PixelFormat &format)
+{
+ const int ret = selectPipeline(format);
+ if (ret) {
std::cerr
<< "Unable to find display pipeline for format "
<< format.toString() << std::endl;
- return -EPIPE;
+ return ret;
}
std::cout
@@ -200,7 +206,7 @@ int KMSSink::configurePipeline(const libcamera::PixelFormat &format)
<< ", connector " << connector_->name()
<< " (" << connector_->id() << ")" << std::endl;
- return 0;
+ return ret;
}
int KMSSink::start()
@@ -47,6 +47,7 @@ private:
libcamera::Request *camRequest_;
};
+ int selectPipeline(const libcamera::PixelFormat &format);
int configurePipeline(const libcamera::PixelFormat &format);
void requestComplete(DRM::AtomicRequest *request);
The break only breaks out of the innermost loop which is not the most optimal. It also breaks cam on my machines. Fixes: 1de0f90dd432 ("cam: kms_sink: Print display pipelineconfiguration") Signed-off-by: Eric Curtin <ecurtin@redhat.com> --- Changes in v2: - Change function name to selectPipeline - Return int rather than pointer - Formatting - Mention in commit message that it fixes a bug on my machine also src/cam/kms_sink.cpp | 18 ++++++++++++------ src/cam/kms_sink.h | 1 + 2 files changed, 13 insertions(+), 6 deletions(-)