Commit Graph

2441 Commits

Author SHA1 Message Date
wm4 ff9f2c4b6e vdpau: use libavutil for surface allocation during decoding
Use the libavutil vdpau frame allocation code instead of our own "old"
code. This also uses its code for copying a video surface to normal
memory (used by vdpau-copy).

Since vdpau doesn't really have an internal pixel format, 4:2:0 can be
accessed as both nv12 and yuv420p - and libavutil prefers to report
yuv420p. The OpenGL interop has to be adjusted accordingly.

Preemption is a potential problem, but it doesn't break it more than it
already is.

This requires a bug fix to FFmpeg's vdpau code, or vdpau-copy (as well
as taking screenshots) will fail. Libav has fixed this bug ages ago.
2017-01-17 15:48:56 +01:00
wm4 8a23892d04 vo_opengl: hwdec_cuda: add yuv420p support
Because it allows easier testing of filters + hwdec.

Make the texture setup code a bit more generic so it doesn't get too
much of a mess. We also use the GL renderer utility function
gl_find_unorm_format(), which saves us additional work with OpenGL's
semi-redundant format specifiers.
2017-01-16 16:10:39 +01:00
wm4 6b00663755 vo_opengl: hwdec_cuda: export AVHWDeviceContext
So we can use it for filtering later.
2017-01-16 16:10:39 +01:00
wm4 6c28824a92 vo_opengl: hwdec_vaegl: add a lie for compatibility
EGL rendering + new decode API didn't work due to a certain libva bug
with sort-of legacy API use hitting again. It will report the wrong
vaapi pixel format. It's old code and always nv12 anyway, so stop
worrying about it.
2017-01-13 18:43:35 +01:00
wm4 812128bab7 vo_opengl, vaapi: properly probe 10 bit rendering support
There are going to be users who have a Mesa installation which do not
support 10 bit, but a GPU which can decode to 10 bit. So it's probably
better not to hardcode whether it is supported.

Introduce a more general way to signal supported formats from renderer
to decoder. Obviously this is imperfect, because it still isn't part of
proper format negotation (for example, what if there's a vavpp filter,
which accepts anything). Still slightly better than before.

I don't know any way to probe for vaapi dmabuf/EGL dmabuf support
properly (in particular testing specific formats, not just general
availability). So we stay with the current approach and try to create
and map dummy surfaces on init to probe for support. Overdo it and check
all formats that AVHWFramesConstraints reports, instead of only NV12 and
P010 surfaces.

Since we can support unknown formats now, add explicitly checks to the
EGL/dmabuf mapper code to reject unsupported formats. I also noticed
that libavutil signals support for RGB0/BGR0, but couldn't get it to
work. Remove the DRM formats that are unused/didn't work the way I tried
to use them.

With this, 10 bit decoding + rendering should work, provided you have
a capable CPU and a patched Mesa. The required Mesa patch adds support
for the R16 and GR32 formats. It was sent by a Kodi developer to the
Mesa developer mailing list and was not accepted yet.
2017-01-13 18:43:35 +01:00
wm4 88dfb9a5e7 vo_opengl: hwdec_vaegl: remove redundant vaapi surface format check
For surfaces allocated by libavutil, we assume that the sw_format (i.e.
in hw_subfmt in mp_image_params) is always correct. The API guarantees
that it explicitly sets the equivalent vaapi format on surface
allocation.

For surfaces allocated by mpv's old vaapi code, we explicitly retrieve
the format right after decoding. Unless the driver magically changes the
format asynchronously, it will still be correct once the surface reaches
the renderer.

In both cases, checking the format again is obviously redundant. In
addition, it doesn't require us to maintain a libva fourcc <-> mpfmt
table and the va_fourcc_to_imgfmt() function. This also unbreaks 10 bit
rendering support (still disabled by default).
2017-01-13 10:28:58 +01:00
wm4 6de00d10c8 vo_opengl: hwdec_vaegl: fix terminology in comment
Bad idea to call a component "pixel" - that's true only for the Y plane.
2017-01-13 10:22:11 +01:00
Mark Thompson 14010e7cf6 vo_opengl: hwdec_vaegl: DRM_FORMAT_GR16 was renamed to DRM_FORMAT_GR32
Signed-off-by: wm4 <wm4@nowhere>
2017-01-13 10:18:54 +01:00
wm4 5174add43a vo_opengl: hwdec_vaegl: add experimental P010 support
This does not work, because Mesa has no support for the proposed
DRM_FORMAT_R16 and DRM_FORMAT_GR16 formats. It's also untested of
course.

