Infinite Timeout Support #3

Hi,

this is a follow up of this thread.

Meanwhile I tried to use enableCamInfiniteTimeout=1 with L4T 36.2. It seems that it is still not working:

SCF: Error Timeout: Sending critical error event for Session 1 
 (in src/api/Session.cpp, function sendErrorEvent(), line 979)
SCF: Error InvalidState: Session has suffered a critical failure (in src/api/Session.cpp, function capture(), line 675)
SCF: Error InvalidState: Timeout!! Skipping requests on sensor GUID 1, capture sequence ID = 4 draining session frameStart events 1
 (in src/services/capture/FusaCaptureViCsiHw.cpp, function waitCsiFrameStart(), line 536)
(Argus) Error InvalidState:  (propagating from src/api/ScfCaptureThread.cpp, function run(), line 110)
PowerServiceCore:handleRequests: timePassed = 2653
SCF: Error InvalidState: Sensor 1 already in same state 
 (in src/services/capture/CaptureServiceDeviceSensor.cpp, function setErrorState(), line 100)
SCF: Error InvalidState: Timeout!! Skipping requests on sensor GUID 1, capture sequence ID = 3 draining session frameEnd events 2
 (in src/services/capture/FusaCaptureViCsiHw.cpp, function waitCsiFrameEnd(), line 639)
SCF: Error BadParameter: CC has already been disposed (in src/components/CaptureContainerManager.cpp, function dispose(), line 161)
SCF: Error InvalidState: Timeout!! Skipping requests on sensor GUID 1, capture sequence ID = 5 draining session frameStart events 1
 (in src/services/capture/FusaCaptureViCsiHw.cpp, function waitCsiFrameStart(), line 536)
SCF: Error BadParameter: CC has already been disposed (in src/components/CaptureContainerManager.cpp, function dispose(), line 161)
SCF: Error BadParameter: CC has already been disposed (in src/components/CaptureContainerManager.cpp, function dispose(), line 161)
SCF: Error BadParameter: CC has already been disposed (in src/components/CaptureContainerManager.cpp, function dispose(), line 161)
SCF: Error InvalidState: Sensor 1 already in same state 
 (in src/services/capture/CaptureServiceDeviceSensor.cpp, function setErrorState(), line 100)
SCF: Error InvalidState: Timeout!! Skipping requests on sensor GUID 1, capture sequence ID = 4 draining session frameEnd events 2
 (in src/services/capture/FusaCaptureViCsiHw.cpp, function waitCsiFrameEnd(), line 639)
SCF: Error BadParameter: CC has already been disposed (in src/components/CaptureContainerManager.cpp, function dispose(), line 161)
SCF: Error InvalidState: Sensor 1 already in same state 
 (in src/services/capture/CaptureServiceDeviceSensor.cpp, function setErrorState(), line 100)
SCF: Error InvalidState: Timeout!! Skipping requests on sensor GUID 1, capture sequence ID = 5 draining session frameEnd events 1
 (in src/services/capture/FusaCaptureViCsiHw.cpp, function waitCsiFrameEnd(), line 639)
SCF: Error BadParameter: CC has already been disposed (in src/components/CaptureContainerManager.cpp, function dispose(), line 161)

Is there a patch or anything else to support infinite cam timeout with l4t 36.2?

hello MarkusHess,

please apply the pre-built update manually, Topic293579_May22_libnvscf.7z (1.6 MB)

although the fixes to support infinite cam timeout did not catch JP-6 GA release date, the change had check-in to rel-36 code-line.

Hi JerryChang,

when using the patched libnvscf.so, it crashes on start:

