Commit Graph

46931 Commits

Author SHA1 Message Date
Philip Langdale 1638fa7b46 vo/gpu: hwdec_vdpau: Support direct mode for 4:4:4 content
New releases of VDPAU support decoding 4:4:4 content, and that comes
back as NV24 when using 'direct mode' in OpenGL Interop. That means we
need to be a little bit smarter about how we set up the OpenGL
textures.
2019-07-08 01:11:27 +02:00
Michael Forney 13e14d95e1 opengl/context_wayland: Fix crash on configure before initial reconfig
If the compositor sends a configure event before the surface is initially
mapped, resize gets called before the egl_window gets created, resulting
in a crash in wl_egl_window_resize.

This was fixed back in 618361c697, but was reintroduced when the wayland
code was rewritten in 68f9ee7e0b.
2019-07-08 01:00:01 +02:00
Philip Langdale e2976e662d video/out/gpu: Add a `storable` flag to ra_format
While `ra` supports the concept of a texture as a storage
destination, it does not support the concept of a texture format
being usable for a storage texture. This can lead to us attempting
to create a texture from an incompatible format, with undefined
results.

So, let's introduce an explicit format flag for storage and use
it. In `ra_pl` we can simply reflect the `storable` flag. For
GL and D3D, we'll need to write some new code to do the compatibility
checks. I'm not going to do it here because it's not a regression;
we were already implicitly assuming all formats were storable.

Fixes #6657
2019-07-08 00:59:28 +02:00
wm4 c379950ce0 codec_tags: fix wrong buffer size
Obvious mistake. This reported 44 bytes more data than what was
available. Could cause out of bounds reads. Security researchers would
claim a major victory if they found something like this in more popular
software, and would create a website for it.
2019-07-03 17:47:24 +03:00
James Ross-Gowan ea91162802 appveyor: remove broken packages, install libplacebo
Support for Ada and Objective-C was removed from MSYS2, which made
pacman refuse to update GCC while the gcc-ada and gcc-objc packages were
installed. Remove those packages before updating the others. Also remove
ANGLE, which has been removed from MSYS2, and add libplacebo, which is
now needed for the Vulkan VO.
2019-07-03 17:30:50 +03:00
Bin Jin c9e7473d67 vo_gpu: process three component together in error diffusion
This started as a desperate attempt to lower the memory requirement
of error diffusion, but later it turns out that this change also
improved the rendering performance a lot (by 40% as I tested).

Errors was stored in three uint before this change, each with 24bit
precision. This change encoded them into a single uint, each with 8bit
precision. This reduced the shared memory usage, as well as number of
atomic operations, all by three times.

Before this change, with the minimum required 32kb shared memory, only
the `simple` kernel can be used to render 1080p video, which is mostly
useless compare to `--dither=fruit`. After this change, 32kb can
handle `burkes` kernel for 1080p, or `sierra-lite` for 4K resolution.
2019-06-16 11:19:44 +02:00
Bin Jin f6fd127fe8 vo_gpu: fix use of existing textures in error diffusion
error diffusion requires two texture rendering pass. The existing code
reuses `screen_tex` and creates another for such purpose. This works
generally well for opengl, but could potentially be problematic for
vulkan, due to its async natural.
2019-06-16 11:19:44 +02:00
Bin Jin ca2f193671 vo_gpu: implement error diffusion for dithering
This is a straightforward parallel implementation of error diffusion
algorithms in compute shader. Basically we use single work group with
maximal possible size to process the whole image. After a shift
mapping we are able to process all pixels column by column.

A large ring buffer are allocated in shared memory to speed things up.
However the size of required shared memory depends linearly on the
height of video window (or screen height in fullscreen mode). In case
there is no enough shared memory, it will fallback to `--dither=fruit`.

