Commit graph

37 commits

Author SHA1 Message Date
olivier.crete@collabora.com
b393b650ab wayland: Drop big-endian version of the DRM formats
They were a big in some big-endian implementations
2019-09-27 19:52:25 +00:00
Jeffy Chen
b8946d06c7 Revert "waylandsink: Don't create throwaway empty regions"
This reverts commit 68fa80e831.

Some wayland servers, especially weston, only expect empty input
region as a request to disable input.

Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
2019-09-03 13:27:12 +00:00
Nicolas Dufresne
f14206f2b3 waylandsink: Workaround gnome-shell bug
Use a timeout to limit that amount of time we wait after the compositor
for the initial configure event. Compositor are support to emit a
configure event before any wl_buffer can be attached. The problem is
that Weston strongly enforce this, while gnome-shell simply does not
emit such an event.
2019-05-26 17:49:29 +02:00
Andrey Konovalov
88bee1a322 waylandsink: make gst_wl_window_is_toplevel aware of XDG shell 2019-04-09 21:32:36 +03:00
Nicolas Dufresne
3fea1fa50b waylandsink: Wait for the surface to be configured
With latest XDG shell, we need to fait for the surface to have been
configured before we can attach a buffer to it. This is being enforce by
Weston with an error.

Fixes #933
2019-04-03 18:20:58 +00:00
Niels De Graef
67bb17e4fa waylandsink: Implement XDG-shell stable support
[wl_shell] is officially [deprecated], so provide support for the
XDG-shell protocol should be provided by all desktop-like compositors.
(In case they don't, we can of course fall back to wl_shell).

Note that the [XML spec] is provided by the `wayland-protocols`
git repository, which is provided by the Wayland project.

Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/issues/897

[wl_shell]: https://people.freedesktop.org/~whot/wayland-doxygen/wayland/Client/group__iface__wl__shell.html
[deprecated]: 698dde1958
[XML spec]: https://github.com/wayland-project/wayland-protocols/blob/master/stable/xdg-shell/xdg-shell.xml
2019-03-04 10:58:54 +00:00
Niels De Graef
c461f22bef waylandsink: prefix wl_shell-specific variables with wl_ 2019-03-04 10:58:54 +00:00
Daniel Stone
68fa80e831 waylandsink: Don't create throwaway empty regions
Instead of creating a region, adding nothing to it, setting that as the
input region and destroying the region, you can instead just pass NULL
to wl_surface_set_input_region for the same effect.

Fixes #702
2019-02-15 12:03:48 +00:00
Wonchul Lee
2ae381e2a3 waylandsink: Avoid race condition on multi-threaded client
When waylandsink is used on some other thread than the main wayland
client thread, the waylandsink implementation is vulnerable to a

condition related to registry and surface events which handled in
seperated event queue.

The race that may happen is that after a proxy is created, but
before the queue is set, events meant to be emitted via the yet to

set queue may already have been queued on the wrong queue.

Wayland 1.11 introduced new API that allows creating a proxy
wrappper which can help to avoid this race condition.
2018-12-13 17:20:04 +00:00
Matteo Valdina
e0535b44d4 waylandsink: relaxed wl_shell check and added zwp_fullscreen_shell.
Relaxed the wl_shell interface constrains, so application that
pass via GstContext the wl_surface can use waylandsink in a
compositor without wl_surface and zwp_fullscreen_shell.

Added support for zwp_fullscreen_shell.

https://bugzilla.gnome.org/show_bug.cgi?id=796772
2018-07-25 07:53:09 -04:00
Fabien Dessenne
f777c66dcc waylandsink: support fullscreen
Add the fullscreen property that makes the sink displayed all across
the output.

https://bugzilla.gnome.org/show_bug.cgi?id=688190
2018-05-06 15:13:59 +02:00
Shinya Saito
816d115317 waylandsink: Fix memory leak of shm allocator.
gst_allocator_find() needs gst_object_unref() after usage.

https://bugzilla.gnome.org/show_bug.cgi?id=790042
2017-12-06 15:46:40 -05:00
Fabien Dessenne
57645056ad waylandsink: set video surface opaque
Unless the video format has an alpha component (ARGB, ...), set the
video_surface opaque.
In the usual case where the black area_surface has the same size as the
video_surface (eg: run gst-play-1.0 video.mp4), this makes the black
surface totally occluded which makes weston compositor's life easier
since it can ignore that surface.
Also unconditionally set the black area_surface opaque.

https://bugzilla.gnome.org/show_bug.cgi?id=778078
2017-02-02 13:14:01 -05:00
Nicolas Dufresne
f6b270d8eb waylandsink: Update our window size on configure event
This is specific to when the waylandsink is not being embedded. In
this patch we pass the render lock to the window so it can safely
call gst_wl_window_set_render_rectangle() with the new size.

https://bugzilla.gnome.org/show_bug.cgi?id=722343
2016-09-22 19:12:22 -04:00
Nicolas Dufresne
ecf88d0d43 waylandsink: Properly draw black border in absence of viewporter
When we don't have a viewporter (scaling support), we can't use the
1x1 scaleup image trick. Instead, we need to allocate a buffer with
the same size as the area that need to have black background.
2016-09-22 19:12:22 -04:00
Nicolas Dufresne
4bb5823cea waylandsink: Make wl_viewporter optional
This makes the viewporter interface optional. The end result is
obviously far from optimal, though it greatly helps testing on older
compostitors or gnome-wayland. We can make it strictly needed later when
this new interface get widely adopted.
2016-09-15 14:14:10 -04:00
Scott D Phillips
a5ead086f9 wayland: Update from scaler to viewporter protocol
Signed-off-by: Scott D Phillips <scott.d.phillips@intel.com>

https://bugzilla.gnome.org/show_bug.cgi?id=767671
2016-09-15 12:10:59 -04:00
George Kiagiadakis
c51fe83d42 waylandsink: call gst_video_sink_center_rect with a destination rectangle that starts from (0,0)
The intention of this code is to find the center rectangle relative
to (0,0), since subsurface coordinates are relative to the parent
surface.

The old code used to work but was wrong and broken by
http://cgit.freedesktop.org/gstreamer/gst-plugins-base/commit/gst-libs/gst/video/gstvideosink.c?id=ff57f6913456ec1991e55517cf1f239e80eeddef
2015-11-18 13:10:45 +01:00
Wim Taymans
87f5574e39 rectangle: clear rectangle struct before use 2014-12-16 13:35:14 +01:00
Tifaine Inguere
4395c02b96 waylandsink : Allow surface to catch input events
If waylandsink is the owner of the display then it is in charge
of catching input events on the surface.

https://bugzilla.gnome.org/show_bug.cgi?id=733682

Signed-off-by: Tifaine Inguere <tifaine.inguere@st.com>
Reviewed-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
2014-10-11 17:18:29 +02:00
George Kiagiadakis
5b1c5dbf99 waylandsink: stack the video subsurface into another subsurface that covers the whole render rectangle
The main reason behind this is that when the video caps change and the video
subsurface needs to resize and change position, the wl_subsurface.set_position
call needs a commit in its parent in order to take effect. Previously,
the parent was the application's surface, over which there is no control.
Now, the parent is inside the sink, so we can commit it and change size smoothly.

As a side effect, this also allows the sink to draw its black borders on
its own, without the need for the application to do that. And another side
effect is that this can now allow resizing the sink when it is in top-level
mode and have it respect the aspect ratio.
2014-10-11 14:57:14 +02:00
George Kiagiadakis
e5334a1f8b waylandsink/wlwindow: do not commit a resize when it happens due to a video info change
1) We know that gst_wayland_sink_render() will commit the surface
   in the same thread a little later, as gst_wl_window_set_video_info()
   is always called from there, so we can save the compositor from
   some extra calculations.
