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 763732 - glwindow: no video frame when use QT created window on X11
glwindow: no video frame when use QT created window on X11
Status: RESOLVED NOTGNOME
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
1.6.0
Other Linux
: Normal normal
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2016-03-16 03:48 UTC by Haihua Hu
Modified: 2016-11-15 05:42 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
glwindow: fix no video frame when use QT created window on X11 (2.23 KB, patch)
2016-03-16 03:48 UTC, Haihua Hu
needs-work Details | Review
glwindow: fix no frame when use glimagesink with QT (2.42 KB, patch)
2016-03-16 05:46 UTC, Haihua Hu
rejected Details | Review
videooverlay test log (11.41 KB, text/plain)
2016-03-16 09:43 UTC, Haihua Hu
  Details
The demo (1.06 MB, image/jpeg)
2016-03-16 11:33 UTC, Haihua Hu
  Details

Description Haihua Hu 2016-03-16 03:48:49 UTC
Created attachment 324071 [details] [review]
glwindow: fix no video frame when use QT created window on X11

When use glimagesink with QT, no video frame showed in the QWidget window, the whole window is in black. While version 1.4.5 is OK.
Comment 1 Matthew Waters (ystreet00) 2016-03-16 04:32:19 UTC
Review of attachment 324071 [details] [review]:

1. The code formatting isn't up to gstreamer style.  Please run gst-indent before submitting your patches
2. When is this needed exactly? i.e. when are you calling gst_video_overlay_set_window_handle()? As a response to the need-window-handle message? or on your own?  If on your own, at what state is the sink at (NULL, READY, PAUSED, PLAYING)?
Comment 2 Haihua Hu 2016-03-16 05:08:51 UTC
I don't have gst-indent tool on my PC, i will try to re-edit this patch.

I call gst_video_overlay_set_window_handle() when pipeline state is NULL on my own. I want to know if this issue is a glwindow issue or what is the correct way to us glimagesink with QT window.
Comment 3 Haihua Hu 2016-03-16 05:22:23 UTC
FYI as above

