cuGraphicsResourceGetMappedPointer returning CUDA_ERROR_INVALID_CONTEXT
Hi, CUDA noob here.
I am using FFmpeg/libav to do video decoding using the NVDEC backend. The video decode in CUVID seems to be happening fine.
However, I am running into an error when stepping up to run a kernel to color-convert the decoded image to a D3D11 texture.
Here is the troublesome snippet, with error handling removed:
CUdeviceptr devptr;
size_t devptrSize;
ID3D11Resource *targetTex = GetScreenTexture();
cuCtxPushCurrent(ffCudaCtx);
cuGraphicsD3D11RegisterResource(&resource, targetTex, 0);
cuGraphicsResourceSetMapFlags(resource, CU_GRAPHICS_MAP_RESOURCE_FLAGS_READONLY);
cuGraphicsMapResources(1, &resource, ffCudaStream);
cuCtxSynchronize();
cuGraphicsResourceGetMappedPointer(&devptr, &devptrSize, resource);
// afterwards: kernel launch, unmap, ctx pop.
That last line is returning 201, CUDA_ERROR_INVALID_CONTEXT. I don't understand why, as the preceding calls all succeeded.
Thanks!
Posted Jan 10, 2020, 11:42 AM UTC
Are you running this on Windows or Ubuntu? If you use the debugging tools in the Nvidia’s IDE, you can get more info about the memory mapped space and from there you can refer to the variable that causes the above
This is on Windows 10.
Sorry, no idea on the windows operating system