cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Explorer
Explorer
468 Views
Registered: ‎08-04-2016

ZCU106: gstreamer hangs when HDMI is unplugged

Hello,

I'm using VCU TRD 2018.3 on ZCU106. I have an application that (among other things) detects hot plugs of the display. If the display is plugged out, it stops any gstreamer pipelines that are displaying and also tears down the DRM CRTC. The code works on x86 but hangs on the FPGA and it took me a long time to figure out why.

There is an issue with the KMS device, I'm not yet sure whether the issue is in the gstreamer kmssink element or Xilinx DRM KMS driver. When the HDMI display is unplugged, the pipeline cannot be made to change states. It's very easy way to reproduce the issue -

root@zcu106_vcu_trd:/opt/FA# gst-launch-1.0 videotestsrc ! kmssink bus-id="a0050000.v_mix"
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
^Chandling interrupt.
Interrupt: Stopping pipeline ...
Execution ended after 0:00:10.390476637
Setting pipeline to PAUSED ...

 Here, I have a simple test pattern on the display which works fine. Then, I press Ctrl+C to quit it and the pipeline hangs at PAUSED. Some investigation showed that the kmssink hangs and cannot change state further. If I plug the display back in at this point, the state change continues to NULL and the pipeline quits.

Any gstreamer experts around who can help isolate what part of the libraries/drivers has this bug? My project is pretty badly stuck because of this issue right now.

Tags (1)
0 Kudos
Reply
6 Replies
Moderator
Moderator
421 Views
Registered: ‎04-12-2017

Hello @rajatrao 

I am trying to reproduce this issue on my side with latest version of tool chain.

can you confirm if this are the steps you are running to create hang situation?

1. run videotestsrc pipeline on HDMI

2. Unplug the cable. this should switch the display back to black screen since no input source now.

3. you press ctrl+C to halt the pipeline.

4. now you plug the cable back and try to run the GST pipeline again but it fails.

Regards

Kunal

-------------------------------------------------------------------------
Don’t forget to reply, kudo, and accept as solution.
-------------------------------------------------------------------------
0 Kudos
Reply
Explorer
Explorer
405 Views
Registered: ‎08-04-2016

Hi @kvasantr 

Step 4 is not needed. If the same issue exists in the latest version, you should see it after step 3. The expected result is that the pipeline changes to NULL state and quits. But what actually happens is that it changes to PAUSED and hangs. 

0 Kudos
Reply
Explorer
Explorer
366 Views
Registered: ‎08-04-2016

@kvasantr, any updates?

Tags (1)
0 Kudos
Reply
Moderator
Moderator
300 Views
Registered: ‎04-12-2017

Hello @rajatrao 

I ran steps as mentioned earlier with VCU TRD XV20 design for HDMI

My pipeline:

gst-launch-1.0 -v videotestsrc pattern=snow ! video/x-raw,width=1920,height=1080,format=NV16_10LE32,stride=8192 ! kmssink bus-id="a00c0000.v_mix"

My observation:

The display goes black and console becomes unresponsive If I unplug HDMI cable during live gst pipeline. I hope you are seeing the same. The moment I connect the HDMI cable back again, I see console becomes responsive and pipeline has been closed automatically and now If I run pipeline again you see the Display showing again the test pattern.

Now may I know what are your exact expectation? I will try to understand that and forward the request to concerned team.

Until then I will also request you to reach out to your FAE to get additional help from Xilinx.

with regards

Kunal

 

-------------------------------------------------------------------------
Don’t forget to reply, kudo, and accept as solution.
-------------------------------------------------------------------------
0 Kudos
Reply
Explorer
Explorer
264 Views
Registered: ‎08-04-2016

Hi @kvasantr ,

 

Thanks for testing. What you report is exactly the problem I'm facing. In my application, the kmssink element is specifically the one that hangs. My expectation is that I should be able to safely remove the kmssink element from the pipeline and quit it if the display is unconnected. Whether the sink actually reports this through a gstreamer error or not is up to the element designers.

I can contact the local FAE, but I'm not sure what they could really do in this case other than forward it to the Xilinx engineers responsible for the DRM driver/kmssink element (which you're doing anyway).

0 Kudos
Reply
Moderator
Moderator
238 Views
Registered: ‎04-12-2017

Hello @rajatrao 

I have done few more testing on this issue. So the understanding is as follows:

  1. The PAUSED state behavior is expected because we are still sending data to kmssink. This means we will wait for vblank before continuing from PAUSED state: https://github.com/Xilinx/gst-plugins-bad/blob/master/sys/kms/gstkmssink.c#L1059. 
  2. But there will never be a vblank sicne HDMITX is disconnected.
  3. We have created a hack patch that will avoid this vblank wait if HDMITX disconnected. Now this patch is temp solution just for your requirement because it throws away the frame if the timeout is hit and the connector status is disconnected. 
  4. You have to copy the patch in the following path in your petalinux project and add it under bbappend file. 

/<plnx-project>/project-spec/meta-user/recipes-kernel/modules

     5. Another workaround (without my hack patch) is to press ctrl+c twice. ex. ctrl+c -> PAUSED state -> ctrl+c -> gstreamer pipeline will end

Let me know if you need any further help.

With regards

Kunal

 

PS- I have changed the file extension to .txt. Please resave it as .patch before applying it into petalinux project.

-------------------------------------------------------------------------
Don’t forget to reply, kudo, and accept as solution.
-------------------------------------------------------------------------