After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 753886 - Poor GLImageSink performance on Raspberry Pi
Poor GLImageSink performance on Raspberry Pi
Status: RESOLVED DUPLICATE of bug 760916
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
1.5.90
Other Linux
: Normal normal
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2015-08-20 16:47 UTC by Sam Hurst
Modified: 2016-05-15 08:47 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Caps for gst-launch-1.0 filesrc location =/path/ ! qtdemux ! h264parse ! omxh264dec ! glimagesink (4.08 KB, text/plain)
2016-01-12 21:18 UTC, Sergey Borovkov
Details

Description Sam Hurst 2015-08-20 16:47:31 UTC
(Following on from https://bugzilla.gnome.org/show_bug.cgi?id=752376 )

In the 1.6 Release Candidate (1.5.90), there seems to have been a regression in OpenGL performance with regard to the GLImageSink. In the 1.4.5 release, I could play back a normal 1080p video fine on my Raspberry Pi 2, but in the new 1.5.90 release candidate the video is constantly stalling and end playback is only managing about 1 frame per second.

This is also reproducible using videotestsrc:

$ gst-launch-1.0 videotestsrc ! video/x-raw,width=1920,height=1080 ! glimagesink

The above will result in GStreamer printing the following over and over again:

WARNING: from element /GstPlayBin:playbin0/GstPlaySink:playsink/GstBin:vbin/GstGLImageSinkBin:glimagesinkbin0/GstGLImageSink:sink: A lot of buffers are being dropped.
Additional debug info:
gstbasesink.c(2846): gst_base_sink_is_too_late (): /GstPlayBin:playbin0/GstPlaySink:playsink/GstBin:vbin/GstGLImageSinkBin:glimagesinkbin0/GstGLImageSink:sink:
There may be a timestamping problem, or this computer is too slow.

The video output is sped up a bit if I add "sync=false" to the glimagesink here, but it's still noticeably slower than the old release was, although it does stop complaining about timestamping problems. That being said, I don't actually know what the sync= attribute does, the online documentation for gst-plugins-bad appears to have gone missing?

I'm currently running rpi-userland b834074, and I've confirmed that 1.4.5 worked correctly using this firmware.
Comment 1 Yevhen 2016-01-07 22:03:12 UTC
I have the same problem with gstreamer 1.7.1
Comment 2 Sergey Borovkov 2016-01-12 21:18:29 UTC
Created attachment 318921 [details]
Caps for gst-launch-1.0 filesrc location =/path/ ! qtdemux ! h264parse ! omxh264dec ! glimagesink
Comment 3 Matthew Waters (ystreet00) 2016-01-13 00:20:43 UTC
The caps look correct.  glimagesink cannot render EGLImage's directly so it's converted by glupload.  That has not changed since glimagesink was introduced in 1.4 so that's not this problem.
Comment 4 Sergey Borovkov 2016-01-13 21:31:23 UTC
I managed to get qmlglsink working without performance drops on rpi - in it's initial state (and well after enabling it to work on rpi by using android code for egl) it's as slow as glimagesink. I set caps to EGLimage bypassing glupload. Once I had created one texture and rendered every eglimage to that texture I started having no frame drops at 1080p. Just for reference this was my rendering code (modified ext/qt/gstqsgtexture.cpp).
	if (tex == 0) {
	  gl->GenTextures(1, &tex);
          gl->BindTexture (GL_TEXTURE_2D, tex);
	  gl->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
          gl->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
          gl->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
	  gl->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
	  gl->TexImage2D ( GL_TEXTURE_2D, 0, GL_RGBA,  1920, 1080, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL );
	}
      gl->BindTexture (GL_TEXTURE_2D, tex);
      gl->EGLImageTargetTexture2D (GL_TEXTURE_2D, gst_egl_image_memory_get_image (mem));

I don't know if this is any helpful but the only difference that I see compared to when I was using glupload is that glupload creates a lot of new textures (1 for every frame?) - I don't know if that's what impacts performance though.
Comment 5 Gwang Yoon Hwang 2016-01-22 09:26:33 UTC
(In reply to Sergey Borovkov from comment #4)
> I managed to get qmlglsink working without performance drops on rpi - in
> it's initial state (and well after enabling it to work on rpi by using
> android code for egl) it's as slow as glimagesink. I set caps to EGLimage
> bypassing glupload. Once I had created one texture and rendered every
> eglimage to that texture I started having no frame drops at 1080p. Just for
> reference this was my rendering code (modified ext/qt/gstqsgtexture.cpp).
> 	if (tex == 0) {
> 	  gl->GenTextures(1, &tex);
>           gl->BindTexture (GL_TEXTURE_2D, tex);
> 	  gl->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
>           gl->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,
> GL_NEAREST);
>           gl->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S,
> GL_CLAMP_TO_EDGE);
> 	  gl->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
> 	  gl->TexImage2D ( GL_TEXTURE_2D, 0, GL_RGBA,  1920, 1080, 0, GL_RGBA,
> GL_UNSIGNED_BYTE, NULL );
> 	}
>       gl->BindTexture (GL_TEXTURE_2D, tex);
>       gl->EGLImageTargetTexture2D (GL_TEXTURE_2D,
> gst_egl_image_memory_get_image (mem));
> 
> I don't know if this is any helpful but the only difference that I see
> compared to when I was using glupload is that glupload creates a lot of new
> textures (1 for every frame?) - I don't know if that's what impacts
> performance though.