(In reply to Matthew Waters (ystreet00) from comment #1)
> Review of attachment 324071 [details] [review] [review]:
> 
> 1. The code formatting isn't up to gstreamer style.  Please run gst-indent
> before submitting your patches
> 2. When is this needed exactly? i.e. when are you calling
> gst_video_overlay_set_window_handle()? As a response to the
> need-window-handle message? or on your own?  If on your own, at what state
> is the sink at (NULL, READY, PAUSED, PLAYING)?
Comment 4 Haihua Hu 2016-03-16 05:46:37 UTC
Created attachment 324072 [details] [review]
glwindow: fix no frame when use glimagesink with QT
Comment 5 Matthew Waters (ystreet00) 2016-03-16 06:06:30 UTC
I'm still not sold on why this is necessary, the videooverlay example in https://cgit.freedesktop.org/gstreamer/gst-plugins-bad/tree/tests/examples/gl/qt/videooverlay works with the current code.  It even does what you do by setting the window handle on NULL.
Comment 6 Haihua Hu 2016-03-16 06:44:35 UTC
(In reply to Matthew Waters (ystreet00) from comment #5)
> I'm still not sold on why this is necessary, the videooverlay example in
> https://cgit.freedesktop.org/gstreamer/gst-plugins-bad/tree/tests/examples/
> gl/qt/videooverlay works with the current code.  It even does what you do by
> setting the window handle on NULL.

This example also cannot work on my platform (i.Mx6Q). Only show white window. When pipeline state is NULL, window_x11->internal_win_id has not created, set window handle will pass window_x11->internal_win_id to XResizeWindow and XReparentWindow. I think this is the root cause for my issue. But I don't know why it works on your platform
Comment 7 Matthew Waters (ystreet00) 2016-03-16 07:38:20 UTC
That's not quite how it works.

Setting the window handle in state NULL means glimagesink doesn't have any glwindow instantiated.  So, glimagesink stores the window handle from set_window_handle and sets it later when creating the actual glwindow.

Can you attach an GST_DEBUG=glimagesink:6,glwindow*:6 log while running the above example to this bug please?
Comment 8 Haihua Hu 2016-03-16 09:43:32 UTC
Created attachment 324079 [details]
videooverlay test log

This is the log of the QT videooverlay example
Comment 9 Matthew Waters (ystreet00) 2016-03-16 11:10:47 UTC
Everything looks normal in the log (this is without the patch right?).

What happens if you keep the old XReparentWindow in set_window_handle() (i.e. don't comment it out)?.  An interesting data point would be printing/inspecting the the attributes returned by xGetWindowAttributes on the parent window in both places (_set_window_handle() and _show()) and seeing if they make sense and are the same in both places.
Comment 10 Haihua Hu 2016-03-16 11:31:39 UTC
Yes, this log is with out the patch.

If I keep XReparentWindow in set_window_handle(), there is no frame either. I print the attrubutes, they are the same in both places. 

By the way, I found if add XMapWindow in set_window_handle() after XReparentWindow will also fix this problem. Does it make any sence?
Comment 11 Haihua Hu 2016-03-16 11:33:55 UTC
Created attachment 324088 [details]
The demo

This is qt example videooverlay running result. If normal, there will be color bar frame.
Comment 12 Matthew Waters (ystreet00) 2016-03-16 11:45:25 UTC
What??  That makes no sense whatsoever...unless the writes aren't making it to the X server?  Try adding an XSync (device, False) after XMapWindow in _show_window().

Another data point, GST_DEBUG=glwindow*:6, get the internal window handle from the debug line, "glwindow gstglwindow_x11.c:243:gst_gl_window_x11_create_window: gl window id: xxxxx" (without the 'd' at the end), and while that's running pass it into xwininfo -id xxxx and see what that says about the window (and maybe the parent window as well).
Comment 13 Matthew Waters (ystreet00) 2016-03-16 11:46:17 UTC
parent window is in glimagesink:6 debugging as new_window_id.
Comment 14 Haihua Hu 2016-03-16 14:32:27 UTC
Thanks for your nice help. I am off work now and can not see the runnning result. What do you mean for "the writes aren't making it to the X server"?
Comment 15 Matthew Waters (ystreet00) 2016-03-16 14:47:53 UTC
As in, you're not seeing any output because the XMapWindow is being written to the request buffer but not being flushed and sent to the X server so the server isn't mapping the window.
Comment 16 Haihua Hu 2016-03-17 09:10:06 UTC
(In reply to Matthew Waters (ystreet00) from comment #15)
> As in, you're not seeing any output because the XMapWindow is being written
> to the request buffer but not being flushed and sent to the X server so the
> server isn't mapping the window.

After add XSync (device, False) after XMapWindow in _show_window(), still cannot see the color bar and only white screen without my patch. Is there any other reason for this issue?
Comment 17 Matthew Waters (ystreet00) 2016-03-17 09:58:58 UTC
And what did xwinwinfo say?
Comment 18 Haihua Hu 2016-03-17 10:36:17 UTC
(In reply to Matthew Waters (ystreet00) from comment #17)
> And what did xwinwinfo say?

root@imx6qpsabresd:~# xwininfo -id 27262978

xwininfo: Window id: 0x1a00002 "OpenGL renderer"

  Absolute upper-left X:  0
  Absolute upper-left Y:  48
  Relative upper-left X:  0
  Relative upper-left Y:  0
  Width: 1024
  Height: 720
  Depth: 16
  Visual: 0x21
  Visual Class: TrueColor
  Border width: 0
  Class: InputOutput
  Colormap: 0x1a00001 (not installed)
  Bit Gravity State: ForgetGravity
  Window Gravity State: NorthWestGravity
  Backing Store State: NotUseful
  Save Under State: no
  Map State: IsViewable
  Override Redirect State: no
  Corners:  +0+48  -0+48  -0-0  +0-0
  -geometry 1024x720+0+0

root@imx6qpsabresd:~# xwininfo -id 23068676

xwininfo: Window id: 0x1600004 "GstVideoOverlay Qt demo"

  Absolute upper-left X:  0
  Absolute upper-left Y:  48
  Relative upper-left X:  0
  Relative upper-left Y:  48
  Width: 1024
  Height: 720
  Depth: 16
  Visual: 0x21
  Visual Class: TrueColor
  Border width: 0
  Class: InputOutput
  Colormap: 0x1600001 (not installed)
  Bit Gravity State: ForgetGravity
  Window Gravity State: NorthWestGravity
  Backing Store State: NotUseful
  Save Under State: no
  Map State: IsViewable
  Override Redirect State: no
  Corners:  +0+48  -0+48  -0-0  +0-0
  -geometry 1024x720+0-0
Comment 19 Haihua Hu 2016-03-17 10:37:11 UTC
(In reply to Matthew Waters (ystreet00) from comment #17)
> And what did xwinwinfo say?

The first is internal window and the second one is parent window.
Comment 20 Haihua Hu 2016-03-22 02:10:25 UTC
(In reply to Matthew Waters (ystreet00) from comment #17)
> And what did xwinwinfo say?
Hi Matthew,

Any update for this issue?
Comment 21 Matthew Waters (ystreet00) 2016-03-22 02:57:02 UTC
Those xwininfo's look fine.  The window's are being mapped which means they should be displayed, the fact that they're not indicates some bug lower in the stack.

What Xorg, Qt, etc versions are you running?

What are the values in attr (from XGetWindowAttributes) in _set_window_handle()?
Comment 22 Matthew Waters (ystreet00) 2016-03-22 02:59:29 UTC
Or, there's some subtle interaction between the GL driver and having the X11 window unparented and unmapped or parented and mapped to which requires looking into driver code.
Comment 23 Matthew Waters (ystreet00) 2016-03-30 02:04:24 UTC
Another problem I have with this patch as is that it effectively only ever calls XReparentWindow once on show() however there's a gtk example (https://cgit.freedesktop.org/gstreamer/gst-plugins-bad/tree/tests/examples/gl/gtk/switchvideooverlay) that allows switching the video overlay at runtime.  granted it only currently works on X11 however moving the XReparentWindow call into show() will break that.
Comment 24 Matthew Waters (ystreet00) 2016-11-15 05:42:10 UTC
Closing as this seems to be a bug in a lower element of the stack.