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 794614 - gst_gl_window_set_window_handle() problem on Wayland EGL
gst_gl_window_set_window_handle() problem on Wayland EGL
Status: RESOLVED OBSOLETE
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
1.12.4
Other Linux
: Normal normal
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2018-03-23 06:59 UTC by Yuji Kuwabara
Modified: 2018-11-03 14:19 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Yuji Kuwabara 2018-03-23 06:59:48 UTC
In "gstglwindow.c"
----------------------------------------------------------------
void
gst_gl_window_set_window_handle (GstGLWindow * window, guintptr handle)
{
  :
  gst_gl_window_send_message_async (window,
      (GstGLWindowCB) _set_window_handle_cb, data,
      (GDestroyNotify) _free_swh_cb);
}
----------------------------------------------------------------


In "gstglwindow.c"
----------------------------------------------------------------
static void
_set_window_handle_cb (GstSetWindowHandleCb * data)
{
  :
    gst_gl_context_activate (context, FALSE);
  :

  window_class->set_window_handle (data->window, data->handle);

  :
    gst_gl_context_activate (context, TRUE);
  :

}
----------------------------------------------------------------


In "gstglcontext_egl.c"
----------------------------------------------------------------
static gboolean
gst_gl_context_egl_activate (GstGLContext * context, gboolean activate)
{
  :
  if (activate) {
    /* Check if the backing handle changed */
      handle = (EGLNativeWindowType) gst_gl_window_get_window_handle (window);

    if (handle && handle != egl->window_handle) {
      GST_DEBUG_OBJECT (context,
          "Handle changed ",
          :
    }
    result = eglMakeCurrent (egl->egl_display, egl->egl_surface,
        egl->egl_surface, egl->egl_context);
  }
  :
}
----------------------------------------------------------------
NOTE: GstGLContextEGL assumes window handle change.


In "gstglwindow_wayland_egl.c"
----------------------------------------------------------------
static guintptr
gst_gl_window_wayland_egl_get_window_handle (GstGLWindow * window)
{
  return (guintptr) GST_GL_WINDOW_WAYLAND_EGL (window)->window.native;
}
----------------------------------------------------------------
NOTE: "window handle" is window.native .


In "gstglwindow_wayland_egl.c"
----------------------------------------------------------------
static void
gst_gl_window_wayland_egl_set_window_handle (GstGLWindow * window,
    guintptr handle)
{
  :
  destroy_surfaces (window_egl);
  window_egl->window.foreign_surface = surface;
  create_surfaces (window_egl);
  :
}
----------------------------------------------------------------
NOTE: window.native is destroyed in destroy_surfaces().
 create_surfaces() may allocate same id for window.native .
 If so, gst_gl_context_egl_activate() cannot detect change.


Modification suggestion:

In "gstglwindow_wayland_egl.c"
----------------------------------------------------------------
static void
gst_gl_window_wayland_egl_set_window_handle (GstGLWindow * window,
    guintptr handle)
{
  :
  struct wl_egl_window *savewin;
  :
  :
  savewin = window_egl->window.native;  /* defer destroy window to generate different id */
  window_egl->window.native = NULL;     /* avoid destroy */


  destroy_surfaces (window_egl);
  window_egl->window.foreign_surface = surface;
  create_surfaces (window_egl);


  if (savewin) {
    wl_egl_window_destroy (savewin);  /* deferred destroy */
  }
}
----------------------------------------------------------------
Comment 1 Matthew Waters (ystreet00) 2018-03-23 09:31:23 UTC
My question is what does this solve?

Do you want to create a patch for this?
Comment 2 Yuji Kuwabara 2018-03-23 10:16:01 UTC
If window handle is changed on GstGLWindowWaylandEGL, but the change is not detected by GstGLContextEGL, eglMakeCurrent() in gst_gl_context_egl_activate() fails with EGL_BAD_NATIVE_WINDOW.

Above modification solved this problem.
(but I'm not sure why eglDestroySurface() does not fail)

Further investigation may be needed.
Comment 3 GStreamer system administrator 2018-11-03 14:19:34 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/issues/670.