Resolve device selector on detach and add YuvStimProducer state tests.
Detach finds the shared producer via lcameraDev_resolveDeviceSelectorCReq then removes buffers by attach identity; unit tests cover quale guards. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,95 @@
|
||||
#include <hilSmoCallbacksStub.h>
|
||||
#include <opts.h>
|
||||
#include <user/comparatorApiDesc.h>
|
||||
#include <spinscale/componentThread.h>
|
||||
|
||||
namespace lcamera_buff_tests {
|
||||
|
||||
namespace {
|
||||
|
||||
std::optional<std::string> searchForLibInSmoSearchPathsStub(
|
||||
const std::string& libraryPath)
|
||||
{
|
||||
(void)libraryPath;
|
||||
|
||||
const char *overridePath = std::getenv("LCAMERADEV_LIB_PATH");
|
||||
if (overridePath != nullptr && std::string(overridePath).size() > 0) {
|
||||
return overridePath;
|
||||
}
|
||||
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
std::shared_ptr<sscl::ComponentThread> componentThreadGetSelfStub()
|
||||
{
|
||||
return sscl::ComponentThread::getSelf();
|
||||
}
|
||||
|
||||
OptionParser& optionParserGetOptionsStub()
|
||||
{
|
||||
return OptionParser::getOptions();
|
||||
}
|
||||
|
||||
void releaseUseHostPtrBufferStub(
|
||||
std::shared_ptr<smo::compute::ClBuffer> buffer)
|
||||
{
|
||||
(void)buffer;
|
||||
}
|
||||
|
||||
std::shared_ptr<smo::compute::ComputeDevice> computeManagerGetDeviceStub()
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void computeManagerReleaseDeviceStub(
|
||||
std::shared_ptr<smo::compute::ComputeDevice> device)
|
||||
{
|
||||
(void)device;
|
||||
}
|
||||
|
||||
std::shared_ptr<smo::cologex::ExportedComparatorTypeDesc>
|
||||
comparatorManagerGetComparatorTypeStub(smo::cologex::ComparatorTypeId typeId)
|
||||
{
|
||||
(void)typeId;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::unique_ptr<smo::cologex::Comparator> comparatorGetNewInstanceStub(
|
||||
const std::shared_ptr<smo::cologex::ExportedComparatorTypeDesc>& comparatorType)
|
||||
{
|
||||
(void)comparatorType;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const smo::stim_buff::SmoCallbacks hilCallbacks = {
|
||||
.searchForLibInSmoSearchPaths = searchForLibInSmoSearchPathsStub,
|
||||
.ComponentThread_getSelf = componentThreadGetSelfStub,
|
||||
.OptionParser_getOptions = optionParserGetOptionsStub,
|
||||
.ComputeManager_createUseHostPtrBuffer = createUseHostPtrBufferStub,
|
||||
.ComputeManager_releaseUseHostPtrBuffer = releaseUseHostPtrBufferStub,
|
||||
.ComputeManager_getDevice = computeManagerGetDeviceStub,
|
||||
.ComputeManager_releaseDevice = computeManagerReleaseDeviceStub,
|
||||
.ComparatorManager_getComparatorType =
|
||||
comparatorManagerGetComparatorTypeStub,
|
||||
.Comparator_getNewInstance = comparatorGetNewInstanceStub,
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
std::shared_ptr<smo::compute::ClBuffer> createUseHostPtrBufferStub(
|
||||
void* hostPtr,
|
||||
size_t size,
|
||||
cl_mem_flags flags)
|
||||
{
|
||||
static const std::vector<std::shared_ptr<smo::compute::ComputeDevice>>
|
||||
emptyDevices;
|
||||
return std::make_shared<smo::compute::ClBuffer>(
|
||||
hostPtr, size, flags, emptyDevices);
|
||||
}
|
||||
|
||||
const smo::stim_buff::SmoCallbacks& hilSmoCallbacksStub()
|
||||
{
|
||||
return hilCallbacks;
|
||||
}
|
||||
|
||||
} // namespace lcamera_buff_tests
|
||||
Reference in New Issue
Block a user