The maximal allowed work group size is hardcoded as 1024. Ideally we
could query `GL_MAX_COMPUTE_WORK_GROUP_INVOCATIONS`. But for whatever
reason, it seems most high end card from nvidia and amd support only
the minimal required value, so I guess we can stick to it for now.
2019-06-16 11:19:44 +02:00
Martin Herkt 6aecd10eba
ci: Remove snapshot-deps config from tw builds
OBS isn’t really set up to support this. If needed, we should instead
git clone FFmpeg as part of the CI. I don’t think it is, though.
2019-06-14 05:24:35 +02:00
Martin Herkt 59f1e72a3c
build: Add support for static spirv-cross
This assumes a non-upstream .pc file since upstream doesn’t seem
to give a fuck about this use case at all.
2019-06-14 04:56:30 +02:00
Philip Sequeira a38aa74454 demux_mkv: copy attachments (fonts) from ordered chapter sources
They might be needed for rendering subs from those sources.

Fixes #6009.
2019-06-12 23:34:47 +03:00
James Ross-Gowan cc38035841 vo_gpu: d3d11: use the SPIRV-Cross C API directly
When the D3D11 backend was first written, SPIRV-Cross only had a C++ API
and no guarantee of API or ABI stability, so instead of using
SPIRV-Cross directly, mpv used an unofficial C wrapper called crossc.

Now that KhronosGroup/SPIRV-Cross#611 is resolved, SPIRV-Cross has an
official C API that can be used instead, so remove crossc and use
SPIRV-Cross directly.
2019-06-12 23:03:55 +03:00
Bin Jin fbe267150d vo_gpu: fix --scaler-resizes-only for fractional ratio scaling
The calculation of scale factor involves 32-bit float, and a strict
equality test will effectively ignore `--scaler-resizes-only` option
for some non-integer scale factor.

Fix this by using non-strict equality check.
2019-06-06 20:01:56 +02:00
Bin Jin f2119d9d88 vo_gpu: expose texture_off to user shader
It will provide low level access to coordinate mapping other than
texmap().
2019-06-06 20:01:56 +02:00
Bin Jin ae1c489b31 vo_gpu: allow user shader to fix texture offset
This commit essentially makes user shader able to fix offset (produced
by other prescaler, for example) like builtin `--scale`.
2019-06-06 20:01:56 +02:00
Niklas Haas 4d001bb30d wayland: fix segfault on uninit
Probably the same issue as #6732
2019-05-26 11:09:16 +02:00
dudemanguy 6e4971f697 wayland: fix various memory leaks 2019-05-21 22:41:22 +02:00
der richter 64cdc3694e cocoa-cb: fix quit in fs with none native fs
since the none native fs is a special legacy case it needs a special
quit routine. it indefinitely waited for an exit fs screen event to
shutdown properly, though that event only fires for the native fs.
now we check if we really are using a native fullscreen and if not
shutdown immediately.

Fixes #6704
2019-05-11 12:54:44 +02:00
James Ross-Gowan 86bdd22060 win32-console-wrapper: silence missing prototype warnings 2019-05-10 21:06:58 +10:00
James Ross-Gowan c754c31d6f w32_common: avoid unnecessary sprintfs
These were unnecessary for a couple of reasons, but it seems like the
old code went through a lot of effort to avoid duplicating the code to
print a RECT, even though the windowrc gets printed anyway at the end of
the function.

Avoid printing the same windowrc twice by only printing it when it gets
changed (in the w32->current_fs branch.)
2019-05-10 20:47:05 +10:00
Nicolas F 91c1691b35 man: clarify vavpp requirements
I assume (but cannot confirm) that VA-AP-API is in fact a typo, because
most if not all search engine results related to it are from mpv's manual
page.

By changing this to VA-API and clarifying that this requires VA-API support
on a system to use it, we can hopefully make it clear to unsuspecting
Windows users that this is not the filter they're looking for.

