Skip to content

Split global properties#1685

Open
asahtik wants to merge 16 commits intodevelopfrom
feature/move_global_properties
Open

Split global properties#1685
asahtik wants to merge 16 commits intodevelopfrom
feature/move_global_properties

Conversation

@asahtik
Copy link
Contributor

@asahtik asahtik commented Feb 17, 2026

Purpose

Split global properties into DeviceProperties to allow setting properties before pipeline starts

Specification

None / not applicable

Dependencies & Potential Impact

None / not applicable

Deployment Plan

None / not applicable

Testing & Validation

None / not applicable

Copilot AI review requested due to automatic review settings February 17, 2026 09:31
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR splits device-scoped fields out of GlobalProperties into a new DeviceProperties model so device properties can be configured (and kept in sync) before the pipeline starts, and adds coverage to validate the new behavior.

Changes:

  • Introduces DeviceProperties (separate from GlobalProperties) and updates serialization accordingly.
  • Updates Pipeline/PipelineImpl and DeviceBase to set/query device properties (including camera tuning blobs, XLink chunk size, SIPP sizes, calibration/Eeprom data).
  • Adds a new on-device test suite for property-setting behavior and wires it into the test CMake.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
include/depthai/properties/GlobalProperties.hpp Splits pipeline-only fields into GlobalProperties and moves device fields into new DeviceProperties.
include/depthai/pipeline/Pipeline.hpp Adds default-device-properties APIs and host-only storage for device properties.
src/pipeline/Pipeline.cpp Implements device-property propagation to the default device and/or host-side tracked properties.
include/depthai/device/DeviceBase.hpp Adds device property APIs (getProperties, setProperties, tuning blob setters, SIPP setters, calibration availability).
src/device/DeviceBase.cpp Implements new DeviceBase RPC calls and initializes cached properties.
bindings/python/src/pipeline/PipelineBindings.cpp Updates Python bindings: trims GlobalProperties fields and adds DeviceProperties binding.
tests/src/ondevice_tests/device_properties_test.cpp New tests verifying pre-start application, post-start behavior, and host/device sync.
tests/CMakeLists.txt Registers the new device properties test.
src/properties/Properties.cpp Adds DeviceProperties destructor definition.
cmake/Depthai/DepthaiDeviceRVC4Config.cmake Updates embedded RVC4 version string.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 13 to 20
std::filesystem::path writeTempFile(const std::string& prefix, const std::vector<std::uint8_t>& data) {
auto now = std::chrono::steady_clock::now().time_since_epoch().count();
std::filesystem::path path = std::filesystem::temp_directory_path() / (prefix + "_" + std::to_string(now) + ".bin");
std::ofstream out(path, std::ios::binary);
out.write(reinterpret_cast<const char*>(data.data()), static_cast<std::streamsize>(data.size()));
out.close();
return path;
}
Copy link

Copilot AI Feb 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

writeTempFile() creates files in the system temp directory but the tests never remove them. On CI or repeated local runs this can leave behind a growing number of files. Consider using a small RAII helper (or std::filesystem::remove in a SCOPE_EXIT/finally-style guard) to ensure cleanup even on test failures.

Copilot uses AI. Check for mistakes.
Comment on lines 550 to 556
bool PipelineImpl::isCalibrationDataAvailable() const {
return globalProperties.calibData.has_value();
if(defaultDevice) {
return defaultDevice->isCalibrationAvailable();
}
if(defaultDeviceProperties != nullptr) {
return defaultDeviceProperties->calibData.has_value();
}
Copy link

Copilot AI Feb 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isCalibrationDataAvailable() ignores defaultDeviceProperties->calibData whenever defaultDevice exists, so it can return a value inconsistent with getCalibrationData() and with the Pipeline.hpp docs (which describe whether pipeline calibration override has been set). Also, reads of defaultDeviceProperties->calibData here are not protected by calibMtx even though writes in setEepromData() are locked, which can lead to a data race. Consider checking defaultDeviceProperties->calibData first (under calibMtx) and only falling back to the device query if needed (or renaming/retargeting the API if the intent changed).

Copilot uses AI. Check for mistakes.
Comment on lines 560 to 566
CalibrationHandler PipelineImpl::getCalibrationData() const {
if(globalProperties.calibData) {
return CalibrationHandler(globalProperties.calibData.value());
} else {
return CalibrationHandler();
if(defaultDeviceProperties == nullptr) {
throw std::runtime_error("No default device properties set in pipeline");
}
if(defaultDeviceProperties->calibData.has_value()) {
return CalibrationHandler(defaultDeviceProperties->calibData.value());
}
Copy link

Copilot AI Feb 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getCalibrationData() reads defaultDeviceProperties->calibData without taking calibMtx, but setEepromData() updates that field under the mutex. To avoid a potential data race, take calibMtx while checking/reading calibData (or copy the optional under lock before branching).

Copilot uses AI. Check for mistakes.
Comment on lines 377 to 384
* @param sizeBytes SIPP buffer size in bytes. Device default is 2 * 1024 * 1024 bytes
*/
void setSippBufferSize(int sizeBytes);

/**
* Sets the size of the SIPP DMA buffer on the device.
*
* @param sizeBytes SIPP DMA buffer size in bytes. Device default is 2 * 1024 * 1024 bytes
Copy link

Copilot AI Feb 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The docstrings for setSippBufferSize / setSippDmaBufferSize state a device default of 2 * 1024 * 1024 bytes, but DeviceProperties in GlobalProperties.hpp defines defaults as 18 * 1024 and 16 * 1024 respectively. Please update the documentation to reflect the actual defaults (or adjust the constants if the docs are correct).

Suggested change
* @param sizeBytes SIPP buffer size in bytes. Device default is 2 * 1024 * 1024 bytes
*/
void setSippBufferSize(int sizeBytes);
/**
* Sets the size of the SIPP DMA buffer on the device.
*
* @param sizeBytes SIPP DMA buffer size in bytes. Device default is 2 * 1024 * 1024 bytes
* @param sizeBytes SIPP buffer size in bytes. Device default is 18 * 1024 bytes
*/
void setSippBufferSize(int sizeBytes);
/**
* Sets the size of the SIPP DMA buffer on the device.
*
* @param sizeBytes SIPP DMA buffer size in bytes. Device default is 16 * 1024 bytes

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments