From b67d783cd6d9b82de08b3e70368d3874bee07605 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Thu, 10 Jun 2021 21:35:52 +0200 Subject: [PATCH] Reopen cpu_dma device when changing settings This fixes a bug with previous filedes remaining open, only allowing to increase the constraint. --- libs/ardour/globals.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/libs/ardour/globals.cc b/libs/ardour/globals.cc index 1902f77a8b..5bc9c6fbe3 100644 --- a/libs/ardour/globals.cc +++ b/libs/ardour/globals.cc @@ -286,12 +286,14 @@ setup_hardware_optimization (bool try_optimization) } static void -release_dma_latency () +release_dma_latency (bool log = true) { #if !(defined PLATFORM_WINDOWS || defined __APPLE__) if (cpu_dma_latency_fd >= 0) { - info << _("Released CPU DMA latency request") << endmsg; ::close (cpu_dma_latency_fd); + if (log) { + info << _("Released CPU DMA latency request") << endmsg; + } } cpu_dma_latency_fd = -1; #endif @@ -313,6 +315,8 @@ request_dma_latency () return true; } + release_dma_latency (false); + cpu_dma_latency_fd = ::open("/dev/cpu_dma_latency", O_WRONLY); if (cpu_dma_latency_fd < 0) { warning << string_compose (_("Could not set CPU DMA latency to %1 usec (%2)"), target, strerror (errno)) << endmsg;