Quellcode durchsuchen

Merge tag 'JH7110_MM_v5.9.2' into vf2-devel

Andy Hu vor 6 Monaten
Ursprung
Commit
fe8f46ced4

+ 1 - 2
package/libcamera/libcamera.hash

@@ -1,2 +1 @@
-sha256  f66c16878e335012f0ce5ba1cd47296aa69392bf449b90a1098a16723d1d0ac7  libcamera-a10863152a7ca4b98304e345db3c9f9e0034d8f9-br1.tar.gz
-
+sha256  bf967a208598db61f3d3470948fc82ef539f5c12b67b09891a6d735ba536db1d  libcamera-8e8657042c06d0fc6c90e4031cfb93251ec9d5d2-br1.tar.gz

+ 1 - 1
package/libcamera/libcamera.mk

@@ -4,7 +4,7 @@
 #
 ################################################################################
 
-LIBCAMERA_VERSION = a10863152a7ca4b98304e345db3c9f9e0034d8f9
+LIBCAMERA_VERSION = 8e8657042c06d0fc6c90e4031cfb93251ec9d5d2
 LIBCAMERA_SITE = https://github.com/starfive-tech/libcamera
 LIBCAMERA_SITE_METHOD = git
 

+ 148 - 0
package/starfive/libcamera-apps/0006-Make-the-qt-preview-work-in-debian.patch

