Opened 8 years ago
Closed 8 years ago
Last modified 6 years ago
#12799 closed Developer Task (fixed)
Improve OSD on Raspberry Pi
Reported by: | Peter Bennett | Owned by: | Peter Bennett |
---|---|---|---|
Priority: | minor | Milestone: | unknown |
Component: | Ports - rPi | Version: | Master Head |
Severity: | medium | Keywords: | |
Cc: | Ticket locked: | no |
Description
The playback OSD on Raspberry Pi has some problems:
- Can cause the video to become choppy due to high CPU utilization.
- On standard definition channels or videos the OSD is low-definition.
Fix this by using OpenGL to display the OSD over the video instead of merging the OSD into the frames. Leave the software merge available as an alternative in case of problems with OpenGL support.
Change History (8)
comment:1 Changed 8 years ago by
Status: | new → accepted |
---|
comment:3 Changed 8 years ago by
Replying to pbennett:
Options:
- Investigate further into which specific OGL operations are slow and try to improve them.
This is probably worth doing anyway, as it will improve overall UX
- Put OSD rendering in a separate thread. This may require a new osd renderer object and ways of synchronizing information. Simply using the existing OSD object in another thread does not work, for several reasons.
- Use the OSD::Draw method instead, which draws into a memory image, and then use OpenGL to display that image. The OSD::Draw is used by software merge and is fast.
Which of these 2 is the "right way"? I currently lean towards #3 as that will be the easiest in the short term, but if it's not great in the long term then #2 becomes more appealing....
Regards Stuart
comment:4 Changed 8 years ago by
The performance problems are now solved. I have now implemented two new OSD rendering methods that are available when selecting Openmax video rendering:
OpenGL - This uses the existing opengl code with good performance. All OSD show without any jerkiness, except for subtitles on Raspberry Pi 2. All OSD are fine with Pi 3.
Threaded - Combines 2 and 3 of the above proposal. On Raspberry Pi 2 this can be used if you want subtitles. It gives good OSD but keyboard response is sluggish.
There is one OpenGL performance enhancement - disabling flush. Flush is called frequently in the code and I am not sure why it is needed. I have a change that disables it only for the openmax OSD. That flag can also be enabled if needed in other cases.
To get these changes, opengl must be enabled in configure.
I will commit these changes soon. Currently they are in my bennettpeter git repo.
comment:5 Changed 8 years ago by
Resolution: | → fixed |
---|---|
Status: | accepted → closed |
comment:6 Changed 8 years ago by
The improvements only work on raspbian, not on ubuntu.
To see the improved features add these options to configure
--enable-opengl --disable-opengl-themepainter
Select playback profile "OpenMax High Quality"
See wiki page https://www.mythtv.org/wiki/Raspberry_Pi
comment:8 Changed 6 years ago by
Owner: | changed from Peter Bennett to Peter Bennett |
---|
I have the OSD displaying with OpenGL ES on raspberry pi, using the existing code that displays with OpenGL. All OSDs are displaying correctly and with excellent detail, but there is a severe performance problem. Playback is badly impacted when the OSD appears. Subtitles are the worst offender. In general performance is much worse than with Software merge.
Investigation shows that the call to OSD::DrawDirect is taking from 200 ms to 700 ms. Since this is done between frames in the frame rendering thread, up to 21 frames are lost when an OSD appears or changes. CPU time is not high so I suspect that the OpenGL calls are blocking.
Removing the call to glFlush improves performance, but not enough. With this change, calls to OSD::DrawDirect take from 50 ms to 200 ms.
Options: