summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEric Curtin <ecurtin@redhat.com>2022-02-07 15:01:36 +0000
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2022-02-08 12:42:19 +0200
commitca20503f6295a6cc25261ad5b975a73c961ae73b (patch)
tree7d537aba52bc23a140f6ce00a288c0e86e78efb4 /src
parent7653021549583a58660d46e3d160c82f58f22c69 (diff)
cam: kms_sink: Use the first suitable pipeline found
When searching for a suitable pipeline, we mistakenly only break from the inner loop. This results in the last suitable output being selected. Pick the first one instead. Fixes: 1de0f90dd432 ("cam: kms_sink: Print display pipelineconfiguration") Signed-off-by: Eric Curtin <ecurtin@redhat.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'src')
-rw-r--r--src/cam/kms_sink.cpp16
-rw-r--r--src/cam/kms_sink.h1
2 files changed, 12 insertions, 5 deletions
diff --git a/src/cam/kms_sink.cpp b/src/cam/kms_sink.cpp
index d30fba78..da579846 100644
--- a/src/cam/kms_sink.cpp
+++ b/src/cam/kms_sink.cpp
@@ -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
diff --git a/src/cam/kms_sink.h b/src/cam/kms_sink.h
index 1e4290ad..4a0a872c 100644
--- a/src/cam/kms_sink.h
+++ b/src/cam/kms_sink.h
@@ -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);