From: Helge Norberg Date: Tue, 5 Jan 2016 22:02:47 +0000 (+0100) Subject: On Linux Decklink cannot DMA transfer from memory returned by glMapBuffer. Thanks... X-Git-Tag: 2.1.0_Beta1~120 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=26bcb0e6c76cf3ef9ee068bcf497545bf0356364;p=casparcg On Linux Decklink cannot DMA transfer from memory returned by glMapBuffer. Thanks Nick from Blackmagic for spotting this. As a workaround we will memcpy to ordinarily allocated memory before scheduling frame. --- diff --git a/modules/decklink/CMakeLists.txt b/modules/decklink/CMakeLists.txt index a379f2742..84ce9d29f 100644 --- a/modules/decklink/CMakeLists.txt +++ b/modules/decklink/CMakeLists.txt @@ -60,6 +60,7 @@ include_directories(${BOOST_INCLUDE_PATH}) include_directories(${TBB_INCLUDE_PATH}) include_directories(${FFMPEG_INCLUDE_PATH}) include_directories(${RXCPP_INCLUDE_PATH}) +include_directories(${ASMLIB_INCLUDE_PATH}) set_target_properties(decklink PROPERTIES FOLDER modules) source_group(sources ./*) diff --git a/modules/decklink/consumer/decklink_consumer.cpp b/modules/decklink/consumer/decklink_consumer.cpp index 2031d19d6..58a53e658 100644 --- a/modules/decklink/consumer/decklink_consumer.cpp +++ b/modules/decklink/consumer/decklink_consumer.cpp @@ -40,6 +40,8 @@ #include #include #include +#include +#include #include #include #include @@ -168,12 +170,12 @@ void set_keyer( class decklink_frame : public IDeckLinkVideoFrame { - tbb::atomic ref_count_; - core::const_frame frame_; - const core::video_format_desc format_desc_; + tbb::atomic ref_count_; + core::const_frame frame_; + const core::video_format_desc format_desc_; - const bool key_only_; - cache_aligned_vector data_; + const bool key_only_; + cache_aligned_vector> data_; public: decklink_frame(core::const_frame frame, const core::video_format_desc& format_desc, bool key_only) : frame_(frame) @@ -216,7 +218,7 @@ public: { if(static_cast(frame_.image_data().size()) != format_desc_.size) { - data_.resize(format_desc_.size, 0); + data_.resize(format_desc_.size); *buffer = data_.data(); } else if(key_only_) @@ -229,7 +231,16 @@ public: *buffer = data_.data(); } else + { *buffer = const_cast(frame_.image_data().begin()); + +#if !defined(_MSC_VER) + // On Linux Decklink cannot DMA transfer from memory returned by glMapBuffer + data_.resize(frame_.image_data().size()); + fast_memcpy(data_.data(), *buffer, frame_.image_data().size()); + *buffer = data_.data(); +#endif + } } catch(...) {