As long as video/decode/vaapi.c doesn't hand down P010 surfaces, this is
fine anyway.

This can be tested by removing the code that disables P010 output:

diff --git a/video/decode/vaapi.c b/video/decode/vaapi.c
--- a/video/decode/vaapi.c
+++ b/video/decode/vaapi.c
@@ -55,13 +55,6 @@ static int init_decoder(struct lavc_ctx *ctx, int w, int h)

     assert(!ctx->avctx->hw_frames_ctx);

-    // If we use direct rendering, disallow 10 bit - it's probably not
-    // implemented yet, and our downstream components can't deal with it.
-    if (!p->own_ctx && required_sw_format != AV_PIX_FMT_NV12) {
-        MP_WARN(ctx, "10 bit surfaces are currently supported.\n");
-        return -1;
-    }
-
2017-01-12 14:01:09 +01:00
wm4 fb4ae3c06c cuda: use libavutil functions for copying hw surfaces to memory
mp_image_hw_download() is a libavutil wrapper added in the previous
commit. We drop our own code completely, as everything is provided by
libavutil and our helper wrapper.

This breaks the screenshot code, so that has to be adjusted as well.
2017-01-12 13:59:35 +01:00
Akemi fee5ceccad cocoa: don't change Space on quit in fullscreen
circumvent undefined behavior when quitting in
fullscreen.

Fixes #3957
2017-01-11 15:00:47 +01:00
Akemi 449eb208f4 cocoa: rate limit video output
the display refresh rate can't be estimated
correctly in some cases and just increases till it
turns off display-resample. cases are
off-screen rendering (different space), mpv
being completely hidden behind another window or
the mission control view.
this utilise the unused displaylink callback to
limit the refresh rate to the actual display
refresh rate.
2017-01-11 14:20:32 +01:00
Akemi 46b74a38f1 cocoa: add border cycling
Fixes #2430
2017-01-11 14:17:33 +01:00
Akemi a05c5b4ec6 cocoa: fix handling of geometry option
This flips the y-coordinate to be consistent with
other platforms and the manual. furthermore it
fixes an unwanted behaviour of the cocoa
convertRectFromBacking method, where the x- and
y-coordinate was divided by the same factor as the
width and height instead of placing the new scaled
rectangle at the same relative position as the
original unscaled rectangle, by manually
calculating the new position.

Fixes #3867
2017-01-11 14:15:10 +01:00
wm4 9c5cbbf5d7 vo_drm: remove 2 redundant include statements
They're already pulled in by drm_common.h.
2017-01-09 16:23:27 +01:00
wm4 854651f4f5 drm: include <poll.h> instead of <sys/poll.h>
I'm not sure what systems have <sys/poll.h> (maybe there are historical
reasons why some would), but POSIX defines <poll.h>. Although this code
is full of highly OS specific calls (like ioctl()), there's no reason
not to use the more standard include path.
2017-01-09 16:21:28 +01:00
wm4 e0f25010c7 vo_opengl: replace 2 memsets
Cosmetic change.
2017-01-08 11:22:55 +01:00
Rostislav Pehlivanov c17c26f404 context_wayland: do not call vo_wayland_request_frame() upon bufferswap
vo_wayland_wait_events() is going to return when its time to swap the
buffers anyway, calling request_frame() before makes no sense.