Concerns #6690.
2019-05-05 21:06:18 +02:00
dudemanguy 037cbacb8c libarchive: add fallback for systems without C.UTF-8 2019-05-04 14:17:40 +02:00
Anton Kindestam dcb7838bb7 drm_common: Support --drm-mode=<preferred|highest|N|WxH[@R]>
This allows to select the drm mode using a string specification. You
can either select the the preferred mode, the mode with the highest
resolution, by specifying WxH[@R] or by its index in the list of modes
as before.
2019-05-04 14:17:11 +02:00
Anton Kindestam d155b7541f drm_common: Don't export functions only being used internally
As far as I know none of these functions were being used outside of
drm_common, nor should there really be a need to use them.
2019-05-04 14:17:11 +02:00
Anton Kindestam 8261924db9 drm_common: Add proper help option to drm-mode
This was implemented by using OPT_STRING_VALIDATE for drm-mode,
instead of OPT_INT. Using a string here also prepares for future
additions to drm-mode that aim to allow specifying a mode by its
resolution.
2019-05-04 14:17:11 +02:00
Anton Kindestam a776628d88 drm_common: Add option to toggle use of atomic modesetting
It is useful when debugging to be able to force atomic off, or as a
workaround if atomic breaks for some user. Legacy modesetting is less
likely to break by virtue of being a less complex API.
2019-05-04 14:17:11 +02:00
Philip Langdale 23a324215b vo/gpu: hwdec_cuda: Refactor gpu api specific code into separate files
The amount of code now present that's specific to Vulkan or OpenGL
has reached the point where we really want to split it out to
avoid a mess of #ifdefs.

At the same time, I'm moving the code to an api neutral location.
2019-05-03 18:02:18 +02:00
Anton Kindestam 738fda3677 context_drm_egl: Add support for presentation feedback
This implements presentation feedback for context_drm_egl using the
values that get fed to the page flip handler.
2019-05-03 18:01:56 +02:00
der richter 71ad1e2f4c cocoa-cb: remove all force unwrappings of optionals
the force unwrapping of optionals caused many unpredictable segfaults
instead of gracefully exiting or falling back. besides that, it is bad
practice and the code is a lot more stable now.
2019-04-25 23:02:19 +03:00
Jan Ekström edbc199914 vo_gpu/hwdec_cuda: fixup compilation with vulkan disabled
The actual code utilizing this enum was seemingly properly if'd,
but not the enum in the struct itself.

Fixes compilation.
2019-04-22 18:17:30 +03:00
Jan Ekström 9b8d3eff78 docs: add mentions of the Vulkan rendering abstraction replacement
From internal to libplacebo.
2019-04-22 15:58:10 +03:00
Philip Langdale 74831dd651 vo/gpu: hwdec_cuda: Reorganise backend-specific code
This tries to tidy up the GL vs Vulkan code to be a bit cleaner
and easier to read.
2019-04-21 23:55:22 +03:00
Philip Langdale 4005cda614 vo_gpu: hwdec_cuda: Implement interop for placebo
This change updates the vulkan interop code to work with the
libplacebo based ra_vk, but also introduces direct VkImage
sharing to avoid the use of the intermediate buffer.

It is also necessary and desirable to introduce explicit
semaphore bsed synchronisation for operations on the shared
images.

Synchronisation means we can safely reuse the same VkImage for every
mapped frame, by ensuring the frame is copied to the VkImage before
mapping the next frame.

This functionality requires a 417.xx or newer nvidia driver, due to
bugs in the VkImage interop in the earlier 411 and 415 drivers.

It's definitely worth the effort, as the raw throughput is about
twice that of implementation using an intermediate buffer.
2019-04-21 23:55:22 +03:00
Philip Langdale ffb8ffdd55 vo/gpu: ra_pl: Add helper to get pl_fmt from ra_format
When interacting directly with libplacebo, we may need to pass a
pl_fmt based on an ra_format. Although the mapping is currently
trivial, it's worth wrapping to make it easy to adapt if this
changes in the future.
2019-04-21 23:55:22 +03:00
Philip Langdale 4c133f3b45 vo_gpu: ra_pl: Add getter for pl_gpu
We need access to the underlying pl_gpu to make libplacebo calls
from hwdecs.
2019-04-21 23:55:22 +03:00
Philip Langdale b74b39dfb5 vo_gpu: vulkan: Add back context_win for libplacebo
Feature parity with the original ra_vk obviously requires win32 support,
so let's put it back in.
2019-04-21 23:55:22 +03:00
Niklas Haas 7006d6752d vo_gpu: vulkan: use libplacebo instead
This commit rips out the entire mpv vulkan implementation in favor of
exposing lightweight wrappers on top of libplacebo instead, which
provides much of the same except in a more up-to-date and polished form.