OFParserListModules: module list: /proc/device-tree/tegra-camera-platform/modules/module0
OFParserListModules: module list: /proc/device-tree/tegra-camera-platform/modules/module1
NvPclHwGetModuleList: WARNING: Could not map module to ISP config string
NvPclHwGetModuleList: No module data found
NvPclHwGetModuleList: WARNING: Could not map module to ISP config string
NvPclHwGetModuleList: No module data found
OFParserGetVirtualDevice: NVIDIA Camera virtual enumerator not found in proc device-tree
---- imager: No override file found. ----
SCF: Error BadParameter: Unknown sensor pixel type (in src/common/Utils.cpp, function translateColorFormat(), line 432)
SCF: Error BadParameter:  (propagating from src/services/capture/CaptureServiceDeviceSensor.cpp, function open(), line 216)
SCF: Error BadParameter:  (propagating from src/services/capture/CaptureServiceDeviceSensor.cpp, function getSourceFromGuid(), line 722)
SCF: Error BadParameter:  (propagating from src/services/capture/CaptureService.cpp, function addSourceByGuid(), line 453)
SCF: Error BadParameter:  (propagating from src/api/CameraDriver.cpp, function addSourceByIndex(), line 347)
SCF: Error BadParameter:  (propagating from src/api/CameraDriver.cpp, function getSource(), line 519)
Acquiring SCF Camera device source via index 0 has failed. ---- imager: No override file found. ----
(NvCamV4l2) Error ModuleNotPresent: V4L2Device not available (in /dvs/git/dirty/git-master_linux/camera/utils/nvcamv4l2/v4l2_device.cpp, function findDevice(), line 256)
(NvCamV4l2) Error ModuleNotPresent:  (propagating from /dvs/git/dirty/git-master_linux/camera/utils/nvcamv4l2/v4l2_device.cpp, function initialize(), line 60)
(NvOdmDevice) Error ModuleNotPresent:  (propagating from dvs/git/dirty/git-master_linux/camera-partner/imager/src/devices/V4L2SensorViCsi.cpp, function initialize(), line 107)
NvPclDriverInitializeData: Unable to initialize driver v4l2_sensor
NvPclInitializeDrivers: error: Failed to init camera sub module v4l2_sensor
NvPclStartPlatformDrivers: Failed to start module drivers
NvPclDriver_V4L2_Focuser_Stub_Close: Invalid NULL input pPclDriver
NvPclStateControllerOpen: Failed ImagerGUID 0. (error 0xA000E)
NvPclOpen: PCL Open Failed. Error: 0xf
SCF: Error BadParameter: Sensor could not be opened. (in src/services/capture/CaptureServiceDeviceSensor.cpp, function getSourceFromGuid(), line 725)
SCF: Error BadParameter:  (propagating from src/services/capture/CaptureService.cpp, function addSourceByGuid(), line 453)
SCF: Error BadParameter:  (propagating from src/api/CameraDriver.cpp, function addSourceByIndex(), line 347)
SCF: Error BadParameter:  (propagating from src/api/CameraDriver.cpp, function getSource(), line 519)
Acquiring SCF Camera device source via index 1 has failed. Segmentation fault (core dumped)

The old lib is working, besides the issue with the enableCamInfiniteTimeout. So may there is a version conflict? I am on L4T r36.2.

@JerryChang I noticed, l4t 36.3 was released. May the libs you provided are for that version? Should I update?

hello MarkusHess,

please note that r36.2 is a Developer Preview version,
you may use below pre-built update with r36.3, which is a production quality release version.
for instance, Topic293579_May29_r363.7z (1.6 MB)

Hi JerryChang,

with r36.3 and the updated libnvscf.so, enableCamInfiniteTimeout=1 is working again. Unfortunately there is still the issue, that the waitForEvents function of CaptureSession’s EventProvider waits forever even when a timeout value was provided. Therefore, my application gets stuck on exit if no event occures. See here a reduced example:

Argus::IEventProvider *iEventProvider = captureSession->eventProvider();
uint64_t eventTimeout = 2000000000; // 2 seconds as nanoseconds

std::vector<Argus::EventType> eventTypes;
eventTypes.push_back(Argus::EVENT_TYPE_CAPTURE_COMPLETE);
eventTypes.push_back(Argus::EVENT_TYPE_ERROR);
Argus::UniqueObj<Argus::EventQueue> eventQueue(iEventProvider->createEventQueue(eventTypes));

while(m_run) {
    std::cout << "wait for events" << std::endl;

    // This call should abort after 2 seconds (eventTimeout) if no event occures
    // but unfortunately it waits forever when enableCamInfiniteTimeout=1
    iEventProvider->waitForEvents(eventQueue.get(), eventTimeout);

    std::cout << "wait for events done" << std::endl;
}

I hoped this would be fixed in the new version. Do you have another solution/idea to exit the event reading loop if no event occures?

hello MarkusHess,

FYI, the status on rel-36 remain the same as mentioned here… Topic 284939, comment #5.
so far, it’ll be waiting continuously only when SOF signal received.

anyways, let me arrange resources to have some internal discussion and investigation.

Perfect, thanks a lot. Please let me know when there are any news from the discussion.

Also, will the patched libnvscf.so provided by you be part of the next release? For production use, we would prefer to use an official release.

hello MarkusHess,

as you may know… we need some time for getting code reviewed, tested, and check-in to main code-line.
even though such fix did not catch JP-6.0 GA release date, you may still use pre-built update (i.e. Topic293579_May29_r363.7z) for your use-case.

yes, the change to support infinite camera timeout setting has already merged into rel-36 code-line.
please expect next Jetpack-6 public release (i.e. Jetpack-6.1/ l4t-r36.4) will include this fix as well.

hello MarkusHess,

I’ve went through the code regarding to the issue you’ve reported in comment #8.
it looks waitForEvents() still treat timeout values in the scope. however, it needs to wait until at least one event is available.

here’s a pre-built binary file, Topic293579_Jun11.zip (453.2 KB) which has some debug messages for checking waitForEvents(),
I’ve also try to revise the code for exit the reading loop if no event occures.
please give it a try, thanks

Hi JerryChang,

I am getting Illegal instruction (core dumped) if I use this library. May this is for a different device?

hello MarkusHess,

I was shared the pre-built based-on r36.3 release version.
anyways, let’s have a new thread for following-up waitForEvents() issues.