Fixes the constant high CPU usage by the compositor when mpv is paused
and the window is in view.
2017-01-07 10:29:15 +00:00
pavelxdd 0e7dd6d4ff win32: fix for wm_syscommand
According to MSDN, in WM_SYSCOMMAND messages, the four low-order
bits of the wParam parameter are used internally by the system.
To obtain the correct result when testing the value of wParam,
an application must combine the value 0xFFF0 with the wParam
value by using the bitwise AND operator.
2017-01-05 17:23:03 +11:00
wm4 0067d1dbef vo_opengl: egl: handle potential eglChooseConfig failures
This is actually a pretty important fix. eglChooseConfig() might be the
first thing that fails when porobing for desktop GL / ES2 / ES3 support,
because EGL_RENDERABLE_TYPE is set values specific to the underlying
APIs.

Not sure how the hell this worked before. EGL 1.4 implementations
certainly could fail the call with EGL_BAD_ATTRIBUTE if
EGL_RENDERABLE_TYPE has EGL_OPENGL_ES3_BIT set. It's quite possible that
many EGL implementations tolerate invalid EGLConfig values steming from
uininitialized EGLConfig values (and eglCreateWindowSurface() even is
specified to return EGL_BAD_CONFIG error code for "not valid"
EGLConfigs).
2016-12-31 14:58:46 +01:00
wm4 5ed4119057 vo_opengl: egl: fix depth size parameter
This was accidentally flipped from 0 to 1 in a previous commit. Actually
simply remove it, because 0 is the default value for this parameter
anyway.
2016-12-30 21:45:55 +01:00
wm4 b14fc38590 vo_opengl: x11egl: fix alpha mode
The way it should (probably) work is that selecting a RGBA framebuffer
format will simply make the compositor use the alpha. It works this way
on Wayland. On X11, this is... not done. Instead, both GLX and EGL
report two FB configs, which are exactly the same, except for the
platform-specific visual. Only the latter (non-default) points to a
visual that actually has alpha. So you can't make the pure GLX and EGL
APIs select alpha mode, and you have to override manually.

Or in other words, alpha was hacked violently into X11, in a way that
doesn't really make sense for the sake of compatibility, and forces API
users to wade through metaphorical cow shit to deal with it.

To be fair, some other platforms actually also require you to enable
alpha explicitly (rather than looking at the framebuffer type), but they
skip the metaphorical cow shit step.
2016-12-30 20:04:47 +01:00
wm4 58a0c43cf4 vo_opengl: x11: move RGBA visual test to x11_common.c
So that the EGL code can use it too.

Also print the actual FB config ID, instead of nonsense. (I _think_ once
in the past a certain GLX implementation just used numeric config IDs
casted to EGLConfig - or at least that would explain this nonsense.)
2016-12-30 20:04:32 +01:00
wm4 7033a4334b vo_opengl: egl_helpers: add a way to override config selection
Preparation for the following commits. Since at least theoretically the
config selection depends on the context type (EGL_RENDERABLE_TYPE has
separate bits for ES 2, ES 3, and desktop GL), doing it any other way
would be too painful.
2016-12-30 20:03:50 +01:00
wm4 d4e7b981bf vo_opengl: egl_helpers: add a way to pass more options
For X11 garbage we have to pass some annoying parameters to EGL context
creation. Add some sort of extensible API, so that adding a new
parameter doesn't break all callers. We still want to keep it as a
single function, because it's so nice isolating all the EGL nonsense API
boilerplate like this. (Did I mention yet that X11 and EGL are garbage?)

Also somewhat simplifies the vo_flags mess in the helper internals.
2016-12-30 20:03:17 +01:00
Niklas Haas 22a22322cb vo_opengl: partially fix rotation for 4:2:2 content
The chroma alignment renormalization code forgot to account for the fact
that the chroma subsampling ratio has to be rotated.

Unfortunately, doing it this way seems to have somewhat broken the
chroma offset rotation logic for odd-sized subsampled image files. While
this is a bug, it's much, much less noticeable, so it's not nearly as
important as the bug this change fixes. Either way, a future patch needs
to still revise this logic, ideally by redesigning the entire rotation
mechanism.
2016-12-28 15:10:48 +01:00
Akemi a283b35556 cocoa: fix build on OS X 10.9
fixes #3946
2016-12-26 22:53:04 +01:00
Dario Russo 1ba3525816 Fix mistakes in spelling and grammar 2016-12-21 17:47:57 +01:00
Akemi 2b8b17402e cocoa: cosmetic fixes 2016-12-16 16:32:26 +01:00
Akemi a8347eb9ba cocoa: fullscreen refactoring
this replaces the old fullscreen with the native
macOS fullscreen. additional the
--fs-black-out-screens was removed since the new
API doesn't support it in a way the old one did.
it can possibly be re-added if done manually.

