Graphics
Intel® graphics drivers and software, compatibility, troubleshooting, performance, and optimization
20585 Discussions

cl_khr_d3d11_sharing causes tearing and artifacts on DG2/A380 and DG1

nyanmisaka
Beginner
1,357 Views

Hello there! I got some tearing and artifacts when sharing textures between the D3D11 and OpenCL. As you can see, there's a noticeable tearing in the image.

212116439-a032fc87-b96a-4ef3-8cc0-1602c1cfc271.png

212118927-95a130b4-8fd3-4f1b-bfc8-b7755fb43938.png

Here's the main procedures to decode and share a video frame in FFmpeg used in our software:


1, hwcontext_d3d11va
- Create D3D11 device on A380, set ID3D10Multithread_SetMultithreadProtected to true.
- Create ID3D11Texture2D texture array with D3D11_RESOURCE_MISC_SHARED.

2, hwcontext_opencl
- Create the OpenCL context with CL_CONTEXT_INTEROP_USER_SYNC=0 on same D3D11 device.
- Use subresource to create Y and UV images from the ID3D11Texture2D texture array with clCreateFromD3D11Texture2DKHR and the cl_intel_d3d11_nv12_media_sharing extension.

3, d3d11va hwaccel decoder
- ID3D11VideoDecoder decode a frame as NV12 or P010 to the ID3D11Texture2D texture array.

4, hwcontext_opencl
- Accquire the image from ID3D11Texture2D texture array with clEnqueueAcquireD3D11ObjectsKHR and wait the event.
- Copy the image to host for debugging.
- Release the accquired image with clEnqueueReleaseD3D11ObjectsKHR and wait the event.

5, uninit and cleanup the decoder and hwcontexts

Once I set the decoder thread count to 1 "-threads 1" in FFmpeg, it gives me tearing and artifacts in the output image.

I only notice the issue on DG2/A380 and a few Xe graphics such as DG1 Max, both are Gen12 platform with the latest WHQL driver 4091 installed. For comparison I also tried the same CLI on an AMD GPU and it works fine.

So I suspect there are some flaws in the Gen12 Windows driver since the cl_khr_d3d11_sharing extension claimed that the driver is responsible for providing the synchronization guarantee if I set CL_CONTEXT_INTEROP_USER_SYNC=0 on context creation.

 

The test video is taken from http://www.larmoire.info/jellyfish/media/jellyfish-120-mbps-4k-uhd-hevc-10bit.mkv and here's the test command for FFmpeg:

 

 

 

./ffmpeg.exe -init_hw_device d3d11va=dx -init_hw_device opencl=ocl@dx `
-hwaccel_device dx -filter_hw_device ocl `
-hwaccel d3d11va -hwaccel_output_format d3d11 -threads 1 `
-c:v hevc -i "jellyfish-120-mbps-4k-uhd-hevc-10bit.mkv" -an -sn `
-vf "hwmap=derive_device=opencl,format=opencl,hwdownload,format=p010" `
-c:v hevc_qsv -preset veryfast -global_quality 30 -g:v 120 -t 30 -y "tearing_artifacts.mp4"

 

 

You can try the command with our pre-built FFmpeg or build the FFmpeg from source with this patch applied to enable the MISC_SHARED flag for D3D11 sharing.

 

The attachment file is the output video from my A380 and my OS is Windows 10 22H2 19045.2546.

I posted this in compute-runtime repository last month but didn't get a reply. Hope you guys can help me solve it.

 

Thanks in advance!

Labels (2)
0 Kudos
5 Replies
Jean_Intel
Employee
1,299 Views

Hello nyanmisaka,

 

Thank you for posting on the Intel️® communities. We are sorry to hear that you are experiencing tearing and artifacts when sharing textures between the D3D11 and OpenCL.

 

We want to investigate this issue. Please, provide us with a report using the Intel®️ System Support Utility (Intel®️ SSU). This report will gather information about your system, such as Operating System Built, Driver, BIOS versions, etc.

  • Download the Intel SSU
  • Open the application and click "Scan" to see the system and device information. By default, Intel®️ SSU will take you to the "Summary View." 
  • Click on the menu where it says: "Summary" to change it to "Detailed View." 
  • To save your scan: click "Next"; then "Save." 

 

Best regards,

Jean O. 

Intel Customer Support Technician


0 Kudos
nyanmisaka
Beginner
1,287 Views

Thanks for you instant reply!

 

The required SSU log is attached.

In the mean while, I updated the driver to the beta version 31.0.101.4123 with no luck.

0 Kudos
Jean_Intel
Employee
1,268 Views

Hello nyanmisaka,

 

Thank you for the information provided.

 

Let us look into this and we will get back to you at our earliest convenience.

 

Best regards,

Jean O.

Intel Customer Support Technician


0 Kudos
Jean_Intel
Employee
1,198 Views

Hello nyanmisaka,

 

We appreciate your patience.

 

We were unable to reproduce this issue, and since you are a developer, please, create an account to submit your inquiry in our Intel®️ Developer Zone, as the document you refer to comes from this website. So, you receive further troubleshooting support and get access to documentation. 

 

Intel®️ Developer Zone - Contact Page 

 

Best regards,

Jean O. 

Intel Customer Support Technician


0 Kudos
Jean_Intel
Employee
1,180 Views

Hello nyanmisaka,

 

We hope you are doing fine.

 

We have not heard back from you. So we will close this thread. If you need any additional information, submit a new question, as this thread will no longer be monitored.

 

Best regards.

Jean O. 

Intel Customer Support Technician.


0 Kudos
Reply