Bug 454535 - Transparent border around video in mpv
Summary: Transparent border around video in mpv
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Unclassified
Component: wayland-generic (show other bugs)
Version: 5.24.90
Platform: Archlinux Packages Linux
: NOR normal (vote)
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-05-28 14:22 UTC by Magnus Boman
Modified: 2022-06-13 16:49 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.25.1


Attachments
mpv commit defb02daa461200f4de972c57c4ac8dc108feb5f, with the border (365.17 KB, image/png)
2022-05-28 14:22 UTC, Magnus Boman
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Magnus Boman 2022-05-28 14:22:16 UTC
Created attachment 149291 [details]
mpv commit defb02daa461200f4de972c57c4ac8dc108feb5f, with the border

SUMMARY
I was told this is not a bug with mpv but rather a but with KDE Plasma, and most likely with kwin, so here goes..
As of mpv commit defb02daa461200f4de972c57c4ac8dc108feb5f, which adds a vaapi-wayland driver, even when not using that a transparent border around the video is added.

STEPS TO REPRODUCE
1. Compile mpv with commit defb02daa461200f4de972c57c4ac8dc108feb5f (or newer)
2. Start a video while in a KDE wayland session
3. Observe a transparent border around the video

OBSERVED RESULT
A transparent border shows up both when windowed and in fullscreen.

EXPECTED RESULT
No added border

SOFTWARE/OS VERSIONS
Operating System: Arch Linux
KDE Plasma Version: 5.24.90
KDE Frameworks Version: 5.94.0
Qt Version: 5.15.4
Kernel Version: 5.18.0-zen1-1-zen (64-bit)
Graphics Platform: Wayland
Processors: 16 × AMD Ryzen 7 3700X 8-Core Processor
Memory: 15.6 GiB of RAM
Graphics Processor: AMD Radeon RX Vega
Manufacturer: Gigabyte Technology Co., Ltd.
Product Name: B450M DS3H

ADDITIONAL INFORMATION
mpv bug report: https://github.com/mpv-player/mpv/issues/10240
Comment 1 tempel.julian 2022-06-07 20:24:15 UTC
Can confirm the issue. It's quite annoying, as you have to hide the taskbar and background windows to make elements not appear in front of the player window in fullscreen etc.
Comment 2 Bug Janitor Service 2022-06-13 08:38:00 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/2511
Comment 3 Vlad Zahorodnii 2022-06-13 09:49:51 UTC
Git commit 00df0a7019d0f0bdea2c92079ac41c0d166e972d by Vlad Zahorodnii.
Committed on 13/06/2022 at 09:25.
Pushed by vladz into branch 'master'.

wayland: Explicitly initialize surface size to 0

QSize() will construct an invalid size. An invalid size has width and
height set to -1. In other words, QSize() != QSize(0, 0). This can create
issues when computing the bounding rect of a surface that has invisible
subsurfaces.

For example, if the subsurface rect is QRect(0,0 -1x-1), the top-left
corner of the bounding rect will be affected.

In order to make computation of the bounding rect robust, initialize the
surface size to 0 explicitly.

M  +1    -1    src/wayland/autotests/client/test_wayland_surface.cpp
M  +4    -3    src/wayland/surface_interface.cpp
M  +3    -3    src/wayland/surface_interface_p.h

https://invent.kde.org/plasma/kwin/commit/00df0a7019d0f0bdea2c92079ac41c0d166e972d
Comment 4 Vlad Zahorodnii 2022-06-13 09:50:32 UTC
Git commit 4adc1cae7edcfceb4f601cd9ea8689b2885375a5 by Vlad Zahorodnii.
Committed on 13/06/2022 at 09:50.
Pushed by vladz into branch 'Plasma/5.25'.

wayland: Explicitly initialize surface size to 0

QSize() will construct an invalid size. An invalid size has width and
height set to -1. In other words, QSize() != QSize(0, 0). This can create
issues when computing the bounding rect of a surface that has invisible
subsurfaces.

For example, if the subsurface rect is QRect(0,0 -1x-1), the top-left
corner of the bounding rect will be affected.

In order to make computation of the bounding rect robust, initialize the
surface size to 0 explicitly.


(cherry picked from commit 00df0a7019d0f0bdea2c92079ac41c0d166e972d)

M  +1    -1    src/wayland/autotests/client/test_wayland_surface.cpp
M  +4    -3    src/wayland/surface_interface.cpp
M  +3    -3    src/wayland/surface_interface_p.h

https://invent.kde.org/plasma/kwin/commit/4adc1cae7edcfceb4f601cd9ea8689b2885375a5
Comment 5 Magnus Boman 2022-06-13 10:21:21 UTC
Tested the commit and it works perfectly, thanks!