StimBuff: Use a single StagingBuffer for all StimFrames

We now allocate all the stimFrames for a StimBuffer using a
single StagingBuffer. This gives us all the benefits we're
looking for (pinning, alignment, etc).
This commit is contained in:
2025-11-19 03:08:16 -04:00
parent 3f04d1b387
commit 41b8385cb2
8 changed files with 93 additions and 57 deletions
+8 -6
View File
@@ -6,6 +6,7 @@
#include <memory>
#include <user/spMcRingBuffer.h>
#include <user/stagingBuffer.h>
#include <user/frameAssemblyDesc.h>
#include "stimulusFrame.h"
#include "deviceAttachmentSpec.h"
@@ -30,15 +31,15 @@ public:
&deviceAttachmentSpec,
int histbuffMs,
const StagingBuffer::IOEngineConstraints& inputEngineConstraints,
const StagingBuffer::IOEngineConstraints& outputEngineConstraints,
size_t nSlotsPerStimFrame)
const StagingBuffer::IOEngineConstraints& outputEngineConstraints)
: parent(parent),
deviceAttachmentSpec(deviceAttachmentSpec),
histbuffMs(histbuffMs),
ringBuffer(
static_cast<size_t>(histbuffMs / CONFIG_STIMBUFF_FRAME_PERIOD_MS),
inputEngineConstraints, outputEngineConstraints,
nSlotsPerStimFrame)
stagingBuffer(
inputEngineConstraints,
outputEngineConstraints,
static_cast<size_t>(histbuffMs / CONFIG_STIMBUFF_FRAME_PERIOD_MS)),
ringBuffer(static_cast<std::shared_ptr<FrameAssemblyDesc>>(stagingBuffer))
{}
virtual ~StimulusBuffer() = default;
@@ -53,6 +54,7 @@ public:
StimulusProducer& parent;
std::shared_ptr<device::DeviceAttachmentSpec> deviceAttachmentSpec;
int histbuffMs;
StagingBuffer stagingBuffer;
SpMcRingBuffer ringBuffer;
};