Add PcloudAmbienceStencil, LG1PcloudAmbienceStencil
These two classes represent our first foray into stencil construction. One of them standardizes PcloudAmbience stencils across all stimbuffs, and the other specifies the internal memory constraints and requirements for a LivoxGen1 device's stencils.
This commit is contained in:
@@ -15,6 +15,7 @@ if(ENABLE_STIMBUFFAPI_livoxGen1)
|
||||
add_library(livoxGen1 SHARED
|
||||
livoxGen1.cpp
|
||||
pcloudStimulusProducer.cpp
|
||||
lg1PcloudAmbienceStencil.cpp
|
||||
ioUringAssemblyEngine.cpp
|
||||
openClCollatingAndMeshingEngine.cpp
|
||||
openClKernels.cl.S
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
#include "lg1PcloudAmbienceStencil.h"
|
||||
#include <unistd.h>
|
||||
|
||||
namespace smo {
|
||||
namespace stim_buff {
|
||||
|
||||
// Common IOEngineConstraints for LG1 ambience stencil StagingBuffer
|
||||
// (used for both input and output constraints)
|
||||
const StagingBuffer::IOEngineConstraints
|
||||
LG1PcloudAmbienceStencil::stencilBufferConstraints(
|
||||
// slotStartAlignmentByteVal, slotPadToNBytes.
|
||||
sizeof(void*),
|
||||
sizeof(PcloudAmbienceStencil::RangeDescriptor),
|
||||
// frameStartAlignmentByteVal, framePadToNBytes.
|
||||
static_cast<size_t>(sysconf(_SC_PAGE_SIZE)),
|
||||
static_cast<size_t>(sysconf(_SC_PAGE_SIZE)));
|
||||
|
||||
} // namespace stim_buff
|
||||
} // namespace smo
|
||||
@@ -0,0 +1,45 @@
|
||||
#ifndef _LG1_PCLOUD_AMBIENCE_STENCIL_H
|
||||
#define _LG1_PCLOUD_AMBIENCE_STENCIL_H
|
||||
|
||||
#include "livoxGen1.h"
|
||||
#include <user/pcloudAmbienceStencil.h>
|
||||
#include <user/stagingBuffer.h>
|
||||
#include <unistd.h>
|
||||
|
||||
namespace smo {
|
||||
namespace stim_buff {
|
||||
|
||||
/**
|
||||
* LG1PcloudAmbienceStencil represents Livox Gen1-specific stencils for
|
||||
* ambience data. The StagingBuffer is sized to handle the worst-case scenario
|
||||
* where every ambience body spot requires its own descriptor
|
||||
* (nDgramsPerFrame slots).
|
||||
*/
|
||||
class LG1PcloudAmbienceStencil
|
||||
: public PcloudAmbienceStencil
|
||||
{
|
||||
public:
|
||||
// Common IOEngineConstraints for stencil buffer (used for both input and output)
|
||||
static const StagingBuffer::IOEngineConstraints stencilBufferConstraints;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param nDgramsPerFrame Number of datagrams per frame, used to size the
|
||||
* stencil buffer for worst-case scenario (one descriptor per dgram)
|
||||
*/
|
||||
explicit LG1PcloudAmbienceStencil(size_t nDgramsPerFrame)
|
||||
: PcloudAmbienceStencil(),
|
||||
stencilBuffer(
|
||||
stencilBufferConstraints, // Input constraints
|
||||
stencilBufferConstraints, // Output constraints (same as input)
|
||||
nDgramsPerFrame)
|
||||
{}
|
||||
|
||||
public:
|
||||
StagingBuffer stencilBuffer;
|
||||
};
|
||||
|
||||
} // namespace stim_buff
|
||||
} // namespace smo
|
||||
|
||||
#endif // _LG1_PCLOUD_AMBIENCE_STENCIL_H
|
||||
@@ -9,7 +9,9 @@
|
||||
#include <asynchronousLoop.h>
|
||||
#include <user/stimulusFrame.h>
|
||||
#include <user/frameAssemblyDesc.h>
|
||||
#include <user/pcloudAmbienceStencil.h>
|
||||
#include <livoxProto1/device.h>
|
||||
#include "livoxGen1.h"
|
||||
#include "pcloudStimulusProducer.h"
|
||||
|
||||
namespace smo {
|
||||
@@ -56,7 +58,7 @@ static StagingBuffer::IOEngineConstraints openClAmbienceInputConstraints(
|
||||
// slotStartAlignmentByteVal (page alignment)
|
||||
static_cast<size_t>(sysconf(_SC_PAGE_SIZE)),
|
||||
// slotPadToNBytes: This is dynamically calculated based on the return mode.
|
||||
sizeof(uint32_t),
|
||||
sizeof(PcloudAmbienceStencil::PcloudAmbienceStimulusValue),
|
||||
// frameStartAlignmentByteVal (page alignment)
|
||||
static_cast<size_t>(sysconf(_SC_PAGE_SIZE)),
|
||||
// framePadToNBytes (pointer size)
|
||||
|
||||
Reference in New Issue
Block a user