0
0
mirror of https://github.com/mpv-player/mpv.git synced 2024-09-20 12:02:23 +02:00
Commit Graph

4700 Commits

Author SHA1 Message Date
Dudemanguy
8db1902ae9 vo_dmabuf_wayland: fix scaling for subsurface positioning
It's off if the video aspect ratio doesn't match the monitor aspect
ratio. Fixes c243946338.
2024-04-21 13:42:49 -05:00
Kacper Michajłow
1a495451ab d3d11: disable IDXGIInfoQueue usage if dxgidebug.h is incomplete
Older MinGW-w64 doesn't define IDXGIInfoQueue in dxgidebug.h.
2024-04-19 03:32:29 +02:00
Kacper Michajłow
19a9164e24 d3d11: use IDXGIInfoQueue instead ID3D11InfoQueue
DXGI debug interface encapsulate multiple message queues, which allows
to get validation not only for D3D11 calls, but also DXGI ones.

Also this makes leak detector not report self debug interface as alive
like it was before. And same as with validation, it has ability to
detect more alive objects, not being limited to D3D11.
2024-04-19 03:32:29 +02:00
Dudemanguy
e5d683e187 context_drm_egl: guard gbm_device on uninit
Not all cards support gbm which means the creation of the gbm device
will fail. However during the uninit process, the destruction of the
device was unconditionally done which leads to a segfault. Guard it
instead. Fixes #13929.
2024-04-18 14:57:01 -05:00
Dudemanguy
4d80e7b72c x11: always do a reset_size if geometry/autofit is updated at runtime
Previously, the code required a check against the old saved geometry to
make sure the size and/or position was different before updating. The
doesn't work with the previous changes that allow a geometry value to be
set again with the same value as before. It would probably be nicer to
check against something that always keeps track of the actual window
size in real time, but it seems geometry in x11 doesn't quite work that
way so we'll do it the easier way instead.
2024-04-18 17:40:16 +00:00
nanahi
2533ea764f various: add GPU context description
Now that obj_settings_list is used for GPU contexts, detailed
descriptions can be added so that --gpu-context=help can print
the descriptions of the GPU contexts using standard
obj_settings_list help printing.
2024-04-18 16:28:21 +02:00
nanahi
a6ff33425d video/out/gpu/context: add auto dummy context
This adds a dummy context at the start of the context lists, which
serves three purposes:

- The "auto" option is listed for --gpu-context=help.
- Some special handlings of "auto" string are removed.
- Make sure that lists have at least one element, so MP_ARRAY_SIZE()
  works as intended.
2024-04-18 16:28:21 +02:00
nanahi
96e1f1dfa5 video/out/gpu/context: convert --gpu-context to use obj_settings_list
Since the list of available GPU contexts is a compile time constant,
use obj_settings_list instead of opt_string_validate for GPU contexts.
This has several advantages:

- Aligns with the existing usage of vo, ao, and filter lists.
- Allows custom probing order.
- Allows list option suffixes. (--gpu-context-append, etc.)
- Allows autocomplete in console.lua.
- Uses the standard obj_settings_list help printing, so the custom
  help printing function is no longer needed.

This also deduplicates some context creation code for ra_ctx_create
and ra_ctx_create_by_name.
2024-04-18 16:28:21 +02:00
nanahi
d5ec069829 video/out/gpu/context: don't use hidden flag for contexts
For contexts that have no API, just use a separate list for them.
This keeps validate func for the main contexts simpler.
2024-04-18 16:28:21 +02:00
Kacper Michajłow
2f8038c598 vo_gpu_next: invalidate cache object if requested by libplacebo
See: https://code.videolan.org/videolan/libplacebo/-/merge_requests/659
2024-04-18 02:25:12 +02:00
nanahi
c2ed2e7bc8 terminal: add terminal_set_mouse_input function
This function is used to enable/disable mouse input for win32 and unix.
2024-04-18 01:03:33 +02:00
nanahi
7c6bb9c37b vo_{tct,sixel,kitty}: implement mouse support 2024-04-18 01:03:33 +02:00
nanahi
8c614e0df5 w32_common: implement --show-in-taskbar option
When the window style changes, use WS_EX_TOOLWINDOW style to exclude
the window from the taskbar and Alt+Tab switching.
2024-04-18 00:09:09 +02:00
nanahi
dcd1034529 x11_common: implement --show-in-taskbar option
This adds a new option --show-in-taskbar, which controls whether
mpv appears in taskbars. This is useful for picture-in-picture
setups where the video window should not appear in taskbars.

