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 794507 - waylandsink: gstbuffer which made by waylandsink buffer pool
waylandsink: gstbuffer which made by waylandsink buffer pool
Status: RESOLVED INVALID
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
git master
Other Linux
: Normal normal
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2018-03-20 01:50 UTC by Hyunil Park
Modified: 2018-03-21 03:47 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gstbuffer which made by waylandsink buffer pool (1.77 KB, patch)
2018-03-20 01:50 UTC, Hyunil Park
rejected Details | Review

Description Hyunil Park 2018-03-20 01:50:03 UTC
Created attachment 369886 [details] [review]
gstbuffer which made by waylandsink buffer pool

In the current version, gstbuffer can not be created using the buffer pool of gst_wayland_sink_propose_allocation, and 679 rows of gst_wayland_sink_show_frame () can not be reached.


642 static GstFlowReturn
643 gst_wayland_sink_show_frame (GstVideoSink * vsink, GstBuffer * buffer)
[...]

686  wlbuffer = gst_buffer_get_wl_buffer (buffer);
687
678 if (G_LIKELY (wlbuffer && wlbuffer->display == sink->display)) {
679    GST_LOG_OBJECT (sink, "buffer %p has a wl_buffer from our display, "
680        "writing directly", buffer);
681    to_render = buffer;
682    goto render;
683 }
Comment 1 Nicolas Dufresne (ndufresne) 2018-03-20 02:00:34 UTC
Review of attachment 369886 [details] [review]:

I cannot make any sense of this commit message. Can you rewrite this, and add a longer explanation ?

::: ext/wayland/gstwaylandsink.c
@@ +585,3 @@
+    config = gst_buffer_pool_get_config (sink->pool);
+    gst_buffer_pool_config_get_params (config, NULL, &size, &min_bufs,
+        &max_bufs);

That make no sense. The pool does not know the caps, how could it know it's buffer size ?

@@ +589,1 @@
+    gst_query_add_allocation_pool (query, sink->pool, size, min_bufs, max_bufs);

sink->pool is private and internal. The only use for this pool is to copy incoming buffers when they are not suitable for the Wayland protocol (not from wayland pool, FD base, or dmabuf). Sharing this pool with upstream is unsafe.

@@ +589,2 @@
+    gst_query_add_allocation_pool (query, sink->pool, size, min_bufs, max_bufs);
+    gst_query_add_allocation_param (query, gst_tizen_wl_shm_allocator_get (),

Right, gst_tizen .... I guess you should submit your patch to the related downstream fork ?
Comment 2 Nicolas Dufresne (ndufresne) 2018-03-20 02:02:54 UTC
I'm closing this bug report as the attached patch is not valid and no bug description has been provided. When you file bugs, you should first describe the issue you are facing so that your reviewer understand what you are trying to fix. This patch indicate that you might be fixing an issue that only exist in a downstream fork of GStreamer. The patch itself is as describe fully incorrect.
Comment 3 Hyunil Park 2018-03-20 04:36:02 UTC
please check if waylandsink can make gstbuffer in the gst_wayland_sink_propose_allocation().
The current master version only make gstbuffer poll int gst_wayland_sink_propose_allocation() and create gstbuffer in the gst_wayland_sink_show_frame() because 'if(!wbuf)' is true and always do gst_vido_frame_copy().

if waylandsink does not want to make gstbuffer everytime, waylandsink use gstbuffer which is made by gst_wayland_sink_propose_allocation().

waylandsink can gst buffer poll in set_caps() so this patch can run.
Comment 4 Hyunil Park 2018-03-20 04:45:16 UTC
If wayland sink use wl_buffer widthout creating and gst_vido_frame_copy, the master version has no issue.
but master code can not reach that below code is true.

  if (G_LIKELY (wlbuffer && wlbuffer->display == sink->display)) {
    GST_LOG_OBJECT (sink, "buffer %p has a wl_buffer from our display, "
        "writing directly", buffer);
    to_render = buffer;
    goto render;
  }
Comment 5 Nicolas Dufresne (ndufresne) 2018-03-20 12:24:25 UTC
This code is reached if upstream uses the proposed pool. To demonstrate this you can run:

Copy Path (not using the pool):
$ GST_DEBUG="GST_PERFORMANCE:5" gst-launch-1.0 videotestsrc ! identity drop-allocation=1 ! waylandsink
...
0:00:01.851560175 15888      0x2178450 DEBUG        GST_PERFORMANCE video-frame.c:372:gst_video_frame_copy_plane: copy plane 0, w:1280 h:240 

Zero-Copy:
GST_DEBUG="GST_PERFORMANCE:5" gst-launch-1.0 videotestsrc ! identity drop-allocation=0 ! waylandsink
...
0:00:02.584972806 15987       0xc0c050 LOG              waylandsink gstwaylandsink.c:680:gst_wayland_sink_show_frame:<waylandsink0> buffer 0x7f6eb4013390 has a wl_buffer from our display, writing directly
Comment 6 Nicolas Dufresne (ndufresne) 2018-03-20 12:25:15 UTC
Errata: Zero-copy: GST_DEBUG="GST_PERFORMANCE:5,waylandsink:7"
Comment 7 Hyunil Park 2018-03-21 00:29:24 UTC
Is below command non-zero-copy, right?
gst-launch-1.0 videotestsrc ! waylandsink
Comment 8 Nicolas Dufresne (ndufresne) 2018-03-21 02:56:11 UTC
(In reply to Hyunil Park from comment #7)
> Is below command non-zero-copy, right?
> gst-launch-1.0 videotestsrc ! waylandsink

It is zero-copy in GStreamer, videotestsrc uses wayland SHM based proposed allocator and write into these buffers. The SHM is passed zero-copy to the compositor, which of course will likely have to copy to GL, but this is what wayland offers without custom extensions (like Tizen seems to do).
Comment 9 Hyunil Park 2018-03-21 03:47:11 UTC
Thank you!!