That's correct.
Current implementation of EGLImageMemory and GLUpload creates a texture and
copies EGLImage's contents to the glUpload's texture for every frame.
That makes huge performance drop.

I did some job to remove those overheads, here is the related bugs:
https://bugzilla.gnome.org/show_bug.cgi?id=760916
https://bugzilla.gnome.org/show_bug.cgi?id=760918
Comment 6 Sergey Borovkov 2016-01-22 20:29:51 UTC
Thanks. I will test your patches next week.
Comment 7 Sergey Borovkov 2016-01-26 18:45:19 UTC
Just tried your patches. Performance for glimagesink is very good. I had a couple of runs when it dropped couple of frames but was on a couple occasions only.
There are some warning printed during playback though:
invalid uninstantiatable type '<unknown>' in cast to 'GstGLContextEGL'
Comment 8 Nicolas Dufresne (ndufresne) 2016-01-26 19:31:53 UTC
The "invalid uninstantiatable ..." error is due to the presence of the old egl plugin. Remove the cruft from you prefix or build and it should go away. If it worked it's because you have been lucky enough to load the newest one first. (it's an indicator of type clash in GObject registration).
Comment 9 Sergey Borovkov 2016-02-16 16:39:16 UTC
Nicolas, I am kinda late with response, but I did a full rebuild of my buildroot with gstreamer and warnings never go away.
Comment 10 Matthew Waters (ystreet00) 2016-02-16 22:53:36 UTC
You may be picking up system libraries instead.
Comment 11 Peter Maersk-Moller 2016-02-19 15:44:16 UTC
Has the speed issue been resolved?

Until resolution, we are kind of stuck with 1.2.4 or alike for playing 1080p and even 720p on Raspberry Pi 2.
Comment 12 Sergey Borovkov 2016-02-19 15:49:12 UTC
>You may be picking up system libraries instead.
This is impossible, since I am running from chrooted environment. To make sure it was not on my side I rebuilt everything from scratch as well removing previous binaries. Yet I'm still getting this warning every time cast GstGLContextEGL happens.
Comment 13 Matthew Waters (ystreet00) 2016-02-22 05:40:41 UTC
The other option is that it's attempting to cast from a GLX context to an EGL context.  If the warnings disappear when running with GST_GL_PLATFORM=egl then that's your issue.

In any case, at backtrace at the error site (run with G_DEBUG=fatal-warnings inside gdb) would be useful.
Comment 14 Sergey Borovkov 2016-02-25 18:08:29 UTC
Warning do not disappear when running with GST_GL_PLATFORM=egl. This is the backtrace. (For reference I am running following pipeline - filesrc ! decodebin ! glupload ! qmlglsink).

  • #0 raise
    from /tmp/work/build/buildroot/host/usr/arm-buildroot-linux-gnueabihf/sysroot/lib/libpthread.so.0
  • #1 _g_log_abort
    at gmessages.c line 315
  • #2 g_logv
    at gmessages.c line 1041
  • #3 g_log
    at gmessages.c line 1079
  • #4 g_type_check_instance_cast
    at gtype.c line 4025
  • #5 gst_gl_memory_egl_get_display
    at gstglmemoryegl.c line 69
  • #6 gst_omx_video_dec_allocate_output_buffers
    at gstomxvideodec.c line 665
  • #7 gst_omx_video_dec_reconfigure_output_port
    at gstomxvideodec.c line 1034
  • #8 gst_omx_video_dec_loop
    at gstomxvideodec.c line 1298
  • #9 gst_task_func
    at gsttask.c line 331
  • #10 default_func
    at gsttaskpool.c line 68
  • #11 g_thread_pool_thread_proxy
    at gthreadpool.c line 307
  • #12 g_thread_proxy
    at gthread.c line 764
  • #13 start_thread
    from /tmp/work/build/buildroot/host/usr/arm-buildroot-linux-gnueabihf/sysroot/lib/libpthread.so.0

Comment 15 Matthew Waters (ystreet00) 2016-05-15 08:47:12 UTC
The aforementioned patches increase the performance of omx*dec ! glimagesink

*** This bug has been marked as a duplicate of bug 760916 ***