@@ -0,0 +1,148 @@
+From 0327a137e069e0cfbdd775f7c40f03e088b765d6 Mon Sep 17 00:00:00 2001
+From: "zejian.su" <zejian.su@starfivetech.com>
+Date: Wed, 8 Nov 2023 09:23:01 +0800
+Subject: [PATCH 2/2] Make the qt preview work in debian. 1. Fill the NV12 data
+ into the QT buffer. 2. For the low performance of QWidget, reduce the FPS to
+ 15.
+
+Signed-off-by: zejian.su <zejian.su@starfivetech.com>
+---
+ preview/preview.cpp    | 37 ++++++++++++++-----------------------
+ preview/qt_preview.cpp | 20 ++++++++++++++++----
+ 2 files changed, 30 insertions(+), 27 deletions(-)
+
+diff --git a/preview/preview.cpp b/preview/preview.cpp
+index b67edb3..d2c511a 100644
+--- a/preview/preview.cpp
++++ b/preview/preview.cpp
+@@ -19,47 +19,38 @@ Preview *make_preview(Options const *options)
+ 	if (options->nopreview)
+ 		return make_null_preview(options);
+ #if QT_PRESENT
+-	else if (options->qt_preview)
++	else
+ 	{
+ 		Preview *p = make_qt_preview(options);
+ 		if (p)
+ 			LOG(1, "Made QT preview window");
+ 		return p;
+ 	}
+-#endif
+-	else
++#else
++	try
++	{
++		throw std::runtime_error("qt5 libraries unavailable.");
++	}
++	catch(std::exception const &e)
+ 	{
+ 		try
+ 		{
+-#if LIBEGL_PRESENT
+-			Preview *p = make_egl_preview(options);
++#if LIBDRM_PRESENT
++			Preview *p = make_drm_preview(options);
+ 			if (p)
+-				LOG(1, "Made X/EGL preview window");
++				LOG(1, "Made DRM preview window");
+ 			return p;
+ #else
+-			throw std::runtime_error("egl libraries unavailable.");
++			throw std::runtime_error("drm libraries unavailable.");
+ #endif
+ 		}
+ 		catch (std::exception const &e)
+ 		{
+-			try
+-			{
+-#if LIBDRM_PRESENT
+-				Preview *p = make_drm_preview(options);
+-				if (p)
+-					LOG(1, "Made DRM preview window");
+-				return p;
+-#else
+-				throw std::runtime_error("drm libraries unavailable.");
+-#endif
+-			}
+-			catch (std::exception const &e)
+-			{
+-				LOG(1, "Preview window unavailable");
+-				return make_null_preview(options);
+-			}
++			LOG(1, "Preview window unavailable");
++			return make_null_preview(options);
+ 		}
+ 	}
++#endif
+ 
+ 	return nullptr; // prevents compiler warning in debug builds
+ }
+diff --git a/preview/qt_preview.cpp b/preview/qt_preview.cpp
+index f595db7..8196a8e 100644
+--- a/preview/qt_preview.cpp
++++ b/preview/qt_preview.cpp
+@@ -58,7 +58,7 @@ protected:
+ class QtPreview : public Preview
+ {
+ public:
+-	QtPreview(Options const *options) : Preview(options)
++	QtPreview(Options const *options) : Preview(options), frame_counter_(0)
+ 	{
+ 		window_width_ = options->preview_width;
+ 		window_height_ = options->preview_height;
+@@ -83,6 +83,12 @@ public:
+ 	void SetInfoText(const std::string &text) override { main_window_->setWindowTitle(QString::fromStdString(text)); }
+ 	virtual void Show(int fd, libcamera::Span<uint8_t> span, StreamInfo const &info) override
+ 	{
++		if((frame_counter_++) & 1) {
++			// Return the buffer to the camera system.
++			done_callback_(fd);
++			return;
++		}
++		
+ 		// Quick and simple nearest-neighbour-ish resampling is used here.
+ 		// We further share U,V samples between adjacent output pixel pairs
+ 		// (even when downscaling) to speed up the conversion.
+@@ -131,6 +137,7 @@ public:
+ 		// take a copy of each row used. This is a speedup provided memcpy() is vectorized.
+ 		tmp_stripe_.resize(2 * info.stride);
+ 		uint8_t const *Y_start = span.data();
++		uint8_t const *UV_start = Y_start + info.height * info.stride;
+ 		uint8_t *Y_row = &tmp_stripe_[0];
+ 		uint8_t *U_row = Y_row + info.stride;
+ 		uint8_t *V_row = U_row + (info.stride >> 1);
+@@ -146,8 +153,11 @@ public:
+ 			unsigned x_pos = x_step >> 1;
+ 
+ 			memcpy(Y_row, Y_start + row * info.stride, info.stride);
+-			memcpy(U_row, Y_start + ((4 * info.height + row) >> 1) * (info.stride >> 1), info.stride >> 1);
+-			memcpy(V_row, Y_start + ((5 * info.height + row) >> 1) * (info.stride >> 1), info.stride >> 1);
++			//memcpy(U_row, Y_start + ((4 * info.height + row) >> 1) * (info.stride >> 1), info.stride >> 1);
++			//memcpy(V_row, Y_start + ((5 * info.height + row) >> 1) * (info.stride >> 1), info.stride >> 1);
++			uint8_t const *cur_uv = UV_start + (row >> 1) * info.width;
++			for(unsigned int uv_idx = 0; uv_idx < info.width >> 1; uv_idx++, cur_uv += 2)
++				U_row[uv_idx] = cur_uv[0], V_row[uv_idx] = cur_uv[1];
+ 
+ 			for (unsigned int x = 0; x < window_width_; x += 2)
+ 			{
+@@ -183,7 +193,7 @@ public:
+ 	}
+ 	// Reset the preview window, clearing the current buffers and being ready to
+ 	// show new ones.
+-	void Reset() override {}
++	void Reset() override {frame_counter_ = 0;}
+ 	// Check if preview window has been shut down.
+ 	bool Quit() override { return main_window_->quit; }
+ 	// There is no particular limit to image sizes, though large images will be very slow.
+@@ -218,6 +228,8 @@ private:
+ 	std::mutex mutex_;
+ 	std::condition_variable cond_var_;
+ 	std::vector<uint8_t> tmp_stripe_;
++
++	unsigned int frame_counter_;
+ };
+ 
+ Preview *make_qt_preview(Options const *options)
+-- 
+2.34.1
+

+ 37 - 0
package/starfive/libcamera-apps/0007-Fix-the-libcamera-still-bug-at-low-resolution-redmin.patch

@@ -0,0 +1,37 @@
+From de29362501b331f640a3d1d1f18722b229044873 Mon Sep 17 00:00:00 2001
+From: "zejian.su" <zejian.su@starfivetech.com>
+Date: Wed, 15 Nov 2023 12:00:25 +0800
+Subject: [PATCH] Fix the libcamera-still bug at low resolution (redmine
+ #8306).
+
+Set the raw stream's resolution too.
+
+Signed-off-by: zejian.su <zejian.su@starfivetech.com>
+---
+ core/libcamera_app.cpp | 8 ++++++--
+ 1 file changed, 6 insertions(+), 2 deletions(-)
+
+diff --git a/core/libcamera_app.cpp b/core/libcamera_app.cpp
+index a49e31d..27d5c44 100644
+--- a/core/libcamera_app.cpp
++++ b/core/libcamera_app.cpp
+@@ -349,10 +349,14 @@ void LibcameraApp::ConfigureStill(unsigned int flags)
+ 		configuration_->at(0).bufferCount = 3;
+ 	else if (options_->buffer_count > 0)
+ 		configuration_->at(0).bufferCount = options_->buffer_count;
+-	if (options_->width)
++	if (options_->width) {
+ 		configuration_->at(0).size.width = options_->width;
+-	if (options_->height)
++		configuration_->at(1).size.width = options_->width;
++	}
++	if (options_->height) {
+ 		configuration_->at(0).size.height = options_->height;
++		configuration_->at(1).size.height = options_->height;
++	}
+ 	configuration_->at(0).colorSpace = libcamera::ColorSpace::Sycc;
+ 	configuration_->transform = options_->transform;
+ 
+-- 
+2.34.1
+