2 Replies Latest reply on Feb 9, 2016 10:15 AM by et@et3d

    OpenCL interop doesn't work?

    et@et3d

      Trying surface->Convert(amf::AMF_MEMORY_OPENCL) in the SimpleDecoder sample prints the following to the console (stdout or stderr):

       

      2016-02-07 18:11:08.764     1184 [DeviceComputeImplDX11]   Error: ..\..\..\..\impl\core\src\DeviceComputeImplDX11.cpp(68):OpenCL failed, error = -4:clEnqueueAcquireD3D11ObjectsKHR(m_clCommandQueue, 1, &clImage, 0, NULL, &clWaitEvent)

       

      I tested it because in my own code this convert seems to take the majority of processing time, so I assumed that it goes through the CPU instead of through interop.

       

      All I did in the sample is add context->InitOpenCL() after context->InitDX11(NULL) and add the conversion in PollingThread::Run (creating a 'surface' variable instead of just using amf::AMFSurfacePtr(data) as a parameter).

       

      Anything I'm missing that's needed to make interop work? This happened to me both on the Radeon R9 290X I previously used and the Radeon R9 Fury I just upgraded to. I'm using Radeon drivers 15.12.

        • Re: OpenCL interop doesn't work?
          et@et3d

          Upon further investigation, it looks like the D3D11 texture returned is in NV12 format, and D3D11 interop doesn't support this (except for Intel where there's a custom extension; AMD, why are you behind?). D3D9 does have such support, using clCreateFromDX9MediaSurfaceKHR, but for one thing I get a DXVA2 error if I try to open more than 6 movies simultaneously (which I want) and if I open fewer I get an error, not immediately but after quite a few frames:

           

          2016-02-09 17:27:32.358  774 [DeviceComputeImplDX9]   Error: ..\..\..\..\impl\core\src\DeviceComputeImplDX9.cpp(86):OpenCL failed, error = -4:clEnqueueAcquireDX9MediaSurfacesKHR(m_clCommandQueue, 1, (cl_mem*)(&clImages[i]), 0, NULL, &events[i])
          • Re: OpenCL interop doesn't work?
            et@et3d

            Doing the DX11 interop myself, it looks like the 1920x1088 NV12 D3D texture is converted to a 1920x1632 CL_R image, with the Y plane first and UV after, which far as I'm concerned is great, so I'm going to use that.