On X11, this can be controled by setting the
_NET_WM_STATE_SKIP_TASKBAR window state.
2024-04-18 00:09:09 +02:00
nanahi
3a92d7ba3b x11_common: detect wm support for _NET_WM_STATE_SKIP_TASKBAR 2024-04-18 00:09:09 +02:00
llyyr
3995cd3714 wayland: fix segfault in surface_handle_enter due to memory read
Fixes: 895f40e150 ("wayland: only perform a rescale if window is on one output")
2024-04-15 16:41:01 +00:00
Dudemanguy
cb6e7c7a55 wayland: check if scale actually changes in scaling events
The protocol strongly implies that this only happens when the value
changes, and it's also what you would naturally expect. But maybe it's
worth guarding this in cause for some reason the same value twice in a
row happens.
2024-04-14 17:09:31 +00:00
Dudemanguy
895f40e150 wayland: only perform a rescale if window is on one output
The mpv window overlapping multiple outputs with different scale values
can result in some weird behavior when dragging it from one monitor to
another one. This is due to the way some compositors implement
preferred_scale or preferred_buffer_scale (integer scale equivalent).
Depending on the scale values, mpv window has to be resized to match the
new scaling value (due to fractional scaling requiring a viewport). This
can cause the window to become smaller and no longer overlap the monitor
you were just trying to drag it to. Repeat this and the window will
become smaller and smaller. Depending on the layout, the reverse can
also happen (the window becomes larger). This can cause additional
events to fire as the preferred_scale value may change again which does
more weird things.