2) We should not commit a resize with the new video info while we are still
   showing the buffer of the previous video, with the old caps, as that
   would probably be a visible resize glitch.
2014-06-17 13:51:30 +02:00
George Kiagiadakis
04b0e54838 waylandsink/wlwindow: take into account the video aspect ratio when determining the size of the surface 2014-06-17 13:51:30 +02:00
George Kiagiadakis
bda600ed92 waylandsink: improve the way the video size is passed to wlwindow and also improve the code for window creation 2014-06-17 13:51:29 +02:00
George Kiagiadakis
cffb38993d waylandsink: move surface resizing logic to the GstWlWindow and make it be called from the main thread 2014-06-17 13:51:28 +02:00
George Kiagiadakis
61e077155b waylandsink: cleanup GstWlWindow a bit after the overlaying semantics change
* own_surface is not needed anymore
* gst_wl_window_from_surface is not used externally anymore
* many initializations to 0 are not needed (GObject does them)
2014-06-17 13:51:27 +02:00
George Kiagiadakis
07f671fcaf waylandsink: create and maintain the subsurface inside the sink
This means that the given surface in set_window_handle can now be
the window's top-level surface on top of which waylandsink creates
its own subsurface for rendering the video.

This has many advantages:
* We can maintain aspect ratio by overlaying the subsurface in
  the center of the given area and fill the parent surface's area
  black in case we need to draw borders (instead of adding another
  subsurface inside the subsurface given from the application,
  so, less subsurfaces)
