Skip to content

gallium/st: fix a deadlock during execute CTS cases

Dong Yang requested to merge dyang23/mesa:main into main

This patch try to fix a deadlock issue when runing android.media.cts.HeifWriterTest#testInputSurface_Grid_Handler

In this case, there are two deadlock threads involved, the cts thread and a drawframe thread. There is an one buffer input Surface bind to encoder, the drawframe thread will try to draw a frame and enqueue to the surface for encode, in st_api_make_currentst() it will pending in surface dequeubuffer() with hold of display lock, and will block cts thread executing, the buffer will be returned after encode done by cts thread, cts waiting for the display lock, and drawframe thread wait for buffer, so deadlock produced.

In case this is not the first time run of make_current(), allocate buffer can be postponed, and in a context without hold of display lock.

Signed-off-by: Yang, Dong dong.yang@intel.com

Merge request reports