Wayland debugging with Qtwayland, gstreamer waylandsink, wayland-lib and Weston

Pekka Paalanen pekka.paalanen at haloniitty.fi
Mon Feb 26 13:28:16 UTC 2024


On Sun, 25 Feb 2024 08:04:30 +0000
Terry Barnaby <terry1 at beam.ltd.uk> wrote:

> Hi,
> 
> I have investigated a bit further. I have built my own Weston server to 
> run under X11 on Fedora37 so I can add printf's and debug more easily 
> than using a cross compiled iMX8mp target system etc. I added a new 
> dsmc-shell to Weston which is identical to kiosk-shell (apart from 
> names) so I could play with that.
> 
> When It run my simple QWidget test program (test016-qt6-video-example) 
> which creates one top level QWidget with a child QWidget to display the 
> Gstreamer video in it, I see the following surfaces/subsurfaces when 
> desktop_surface_committed() is called in the dsmc-shell.
> 
> Surface: 16 1044,620 mapped: 1 opaque: 0
>   View: 0x29182b0
>   Surface: 18 0,0 mapped: 0 opaque: 0
>    Surface: 44 640,480 mapped: 1 opaque: 0
>    Surface: 18 0,0 mapped: 0 opaque: 0
>   Surface: 17 0,0 mapped: 0 opaque: 0
>   Surface: 16 1044,620 mapped: 1 opaque: 0

Btw. the sub-surface list also contains the parent weston_surface in
it, that's why surface 18 and 16 show up twice, I guess. It's used for
z-ordering.

> 
> Surface 16 is used by the top level QWidget, surface 18 is used by the 
> Video QWidget and surface 44 is the GStreamer video display surface (I 
> think!). This list is generated traversing the weston_surface's views 
> and subsurface_list lists. The mapped is the "is_mapped" field of the 
> surface.
> Only the top level weston_surface has a weston_view in the views list it 
> that is any relevance. "weston-debug scene-graph" only shows the tope 
> most surface, no subsurfaces.

Right.

A sub-surface requires its parent surface to be mapped in order to show
up on screen. This applies recursively, so surface 18 not being mapped
prevents surface 44 from showing up.

IIRC, more or less only "fully mapped" weston_surfaces (as in, if it's
a sub-surface, the whole sub-surface ancestry path up to a top-level is
mapped) have a weston_view. weston_view defines where on screen a
weston_surface will be presented, so without a view it cannot show up.

> 
> As mentioned before, If I use QPainter to draw into the video QWidget it 
> actually draws into the top QWidgets 16 surface using Wayland protocol. 
> I would have thought it would draw into its own QWidget surface 18 as it 
> has Qt::WA_NativeWindow set ?
> 
> I assume that Qtwayland is not "activating" the video QWidget's surface 
> or using it for some reason (send subsurface expose events ?) ?
> 

If that's true, then it is very relevant. A sub-surface becomes mapped
and visible when:

- its parent surface is mapped and visible, and

- the parent surface is committed after the sub-surface has been
  created and associated, and

- if the sub-surface is in synchronized mode, there also needs to be a
  parent surface commit after every sub-surface commit you want to
  become visible. So if you do the first sub-surface sync-mode commit
  with a buffer after the parent has already committed the
  sub-surface's creation, the parent surface needs too commit again.

This applies recursively, too, and you have a sub-sub-surface there.

Do you actually need to sub-surface in the middle? Have you tried
without it?


Thanks,
pq

> 
> I note in the qtwayland change logs, for the earlier QT5 for subsurface 
> changes:
> dist/changes-5.6.3: - [QTBUG-52118] Fixed subsurface positions sometimes 
> not being committed.
> dist/changes-5.11.2: - [QTBUG-69643] Fixed a bug where subsurfaces would 
> not be rendered if clients added them before a WaylandQuickItem was 
> created for the parent surface
> dist/changes-5.12.0: - [QTBUG-49809] Added support for 
> wl_subsurface.place_above and place_below in WaylandQuickItem.
> dist/changes-5.15.2: - [QTBUG-86176] We now send subsurface expose 
> events when a different toplevel (such as a dialog) is configured.
> 
> Could any of these be related ?
> 
> Terry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/wayland-devel/attachments/20240226/7c9eaaeb/attachment.sig>


More information about the wayland-devel mailing list