Reopen cpu_dma device when changing settings
This fixes a bug with previous filedes remaining open, only allowing to increase the constraint.
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user