This (finally) unifies the code base between mpv and libplacebo, which
is something I've been hoping to do for a long time.

Note: The ra_pl wrappers are abstract enough from the actual libplacebo
device type that we can in theory re-use them for other devices like
d3d11 or even opengl in the future, so I moved them to a separate
directory for the time being. However, the rest of the code is still
vulkan-specific, so I've kept the "vulkan" naming and file paths, rather
than introducing a new `--gpu-api` type. (Which would have been ended up
with significantly more code duplicaiton)

Plus, the code and functionality is similar enough that for most users
this should just be a straight-up drop-in replacement.

Note: This commit excludes some changes; specifically, the updates to
context_win and hwdec_cuda are deferred to separate commits for
authorship reasons.
2019-04-21 23:55:22 +03:00
Niklas Haas 9f7dcc0726 mp_image: align stride to multiple of texel size
This helps with compatibility and/or performance in particular for
oddly-sized formats like rgb24. We use a loop to avoid having to
calculate the lcm (or waste bytes in the extremely common case of the
byte size and the stride align having shared factors).
2019-04-21 23:55:22 +03:00
Niklas Haas a3c808c6c8 vo_gpu: fix segfault when OSD tex creation fails
If !osd->texture, then mpgl_osd_draw_prepare fails.
2019-04-21 23:55:22 +03:00
Niklas Haas f0b6860d62 vo_gpu: index desc namespaces by ra
No reason to require them be constant. This allows them to depend on
runtime characteristics of the `ra`.
2019-04-21 23:55:22 +03:00
James Ross-Gowan 4e9dc60d9e appveyor: fix shaderc dependencies
Shaderc comes with a Python script that automatically fetches
"known-good" versions of its dependencies. Use that instead of manually
cloning dependencies to third-party.
2019-04-16 21:35:00 +03:00
JCount 7f1d7c38bc version.sh: update MPVCOPYRIGHT to include the current year, 2019 2019-04-16 20:11:30 +02:00
john e9fae413fd options/path: fix url detection per RFC3986 2019-04-05 20:48:24 +03:00
Aman Gupta 8b114e574a ao/audiounit: include AVAudioSession buffer in latency calc
Signed-off-by: Aman Gupta <aman@tmm1.net>
2019-04-05 10:29:44 +07:00
Aman Gupta e35aca3cb4 ao/audiounit: improve a/v sync
This more closely mimics ao_coreaudio, on which this driver was
originally based.

Signed-off-by: Aman Gupta <aman@tmm1.net>
2019-04-05 10:29:44 +07:00
NoSuck 6c91314900 man/input: clarify behavior of seek's +exact
As discussed here:

https://github.com/mpv-player/mpv/issues/6545#issuecomment-476015318
2019-04-02 09:09:14 +02:00
der richter 90e44d3ff2 cocoa-cb: add support for custom colored title bar 2019-04-02 02:09:01 +03:00
der richter 837e5058ff cocoa-cb: refactor title bar styling
half of the materials we used were deprecated with macOS 10.14, broken
and not supported by run time changes of the macOS theme. furthermore
our styling names were completely inconsistent with the actually look
since macOS 10.14, eg ultradark got a lot brighter and couldn't be
considered ultradark anymore.

i decided to drop the old option --macos-title-bar-style and rework
the whole mechanism to allow more freedom. now materials and appearance
can be set separately. even if apple changes the look or semantics in
the future the new options can be easily adapted.
2019-04-02 02:09:01 +03:00
Akemi 23f55569be cocoa-cb: add support for mac 10.14 Dark mode and run time switching
setting the appearance of the window to nil will always use the system
setting and changes on run time switches too. this is only the case for
macOS 10.14.
2019-04-02 02:09:01 +03:00
der richter d5be1e2729 cocoa-cb: move all title bar related functionality in its own file
quite a lot of the title bar functionality and logic was within our
window. since we recently added a custom title bar class to our window
i decided to move all that functionality into that class and in its
own file.

this is also a preparation for the next commits.
2019-04-02 02:09:01 +03:00