Hello everyone.
I have a producer consumer system, with an argus producer from one side and a cuda consumer from the other side. The argus producer is setted to repeated request mode and the cuda consumer has been conected to the output stream in a different thread. What I want to do is to check if there is a new frame in the EGL buffer before Cuda consumer tries to acquire a new frame. I managed to do that with this reference
http://gis.gha-engineers.com/pub/visionworks/nvvwx_docs/group__nvx__tutorial__eglstream__interoperability__3.html
and by assigning an EGL display to the output stream like this :
Argus producer:
ArgusSamples::Window &window = ArgusSamples::Window::getInstance();
window.setWindowRect(0, 0, 1200, 500);
g_display.initialize(window.getEGLNativeDisplay());
....
iStreamSettings->setEGLDisplay(g_display.get());
....
Cuda consumer:
/* Query the EGL stream state to determine whether a new frame is available */
EGLint streamState = 0;
if (!eglQueryStreamKHR(iStream->getEGLDisplay(), iStream->getEGLStream(), EGL_STREAM_STATE_KHR, &streamState))
{
CUDACONSUMER_ERROR("eglQueryStreamKHR EGL_STREAM_STATE_KHR failed");
continue;
}
if (streamState == EGL_STREAM_STATE_DISCONNECTED_KHR)
{
CUDACONSUMER_ERROR("EGL_STREAM_STATE_DISCONNECTED_KHR received");
continue;
}
else if (streamState != EGL_STREAM_STATE_NEW_FRAME_AVAILABLE_KHR)
{
CUDACONSUMER_DEBUG("No frames available");
continue;
}
/* Acquire the newly produced frame */
CUresult cuResult;
CUgraphicsResource cudaResource = 0;
CUstream cudaStream = 0;
cuResult = cuEGLStreamConsumerAcquireFrame(&cudaConnection, &cudaResource, &cudaStream, 32000);
if (cuResult != CUDA_SUCCESS)
{
CUDACONSUMER_ERROR("Acquire failed: (CUresult " + std::string(ArgusSamples::getCudaErrorString(cuResult)) + ")");
continue;
}
How can I do the same action but without assigning a display to the output stream ?
I tried to give a NULL argument to the eglQueryStreamKHR like this
eglQueryStreamKHR(NULL, iStream->getEGLStream(), EGL_STREAM_STATE_KHR, &streamState)
but fails with: eglQueryStreamKHR EGL_STREAM_STATE_KHR failed
Any idea ? Thanks in advance!