From f599f1bd8e2d163b467ae0a44f5c4fcd40aa4969 Mon Sep 17 00:00:00 2001 From: Matthias Wirth Date: Sat, 27 Apr 2024 15:18:12 +0200 Subject: [PATCH] add option to disable librtlsdr zero copy workaround only disable workaround if zerocopy is disabled in librtlsdr otherwise expect significantly increased CPU use --- Makefile | 5 +++++ sdr_rtlsdr.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 884aa362..9b431768 100644 --- a/Makefile +++ b/Makefile @@ -38,6 +38,11 @@ else LIBS += -lncurses endif +# only disable workaround if zerocopy is disabled in librtlsdr, otherwise expect significantly increased CPU use +ifeq ($(DISABLE_RTLSDR_ZEROCOPY_WORKAROUND), yes) + CFLAGS += -DDISABLE_RTLSDR_ZEROCOPY_WORKAROUND +endif + ifeq ($(HISTORY), yes) CFLAGS += -DALL_JSON=1 endif diff --git a/sdr_rtlsdr.c b/sdr_rtlsdr.c index 11018de7..46eefbc0 100644 --- a/sdr_rtlsdr.c +++ b/sdr_rtlsdr.c @@ -57,7 +57,7 @@ #include -#if defined(__arm__) || defined(__aarch64__) +#if (defined(__arm__) || defined(__aarch64__)) && !defined(DISABLE_RTLSDR_ZEROCOPY_WORKAROUND) // Assume we need to use a bounce buffer to avoid performance problems on Pis running kernel 5.x and using zerocopy # define USE_BOUNCE_BUFFER #endif