Source: rtl-sdr
Version: 2.0.3-1
Severity: normal
Tags: patch

Dear Maintainer,

the fix for #1041701 (2.0.1-2) is ineffective. Line 13 of debian/rules
reads "-DENABLE_ZEROCOPY=$DEB_ZEROCOPY_OPTION", which make expands as
$D followed by the literal text "EB_ZEROCOPY_OPTION". CMake therefore
receives -DENABLE_ZEROCOPY=EB_ZEROCOPY_OPTION, which is truthy, so
zero-copy is enabled on all architectures, including ARM.

The arm64 buildd log for 2.0.3-1 confirms this:
"Building with usbfs zero-copy support enabled".

Impact: on SoCs with non-coherent USB DMA (e.g. RK3588, Raspberry Pi)
the mmapped usbfs buffers are uncached. With dumpvdl2 on an RK3588
(trixie, librtlsdr0 2.0.2-2+b1) the thread reading the buffers uses
about 52% of a core, versus about 2.6% when the buffer is copied first.

The attached patch changes it to $(DEB_ZEROCOPY_OPTION). Checked with
"make -n -f debian/rules override_dh_auto_configure":
DEB_BUILD_ARCH=arm64 now gives OFF, amd64 gives ON.

Possibly DEB_HOST_ARCH instead of DEB_BUILD_ARCH in line 6 would be
more correct for cross builds.

Regards,
Martin Paul
diff --git a/debian/rules b/debian/rules
index fe75936..436781a 100755
--- a/debian/rules
+++ b/debian/rules
@@ -10,7 +10,7 @@ DEB_ZEROCOPY_OPTION=$(shell if [ $(DEB_BUILD_ARCH) = arm64 ] || [ $(DEB_BUILD_AR
 
 override_dh_auto_configure: debian/librtlsdr0.udev
 	dh_auto_configure --buildsystem=cmake -- -DDETACH_KERNEL_DRIVER=ON \
-						 -DENABLE_ZEROCOPY=$DEB_ZEROCOPY_OPTION \
+						 -DENABLE_ZEROCOPY=$(DEB_ZEROCOPY_OPTION) \
 						 -DINSTALL_UDEV_RULES=ON \
 						 -DCMAKE_BUILD_TYPE=RelWithDebInfo \
 						 -DCMAKE_VERBOSE_MAKEFILE=ON

Reply via email to