diff --git a/include/DMDUtil/DMD.h b/include/DMDUtil/DMD.h index e0b5a20..4988e8e 100644 --- a/include/DMDUtil/DMD.h +++ b/include/DMDUtil/DMD.h @@ -339,7 +339,7 @@ class DMDUTILAPI DMD bool m_dumpSuffixValid = false; bool m_hasUpdateBuffered = false; - static bool m_finding; + static std::atomic m_finding; #if !( \ (defined(__APPLE__) && ((defined(TARGET_OS_IOS) && TARGET_OS_IOS) || (defined(TARGET_OS_TV) && TARGET_OS_TV))) || \ diff --git a/platforms/config.sh b/platforms/config.sh index ffce11e..3cc1f8a 100755 --- a/platforms/config.sh +++ b/platforms/config.sh @@ -3,7 +3,7 @@ set -e LIBZEDMD_SHA=dc6613ddfabece90dcb345001aa5ff313d40a1e1 -LIBSERUM_SHA=579c557d474e4728d17dd525bb3c30eb8f2680c1 +LIBSERUM_SHA=ea1d6a31e60e0708d04ccd05d60fdaaef72a4448 LIBPUPDMD_SHA=cd186754ba0dcc1ea418d5557d59d7bf2ed628a3 LIBVNI_SHA=ba43c5abff7fbbb831a4beb9be54447df1532f0c LIBUSB_SHA=15a7ebb4d426c5ce196684347d2b7cafad862626 diff --git a/src/DMD.cpp b/src/DMD.cpp index a8e9532..d8a7d2b 100644 --- a/src/DMD.cpp +++ b/src/DMD.cpp @@ -218,7 +218,7 @@ class DMDServerConnector sockpp::tcp_connector* m_pConnector; }; -bool DMD::m_finding = false; +std::atomic DMD::m_finding{false}; void DMD::Update::convertToHostByteOrder() { @@ -514,7 +514,7 @@ bool DMD::ConnectDMDServer() return (m_pDMDServerConnector); } -bool DMD::IsFinding() { return m_finding; } +bool DMD::IsFinding() { return m_finding.load(std::memory_order_acquire); } bool DMD::HasDisplay() const { @@ -1015,7 +1015,7 @@ bool DMD::WaitForSerumColorizeCapture(uint64_t sourceOrdinal, SerumCapture& capt void DMD::FindDisplays() { - if (m_finding) return; + if (m_finding.load(std::memory_order_acquire)) return; Config* const pConfig = Config::GetInstance(); @@ -1026,7 +1026,7 @@ void DMD::FindDisplays() if (pConfig->IsLocalDisplaysActive()) { - m_finding = true; + m_finding.store(true, std::memory_order_release); std::thread( [this]() @@ -1146,7 +1146,7 @@ void DMD::FindDisplays() } #endif - m_finding = false; + m_finding.store(false, std::memory_order_release); }) .detach(); } @@ -1510,6 +1510,13 @@ void DMD::SerumThread() { if (strcmp(m_romName, name) != 0) { + // don't load Serum until all displays are found + if (m_finding.load(std::memory_order_acquire)) + { + QueueBuffer(); + continue; + } + strcpy(name, m_romName); if (m_pSerum) @@ -1523,10 +1530,28 @@ void DMD::SerumThread() if (m_altColorPath[0] == '\0') strcpy(m_altColorPath, Config::GetInstance()->GetAltColorPath()); flags = 0; + const bool zedmdOnly = m_pZeDMD && m_rgb24DMDs.empty() && m_levelDMDs.empty() +#if !( \ + (defined(__APPLE__) && ((defined(TARGET_OS_IOS) && TARGET_OS_IOS) || (defined(TARGET_OS_TV) && TARGET_OS_TV))) || \ + defined(__ANDROID__)) + && !m_pPixelcadeDMD +#endif +#if defined(DMDUTIL_ENABLE_PIN2DMD) && !((defined(__APPLE__) && ((defined(TARGET_OS_IOS) && TARGET_OS_IOS) || \ + (defined(TARGET_OS_TV) && TARGET_OS_TV))) || \ + defined(__ANDROID__)) + && !m_PIN2DMDConnected +#endif + ; + + if (zedmdOnly) + { + // A single ZeDMD only needs the frame height it can actually render. + flags = (m_pZeDMD->GetHeight() == 64) ? FLAG_REQUEST_64P_FRAMES : FLAG_REQUEST_32P_FRAMES; + } // At the moment, ZeDMD HD and RGB24DMD are the only devices supporting 64P frames. Not requesting 64P // saves memory. - if (m_pZeDMD) + if (!zedmdOnly && m_pZeDMD) { if (m_pZeDMD->GetHeight() == 64) flags |= FLAG_REQUEST_64P_FRAMES; diff --git a/src/convertSerum.cpp b/src/convertSerum.cpp index d888809..fea4caa 100644 --- a/src/convertSerum.cpp +++ b/src/convertSerum.cpp @@ -150,11 +150,11 @@ int main(int argc, char* argv[]) uint8_t flags = FLAG_REQUEST_32P_FRAMES | FLAG_REQUEST_64P_FRAMES; if (opt_strip_sd) { - flags = FLAG_REQUEST_64P_FRAMES; + flags = FLAG_REQUEST_64P_FRAMES | FLAG_REQUEST_FORCE; } else if (opt_strip_hd) { - flags = FLAG_REQUEST_32P_FRAMES; + flags = FLAG_REQUEST_32P_FRAMES | FLAG_REQUEST_FORCE; } if (opt_logging)