Fixes #2857 #3272 #1352 #2062 #3864
2016-12-15 20:55:16 +01:00
pavelxdd 544110bf43 win32: change the log level of 'move window' msg
It does more harm than good, since it spams terminal a lot
2016-12-14 20:45:58 +01:00
Akemi a6035439a9 cocoa: fix dropping of certain urls on the window
the 'path' of an youtube url (youtube.com/watch?v=x)
would just be '/watch'. obviously this fails to
load.
2016-12-14 00:34:16 +01:00
pavelxdd bf5727a60f win32: window styles improvements
Allow minimizing the borderless/fullscreen window by clicking on the
taskbar button or pressing Win+Down hotkey.

Also fixes #2229 and probably fixes #2451
2016-12-12 22:22:43 +11:00
pavelxdd 4399be5b62 win32: update winapi functions names
According to MSDN, GetWindowLong and SetWindowLong have been
superseded by GetWindowLongPtr and SetWindowLongPtr.
It's a cosmetic code change in this case.
2016-12-12 21:17:58 +11:00
wm4 82855bec50 client API: allow passing NULL to mpv_opengl_cb_uninit_gl()
In which case it does nothing.
2016-12-09 21:31:45 +01:00
wm4 51fd8f6fe1 vo_rpi: partially undeprecate
Using vo_opengl + MMAL overlay didn't quite work out.
2016-12-08 11:00:14 +01:00
wm4 3eceac2eab Remove compatibility things
Possible with bumped FFmpeg/Libav.

These are just the simple cases.
2016-12-07 19:53:11 +01:00
Philip Langdale 83c5f704e7 vo_opengl: hwdec_cuda: Don't include hwcontext headers
After various simplifications, these includes simply aren't needed
now.
2016-12-04 20:41:42 +01:00
wm4 09238a9bb5 vo_opengl: don't rely on viewport to contain window dimensions
Apparently we don't always set the viewport to window dimensions
anymore, e.g. if nothing is actually rendered. This means the viewport
can contain old values.

The window screenshot code uses the viewport values to guess the default
framebuffer dimensions. With --force-window --idle --no-osc (which draws
nothing and issues a glClear() command only), taking a screenshot would
yield an image with the wrong size and possibly garbage in it. Fix this
by explicitly passing the currently known window dimensions. Abusing the
values stored in the viewport was questionable anyway.
2016-12-02 15:26:45 +01:00
Emmanuel Gil Peyrot 89837523b5 wayland: destroy input before closing the display connection.
Fixes a segfault introduced in libwayland
e8ad23266f36521215dcd7cfcc524e0ef67d66dd, where a poison value has been
introduced to catch this kind of use-after-free bug.
2016-11-27 02:01:14 +00:00
wm4 1a2319f3e4 options: remove deprecated sub-option handling for --vo and --ao
Long planned. Leads to some sanity.