It seems kwin is not affected by this because their implementation of
preferred_scale sends the event only if the window is fully on the new
monitor. Honestly, this is probably more logical anyway but we should at
least deal with the other implementations better. Try to deal with it by
reworking scaling changes so they only occur when the mpv window is
fully on one monitor. If we get a preferred_scale event and there is an
overlap, save it as a pending change to be performed on the next
surface_enter or surface_leave event (whichever results in there being
only one monitor. Some weird rendering glitches can still happen during
overlap but this makes it usable again.
2024-04-14 17:09:31 +00:00
Kacper Michajłow
078da37d5c vo_gpu_next: rotate target crop
Turns out libplacebo uses unrotated target crop in relation to source.
Use dst rect from VO, instead of extracting it from pl_frame, to avoid
another unrotating operation.

Fixes: a9354b36ca
2024-04-13 23:07:16 +02:00
Dudemanguy
1172c4ead9 wayland: apply keepaspect options to wayland configure bounds
Previously if mpv's size was constrained by the compositor's configure
bounds event, there was no attempt to preserve the aspect ratio of the
given coordinates if --keepaspect (the default) was used. Be sure to
apply keepaspect to the bounded widths and heights if we are using this
event.
2024-04-13 14:33:58 +00:00
Dudemanguy
307255d00d wayland: avoid unneeded calls to xdg_toplevel state functions
The reconfigure event handles setting fullscreen, maximize, etc. We were
implictly relying on the compositor to just ignore mpv if we set a
redundant state (e.g. setting fullscreen when we're already fullscreen),
but kwin actually doesn't and operates again. This causes some subtle
issues when handling geometry on state changes. Rework the state change
calls so they are only executed if wl->geometry_configured isn't set yet
(i.e. the window just opened up for the first time). It's the only time
this is actually needed.
2024-04-13 14:33:58 +00:00
Dudemanguy
4023146a04 wayland: enforce a state change after a reconfigure
If mpv is coming out of some locked size state (fullscreen, maximized,
tiled), the window size given by the reconfigure event should be used
assuming the --auto-window-size option is set.

Fixes 8a9749b8a5
2024-04-13 14:33:58 +00:00
Kacper Michajłow
a9354b36ca vo_gpu_next: set target resolution to crop value
Use rect of the actual image instead of FBO size which includes
margins.
2024-04-13 13:37:12 +02:00
der richter
ee6794225d mac/vulkan: add support for frame timing via presentation feedback 2024-04-10 19:14:20 +02:00
der richter
6df07ce90c mac/window: fix window pinch gesture and modify current-window-scale
this will prevent jumping of the window size in the case the window size
was 'externally' modified and not via the window-scale property, when
using the pinch gesture.

Fixes #11594
Fixes #13799
2024-04-10 19:13:00 +02:00
Kacper Michajłow
89cc477ef1 vo_gpu_next: keep target params in priv instead of alocating it 2024-04-10 18:35:47 +02:00
Dudemanguy
0d250892ba Revert "vo_dmabuf_wayland: assume counter-clockwise rotations"
This commit was originally sparked by a change in sway. When looking at
the wording of the spec, it was believed that the rotation should be
counter-clockwise. But that was interpreted incorrectly. The rotation
direction in the spec is meant for compositors not clients. Clients
should be rotating clockwise and compositors rotate it the opposite
direction. Also see the discussion in upstream wayland*.

*: https://gitlab.freedesktop.org/wayland/wayland/-/merge_requests/369

This reverts commit 27ef1725e7.
2024-04-09 13:48:08 +00:00
Kacper Michajłow
d3941f235a bstr: change bstr0_s to bstr0_lit, restrict it only for string literals
Allows to avoid non-portable strlen usage. Also avoid "initializer
element is not constant" warnings on older GCC that doesn't like
explicit type specification in aggregate initialization.

Co-authored-by: NRK <nrk@disroot.org>
Co-authored-by: nanahi <130121847+na-na-hi@users.noreply.github.com>
2024-04-08 02:06:06 +02:00
Kacper Michajłow
2d4fae4f70 vo_tct: reduce lut_item size and generate it without snprintf 2024-04-07 20:23:04 +02:00
Kacper Michajłow
7d2b7fa019 vo_tct: use fwrite when appropriate 2024-04-07 20:23:04 +02:00
Kacper Michajłow
6177aa7616 vo_tct: add synchronized output support
See-Also: https://gist.github.com/christianparpart/d8a62cc1ab659194337d73e399004036
2024-04-07 20:23:04 +02:00
Kacper Michajłow
5a53fa7cad vo_tct: add --vo-tct-buffering option 2024-04-07 20:23:04 +02:00
Kacper Michajłow
fbc5e47e00 misc/bstr: add bstr0_s for static initialization 2024-04-07 20:23:04 +02:00
Kacper Michajłow
39d560676f vo_tct: write frame fully instead of every pixel
This is multiple times faster than just writing every pixel sequence
separately. Especially on slower terminal emulators. In general no need
to stress I/O, while we can just prepare the frame to print and do it
once.
2024-04-07 20:23:04 +02:00
Kacper Michajłow
2f76536f62 vulkan: use pl_vk_inst_create
This change is mostly motivated by missing
VK_KHR_portability_enumeration instance extension when enumerating the
devices. Which causes issues with MoltenVK which does not advertise full
Vulkan conformance.

To avoid duplicating code use pl_vk_inst_create() which correctly query
availability and enables the mentioned extension.

While at it fix the VkInstance leaking in vk_validate_dev().
2024-04-07 20:16:50 +02:00
Shuanglei Tao
3c1e983351 vo: add win32 context menu support 2024-04-06 08:24:06 +02:00
der richter
c555cfccfe mac/common: reuse hidpi window scale frame calculation helper 2024-04-04 19:39:27 +02:00
der richter
5178c5b7d1 mac/window: cleanup unfsContentFrame usage and make it none optional 2024-04-04 19:39:27 +02:00
der richter
fc36e5d71e mac/window: fix unfs window size retrieval
the unfsContentFrame wasn't updated when externally resized leading to
a wrong unfs window size afterwards. update it on windowDidResize event
when not in fs, not animating and not live resizing.
2024-04-04 19:39:27 +02:00
nanahi
a140d2788c wayland_common: set mouse position on pointer enter
At least on some compositors, when the pointer enters a surface,
only a wl_pointer_enter event is generated, but not wl_pointer_motion.
This results in the initial mouse position being lost, which is
especially problematic when input simulation is used.

Fix this by setting the mouse position on pointer enter event.
2024-04-01 01:17:22 +00:00
der richter
92cb47338f mac/view: fix cursor visibility when toggling fullscreen
this broke with the recent refactor of the input handling. one of the
edge cases was not considered, where not every mouse down event has a
corresponding mouse up event, eg all double clicks or more only have one
up event after the first down event.

this was handled correctly previously.

Fixes #13777
2024-03-29 14:20:40 +01:00
der richter
ba45f2004f mac: cleanup swift bridge header imports and unify them 2024-03-29 14:20:40 +01:00
der richter
ed0587692f mac/log: rename log functions and cleanup class 2024-03-29 14:20:40 +01:00
der richter
ceaabb7b98 mac: use LogHelper directly instead of mp_log 2024-03-29 14:20:40 +01:00
der richter
e7df95b10d mac: rename mpvHandle to mpv 2024-03-29 14:20:40 +01:00
der richter
e71e340b77 mac: remove now unnecessary objective-c forwarding 2024-03-29 14:20:40 +01:00
der richter
1bc680d32a mac/apphub: move menu bar into AppHub 2024-03-29 14:20:40 +01:00
der richter
1acca1d3c4 mac/apphub: move app icon into AppHub
split up AppHub header in obj-c and c parts and make it a bidirectional
bridging.
2024-03-29 14:20:40 +01:00
nanahi
6fed2f8e58 win32: fix native key repeat support
win32 does not respect --native-keyrepeat option, and native key
repeat has been broken since 0ab3482f73.

This lets mpv respect the --native-keyrepeat option on win32.
2024-03-29 14:07:37 +01:00
nanahi
f4a7931c53 vo_gpu: support video-target-params 2024-03-27 22:08:56 +01:00