Commit Graph

1051 Commits

Author SHA1 Message Date
wm4 d38bc531cc vo: include normal render-ahead time in flip_queue_offset
A small refactor; shouldn't change any behavior.

Do this so immediate display can be achieved.
2014-12-09 17:59:04 +01:00
James Ross-Gowan 349d19dda9 w32_common: fix GUID linking in Cygwin 2014-12-09 21:07:47 +11:00
Stefano Pigozzi f93e8bb490 cocoa: fix crash
fixes #1323

Doesn't leak unless we switch video tracks on and off while in fullscreen.
2014-12-08 23:02:09 +01:00
wm4 8927d5942c vo_opengl: enable fancy-downscaling for opengl-hq again
I guess most problems with it have been fixed.

It's still slower than necessary, though.
2014-12-08 17:09:39 +01:00
wm4 08e9bbe3dd vo_opengl: use all filter sizes possible with the shaders
Not all filter sizes the shaders could handle were in the filter_sizes
list. The shader can handle any multiple of 4 (the sizes 2 and 6 are
special-cased to keep it simple).

Add all possible filter sizes, up to 64. 64 is ridiculously high anyway.
Most of the larger filter sizes are completely useless for upscaling,
but help with the fancy-downscaling option. (Although it would still be
more efficient to use cascaded scalers to handle downscaling better.)

I considered doing something less stupid than the hardcoded array, but
it seems this is still the simplest solution.
2014-12-08 17:08:26 +01:00
wm4 9c484cb080 vo_opengl: refactor: instantiate scaler functions at runtime
Before this commit, the convolution scaler shader functions were pre-
instantiated in the shader file. For every filter size, a corresponding
function (with the filter size as suffix) had to be present.

Change this, and make the C code emit the necessary bits.

This means the shader code is much reduced. (Although hopefully it
doesn't make shader compilation faster - it would require a really dumb
compiler if it spends its time on dead code.)

It also makes it more flexible, which is the main goal.

The DEF_SCALER0 stuff is needed because the C code writes the header of
the shader, at a point where scaler macros are not defined yet.
2014-12-08 16:24:38 +01:00
wm4 4a95be014b vo_opengl: never use 1D textures for lookup textures
This was a microoptimization for small filters which need 4 or less
weights per sample point. When I originally wrote this code, using a 1D
texture seemed to give a slight speed gain, but now I couldn't measure
any difference.

Remove this to simplify the code.
2014-12-08 15:23:21 +01:00
wm4 4cae83db76 vo_opengl: refactor: merge convolution function and sampler entrypoint
There's not much of a reason to have the actual convolution code in a
separate function. Merging them actually simplifies the code a bit, and
gets rid of the repetitious macro invocations to define the functions
for each filter size.

There should be no changes in behavior or output.
2014-12-08 14:59:57 +01:00
James Ross-Gowan 2e1daaff83 w32_common: ensure taskbar is hidden when fullscreen
Windows uses a heuristic to determine if a window should appear
fullscreen. If the active window's client area covers the whole screen,
the taskbar should move to the bottom of the Z-order, allowing the
window to show through.

Unfortunately, sometimes it doesn't work and the taskbar stays on top of
the "fullscreen" window. ITaskbarList2->MarkFullscreenWindow explicitly
tells the shell that a window wants to be fullscreen, so the taskbar is
always at the bottom of the Z-order while the marked window is active.

This might help with #999. Firefox also uses this interface to fix
fullscreen issues.
2014-12-08 22:07:20 +11:00
wm4 6adaddbe63 vo_opengl: extend filter size to 64
For better downscaling.

Maybe the list of filter sizes shouldn't be static...
2014-12-06 23:59:54 +01:00
wm4 309c5fee59 vo_opengl: clamp filters to their size
This gives better results with fancy-downscaling. The issue here is that
fancy-downscalign "extends" the filter radius by some amount, which
requires using a larger filter size and shader. Then most of the filter
is "unused", but some filters still return non-0 coefficients, which
create heavy artifacts. Just clamp them off.