There still are some rather gross things. Especially g_groups is ugly,
and a hack that can hopefully be removed. (There is a plan for it, but
whether it's implemented depends on how much energy is left.)
2016-11-25 21:17:25 +01:00
pavelxdd 98a257b3a8 angle_dynamic: silence warnings during compilation
If Angle is statically linked there were some warnings during compilation.

Fixes #3834
2016-11-25 09:49:49 +01:00
Philip Langdale 48a7c4be3a vo_opengl: hwdec_cuda: Prefix cuda symbols to avoid collisions
We want to avoid causing problems if libmpv is used in an application
that links cuda, or if the libav* libraries are linked with cuda,
as might happen if the scale_npp filter is used.
2016-11-24 20:15:57 +01:00
wm4 5aab17f833 vo_opengl: hwdec_cuda: make some init errors verbose
Improves autoprobe behavior. This is equivalent to other hwdec interop
wrappers. If CUDA is just not available, it should remain silent.
2016-11-24 18:14:55 +01:00
pavelxdd e89382f5f6 vo_opengl: hwdec_cuda: fix crash when trying to use hwdec=cuda if cuda SDK is not present
If CUDA SDK wasn't installed, mpv crashed immediately with the message "Failed to load CUDA symbols"
2016-11-24 14:42:30 +01:00
Philip Langdale 7eacaf51f8 vo_opengl/cuda_dynamic: Use explicit cast to silence warnings on windows
Fixes #3834
2016-11-24 11:40:52 +01:00
Philip Langdale 3abb6f1fef wscript: Fix cuda test to actually work when cuda SDK is not present
The test ended up failing if cuda.h wasn't present, even if cuda.h
isn't used during the actual build.

This test is attempting to establish if the ffmpeg being built
against has dynlink_cuda support. While it might theoretically be
possible to build against the older normally-linked-cuda version
of ffmpeg, it seems more trouble than it's worth.
2016-11-23 20:48:26 +01:00
wm4 f696975fe3 angle_dynamic: minor simplification
Remove the inverted condition by swapping if branches.
2016-11-23 16:02:28 +01:00
Martin Herkt f9668f5596
Support linking ANGLE 2016-11-23 04:09:16 +01:00
wm4 6b3d682f4e vo_opengl: hwdec_d3d11egl: fix ANGLE fallback define
This was a typo in the extensiuon spec and was probably always broken.
Could have led to broken builds when used with ancient ANGLE headers
(or possibly generic EGL headers).
2016-11-23 01:09:19 +01:00
Philip Langdale f5e82d5ed3 vo_opengl: hwdec_cuda: Use dynamic loading for cuda functions
This change applies the pattern used in ffmpeg to dynamically load
cuda, to avoid requiring the CUDA SDK at build time.
2016-11-23 01:07:26 +01:00
Philip Langdale 585c5c34f1 vo_opengl: hwdec_cuda: Support P016 output surfaces
The latest 375.xx nvidia drivers add support for P016 output
surfaces. In combination with an ffmpeg change to return those
surfaces, we can display them.

The bulk of the work is related to knowing which format you're
dealing with at the right time. Once you know, it's straight forward.
2016-11-22 20:19:58 +01:00
James Ross-Gowan 803e2c5f87 win32: fix some Clang warnings
- win32-console-wrapper.c was inconsistently using the explicit Unicode
  versions of some Windows API functions and structures.
- vo.c should use llabs for int64_t, since long is 32-bit on Windows.
- vo_direct3d.c had a potential use of an uninitialized variable if it
  took the first goto error_exit.
2016-11-17 23:34:20 +11:00
Philip Sequeira cf85191cb7 vo_opengl: blend against background color for --alpha=blend
Do it after color management, etc. so that it matches the color drawn in
the margins.
2016-11-13 18:21:27 +01:00
Akemi aceeeaf9bb cocoa: option to scale window by HiDPI scale factor
Deactivating this options makes it possible to
circumvent the default OS X behavior of using
points. Windows on HiDPI resolutions won't open
in double the size anymore and videos are display
in their native resolution when windowed.

Fixes #3716
2016-11-11 21:37:04 +01:00
wm4 6a06e6002b vo_opengl: fix --blend-subtitles handling
The intention was that if --blend-subtitles is enabled, the frame should
always be re-rendered instead of using e.g. a cached scaled frame. The
reason is that subtitles can change anyway, e.g. if you pause and change
subtitle size and such.

On the other hand, if the frame is marked as repeated, it should always
use the cached copy. Actually "simplify" this and drop the cache only if
playback is paused (which frame->still indicates indirectly).

Also see PR #3773.
2016-11-07 22:49:24 +01:00
wm4 de72cb2c33 vo_opengl: fix redrawing with hardware decoding
unmap_current_image() is called after rendering. This essentially
invalidates the textures, so we can't assume that the image is still
present.

Also see PR #3773.
2016-11-07 22:49:16 +01:00
Nils Maier 7c9f32620f
Apply autofit-larger after autofit-smaller
This prevents the window scaling beyond screen dimensions

Fixes #3753
2016-11-03 21:30:25 +01:00
Niklas Haas 654721c27b filter_kernels: add ability to taper kernels/windows
This allows us to define the tukey window (and other tapered windows).

Also add a missing option definition for `wblur` while we're at it, to
make testing out window-related stuff easier.
2016-11-01 16:25:40 +01:00
wm4 8dff51e06c vo: clear frame repeat flag when redrawing
This makes no sense, as the flag is supposed to be used for vsync
purposes only (when literally outputting the screen again with no
changes at all), and redrawing is often used for OSD updates.
2016-11-01 16:25:40 +01:00
wm4 17733bd5b8 vo_opengl: make frame reupload logic more robust
It's not that easy to decide whether a frame needs to be
reuploaded/rerendered. Using unique frame IDs for input makes it
slightly easier and more robust. This also removes the use of video PTS
in the interpolation path.

This should also avoid reuploading the video frame if it's just redrawn
in paused mode, or when using OSD/subtitles in cover art mode.
2016-11-01 16:25:40 +01:00
wm4 bc77565838 vo_opengl_cb: fix a race condition
When pthread_cond_timedwait(), the condition we are checking for could
be true or false. This code assumed it was always false.

This should be an extremely obscure race condition, since it can happen
only if timeout and the condition changing sort of happen at the same
time, or the lock is held for a longer time (which it normally isn't).
But I could observe it a few times.
2016-10-30 18:29:24 +01:00
wm4 b0ef3dd4fb vo_opengl_cb: fix inverted condition
Commit e6291697 got this wrong.
2016-10-30 12:16:24 +01:00
wm4 1afc0c8b55 vo_opengl_cb: update current frame if a frame is dropped
Even if a frame is dropped due to the libmpv API user not drawing a
frame, it should be set as current frame. This avoids dropping a frame
forever in certain circumstances such as cover art of the API user was
stuck at initialization or such.
2016-10-30 12:00:33 +01:00
Avi Halachmi (:avih) 363982c774 vo_tct: support also 256 colors output 2016-10-25 00:03:01 +11:00
Avi Halachmi (:avih) 02d2c2cc97 vo_tct: optional custom size, support non-posix with 80x25 default
Also, replace the UTF8 half block char at the source code with C escape.
2016-10-25 00:03:01 +11:00
wm4 9ea9bdf130 vo_opengl: context_rpi: fix stdatomic usage
atomic_bool is not supported with e.g. atomic_fetch_and.

Fixes #3699. Untested.
2016-10-21 17:35:48 +02:00
wm4 202f695398 vo_opengl: partially re-enable glFlush() calls
It turns out the glFlush() call really helps in some cases, though only
in audio timing mode (where we render, then wait for a while, then
display the frame). Add a --opengl-early-flush=auto mode, which does
exactly that.

It's unclear whether this is fine on OSX (strange things going on
there), but it should be.

See #3670.
2016-10-21 17:23:26 +02:00
wm4 cc9e8e7e3d vo: vo_tct is now available on non-POSIX
Fixes Windows build.
2016-10-20 18:30:47 +02:00
Dmitrij D. Czarkoff ee2ba599e7 build: don't rely on "__thread" being always available with GCC
Thread-local storage in GCC is platform-specific, and some platforms that
are otherwise perfectly capable of running mpv may lack TLS support in GCC.

This change adds a test for GCC variant of TLS and relies on its result
instead of assumption.

Provided that LLVM's `__thread` support is similar to GCC, the test is
called "GCC/LLVM TLS".

Signed-off-by: wm4 <wm4@nowhere>
2016-10-20 17:51:57 +02:00
Aman Gupta 4bd3e51fbe opengl: compile against iOS OpenGLES implementation 2016-10-20 17:45:25 +02:00
rr- dd02369c32 vo_tct: introduce modern caca alternative 2016-10-20 14:59:54 +02:00
rr- 403f489f6c vo_drm: change CLI options + refactors
- Change connector selection to accept human readable names (such as
  eDP-1, HDMI-A-2) rather than arbitrary numbers.
- Change GPU selection to accept GPU number rather than device paths.
- Merge connector and GPU selection into one --drm-connector.
- Add support for --drm-connector=help.
- Add support for --drm-* in EGL backend.
- Refactor KMS; reduce state sharing across drm_common.
2016-10-07 00:22:23 +02:00
rr- ea1b183f4c vo_drm: fix segfault when using invalid card 2016-10-06 20:09:37 +02:00
Akemi e543853a7f cocoa: add glFlush() to cocoa backend
The glFlush() call was made optional recently
since it's not needed in most cases. On OSX though
this is needed since we removed kCGLPFADoubleBuffer
from the context creation, so the glFlush() call
was added to the cocoa backend only.
The CGLFlushDrawable() call can be safely removed
since it only does something when a double
buffered context is used. Also fixes a small typo.
Fixes #3627.
2016-10-06 19:50:25 +02:00
wm4 53798b6465 vo_opengl: apply --opengl-early-flush in dumb mode too
In "dumb mode" (where most features are disabled and which only performs
some basic rendering) we explicitly copy a set of whitelisted options,
and leave all the other options at their default values. Add the new
--opengl-early-flush option to this whitelist. Also remove an option
field accidentally added in the commit adding --opengl-early-flush.
2016-10-05 20:35:00 +02:00
wm4 e6291697e3 vo_opengl_cb: don't wait for redrawn frames
This also removes some extra waiting if no video is active, at least in
theory.

Also clarify the vo_frame flag comments for redraw/repeat.
2016-10-05 12:34:47 +02:00
wm4 6789f9b094 vo_opengl: disable glFlush() by default, and add an option to enable it
It seems this can cause issues with certain platforms, so better to
disable it by default. The original reason for this isn't overly
justified, and display-sync mode should get rid of the need for it
anyway.

The new option is meant for testing, and will probably be removed if
nobody comes up and reports that enabling the option actually improves
anything.
2016-10-05 12:21:34 +02:00
wm4 202f14aa29 vo_opengl: hwdec_rpi: fix NULL pointer deref in certain cases
If a client API user provides the MPGetNativeDisplay callback, but
returns NULL for "MPV_RPI_WINDOW", this would crash.
2016-10-04 16:36:20 +02:00
rr- ba3f6f3779 vo_drm: fix tiny memory leak 2016-10-04 13:23:11 +02:00
rr- 1648ff8a0f vo_drm: refactor getting display fps
Reduces code duplication between OpenGL backend and DRM VO.

(The control() for OpenGL backend isn't sufficiently similar to the
VO's control() to consider merging it as a whole - I extracted only the
FPS code.)
2016-10-04 13:23:11 +02:00
wm4 486b3ce6f8 vo_opengl: minor simplification
The extra gl_transform_trans() has no apparent use.
2016-10-01 16:12:03 +02:00
wm4 82231fd74d vo_opengl: attempt to fix chroma offset under rotation and flipping
Other than being overly convoluted, this seems to make sense to me.
Except that to get the "rot" transform I have to set flip=true, which
makes no sense at all to me.
2016-10-01 16:07:51 +02:00
wm4 052584c9e2 vo_opengl: add debugging options for testing with padded textures 2016-10-01 12:09:18 +02:00
wm4 52fea2f909 vo_opengl: partially fix dumb-mode cropping with rotation
Combining rotation and cropping didn't work. It was just completely
broken.

I'm still not sure if this is correct. Chroma positioning seems to be
broken on rotation. There might also be a problem with non-mod-2 frame
sizes. Still, strictly an improvement for both rotated and non-rotated
rendering modes.

Also, this could probably be written in a more elegant way.
2016-09-30 22:19:01 +02:00
wm4 33c24b07e4 vo_opengl: vaegl: log more debugging infos 2016-09-30 14:36:42 +02:00
wm4 5f547e57e3 vo_opengl: rpi: remove dumb comment
It's not even true anymore.
2016-09-30 14:28:55 +02:00
wm4 51f10c512e vo_opengl: rpi: fix glaring memory leak
This was in previously inactive code (uploading yuv420p), so it did not
matter.
2016-09-30 13:53:12 +02:00
wm4 ab07caf39d vo_opengl: rpi: use overlay for yuv420p too
The video code can deal fine with feeding software image formats to
hwdec interop drivers. In RPI's case, this is preferable for
performance, working around OpenGL bugs (see RPI firmware issue #666),
and because OpenGL rendering doesn't bring too many advantages due to
RPI supporting GLES 2.0 only.

Maybe a way to force the normal video path is needed later. But
currently, this can be tested by just not loading the hwdec interop
driver.

If you run command-line mpv and set --hwdec to something that does
not load the RPI interop layer, you'll even have to use --hwdec-preload
manually to get it enabled.
2016-09-30 13:49:49 +02:00
wm4 2aba6972cf vo_opengl: allow hwdec interops to support multiple image formats 2016-09-30 13:46:27 +02:00
wm4 2f1af04745 vo_opengl: egl: print EGL errors only if not probing
Avoids printing an error when trying to create a GLES 3.x context on a
device which can do GLES 2.0 only.
2016-09-30 13:06:31 +02:00
wm4 d3111ee777 vo_opengl: rpi: raise the video layer
Was intended to put the GL layer above the standard console. (But
actually that was done already, and the oddness I'm seeing seems to
be an unrelated bug.)
2016-09-30 13:05:58 +02:00
James Ross-Gowan f549cec0ac w32_common: implement VOCTRL_GET_DISPLAY_NAMES
This should make display-names usable on Windows. It returns a list of
GDI monitor names like "\\.\DISPLAY1". Since it may be useful to get the
monitor that Windows considers associated with the window (with
MonitorFromWindow,) this will always be returned as the first argument.
This monitor is the one used for display-fps and icc-profile-auto.
2016-09-29 23:49:36 +10:00
James Ross-Gowan 3751065f97 win32: build with -DINITGUID
We always want to use __declspec(selectany) to declare GUIDs, but
manually including <initguid.h> in every file that used GUIDs was
error-prone. Since all <initguid.h> does is define INITGUID and include
<guiddef.h>, we can remove all references to <initguid.h> and just
compile with -DINITGUID to get the same effect.

Also, this partially reverts 622bcb0 by re-adding libuuid.a to the
build, since apparently some GUIDs (such as GUID_NULL) are not declared
in the source file, even when INITGUID is set.
2016-09-28 21:38:52 +10:00
wm4 c239b7de7e vo_opengl: deprecate 'drm-egl' backend and introduce 'drm' instead
Just a name change. Requested.
2016-09-27 16:29:22 +02:00
rr- 0fe3e9ca5e vo_drm: provide display fps 2016-09-26 19:26:31 +02:00
Akemi 9f30cd8292 cocoa: fix fullscreen regression on 10.11 and newer
Fixes #3364.
2016-09-26 19:25:50 +02:00
Philip Langdale 343da8d73d vo_opengl: hwdec_cuda: get the cuda device from the GL context
Obviously, in the vast majority of cases, there's only one device
in the system, but doing this means we're more likely to get a
usable device in the multi-device case.

cuda would support decoding on one device and displaying on another
but the peer memory handling is not transparent and I have no way
to test it so I can't really write it.
2016-09-24 17:11:09 +02:00
Philip Langdale 441febfcba vo_opengl: hwdec_cuda: directly map GL textures and skip using PBOs
The documentation around this stuff is poor, but I found an nvidia
sample that demonstrates how to use the interop API most efficiently.

(https://github.com/nvpro-samples/gl_cuda_interop_pingpong_st)

Key lessons are:
1) you can register the texture itself and have cuda write to it,
   thereby skipping an additional copy through the PBO.
2) You don't have to be mapped when you do the copy - once you get a
   mapped pointer, it remains valid. Magic!

This lets us throw out the PBOs as well as much of the explicit
alignment and stride handling.

CPU usage is slightly (~3%) lower for 4K content in one test case,
so it makes a detectable difference, and presumably saves memory.
2016-09-24 17:11:06 +02:00
wm4 5f2822d502 vo_opengl: hwdec_rpi: remove copy&paste error 2016-09-23 19:45:16 +02:00