* We can more easily support toolkits without subsurfaces (see gtk)
* We can get properly use gst_video_overlay_set_render_rectangle
  as our api to set the video area size from the application and
  therefore remove gst_wayland_video_set_surface_size.
2014-06-17 13:51:27 +02:00
George Kiagiadakis
c62ec6f815 waylandsink: get the external display handle using GstContext
This drops the ugly GstWaylandWindowHandle structure and is much
more elegant because we can now request the display separately
from the window handle. Therefore the window handle can be requested
in render(), i.e. when it is really needed and we can still open
the correct display for getting caps and creating the pool earlier.

This change also separates setting the wl_surface from setting its size.
Applications should do that by calling two functions in sequence:

  gst_video_overlay_set_window_handle (overlay, surface);
  gst_wayland_video_set_surface_size (overlay, w, h);
2014-06-17 13:51:27 +02:00
George Kiagiadakis
bd5ad17e58 waylandsink: drop width/height arguments from gst_wl_window_new_from_surface() 2014-06-17 13:51:27 +02:00
George Kiagiadakis
87949dcb07 waylandsink: remove unused functions 2014-06-17 13:51:26 +02:00
George Kiagiadakis
162dbd412c waylandsink: set an empty input region on the video surface 2014-06-17 13:51:25 +02:00
George Kiagiadakis
94d02288d0 waylandsink/wlwindow: reuse code between the two constructors 2014-06-17 13:51:25 +02:00
George Kiagiadakis
086ac4ee81 waylandsink: Use wl_scaler/wl_viewport to scale the surface in the compositor/hardware 2014-06-17 13:51:25 +02:00
George Kiagiadakis
e56f305274 waylandsink: implement the GstVideoOverlay & GstWaylandVideo interfaces
This is the initial implementation, without the GstVideoOverlay.expose()
method. It only implements using an external (sub)surface and resizing
it with GstWaylandVideo.
2014-06-17 13:51:24 +02:00
George Kiagiadakis
350d919719 waylandsink: apply the same debug category to all the subobjects 2014-06-17 13:51:22 +02:00
George Kiagiadakis
ac9503ed65 waylandsink: cleanup header includes 2014-06-17 13:51:22 +02:00
George Kiagiadakis
ae6aebd9d5 waylandsink: split window-related code out to a new GstWlWindow class
GstWlWindow also has API ready to support subsurfaces.
2014-06-17 13:51:22 +02:00