I'm not sure if this is the right solution, but at least it's better
than before.
2014-12-06 23:59:54 +01:00
Stefano Pigozzi 2833670b71 cocoa: fix view leak in uninit when fullscreen 2014-12-06 21:55:36 +01:00
Stefano Pigozzi 685b8b7a00 cocoa: use --idle when running inside bundle
Previously when using the bundle we used a custom bizarro thing to wait for
events. Just use `--idle` and greatly simplify the code.
2014-12-06 14:16:13 +01:00
Stefano Pigozzi 73b7d4516b cocoa: don't change app activation policy in libmpv
/cc @mpv-player/stable
2014-12-06 10:13:11 +01:00
wm4 0641c7b783 vo_opengl: disable fancy-downscaling for opengl-hq again
Seems it's actually buggy, beyond the problem that large filter sizes
are required.
2014-12-06 01:46:34 +01:00
wm4 115b165b98 vo_opengl: extend filter size to 32
Also replace the weights calculations for 8/12/16 with the generic
weight function definition macro. (The weights 2/4/6 follow slightly
different rules.)
2014-12-06 01:45:39 +01:00
wm4 df36470611 vaapi/GLX: remove a direct reference to an GL symbol
Instead go through our function loader.
2014-12-06 01:40:23 +01:00
Stefano Pigozzi ed76d22b22 cocoa: don't create Dock icon for audio only files
fixes #635
2014-12-05 23:13:21 +01:00
Stefano Pigozzi bc1b9aa984 cocoa: don't async redraw when waiting for VO redraw
This fixes the very annoying glitch where the black bars disappear for
a single frame when going fullscreen.
2014-12-04 22:53:50 +01:00
wm4 19f9a7066e vo_opengl: make uninit idempotent 2014-12-03 23:01:19 +01:00
wm4 920512d358 vo_opengl: move hwdec parts into their own files
This wasn't done before because there was no advantage in "abstracting"
it. This changed, and putting this into its own files is better than
messing it into gl_common.c/h.
2014-12-03 23:01:19 +01:00
wm4 63377744f3 vdpau/GLX: don't access VO backend
Same as with the previous commits.

In theory, vdpau/x11 GL interop doesn't assume GLX. It could use EGL as
well. But since it's always GLX in practice, so we're fine with this.

Remove the gl_hwdec.mpgl field - it's unused now.
2014-12-03 21:13:59 +01:00
wm4 031aef9be9 vaapi/GLX: don't access VO backend
Same as with the VDA change.
2014-12-03 21:07:18 +01:00
wm4 bfa7893fe9 vda: make independent from cocoa backend
Basically, don't access the vo field.

There's also no reason anymore to access MPGLContext. We still need to
access loaded GL functions though, so add a field for that to gl_hwdec.

Untested.
2014-12-03 21:02:33 +01:00
Stefano Pigozzi 82afc0f343 vda: use implicit current GL context
Removes the dependency from the Cocoa backend in case we are not using
it but still wanna use VDA GL introp.
2014-12-03 20:40:06 +01:00
wm4 ef1c7563c5 vo_opengl: minor changes
Always set the viewport on entry. The way the viewport is tracked is a
bit complicated in my opinion, and in fact it doesn't even reduce the
number of GL calls. Setting it on entry is actually redundant if video
covers the screen fully, because the handle_pass() unconditionally sets
it anyway, but avoiding it would complicate the cases gl->Clear() is
actually needed.

Add a fbo argument to gl_video_render_frame(). This allows you to render
into a FBO rather than the default framebuffer. It will be useful for
providing an API to render on an external GL context. (If that will
actually be added.)
2014-12-02 20:36:55 +01:00
wm4 33a6b8df46 vo_opengl: print error number if framebuffer creation fails
Seems like a waste not to print this.

Anyone with enough technical knowledge to have use for the exact error
can map the number back to the GL symbol, so don't bother to convert it
to a symbol.
2014-12-02 20:36:55 +01:00
Stefano Pigozzi 586c9e7155 cocoa: allow to black out other display when going fs
fixes #1302
2014-12-01 18:05:30 +01:00
wm4 98da9afb8f vo_opengl: remove redundant GL state initialization
All of these are already the defaults.

One exception is glDepthMask(), which is enabled by default. But if the
framebuffer has no depth buffer anyway, it shouldn't make a difference.
2014-12-01 14:50:00 +01:00
Sergey Kvachonok 01717dcd2c vo_wayland: Add "multimedia" keyboard key bindings.
libxkbcommon keysyms are the same as X11 keysyms (sans prefix),
so I simply copied the missing subsection from x11_common.c.

Signed-off-by: Sergey Kvachonok <ravenexp@gmail.com>
Signed-off-by: wm4 <wm4@nowhere>
2014-11-29 19:13:47 +01:00
wm4 9e10f8ccbb vo_opengl: enable fancy-downscaling by default for opengl-hq 2014-11-29 00:04:01 +01:00
wm4 4ce7a2ede9 vo_opengl: disable fancy-downscaling for anamorphic video
Includes some arbitrary minor refactoring.
2014-11-29 00:04:00 +01:00
wm4 4af24daf2c win32: add screen offset when handling overlarge windows
MS Windows doesn't allow windows larger than the screen, so we include
a hack to make the window smaller. This hack recenters the window (what
else would it do?).

It didn't account for the virtual offset of the current screen, and it
was reported that it forces the window to the first screen.

Should fix #1292.
2014-11-28 22:11:54 +01:00
wm4 5db162231e vo_direct3d: check whether D3DFMT_A8 is available
I suspect this is what is happening in github issue #1265 (at least
partially).

If D3DFMT_A8 is not available, fall back to RGBA. This is less efficient
in general, so we normally want to avoid it.
2014-11-27 20:05:29 +01:00
wm4 4495044947 gl_video: minor simplification
Not needed anymore.
2014-11-27 19:48:15 +01:00
Niklas Haas b584802813 vo_opengl: Linearize non-RGB sRGB files correctly (eg. JPEG)
Signed-off-by: wm4 <wm4@nowhere>
2014-11-26 21:44:36 +01:00
wm4 cc54377463 Do not call strerror()
...because everything is terrible.

strerror() is not documented as having to be thread-safe by POSIX and
C11. (Which is pretty much bullshit, because both mandate threads and
some form of thread-local storage - so there's no excuse why
implementation couldn't implement this in a thread-safe way. Especially
with C11 this is ridiculous, because there is no way to use threads and
convert error numbers to strings at the same time!)

Since we heavily use threads now, we should avoid unsafe functions like
strerror().

strerror_r() is in POSIX, but GNU/glibc deliberately fucks it up and
gives the function different semantics than the POSIX one. It's a bit of
work to convince this piece of shit to expose the POSIX standard
function, and not the messed up GNU one.

strerror_l() is also in POSIX, but only since the 2008 standard, and
thus is not widespread.

The solution is using avlibc (libavutil, by its official name), which
handles the unportable details for us, mostly. We avoid some pain.
2014-11-26 21:21:56 +01:00
wm4 3fe57e3cb6 gl_common: factor context creation
Always create the context in mpgl_init(), instead of doing it when
mpgl_config_window() is called the first time. This is a small step
towards cleaning up the GL backend interface, and adding other things
like perhaps GLES support, or a callback-driven backend for libmpv.
2014-11-26 20:48:18 +01:00
Niklas Haas 7e62f2b052 vo_opengl: Reword comment in shader
I didn't quite understand this comment after looking at the code again
months later, so I reworded it for better clarity.
2014-11-26 20:31:59 +01:00
wm4 fc0ea3a541 vo_opengl: make operator precedence explicit
More readable.
2014-11-26 20:03:20 +01:00
wm4 cebb3ba645 vo_opengl: fix srgb with certain inputs
Sampling from the source texture and scaling must always be done
separately in this mode.

Fix suggested by haasn.

Still looks a bit wrong, though.
2014-11-26 20:02:55 +01:00
wm4 46dc5709c8 vo_opengl: something
Insert explanation here.

Fixes #1023.
2014-11-26 18:22:57 +01:00
Stefano Pigozzi 4590c198e6 cocoa: don’t hand over view memory ownership to libmpv clients 2014-11-25 14:45:13 +01:00
wm4 9d91776d0d x11: fix crash
Broken by previous commit. Oops.
2014-11-23 13:58:03 +01:00
wm4 c9fdf4308c x11: fix crash with --wid=0 and vo_xv/vo_x11
But seriously, don't use --wid=0, don't use vo_xv, and _especially_
don't use vo_x11.

Fixes #1284.
2014-11-23 10:54:34 +01:00
wm4 b8ac594af0 vo_direct3d: fix texture-memory sub-option, extend it
This sub-option was turned into a flag when the sub-option parser was
changed to the generic one (probably accidentally). Turn it into a
proper choice-option.

Also, adjust what the options do. Though none of this probably makes
much sense; the default should work, and if it doesn't, the GPU/driver
is probably beyond help.
2014-11-18 16:30:32 +01:00
wm4 d484cb3f32 vo_opengl: allow setting different filters for downscaling 2014-11-14 15:22:37 +01:00
Rudolf Polzer 4f63a812de ao_lavc, vo_lavc: Fix crashes in case of multiple init attempts.
When initialization failed, vo_lavc may cause an irrecoverable state in
the ffmpeg-related structs. Therefore, we reject additional
initialization attempts at least until we know a better way to clean up
the mess.

ao_lavc currently cannot be initialized more than once, yet it's good to
do consistent changes there as well.

Also, clean up uninit-after-failure handling to be less spammy.
2014-11-12 12:16:07 +01:00
wm4 67e0230905 encode: don't segfault when bailing out due to resolution change
Somehow this code expects lastimg is always set.
2014-11-11 17:59:49 +01:00
wm4 d8cd768ed0 vo_opengl: don't reset user-set gamma when using vo_cmdline 2014-11-11 10:48:54 +01:00