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

2031 Commits

Author SHA1 Message Date
Niklas Haas
076b3d1385 csputils: add support for BT.470-M
For some kind of legacy TV system, who knows? But ffmpeg supports it,
and it's cheap for us to add.
2015-02-28 01:07:09 +01:00
wm4
73c5c3df53 vo_opengl: delete 16 bit test texture
Essentially a leak, but not that bad since it's small and allocated only
once.
2015-02-27 22:13:15 +01:00
wm4
e7b7a5a476 vo_opengl: fix some comments 2015-02-27 22:01:27 +01:00
wm4
1eb533afb3 options: handle choice -> flag fallback automatically
In the past it happened quite often that flag options (yes/no) were
changed to choice options (yes/no/some more). The problem with this was
that while flag options don't need a parameter, this wasn't the case
with choice options. A hack was introduced to compensate for this:
setting M_OPT_OPTIONAL_PARAM on the option, and an empty string ("") was
added as choice, so that the choice could be used like a flag. So, for
example, "--mute" would set the choice "".

Fix this by 1. not requiring a parameter if there's a "yes" choice, and
2. redirect an empty parameter to "yes". The effect is that a choice
option with the choices ["yes", "no"] is pretty much equivalent to a
flag option.
2015-02-27 18:31:24 +01:00
Niklas Haas
0da6a7346a
vo_opengl: implement antiringing for tensor scalers
This is based on pretty much the same (somewhat naive) logic right now.
I'm not convinced that the extra logic that eg. madVR includes is worth
enough to warrant heavily confusing the logic for it.

This shouldn't slow down the logic at all in any sane shader compiler,
and indeed it doesn't on any shader compiler that I tested.

Note that this currently doesn't affect cscale at all, due to the weird
implementation details of that.
2015-02-27 04:35:15 +01:00
wm4
280c826379 vo_opengl: test FBOs only if they're going to be used
Change test_fbo() so that it checks the FBO lazily, and restructure
check_gl_features() to invoke it only if we know that a FBO will be
needed for a certain enabled feature.

This can avoid strange error messages when using --vo=opengl and the
FBO format does not work. It's also less confusing when reading the
verbose log (users might think that the FBO is actually used, etc.).
2015-02-26 10:37:31 +01:00
wm4
a2e0cd7f25 vo_xv: don't attempt to clear window before mapped
This can happen with the "no-colorkey" suboption. Then the code in
xv_draw_colorkey() can be run before vo_x11_config_vo_window(), when
vo_gc is not allocated yet.

Fixes #1629.
2015-02-26 09:26:28 +01:00
Niklas Haas
010cf183fe
vo_opengl: greatly increase smoothmotion performance
Instead of rendering and upscaling each video frame on every vsync, this
version of the algorithm only draws them once and caches the result,
so the only operation that has to run on every vsync is a cheap linear
interpolation, plus CMS/dithering.

On my machine, this is a huge speedup for 24 Hz content (on a 60 Hz
monitor), up to 120% faster. (The speedup is not quite 250% because of
the overhead that the larger FBOs and CMS provides)

In terms of the implementation, this commit basically swaps
interpolation and upscaling - upscaling is moved to inter_program, and
interpolation is moved to the final_program.

Furthermore, the main bulk of the frame rendering logic (upscaling etc.)
was moved to a separete function, which is called from
gl_video_interpolate_frame only if it's actually necessarily, and
skipped otherwise.
2015-02-24 21:52:14 +01:00
wm4
cc011415ff vo_opengl: another GLES2 issue
GLES2 randomly does not support the transpose parameter in matrix
uniform calls. So we have to do this manually. Sure it was worth to
mutilate the standard just so all these shitty SoC vendors can safe 3
lines of code.

(Obviously trying to handle all of GLES2 to GL 4.x in a single codebase
was a mistake.)
2015-02-24 13:48:09 +01:00
wm4
2c8d16d89f vo_opengl: extend ifdef against shader arrays
GLES2 shaders do not have line continuation characters. Abuse the
HAVE_ARRAYS define to exclude code which uses arrays, and which also
happens to cover all code that defines multi-line macros. (So yes, this
is a hack.)
2015-02-24 13:36:43 +01:00
wm4
5baf74fa24 video: remove redundant codec parameters
Remove coded_width and coded_height. This was originally added in commit
fd7dde40, when BITMAPINFOHEADER was killed. The separate fields became
redundant in commit e68f4be1. Remove them (nothing passed to the
decoders actually changes with _this_ commit).
2015-02-24 11:56:48 +01:00
Niklas Haas
a759028f67
filter_kernels: rename bilinear_slow to triangle
This is essentially what it is, and it's a useful for windowing or
downscaling. For upscaling we already have bilinear, no need to cause
extra confusion between biliner and bilinear_slow.

Also made it a bit more well-behaved.
2015-02-24 03:13:37 +01:00
Niklas Haas
dc3c718b37
filter_kernels: add robidoux and robidouxsharp
These are EWA-based versions of the keys B/C splines, of which mitchell
is already a member. They are slightly softer and slightly sharper than
mitchell, respectively.

Very easy to define in terms of things we already have.
2015-02-24 01:35:14 +01:00
Niklas Haas
dd345afb38
filter_kernels: redefine redundant filters
mitchell, hermite and catmull_rom are all B/C splines and can share the
code which was already written for mitchell. This just redefines them in
terms of that.
2015-02-24 01:32:45 +01:00
Niklas Haas
d27563cb14
filter_kernels: add ewa_lanczossharp alias
This is essentially a preconfigured version of ewa_lanczos, with the
"best" parameters for general purpose usage.
2015-02-24 00:52:17 +01:00
Niklas Haas
eb70e31cc7
vo_opengl: support polar filters of any radius
We can now truly pass a radius of 3.2383154841662362 or another
real zero of the jinc function to get a better result.
2015-02-24 00:29:27 +01:00
Niklas Haas
71a20f7c98 vo_opengl: explicitly check potential candidates for polar filters
This adds a small check for candidates that could potentially be inside
the radius, but aren't necessarily. This speeds up performance by a
negligible amount on my hardware, but it's mainly a prerequisite for a
further change (using a larger true radius).
2015-02-24 00:29:24 +01:00
Niklas Haas
36011c7f6d
filter_kernels: add blur parameter to jinc
This affects all filters that use it, eg. ewa_lanczos. Setting it to
something like 0.95 can be done to make the filter a bit less blurry.
2015-02-23 19:06:18 +01:00
Niklas Haas
6765a7549b
filter_kernels: gaussian: redefine the parameter
Previously, this was based on some arbitrary range 1-100, cut off for
no particular reason, and also defined in such a way that higher values
= *less* smoothness. Since it wasn't multiplied by e in the code, the
default had to be 10*e = 28.8539...

Now, it's sane: 1.0 = default, higher = blurrier.
2015-02-23 18:20:06 +01:00
Niklas Haas
a3733b53d3
filter_kernels: remove second parameter from kaiser
This filter isn't supposed to have a second parameter in the first
place, all literature only uses a single parameter alpha in both places.

The second parameter doesn't even do anything other than adding a
constant factor, which is normalized by the LUT calculation either way.
2015-02-23 18:02:52 +01:00
Niklas Haas
99dfd3368d
filter_kernels: rename ginseng to ewa_ginseng
This is done mainly for consistency, since all of the EWA filters share
similar properties and it's important to distinguish them for
documentation purposes.
2015-02-23 17:42:49 +01:00
Niklas Haas
c2c96f9b10
filter_kernels: add ewa_hanning
This is suggested in a thesis by Andreas Gustafsson, and seems to
produce very a bit less ringing than lanczos at high radius.
2015-02-23 16:30:22 +01:00
Niklas Haas
b17781bbc6
filter_kernels: minor code cleanup of jinc stuff
No point in duplicating this check all over the place. No point in
really having it in the first place, to be perfectly honest, j1 should
not be THAT badly behaved.
2015-02-23 16:27:10 +01:00
wm4
24e7280178 vf: fix indentation level of verbose output
Just so that it has the same indentation as the extremely similar audio
filter output.
2015-02-23 16:12:03 +01:00
Niklas Haas
1ecd9727f0
vo_opengl: slightly improve ewa_lanczos windowing
The original filter window was design for a radius based on the true
zero, but we always cut it off at our selection of radius either way (by
necessity, due to the square matrix we sample from).

This window is tweaked from the original (true radius) to our actual
cut-off radius, and hence improves the result in a few edge cases. The
main win is the reduction of code complexity, since we no longer need to
know what the true radius actually is.
2015-02-23 10:37:20 +01:00
wm4
d71bbcbc98 video: un-discourage "vaapi-copy" hwdec mode
Maybe I don't know what I'm doing. I'm fairly certain though that Intel
does not know what they're doing.
2015-02-20 22:24:37 +01:00
wm4
d5addec147 x11egl: minor cleanup
Not like it matters, and is probably still not entirely correct.
2015-02-20 19:54:33 +01:00
wm4
9861abf8ff vo_opengl: minor robustness improvement in function loader
Check the scanf() return value, and don't continue if it doesn't find
both numbers (can happen with GLES 1.0). Also, some implementations can
return NULL from glGetString() if something is "broken".
2015-02-20 18:53:35 +01:00
Niklas Haas
885c2fff70 vo_opengl: add ginseng upscaler
This is a variation of ewa_lanczos that is sinc-windowed instead of
jinc-windowed. Results are pretty similar, but the logic is simpler.
This could potentially replace the ugly ewa_lanczos code.

It's hard to tell, but from comparing stills I think this one has
slightly less ringing than regular ewa_lanczos.
2015-02-20 16:21:46 +01:00
Niklas Haas
4356e893a1 vo_opengl: fix smoothmotion coefficient calculation, for real this time
I've reworked pretty much all the logic to correspond to what the theory
actually describes. With this commit, playback is wonderfully smooth on
my machine.
2015-02-20 15:06:35 +01:00
torque
3b269ac0a0 input: add MOUSE_ENTER keybinding.
Signed-off-by: wm4 <wm4@nowhere>
2015-02-18 00:03:16 +01:00
wm4
0063d94927 vo_opengl: glsl: remove trailing \
This should be no problem... but it _might_ help with #1536, so it's
worth a try.
2015-02-16 21:00:03 +01:00
wm4
6e50e59386 vf_vapoursynth: replace a hack with a newer VS API function
The new function does exactly what we need. Replaces the old hack, which
created the vscore by running an empty script.
2015-02-16 20:56:00 +01:00
wm4
cf073138b2 vd_lavc: uninit the hwdec backend after closing the decoder
A recent behavior change in libavcodec's h264 decoder keeps at least 1
surface even after avcodec_flush_buffers() has been called. We used to
flush the decoder in order to make sure all surfaces are free'd, so that
the hw decoder can be safely uninitialized. This doesn't work anymore.

Fix it by closing the AVCodecContext before the hw decoder is
uninitialized. This is actually simpler and more robust. It seems to be
well-supported too.

Fixes invalid read accesses with vaapi-copy and dxva2-copy. These
destroyed the hwdec API fully on uninit, and could not deal with
surfaces surviving the decoder.

Probably fixes #1587.
2015-02-14 16:45:38 +01:00
wm4
f247294d73 x11: fix uninitialized variable reads
This line of code ended up in the wrong block in commit cd6dfcbe.
2015-02-14 16:45:38 +01:00
Martin Herkt
9aaec7cffb x11: add XK_Cancel to the list of special keys
Some IR receivers emit this key by default for remote control
buttons. Make it mappable.
2015-02-14 03:50:26 +01:00
Julian
349067a6ab vf_vapoursynth: add display refresh rate property
This value is not necessarily trustworthy (it might change) and can be
0.
2015-02-13 22:35:47 +01:00
wm4
cd6dfcbef4 x11: return a framerate even if no window is mapped
Falls back to the first display in the list returned by xrandr. Not
entirely correct, but makes some people happy (see #1575).
2015-02-13 22:34:26 +01:00
wm4
417869f845 x11: make all XF86 special keys mappable
Makes all keys documented in XF86keysym.h mappable. This requires the
user to deal with numeric keycodes; no names are queried or exported.

This is an easy way to avoid adding all the hundreds of XF86 keys to
our X11 lookup table and mpv's keycode/name list.
2015-02-13 21:47:22 +01:00
Stefano Pigozzi
3931544ef3 vo_opengl: fix smoothmotion coefficient calculation
Using prev_pts as the start of the scale was plain wrong. Change it to
prev_vsync.
2015-02-13 20:39:53 +01:00
wm4
5c5e38fc0e vf_lavfi: drop useless option from wrapper filters
Filters which merely wrap libavfilter (for user-compatibility) like
vf_gradfun had a "lavfi-enable" suboption, which could disable
libavfilter usage. Since none of these filters has an internal
implementation anymore, this was completely useless.
2015-02-12 11:53:40 +01:00
wm4
2522bff565 video/filters: simplify libavfilter bridge
Remove the confusing crap that allowed a filter using the libavfilter
bridge to be compiled without libavfilter. Instead, compile the wrappers
only if libavfilter is enabled at compile time.

The only filter which still requires it is vf_stereo3d (unfortunately).
Special-case this one. (The whole filter and how it interacts with lavfi
is pure braindeath anyway.)
2015-02-11 17:35:58 +01:00
wm4
73d23a9405 vf_noise: remove internal implementation
It requires libavfilter now, just like many other filters. Not sure if
it even makes sense to keep this wrapper.
2015-02-11 17:20:22 +01:00
wm4
0ab1509f14 vo: minor simplification
Whatever.
2015-02-07 21:14:43 +01:00
wm4
75edecb526 vo_vdpau: minor simplification
No change in behavior.
2015-02-07 21:14:12 +01:00
wm4
62b0f64c24 Revert "vo_opengl: disable alpha by default"
This reverts commit a33b46194c.

It turns out FFmpeg really considers this a bug, and fixed it by making
the decoder output the correct pixel format.

Fixes #1565. Reverts the fix #1528, though it should work fine with
a recent git master FFmpeg.
2015-02-06 23:23:27 +01:00
wm4
be5994a781 video: work around libswscale for PNG pixel formats
The intention is that we can test vo_opengl with high bit depth PNGs
better. This throws libswscale completely out of the loop, which before
was needed in order to convert from big endian to little endian.

Also apply a minimal cleanup to fmt-conversion.c (unrelated).
2015-02-06 23:22:16 +01:00
Niklas Haas
4fed18e81e
vo_opengl: add support for linear scaling without CMS
This introduces a new option linear-scaling, which is now implied by
srgb, icc-profile and sigmoid-upscaling.

Notably, this means (sigmoidized) linear upscaling is now enabled by
default in opengl-hq mode. The impact should be negligible, and there
has been no observation of negative side effects of sigmoidized scaling,
so it feels safe to do so.
2015-02-06 03:37:21 +01:00
Niklas Haas
4872443fc0
vo_opengl: get rid of unused field approx_gamma
This was left over from 61f5a80.
2015-02-06 02:55:49 +01:00
wm4
c5f1391ebb vo_vdpau: remove unneeded code
This is already done in the common vo.c code.
2015-02-04 23:38:00 +01:00
wm4
23fd114299 vo_opengl: redraw when pausing while showing an interpolated frame
If smoothmotion is enabled, and the screen shows an interpolated frame
the moment you pause, redraw a non-interpolated frame.
2015-02-04 23:37:38 +01:00
Stefano Pigozzi
eacf22e42a cocoa: improve refresh rate fallback code
Apparently CoreGraphics reports the actual refresh rate. DisplayLink can also
query the nominal refresh rate of the display so we use that as fallback
instead of the fugly 60fps hardcode added in aeb1fca0d.

Props to people on https://github.com/glfw/glfw/issues/137
2015-02-03 22:59:54 +01:00
Stefano Pigozzi
aeb1fca0d4 cocoa: automatically fetch display-fps from the monitor
Comment explains why I have been so doubtful at adding this. The Apple docs
say CGDisplayModeGetRefreshRate is supposed to work only for CRTs, but it
doesn't, and actually works for LCD TVs connected over HDMI and external
displays (at least that's what I'm told, I don't have the hardware to test).
Maybe Apple docs are incorrect.

Since AFAIK Apple doesn't want to give us a better API – maybe in the fear we
might be able to actually write some useful software instead of "apps" –
I decided not to care as well and commit this.
2015-02-03 22:07:37 +01:00
wm4
a33b46194c vo_opengl: disable alpha by default
This reverts the default behavior introduced in commit 93feffad. Way too
often libavcodec will return RGB data that has an alpha channel as per
pixel format, but actually contains garbage.

On the other hand, this will actually render garbage color values in
e.g. PNG files (for pixels with alpha==0, the color value should be
essentially ignored, which is what the old alpha blend mode did).

This "fixes" #1528, which is probably a decoder bug (or far less likely,
a broken file).
2015-02-03 21:00:21 +01:00
wm4
fd78d77586 vo_opengl: avoid unnecessary shader reinit on fullscreen toggle
Makes it unnecessarily slow. It's still needed if the sigmoid crap is
actually used.
2015-02-03 17:39:30 +01:00
wm4
98828886d4 vo_opengl: change initialization of gamma option
Make the lazy gamma initialization less weird, and make the default
value of the "gamma" sub-option 1.0. This means --vo=opengl:help will
list the actual default value.

Also change the lower bound to 0.1 - avoids a division by zero (I don't
know how shaders handle NaN, but it's probably not a good idea to give
them this value).
2015-02-03 17:19:34 +01:00
wm4
f296dcb248 csputils, vo_opengl: remove per-component gamma
There was some code accounting for different gamma values for R/G/B.
It's inherited from an old, undocumented MPlayer feature, which was at
some point disabled for convenience by myself (meaning you couldn't
actually set separate gamma because it was removed from the property
interface - mp_csp_copy_equalizer_values() just set them to the same
value). Get rid of these meaningless leftovers.
2015-02-03 16:52:44 +01:00
wm4
0f560bbf8a csputils: remove some unused functions, make some private
mp_gen_gamma_map() and mp_gen_yuv2rgb_map() were used by vo_opengl_old
only. The other functions removed from csputils.h are used by csputils.c
only.
2015-02-03 16:38:38 +01:00
Niklas Haas
9d62482cdc
vo_opengl: change upper bound of :gamma to 2.0
This allows a spread of 1.0 in either direction, which is already close
to absurd. Anything higher than that is pretty pointless.
2015-02-03 12:29:19 +01:00
Niklas Haas
fa1698cb9a vo_opengl: always clamp the video to range 0-1
Before this, enabling :gamma in combination with :sigmoid and probably a few
other things results in ugly artifacts because the video isn't clamped until
after the :gamma was applied (or at all, if the cms_matrix is unused).
2015-02-03 08:47:48 +01:00
wm4
dd287a3276 win32: don't resize when window is minimized
At least the opengl-hq VO allocates additional resources when
downscaling a lot, which is just a waste.

Also see #1547 (although I doubt that this is the cause; if it is,
a real fix will be required).
2015-02-02 22:52:13 +01:00
wm4
2a9534871d command: add property returning detected hwdec API
This is somewhat imperfect, because detection of hw decoding APIs is
mostly done on demand, and often avoided if not necessary. (For example,
we know very well that there are no hw decoders for certain codecs.)

This also requires every hwdec backend to identify itself (see hwdec.h
changes).
2015-02-02 22:43:13 +01:00
wm4
c45f2fe0ee vo_opengl: fix breakage with rotated video on initial display
Resizing was happening before reconfig, so src_rect_rot was outdated and
didn't include the rotation. This resulted in corrupted rendering on
initial display, which fixed itself after the first time the window was
somehow resized.
2015-02-02 18:07:37 +01:00
wm4
697309fc48 vo_opengl: use triangle strip for video
A small simplification. Couldn't be done before, because it was also
used by the OSD code, which required disjoint quads in a single draw
call.

Also mess with the unrelated code in gl_osd.c to simplify it a little
as well.
2015-01-30 15:57:40 +01:00
wm4
e6ddb1fe3f vo_opengl: don't unnecessarily call glDebugMessageCallback()
We still do redundant calls to it, but obviously we can avoid calling it
if we don't want to set a callback at all. May or may not help with
default.
2015-01-30 11:12:58 +01:00
wm4
c5e5f38563 vo_opengl: fix a cast
Basically, the OpenGL API is crap (it takes an offset as pointer).
2015-01-29 21:13:06 +01:00
wm4
547fd2a229 vf_vapoursynth: load Lua stdlib in Lua mode
If you can call this a "stdlib".
2015-01-29 19:57:40 +01:00
wm4
c80a1b7aa9 vo_opengl: let hwdec driver report the exact image format
Hardware decoding/displaying with vo_opengl is done by replacing the
normal video textures with textures provided by the hardware decoding
API OpenGL interop code. Often, this changes the format (vaglx and vdpau
return RGBA, vda returns packed YUV).

If the format is changed, there was a chance (or at least a higher
potential for bugs) that the shader generation code could be confused by
the mismatch of formats, and would create incorrect conversions.

Simplify this by requiring the hwdec interop driver to set the format it
will return to us. This affects all fields, not just some (done by
replacing the format with the value of the converted_imgfmt field in
init_format), in particular fields like colorlevels.

Currently, no hwdec interop driver does anything sophisticated, and the
win is mostly from the mp_image_params_guess_csp() function, which will
reset fields like colorlevels to expected value if RGBA is used.
2015-01-29 19:53:49 +01:00
wm4
e0e06f0f0c vo_opengl: move remaining OSD rendering parts to gl_osd.c
Reduces the size of gl_video.c a bit further.

This also uses a separate vertex array object for OSD elements, so the
video one can be simplified slightly.

OSD shader generation is still in gl_video.c, which leads to the strange
additional parameter to mpgl_osd_init(). The issue is that video
parameters influence the OSD shader (????), and also OSD needs to go
through the screen colormanagement.
2015-01-29 18:29:28 +01:00
wm4
20c5c7e521 vo_opengl: split out a helper for drawing primitives
Useful if we want to reduce the size of gl_video.c further.

To some degree this emulates traditional glDrawArrays() usage. It also
leaves a loophole for avoiding a reupload every time by leaving
ptr==NULL, although this is unused for now.
2015-01-29 17:19:01 +01:00
wm4
0bd147bd14 vo_opengl: some minor cleanups
default_tex_params() and texture_size() are each called only once, so
move inline/reimplement them at the caller.

image_dw/dh were unused. texture_w/h, image_format, and component_bits
were rarely used, and can be replaced. Regroup some other fields.

Rename surface_num to surface_idx, because the former sounded like a
count, and not an index. Move fbosurface_next() closer to its callers
too.

Move the DebugMessageCallback() code to gl_utils.c (also simplify it
by always setting the callback, instead of only when it changes).
2015-01-29 16:21:02 +01:00
wm4
1e67ce74d8 vo_opengl: force redraw on command line changes 2015-01-29 15:16:30 +01:00
wm4
14bbbffa99 vo_opengl: move FBO helper to gl_utils
This is somewhat messy, because fbotex_init() itself was depending on
some gl_video parameters unrelated to FBO creation (like what scaler was
in use - what the fuck did this check do in this function?), so this
commit does a bit more than moving code around. In particular, the FBO
for the separate scaling intermediate step now always uses GL_NEAREST
sampling, and all FBOs are destroyed/recreated on renderer
reinitialization.

This also moves the function matrix_ortho2d() - trivial enough not to
put it into a separate commit.
2015-01-29 15:16:17 +01:00
wm4
bf8abc0ca9 vo_opengl: fix shader issue with Intel drivers
Windows Intel drivers seem to reject some (AFAIK) valid GLSL. Make them
happy.

<rossy> GL_RENDERER='Intel(R) HD Graphics 4400'
<rossy> GL_VERSION='3.0.0 - Build 10.18.14.4080'
<rossy> GL_SHADING_LANGUAGE_VERSION='1.30 - Build 10.18.14.4080'
2015-01-29 15:15:14 +01:00
wm4
34d3a27f28 vo_opengl: create abstraction for VAOs
Handles stupid boilerplate OpenGL requires you to handle. It's the same
code as in gl_video.c, although if no VAOs are available, the fallback
code rebinds them on every draw call instead of just once.
2015-01-28 22:22:29 +01:00
wm4
616481ad29 vo_opengl: remove some unused functions
These were intended for some plans that were never realized.

Also move some comments around and fix them.
2015-01-28 19:40:52 +01:00
wm4
3583559164 vo_opengl: move utility functions from loader to a separate file
gl_common.c contained the function loader (which is big) and additional
utility functions (not so big, but will grow when moving more out of
gl_video.c). Just split them. There are no changes other than some
modifications to comments.
2015-01-28 19:40:46 +01:00
Niklas Haas
8d15f7583c
vo_opengl: remove is_linear_rgb and clean up code
This opportunity for refactoring was enabled by f3c84a3.
2015-01-28 18:52:33 +01:00
wm4
cbd2de6884 vo_opengl: fix the fix for fixing odd video sizes
Commit acb40644 fixed video with unaligned luma/chroma sizes. It
attempted to disable the fix for videos where it effectively does
nothing (just some minor performance paranoia), but this check was
broken - fix it by not duplicating the logic for this.
2015-01-28 13:50:39 +01:00
wm4
f3c84a322d vo_opengl: fix display of ARGB ith color management enabled
PNG uses a different component order from GL_RGBA, so we upload the
surface using the "wrong" order, and then fix it in the shader. This
breaks if a sRGB texture (GL_SRGB) is used: the hardware will not touch
the alpha channel, which means that the B component is not adjusted,
leading to incorrect output.

Just remove the use of sRGB textures completely. It might lead to a
slight slow down when playing RGB with color management enabled, but
with this combination of obscure use case with minor performance impact
it's not a meaningful disadvantage.

Unfortunately this also means that alpha is handled incorrectly with our
own color management, but alpha isn't so important and can be fixed
later. (0.0 and 1.0 are unchanged by the transfer function, so it
"mostly" works.)

Fixes #1530.
2015-01-28 13:36:07 +01:00
wm4
b473477fc5 vf_ilpack: remove this filter
This was apparently useful for correct interlaced scaling (although I
don't know anyone who used this). It was rarely used (if at all), had an
inconvenient output format (packed YUV), and now has a better solution
in libavfilter (using the libavfilter "scale" filter via vf_lavfi).
There is no reason to keep this filter any longer.
2015-01-27 19:13:51 +01:00
wm4
86bba0dc5b vf_divtc: remove this filter
Better solutions are available in vf_vapoursynth and vf_lavfi. The only
user I know who used this is now using vf_vapoursynth.
2015-01-27 19:10:13 +01:00
wm4
97f32fdb23 vf_phase: remove this filter
If you really want it, it's in libavfilter and can be used via vf_lavfi.
2015-01-27 19:06:59 +01:00
wm4
82e3d06f09 vf_swapuv: remove this filter
It's entirely useless. I left it in for a while, because the analog TV
code had a transitional bug that could switch chroma planes, but it was
fixed long ago. It's also available in libavfilter.
2015-01-27 19:04:02 +01:00
wm4
c92f4a1126 vf_softpulldown: remove this filter
Apparently it was completely broken and essentially did nothing. This
was broken sometime in early mpv or mplayer2 times.

Get rid of it. If you _really_ need it, wait until FFmpeg ports it from
MPlayer, which will happen very soon.
2015-01-27 18:58:16 +01:00
wm4
69e5dd9bce vf_pullup: remove builtin implementation
Now it requires libavfilter. The wrapper is left in place, so FFmpeg
users will not notice any change. On Libav, the filter stops working.
2015-01-27 18:53:28 +01:00
Ben Boeckel
2bbad06bfc ta: rename MP_TALLOC_ELEMS to MP_TALLOC_AVAIL
The macro actually returns the *available* space in the array, not how
much is actually filled in.
2015-01-27 18:09:36 +01:00
wm4
acb40644db vo_opengl: change the way unaligned chroma size is handled
This deals with subsampled YUV video that has odd sizes, for example a
5x5 image with 4:2:0 subsampling.

It would be easy to handle if we actually passed separate texture
coordinates for each plane to the shader, but as of now the luma
coordinates are implicitly rescaled to chroma one. If luma and chroma
sizes don't match up, and this is not handled, you'd get a chroma shift
by 1 pixel.

The existing hack worked, but broke separable scaling. This was exposed
by a recent commit which switched to GL_NEAREST sampling for FBOs. The
rendering was accidentally scaled by 1 pixel, because the FBO size used
the original video size, while textures_sizes[0] was set to the padded
texture size (i.e. one pixel larger).

It could be fixed by setting the padded texture size only on the first
shader. But somehow that is annoying, so do something else. Don't pad
textures anymore, and rescale the chroma coordinates in the shader
instead.

Seems like this somehow doesn't work with rectangle textures (and
introduces a chroma shift), but since it's only used when doing VDA
hardware decoding, and the bug occurs only with unaligned video sizes, I
don't care much.

Fixes #1523.
2015-01-27 18:09:03 +01:00
wm4
751830da32 vo: handle very long frame durations with smoothmotion enabled
With mf://, rather long frame durations are common. By default, one
frame takes 1 second. This causes the if branch changed with this commit
to always being taken, which in turn leads to the player not being woken
up correctly. (As a consequence, it "freezes" by waiting for events that
never come, and moving the mouse cursor over the window will wake it up
again and advance video.)

Obviously, the code should account for how long the video frame takes.
The code is probably still not fully correct, but for now this fixes the
issue at hand.

Fixes #1521.
2015-01-26 12:06:45 +01:00
wm4
4a06a66501 vo_opengl: drop sRGB framebuffer detection
We've stopped using them some time ago (we're doing things manually
instead).
2015-01-26 06:12:35 +01:00
wm4
f47b14b717 video/out: cosmetics: rename VO_EVENT_ICC_PROFILE_PATH_CHANGED
Remove the "PATH" bit, because VOCTRL_GET_ICC_PROFILE returns an in-
memory profile, and not a path. (This was changed a while ago.)
2015-01-26 02:21:00 +01:00
wm4
df3e6b549c vo_opengl, x11: implement icc-profile-auto
This queries the _ICC_PROFILE property on the root window. It also tries
to reload the ICC when it changes, or if the mpv window changes the
monitor. (If multiple monitors are covered, mpv will randomly select one
of them.)

The official spec is a dead link on freedesktop.org, so don't blame me
for any bugs.

Note that this assumes that Xinerama screen numbers match the way mpv
enumerates the xrandr monitors. Although there is some chance that this
matches, it most likely doesn't, and we actually have to do complicated
things to map the screen numbers. If it turns out that this is required,
I will fix it as soon as someone with a suitable setup for testing the
fix reports it.
2015-01-26 02:18:47 +01:00
wm4
73d5e396fe vo_opengl: minor changes to ICC update code
Merge update_icc_profile() into get_and_update_icc_profile() - there's
no reason anymore to keep them separate. The former is only called by
the latter, and the separation of responsibilities between them is
blurry a best.

Query the ICC profile only if the corresponding feature is actually
enabled. Additionally, change the error behavior of this code. Make
loading failure non-fatal, and distinguish between runtime error and
unimplemented functionality.

Fix a memory leak in gl_lcms.c (although the changes in vo_opengl.c
already take care of this, it's just logical and cleaner).
2015-01-26 02:11:14 +01:00
wm4
9fc15e5e1c vo_opengl: update a comment
We don't use the hwdec-provided video texture for screenshots anymore.
2015-01-26 02:06:18 +01:00
wm4
dc1793048f vo_opengl: make "mitchell" the hq default filter for downscaling
Seems like several people agree that it's a good filter for downscaling.

Setting this option by default may also prevent people from accidentally
using an unsuitable filter for downscaling by setting "scale" and
without being aware of the impliciations (maybe). On the other hand,
this change is not strictly backwards compatible for the same reasons.

Also, allow disabling this option with scale-down="" (before this, not
setting it was the only way to do this - not possible anymore if it's
set by default). This is what the change in handle_scaler_opt() does.
2015-01-26 02:03:44 +01:00
wm4
639e2bd12f vo_opengl: simplify radius initialization
Somehow, the default radius for filters with variable radius was set in
mp_init_filter(). gl_video.c used NAN as default value for the radius,
which would make the filter use the default radius. Simplify this, and
set the default radius directly in the gl_video options. It also makes
the options easier to understand, because the default value listed in
--vo=opengl:help actually shows the default value.

Remove the function can_use_filter_kernel(), because it doesn't set a
radius if none is set. The function is worthless anyway (something about
making filter_kernels.c reusable to other VOs, and trying to deal with
the possibility that it could provide filters not supported by
vo_opengl.)
2015-01-26 01:56:19 +01:00
wm4
6945369e9c vo_opengl: fancy-downscale affects luma-scaler only 2015-01-25 01:35:17 +01:00
wm4
99c856d3cd vo: fix redraw logic
It actually can and does happen that you want to redraw, even if no
image was queued yet.

Broken by commit 28582322.
Fixes #1510.
2015-01-25 00:52:44 +01:00
wm4
32f726703d vo_opengl: remove remnants of dropped stereo buffer support 2015-01-24 23:29:54 +01:00
wm4
8657b8e1f3 vo: generic redraw support
Usually, a VO must react to VOCTRL_REDRAW_FRAME in order to redraw the
current screen correctly if video is paused (this is done to update
OSD). But if it's not supported, we can just draw the current image
again in the generic vo.c code.

Unfortunately, this turned out pretty useless, because the VOs which
would benefit from this need to redraw even if there is no image, in
order to draw a black screen in --idle --force-window mode. The way
redrawing is handled in the X11 common code and in vo_x11 and vo_xv is
in the way, and I'm not sure what exactly vo_wayland requires. Other VOs
have a non-trivial implementation of VOCTRL_REDRAW_FRAME, which
(probably) makes redrawing slightly more efficient, e.g. by skipping
texture upload. So for now, no VO uses this new functionality, but since
it's trivial, commit it anyway.

The vo_driver->untimed case is for forcibly disabling redraw for vo_lavc
and vo_image always.
2015-01-24 23:28:38 +01:00
wm4
2858232220 vo: simplify VOs by adding generic screenshot support
At the time screenshot support was added, images weren't refcounted yet,
so screenshots required specialized implementations in the VOs. But now
we can handle these things much simpler. Also see commit 5bb24980.

If there are VOs in the future which can't do this (e.g. they need to
write to the image passed to vo_driver->draw_image), this still could be
disabled on a per-VO basis etc., so we lose no potential performance
advantages.
2015-01-24 23:16:27 +01:00
Stefano Pigozzi
13e35730b4 cocoa: fix fallback for OpenGL 2.1 hardware [2]
Looks like it fails on context creation, not pixfmt creation.
2015-01-24 16:54:24 +01:00
Stefano Pigozzi
3dc3bcf8b6 cocoa: fix fallback for OpenGL 2.1 hardware
This was previously done in common code but now it's left to backends. Also
remove the GL4 stuff since requesting a 3_2_Core context creates a 4.1 context
here (wtf).
2015-01-24 16:31:38 +01:00
wm4
5e9f791667 video: separate screenshot modes
Use different VOCTRLs for "window" and normal screenshot modes. The
normal one will probably be removed, and replaced by generic code in
vo.c, and this commit is preparation for this. (Doing it the other way
around would be slightly simpler, but I haven't decided yet about the
second one, and touching every VO is needed anyway in order to remove
the unneeded crap. E.g. has_osd has been unused for a long time.)
2015-01-23 22:08:20 +01:00
wm4
a0a40eb287 vo: fix disabling/enabling smoothmotion at runtime
vo.c queried the VO at initialization whether it wants to be updated on
every display frame, or every video frame. If the smoothmotion option
was changed at runtime, the rendering mode in vo.c wasn't updated.

Just let vo_opengl set the mode directly. Abuse the existing
vo_set_flip_queue_offset() function for this.

Also add a comment suggesting the use of --display-fps to the manpage,
which doesn't have anything to do with the rest of this commit, but is
important to make smoothmotion run well.
2015-01-23 20:56:25 +01:00
wm4
e5bceb061b vf_vavpp: add more deinterlacing algorithms
These are untested due to lack of hardware. From what I've heard, the
drivers are pretty buggy, so it's not clear how well this works, if at
all.
2015-01-23 13:26:41 +01:00
wm4
60dbf192d1 x11: remove unnecessary code 2015-01-23 12:46:36 +01:00
wm4
a96c3ac90e vo: allow dropping additional frames with smoothmotion
The logic disabled framedropping if the frame was interpolated (i.e. the
render call is only done to interpolate between the previous frame, and
the frame before that).

It seems doing this wasn't even necessary, and broke framedrop in
smoothmotion mode. In fact, this code did nothing for display with video
fps below display fps. It did prevent the framedrop counter from going
up, though. So change it so that dropped interpolated frames are never
reported. (Doing so can give confusing results, such as dropping 1000s
of frames on slow operations like video start or changing filters.)
2015-01-23 12:21:45 +01:00
wm4
55cdc734c5 vo: cosmetics 2015-01-23 12:21:45 +01:00
wm4
9c45cdd55e vo: fix framedrop in normal case
vsync_timed is true if smoothmotion is used. That would mean framedrop
is always disabled in the normal case.
2015-01-23 11:21:27 +01:00
Stefano Pigozzi
c29ab5a46b vo_opengl: add smoothmotion frame blending
SmoothMotion is a way to time and blend frames made popular by MadVR. It's
intended behaviour is to remove stuttering caused by mismatches between the
display refresh rate and the video fps, while preserving the video's original
artistic qualities (no soap opera effect). It's supposed to make 24fps video
playback on 60hz monitors as close as possible to a 24hz monitor.

Instead of drawing a frame once once it's pts has passed the vsync time, we
redraw at the display refresh rate, and if we detect the vsync is between two
frames we interpolated them (depending on their position relative to the vsync).
We actually interpolate as few frames as possible to avoid a blur effect as
much as possible. For example, if we were to play back a 1fps video on a 60hz
monitor, we would blend at most on 1 vsync for each frame (while the other 59
vsyncs would be rendered as is).

Frame interpolation is always done before scaling and in linear light when
possible (an ICC profile is used, or :srgb is used).
2015-01-23 09:14:41 +01:00
wm4
2575c01c77 filter_kernels: improve a comment
It's not true anymore that the size necessarily depends on the radius.
2015-01-22 20:08:47 +01:00
wm4
93f1bf48d9 vo_opengl: improve terminal messages with lscale suboption errors
Make it more apparent what the hell the user did wrong.
2015-01-22 19:58:22 +01:00
Niklas Haas
27261bea31
vo_opengl: remove scale-sep and indirect options
These are now auto-detected sanely; and enabled whenever it would be a
performance or quality gain (which is pretty much everything except
bilinear/bilinear scaling).

Perhaps notably, with the absence of scale_sep, there's no more way to
use convolution filters on hardware without FBOs, but I don't think
there's hardware in existence that doesn't have FBOs but is still fast
enough to run the fallback (slow) 2D convolution filters, so I don't
think it's a net loss.
2015-01-22 19:40:06 +01:00
Niklas Haas
1ec77214b1 filter_kernels: get rid of sinc/lanczos aliases
Just set the radius with scale-radius if it's really needed
2015-01-22 19:40:04 +01:00
Niklas Haas
8eb9ddd868 vo_opengl: rename all scale options to make more sense
This emphasizes the fact that scale is used for *all* image upscaling,
with cscale only serving a minor role for subsampled material.
2015-01-22 19:40:04 +01:00
Niklas Haas
02df9886ea vo_opengl: switch to nearest neighbour for trivial resampling
This is significantly faster for FBOs on most modern GPUs, although it
did not result in a huge difference for the video source texture on the
sizes I tested. It might be more significant for 1080p or 4K content, so
it's worth revisiting this in the future.

It also renames SAMPLE_BILINEAR to SAMPLE_TRIVIAL to match the
semantics.
2015-01-22 19:40:04 +01:00
Niklas Haas
f24c2e0f56 vo_opengl: always prefer indirect scaling
This is better even for non-separable. The only exception is when using
bilinear for both lscale and cscale. I've fixed the
documentation/comments to make more sense.
2015-01-22 19:40:04 +01:00
Niklas Haas
2d182fdea0
vo_opengl: implement naive anti-ringing
This is not quite the same thing as madVR's antiringing algorithm, but
it essentially does something similar.

Porting madVR's approach to elliptic coordinates will take some amount
of thought.
2015-01-22 19:39:58 +01:00
Niklas Haas
6c250505fe vo_opengl: unroll ewa_lanczos to avoid looping and unnecessary samples
This speeds up performance by a factor of something like 10%,
since it omits unnecessary checks.

This will also make adding anti-ringing easier.
2015-01-22 19:29:23 +01:00
Niklas Haas
f5e48f0235 vo_opengl: clean up ewa_lanczos code
This fixes compatibility with GLES 2.0 and makes the code a bit neater
in general. It also properly forces indirect scaling for subsampled
video regardless of the lscale setting.
2015-01-22 19:29:23 +01:00
wm4
571fe8f729 vo_opengl: guarantee correct reinitialization on setting options
At least the scale_sep_fbo could have been uninitialized or initialized
incorrectly when switching between scalers (e.g. from bilinear to
lanczos). Calling check_resize() should take care of this.
2015-01-22 19:25:16 +01:00
wm4
a8f565008b vo_opengl: don't reset unused GL_PACK_... state 2015-01-22 18:54:05 +01:00
wm4
5bb24980ae vo_opengl: simplify screenshot code
Instead of reading back the image from textures, keep a reference to the
original image, and return that.

The main reason this was done this way was that originally, images
weren't refcounted, and would be deallocated or overwritten as soon as
the VO's draw call returned. But now there isn't really a good reason
for this anymore. One possibly _could_ argue that it was better because
other code could reuse the image sooner (e.g. for the cache), but on the
other hand, the VO runs already on a different thread, and filtering and
decoding each run on other threads too, so this argument probably
wouldn't hold up.
2015-01-22 18:31:10 +01:00
wm4
16cc429eb8 vo_vdpau: don't render to an output surface if it could be busy
There was a case when we could have rendered to an output surface while
it's still used for display. Not sure why the API doesn't do this
automatically.
2015-01-22 18:18:23 +01:00
wm4
74581a6106 video: handle hwdec screenshots differently
Instead of converting the hw surface to an image in the VO, provide a
generic way to convet hw surfaces, and use this in the screenshot code.

It's all relatively straightforward, except vdpau is being terrible. It
needs a huge chunk of new code, because copying back is not simple.
2015-01-22 18:18:23 +01:00
wm4
e9ac3fc3a1 mp_image_pool: allow passing pool=NULL in more places
It's convenient.
2015-01-22 17:37:40 +01:00
wm4
aae9af348e video: have a generic context struct for hwdec backends
Before this commit, each hw backend had their own specific struct types
for context, and some, like VDA, had none at all. Add a context struct
(mp_hwdec_ctx) that provides a somewhat generic way to pass the hwdec
context around. Some things get slightly better, some slightly more
verbose.

mp_hwdec_info is still around; it's still needed, but is reduced to its
role of handling delayed loading of the hwdec backend.
2015-01-22 15:32:23 +01:00
Stefano Pigozzi
29cf62d201 cocoa: remove support for systems without gl3.h header 2015-01-22 08:27:03 +01:00
Niklas Haas
edc100eee0
vo_opengl: make the default radius 3.0 and simplify scaler documentation
This also fixes the maximum range to 16.0, which was previously set to
32.0 and incorrectly documented as 8.0. 16 taps should be more than
anybody will ever need, but it's the highest radius that's supported by
all affected filters.
2015-01-21 23:08:41 +01:00
wm4
b2149f7fe1 vaapi: minor simplification 2015-01-21 22:12:30 +01:00
wm4
a1ed13869c video: remove vfcap.h
And remove all uses of the VFCAP_CSP_SUPPORTED* constants. This is
supposed to reduce conversions if many filters are used (with many
incompatible pixel formats), and also for preferring the VO's natively
supported pixel formats (as opposed to conversion).

This is worthless by now. Not only do the main VOs not use software
conversion, but also the way vf_lavfi and libavfilter work mostly break
the way the old MPlayer mechanism worked. Other important filters like
vf_vapoursynth do not support "proper" format negotation either.

Part of this was already removed with the vf_scale cleanup from today.

While I'm touching every single VO, also fix the query_format argument
(it's not a FourCC anymore).
2015-01-21 22:08:24 +01:00
wm4
2a691d1ede video: try to keep implied alpha when using conversion filters
Don't just discard alpha. This probably does the right thing, in the
rare situations when alpha matters at all.
2015-01-21 21:49:15 +01:00
wm4
3f49c60762 vo_direct3d: unify d3d "reset" and uninit paths
I'm still not sure how exactly handling of "lost" devices is supposed
to be handled. In theory, you only have to "reset" the device, instead
of recreating _everything_. But as it is, the code for proper uninit
and for handling the reset is exactly the same, so move it into a
function to reduce code duplication and the danger of potential bugs.
2015-01-21 21:12:18 +01:00
wm4
39231e5dfd vo_direct3d: disable shaders if unavailable
Apparently, extremely crappy graphics drivers don't allow you to use
shaders. Simply disable use of shaders if this happens, and use the
"old" method instead.

One unexpectedly tricky thing is that you need a d3d_device to create
a shader, which in turn requires a window, so the initialization order
changes.
2015-01-21 21:06:56 +01:00
wm4
e34957940b vo_opengl: cleanups after vo_opengl_old removal
Don't load all the legacy functions (including ancient extensions).
Slightly simplify function loader and context creation, now that legacy
GL doesn't need to be handled. Remove the code for drawing OSD in legacy
mode.

Remove all the header hacks, which were meant for ancient OpenGL headers
which didn't even support things like OpenGL 1.3. Instead, adjust the
GLX check to make sure we get both OpenGL 3x and 2.1 symbols. For win32
and OSX, we assume that the user has the latest headers anyway. For
wayland, we hope that things somehow go right.
2015-01-21 20:32:42 +01:00
wm4
c15697477f vo: never autoselect vo_null
Same deal as with commit d44b4ccb.
2015-01-21 19:39:58 +01:00
wm4
a0caadd512 vo_opengl: handle grayscale input better, add YA16 support
Simply clamp off the U/V components in the colormatrix, instead of doing
something special in the shader.

Also, since YA8/YA16 gave a plane_bits value of 16/32, and a colormatrix
calculation overflowed with 32, add a component_bits field to the image
format descriptor, which for YA8/YA16 returns 8/16 (the wrong value had
no bad consequences otherwise).
2015-01-21 19:29:18 +01:00
wm4
30ca30c0a1 vf_scale: replace ancient fallback image format selection
If video output and VO don't support the same format, a conversion
filter needs to be insert. Since a VO can support multiple formats, and
the filter chain also can deal with multiple formats, you basically have
to pick from a huge matrix of possible conversions.

The old MPlayer code had a quite naive algorithm: it first checked
whether any conversion from the list of preferred conversions matched,
and if not, it was falling back on checking a hardcoded list of output
formats (more or less sorted by quality). This had some unintended side-
effects, like not using obvious "replacement" formats, selecting the
wrong colorspace, selecting a bit depth that is too high or too low, and
more.

Use avcodec_find_best_pix_fmt_of_list() provided by FFmpeg instead. This
function was made for this purpose, and should select the "best" format.

Libav provides a similar function, but with a different name - there is
a function with the same name in FFmpeg, but it has different semantics
(I'm not sure if Libav or FFmpeg fucked up here).

This also removes handling of VFCAP_CSP_SUPPORTED vs.
VFCAP_CSP_SUPPORTED_BY_HW, which has no meaning anymore, except possibly
for filter chains with multiple scale filters.

Fixes #1494.
2015-01-21 18:33:47 +01:00
wm4
724f722d7f vo_opengl_old: remove this VO
At this point, there is probably no hardware left that doesn't do
OpenGL 2.1, and at the same time is fast enough to handle video.
2015-01-20 21:15:04 +01:00
wm4
9f63b9f673 vo_opengl: fix typo 2015-01-20 20:36:57 +01:00
wm4
6f5e5e6a9e vo_opengl: remove cscale-down suboption
For an explanation see the additions to the manpage.
2015-01-20 14:33:53 +01:00
wm4
84928b049d vo: restore framedrop
Fix inverted condition in commit 234d6329.
2015-01-20 09:11:14 +01:00
wm4
234d632920 video: fix waiting for last frame/format reconfig
We still need to send the VO a duration in these cases. Disabling
framedrop has logically absolutely nothing to do with these cases; it
was overlooked in commit 918b06c4.

So we always send the frame duration (or a guess for it), and check
whether framedropping is actually enabled in the VO code. (It would
be cleaner to send framedrop as a flag, but I don't care about that
right now.)
2015-01-19 18:02:31 +01:00
wm4
46a3974200 vo_opengl: remove 1D texture usage
Broke operation with GLSL.

Since 1D texture usage was apparently (and mysteriously) good for speed,
it might be added back, but it's unknown how to do so in a clean way.
2015-01-18 16:28:41 +01:00
wm4
9eca8b49db x11: fix initial state for --on-all-workspaces 2015-01-17 19:26:39 +01:00
wm4
78e3821bd5 cocoa: fix fullscreen handling
Fixes #1483, if it even compiles.
2015-01-17 02:45:17 +01:00
wm4
eb5a83e1c1 x11: add --on-all-workspaces option and property
Fixes #1469.
2015-01-16 23:38:47 +01:00
wm4
5649658c4e x11: minor cleanup
No reason for these functions to exist separately...
2015-01-16 23:09:06 +01:00
wm4
fc524e8a07 command: unify handling of fullscreen and other VO flags
The "ontop" and "border" properties already used a common
mp_property_vo_flag() function, and the corresponding VOCTRLs used the
same conventions. "fullscreen" is pretty similar, but was handled
slightly similar. Change how VOCTRL_FULLSCREEN behaves, and use the same
helper function for "fullscreen" as the other flags.
2015-01-16 23:07:13 +01:00
wm4
1883b7cc0c player: add --autofit-smaller option
Fixes #1472.

(Maybe these options should have been named --autofit-max and
--autofit-min, but since --autofit-larger already exists, use
--autofit-smaller for symmetry.)
2015-01-16 22:30:41 +01:00
Stefano Pigozzi
730db25b1b cocoa: don't set application icon in libmpv 2015-01-16 19:24:25 +01:00
wm4
918b06c42c player: respect --untimed on last frame
The last video frame is another case that has a separate code path,
although it's pretty similar to the one in commit 73e5aa87. Fix this
in a different way, which also takes care of the last frame case,
although without context the code becomes slightly more tricky.

As further cleanup, move the decision about framedropping itself to
the same place, so the check in vo.c becomes much simpler. The check
for the vo->driver->encode flag, which is remvoed completely, was
redundant too.

Fixes #1480.
2015-01-16 13:57:33 +01:00
Niklas Haas
61f5a80f10
vo_opengl: get rid of approx-gamma and make it the default as per BT.1886
After finding out more about how video mastering is done in the real
world it dawned upon me why the "hack" we figured out in #534 looks so
much better.

Since mastering studios have historically been using only CRTs, the
practice adopted for backwards compatibility was to simulate CRT
responses even on modern digital monitors, a practice so ubiquitous that
the ITU-R formalized it in R-Rec BT.1886 to be precisely gamma 2.40.

As such, we finally have enough proof to get rid of the option
altogether and just always do that.

The value 1.961 is a rounded version of my experimentally obtained
approximation of the BT.709 curve, which resulted in a value of around
1.9610336. This is the closest average match to the source brightness
while preserving the nonlinear response of the BT.1886 ideal monitor.

For playback in dark environments, it's expected that the gamma shift
should be reproduced by a user controlled setting, up to a maximum of
1.224 (2.4/1.961) for a pitch black environment.

More information:
https://developer.apple.com/library/mac/technotes/tn2257/_index.html
2015-01-16 02:17:19 +01:00
Niklas Haas
26baf5b9da
vo_opengl: add ewa_lanczos upscaler (aka jinc)
This is the polar (elliptic weighted average) version of lanczos.
This introduces a general new form of polar filters.
2015-01-15 21:20:27 +01:00
wm4
66c8a87485 vo_opengl_cb: initial screenshot support
Support for taking screenshots when doing hardware decoding needs to be
added later.

This takes the last image queued to the VO, which is logically the image
the player thinks is on screen (so e.g. subtitles will match).

forget_frames() does not clear this, because seeking does not remove the
current image from the screen (until the next one is drawn).
2015-01-15 20:10:11 +01:00
wm4
c118d8f6cc image_writer: check for conversion errors
This can happen when e.g. a VO returns a screenshot in an unsupported
format.
2015-01-15 20:10:08 +01:00
wm4
206cfd964c vf: make message less confusing
Well, probably still not very good, but now at least accounts for the
case the decoder or a filter outputs nonsense values.
2015-01-13 14:40:37 +01:00
wm4
77b488b4a2 mp_image: reject invalid display aspect ratio
Having any of these set to 0 makes no sense.

I think some code might still be using 0/0 aspect ratio to signal unset
aspect ratio, but I didn't find it. If there is still code like this, it
should be fixed instead.

Fixes #1467.
2015-01-13 14:26:25 +01:00
wm4
460ef9c7a4 wayland: implement key modifiers
Includes shift, ctrl, alt, meta.
2015-01-12 16:41:00 +01:00
wm4
10532b99e5 wayland: don't compute absurd window size
For some reason, schedule_resize() can be called with everything set to
0. The code couldn't handle wl->window.aspect set to 0, converting NaNs
to integers. Just work this around.

(I have no idea what I'm doing. This is probably a corner case caused
by my broken-ish wayland setup.)
2015-01-12 15:21:26 +01:00
wm4
a8df0bbf22 x11: explicitly query map status when waiting for map event
For some reason, mpv sometimes does not get a MapNotify event with
GtkSocket embedding. This happens maybe 1 out of 10 times. I'm not sure
how this can happen - it certainly shouldn't. Since I was not able to
find the cause, and causes an apparent "deadlock", here's a lazy hack to
fix the misbehavior.
2015-01-12 12:15:27 +01:00
wm4
fc95678d8d x11: support XEmbed
Seems to work with GtkSocket and passing the gtk_socket_get_id() value
via "wid" option to mpv.

One caveat is that using <tab> to move input focus from mpv to GTK does
not work. It seems we would have to interpret <tab> ourselves in this
case. I'm not sure if we really should do this - it would probably
require emulating some other typical conventions too. I'm not sure if an
embedder could do something about this on the toolkit level, but in
theory it would be possible, so leave it as is for now.
2015-01-12 12:08:48 +01:00
wm4
2e531aaf14 vo: don't synchronize when seeking
Don't use vo_control() for sending VOCTRL_RESET when starting a seek.
This means vo_seek_reset() won't wait until the VO actually processed
VOCTRL_RESET. It happens asynchronously instead.

The impact of this change should be minimal, unless the VO is somehow
too busy (like blocking on vsync).
2015-01-12 05:14:41 +01:00
wm4
e5f2072364 command: change properties added in previous commit
Make their meaning more exact, and don't pretend that there's a
reasonable definition for "bits-per-pixel". Also make unset fields
unavailable.

average_depth still might be inconsistent: for example, 10 bit 4:2:0 is
identified as 24 bits, but RGB 4:4:4 as 12 bits. So YUV formats
seemingly drop the per-component padding, while RGB formats do not.
Internally it's consistent though: 10 bit YUV components are read as
16 bit, and the padding must be 0 (it's basically like an odd fixed-
point representation, rather than a bitfield).
2015-01-10 19:13:16 +01:00
Niklas Haas
286340d7d0 video: Add sigmoidal upscaling to avoid ringing artifacts
This avoids issues when upscaling directly in linear light, and is the
recommended way to upscale images according to imagemagick.

The default slope of 6.5 offers a reasonable compromise between
ringing artifacts eliminated and ringing artifacts introduced by
sigmoid-upscaling. Same goes for the default center of 0.75.
2015-01-09 03:18:21 +01:00
xylosper
a4c0e254a3 vo_opengl_cb: make mpv_opengl_cb_render() return left frames
Instead of error code which was not helpful because it's always 0,
mpv_opengl_cb_render() returns the number of left frames in the
frame queue now.
2015-01-08 21:32:22 +01:00
xylosper
e66acd52af vo_opengl_cb: use vo's drop_count instead of internal counter
This commit makes it possible to query dropped frames by opengl-cb
through vo-drop-frame-count property.
2015-01-08 21:15:24 +01:00
xylosper
5bb3b1b4cf vo: add functions to increment drop_count
Add two functions which increment drop_count thread-safely.
This is for the commit followed.
2015-01-08 21:15:09 +01:00
xylosper
5b4d587ede vo_opengl_cb: introduce frame queue
The previous implementation of opengl-cb kept only latest flipped frame.
This can cause massive frame drops because rendering is done asynchronously
and only the latest frame can be rendered.

This commit introduces frame queue and releated options to opengl-cb.

frame-queue-size: the maximum size of frame queue (1-100, default: 1)
frame-drop-mode: behavior when frame queue is full (pop, clear, default: pop)

The frame queue holds delayed frames and drops frames if the frame queue is
overflowed with next method:

'pop' mode: drops all the oldest frames overflown.
'clear' mode: drops all frames in queue and clear it.

With default options(frame-queue-size=1:frame-drop-mode=pop),
opengl-cb behaves in the same way as previous implementation effectively.

For frame-queue-size > 1, opengl-cb tries to calls update() without waiting
next flip_page() in order to consume queued frames.

Signed-off-by: wm4 <wm4@nowhere>
2015-01-08 18:50:25 +01:00
wm4
348ea46537 win32: minor simplification
The events parameter is not needed here and won't ever be.
2015-01-08 18:32:23 +01:00
wm4
f6e466585a vo_opengl: don't crash win32 backend with NULL events
vo_opengl was crashing since f811348d because it passed NULL for the
events parameter to vo_control. Normally the parameter should not be
NULL, so add a hack to account for this. In particular, we should
handle the events that are returned. For the call in preinit() we
skip this, but it most likely has no meaning anyway, because in this
stage no window is visible yet.
2015-01-08 18:30:19 +01:00
wm4
88c6f18209 vo_opengl_cb: fix a typo 2015-01-08 16:54:15 +01:00
wm4
41f6c15df5 vo_opengl_cb: allow changing debug option at runtime
This was always supposed to work.

Just add the option declaration. Normally I'm not a fan of duplicating
such things, but in this case it's (still) harmless.
2015-01-08 13:36:09 +01:00
wm4
f52ec079b2 vo_opengl_cb: fix flipped rendering
Oops.
2015-01-08 02:19:12 +01:00
wm4
d6aac7f930 vo_opengl: gl_lcms: implement change detection for memory profiles
This affects OSX, where memory profiles are updated e.g. on fullscreen
switches. The profile most likely doesn't change, but the LUT will
be generated and reloaded anyway.

Somewhat of a regression from commit f811348.

Fixes #1439.
2015-01-08 01:03:09 +01:00
wm4
ae8a91d6b6 vo_opengl: gl_lcms: fix potential dangling pointer issue
If icc-path is set, but the thing is replaced with a memory profile,
then p->icc_path would point to deallocated memory.

Also, the NULL checks are unnecessary.
2015-01-08 00:56:21 +01:00
wm4
02dbd41ae0 vo_direct3d: fix shader colormatrix generation
It was accidentally broken in d42d60bc1.
2015-01-07 22:08:20 +01:00
wm4
f61b8b312d win32: request UTF-16 API variants, Vista+ APIs, and COM C macros
Put the Vista+ (_WIN32_WINNT) and the COM C (COBJMACROS) defines into
the build system, instead of defining them over and over in the code.
2015-01-07 21:42:44 +01:00
wm4
5f398831d2 x11: always use glXGetProcAddressARB()
glXGetProcAddress() is outdated, and as far as I know doesn't give all
the guarantees the "new" ARB function gives.

Probably doesn't matter too much, because until now it always appeared
to work. On the other hand, since this function is (bogusly) used only
on the gl3 code path, it could have happened that users hit this, and
just reverted to vo_opengl_old instead.
2015-01-07 21:13:26 +01:00
xylosper
21000774bf gl_video.c: invalidate image_params in uninit_video()
When the given mp_image_params does not match with that of gl_video,
gl_video_config() always calls uninit_video() but calls init_video()
only if valid format is given.

Since uninit_video() does not change image_params of gl_video,
when the same params as the previous one is given to gl_video_config()
after gl_video is unitialized with invalid format, gl_video_config()
never calls init_video().

To prevent this, invalidate image_params of gl_video in uninit_video().
2015-01-07 19:22:54 +01:00
Stefano Pigozzi
f811348d0c vo_opengl: add support for in memory icc profiles
Previously we just forced loading a profile from file, but that has poor
integration for querying the OS / display server for an ICC profile, and
generating profiles on the fly (which we might use in the future for creating
preset 3dluts).

Also changed the previous icc-profile-auto code to use this mechanism, and
moved gl_lcms to be an opaque type with state instead of just providing pure
functions.
2015-01-07 18:47:27 +01:00
Niklas Haas
d66598eeed video: Remove some stale CMS code, minor cosmetics
This removes an old code path that was disabled in 016bb14.
2015-01-07 14:22:17 +01:00
James Ross-Gowan
a095958263 dxva2: copy mp_image attributes to sw_img 2015-01-07 23:00:22 +11:00
James Ross-Gowan
9a3ab5c298 mp_image: copy missing attributes
This adds a couple of missing fields to mp_image_copy_attributes so
things like rotation metadata work.
2015-01-07 22:59:21 +11:00
wm4
b5529707f5 vo_opengl_cb: implement equalizer controls
This makes vo_opengl_cb respond to controls like "gamma" and
"brightness". The commit includes an awkward refactor for vo_opengl to
make it easier for vo_opengl_cb.

One problem is a logical race condition. The set of supported controls
depends on the pixelformat, which in turn is set by reconfig(). But the
actual reconfig() call (on the renderer) happens asynchronously on the
renderer thread. At the time it happens, the player most likely already
tried to set some controls for command line options (see init_vo() in
video.c). So setting this command line options will fail most of the
time, though it could randomly succeed. This can't be fixed directly,
because the player can't wait on the renderer thread, because the
renderer thread might already wait on the player.
2015-01-06 17:34:29 +01:00
wm4
941eff85a6 csputils: use M_PI 2015-01-06 16:51:06 +01:00
wm4
d42d60bc1e csputils: replace float[3][4] with a struct
Not being able to use the 3x3 part of the matrix was annoying, so split
it into a float[3][3] matrix and a separate float[3] constant vector.
2015-01-06 16:51:06 +01:00
wm4
5410a5b2c5 csputils: move image_params -> csp_params into a function
Although the line count increases, this is better for making sure
everything is handled consistently for all users of the mp_csp_params
stuff.

This also makes sure mp_csp_params is always initialized with
MP_CSP_PARAMS_DEFAULTS (for consistency).
2015-01-06 16:51:02 +01:00
wm4
a52ca8a2b0 csputils: get rid of mp_csp_details
It used to be central, but now it's just unneeded.
2015-01-06 16:50:58 +01:00
wm4
02362f938f csputils: cosmetics
Fix some coding style issues, remove doxygen formatting.
2015-01-06 13:46:08 +01:00
wm4
31e9630788 vo_opengl_cb: don't resize when redrawing 2015-01-06 11:32:08 +01:00
Soeren D. Schulze
2ab259e683 video/out/win_state.c: fix --monitoraspect 2015-01-05 17:28:26 +01:00
wm4
df595b06e6 vo_opengl_cb: support changing options at runtime
Like vo_opengl, but way messier, because the already messy config
handling meets threading.
2015-01-05 15:25:58 +01:00
wm4
589e70e17d vf_vapoursynth: autodetect CPU count
This adds an "auto" choice to the concurrent-frames suboption, and makes
it the default.

I'm not so sure about making this the default, though. It could lead to
excessive buffering with large CPU counts. But we'll see.
2015-01-05 12:49:13 +01:00
wm4
0f4bf347c5 player: print used number of threads in verbose mode
Also, don't use av_log() for mpv output.
2015-01-05 12:17:55 +01:00
wm4
d5e744d4b8 vo_opengl: remove obsolete comment in shader 2015-01-04 19:04:45 +01:00
wm4
2b0fce56a2 x11: make display-names property stricter
Returning the property before the window is mapped could lead to
confusing behavior, and in particular strange differences between
vo_vdpau and vo_opengl. (vo_opengl creates the window right at the
start, while vdpau waits until the first reconfigure event.) It might
even be possible that for vo_opengl random results were returned,
because the hidden window can have different placement than the actual,
final one on initial video reconfig.

Fix this by returning the property only if the window is considered
mapped. command.c handles this case specifically, and makes the property
unavailable, instead of returning an empty list.
2015-01-04 03:57:50 +01:00
wm4
a7dddbacc6 video: batch query_format calls
There are currently 568 pixel formats (actually fewer, but the namespace
is this big), and for each format elaborate synchronization was done to
call it synchronously on the VO. This is completely unnecessary, and we
can do with just a single call.
2015-01-03 17:23:01 +01:00
wm4
d5f1170679 vf_vapoursynth: fix Lua backend
It couldn't handle the newly added float variable.
2015-01-03 14:44:20 +01:00
wm4
bfac1e81a6 vf_vapoursynth: pass through container FPS value
This is basically a hack; but apparently a needed one, since many
vapoursynth filters insist on having a FPS set.

We need to apply the FPS override before creating the filters. Also
change some terminal output related to the FPS value.
2015-01-03 03:37:05 +01:00
wm4
9300351a30 x11: make display-names property observable
Reuse MP_EVENT_WIN_STATE for this.
2015-01-03 03:06:26 +01:00
wm4
f5ed13bcd4 video: better pipelining with vf_vapoursynth
Most of this is explained in the code comments. This change should
improve performance with vapoursynth, especially if concurrent requests
are used.

This should change nothing if vf_vapoursynth is not in the filter chain,
since non-threaded filters obviously can not asynchronously finish
filtering of frames.
2015-01-03 03:01:58 +01:00
Stefano Pigozzi
9633790ac6 cocoa: fix build on 10.9
Use -isInFullScreenMode instead of the property introduced with the 10.10 SDK.
2015-01-02 20:54:09 +01:00
Stefano Pigozzi
43faae7a1e cocoa: fix NSMapGet error
regression from 64b6b2ea45
2015-01-02 19:19:23 +01:00
wm4
7873301be8 vo_opengl_old: remove ancient ATI-specific YUV conversions
While there's no actual need to get rid of these, I want to make sure
nobody actually needs this stuff, and removing it is the best way to
get to know this. We still can revert this commit if it turns out there
is a significant need for this stuff.

The final goal is removing vo_opengl_old entirely. Add a warning, which
basically announces this intention.
2015-01-02 00:59:27 +01:00
Stefano Pigozzi
64b6b2ea45 cocoa: fix uninitialization while in fullscreen
This is only needed for switching video track with `_`, since Cocoa
automatically handles cleaning up the application's presentation options when
quitting the process.

Fixes #1399
2015-01-01 14:38:08 +01:00
wm4
3e12e79b8f gl_hwdec_vda: refuse to work with old OpenGL versions
The way we use rectangle textures (required by VDA for no reason) works
onl in OpenGL 3.0 or higher. Below that, the shader will fail to
compile. We could add support for older OpenGL versions, but that would
be a major pain.

This normally doesn't matter; mpv itself always creates OpenGL 3.2
contexts on OSX. But it could matter if a client API user uses
vo_opengl_cb, and gives it a 2.1 context (which OSX also allows you to
create).
2014-12-31 21:04:52 +01:00
wm4
a850bf786e vo_opengl_cb: simplify API uninitialization
Until now, calling mpv_opengl_cb_uninit_gl() at a "bad moment" could
make the whole thing to explode. The API user was asked to avoid such
situations by calling it only in "good moments". But this was probably a
bit too subtle and could easily be overlooked.

Integrate the approach the qml example uses directly into the
implementation. If the OpenGL context is to be unitialized, forcefully
disable video, and block until this is done.
2014-12-31 20:31:19 +01:00
wm4
65f2c6c716 vo_opengl_cb: pass context directly
This is simpler than setting the context after VO creation, which
requires the code to check for the context on every entrypoint.
2014-12-31 19:12:44 +01:00
wm4
282e3202d5 video: pass some VO params as struct
Not particularly elegant, but better than adding more and more stuff to
the relevant function signatures.
2014-12-31 19:01:28 +01:00
wm4
63a414c708 command: make empty vf-metadata not an error
If a filter exists, but has no metadata, just return success. This
allows the user to distinguish between no metadata available, and filter
not inserted.

See #1408.
2014-12-30 14:04:53 +01:00
wm4
a5832ba019 vf: fix crash if filter doesn't provide control entrypoint
This input command crashed:

    vf add @mf:format=yuv420p ; show_text "${vf-metadata/mf}"

Fixes #1408.
2014-12-30 13:21:41 +01:00
James Ross-Gowan
e3a86eb3be w32_common: allow window resizing with --no-border 2014-12-29 15:20:46 +01:00
Niklas Haas
016bb14804 vo_opengl: Ignore approx-gamma for BT.2020-CL
The details of the non-linear transformation from/to BT.2020's constant
luminance system don't really make sense with any other gamma curve,
since changing the gamma curve completely breaks the chroma channels.
2014-12-29 15:20:40 +01:00
Stefano Pigozzi
f987625d5a cocoa: move the gl function loader to gl_cocoa.c 2014-12-28 19:10:44 +01:00
wm4
9270dda50a screenshots: set AVFrame parameters
Currently, libavcodec is rather lenient, but it might get stricter in
the future.

Fixes #1398.
2014-12-28 14:06:56 +01:00
wm4
5a3070304f vo_opengl: don't use 10 bit video on Intel GPUs
vo_opengl was originally written against OpenGL 3 core, and it seems
GPUs/drivers supporting this are mostly sane. Later, it was made to work
with OpenGL 2.1 too. Lately we removed the requirement for RG textures,
and look, someone reported a problem with "lesser" Intel GPUs.

This commit does the same in vo_opengl what was added to vo_opengl_old a
long time ago.

Fixes #1383.
2014-12-24 16:54:47 +01:00
wm4
2ad1906be6 vo_opengl_cb: use VAOs even in OpenGL 2.1
Using them reduces state change, since now at least vo_opengl_cb has to
setup/break the vertex array bindings on every frame if no VAOs are
available.

This reverts the VAO related change in commit f64665e7.
2014-12-23 14:32:24 +01:00
wm4
a71601231e vo_opengl_cb: always setup/break vertex array bindings
Originally, this code was written to have full control over the OpenGL
state, rather than having to cooperate with unknown components by being
embeded like vo_opengl_cb is meant to be. As a consequence, it was
thought to be ok to setup a global binding (if the context is below
OpenGL 3.0, which guarantees VAOs).

This could break badly. Fix it by setting up and breaking the bindings
on entry/exit.
2014-12-23 14:27:47 +01:00
wm4
4cfd641f05 vo_opengl: fix build on OSX
Missing modern OpenGL symbols again.
2014-12-23 03:12:37 +01:00
wm4
04a4c9b53c vo_opengl: don't allow setting 3D LUT if unsupported
The code was always uploading the 3D LUT (even of unused), as long as
vo_opengl was setting a icc-profile. This could crash with GLES 2.
2014-12-23 02:48:58 +01:00
wm4
a8ffa0d0eb vo_opengl: make use of newer OpenGL logging API
GL_ARB_debug_output provides a logging callback, which can be used to
diagnose problems etc. in case the driver supports it. It's enabled only
if the vo_opengl "debug" suboption is set.
2014-12-23 02:46:44 +01:00
wm4
c912288e57 vo_opengl_cb: parse renderer parameters
Now it accepts the same renderer arguments as vo_opengl. This also
disables debug checks by default, and reverts the background color
override. Both can now be controlled by the host application.
2014-12-22 12:51:23 +01:00
wm4
2b9a7c4b5b vo_opengl, vo_opengl_cb: check GL version in renderer
vo_opengl actually checks this in the context creation code already, but
it still increases robustness in case the requirements are changed
later.
2014-12-22 12:49:20 +01:00
wm4
16a5971d28 vo_opengl_cb: free context on exit
Minor memory leak.

Actually, this also exposes some problems in the QtQuick example. This
will have to be fixed in the example.
2014-12-22 12:45:43 +01:00
wm4
c640b8f3c0 vo_opengl: fix feature detection
Fixes #1373.
2014-12-22 02:50:26 +01:00
wm4
d5a7ad630f vo_opengl: improve fallback handling with GLES
Whether we have texture_rg doesn't matter much anymore; the scaler
should be fine with this. But on ES 2.0, 1st class arrays are missing,
so even if filterable float textures should be available, it won't work.

Dithering (at least the "fruit" variant) will not work either, because
it uses floats.
2014-12-21 23:46:54 +01:00
James Ross-Gowan
ec4bbbb69b vo_opengl: silence an INVALID_ENUM error with GLES2
Signed-off-by: wm4 <wm4@nowhere>
2014-12-21 21:39:45 +01:00
wm4
f6dac5d884 vo_opengl: GLES does not support GL_BGRA
Apparently GLES 2 and 3 do not support this. (The implementations I
tested with were derived from desktop OpenGL and were not overly strict
with this.)

This is no problem; just use GL_RGBA and mangle the channels in the
shader.

Also disable direct support for image formats like IMGFMT_RGB555 with
GLES; at least some of them are not supported in this form, and the
formats aren't important anyway.
2014-12-20 19:23:17 +01:00
wm4
501290da02 vo_opengl_old: fix OSD regression
Commit 0e8fbdbd removed the rg_texture requirement from vo_opengl;
commit 541f6731 changed to a more convenient method. Both commits broke
vo_opengl_old in some ways. vo_opengl_old always requires GL_ALPHA for
single-channel texture, because it draws the OSD without shaders and by
using certain blend modes.

So we need to explicitly distinguish between vo_opengl and vo_opengl_old
in the OSD renderer, and force fixed texture formats for vo_opengl_old.
The other logic is specific to the internals of vo_opengl. (Although it
might be possible to get the same result by playing with the old GL
fixed-function functions in vo_opengl_old. But seems like a waste of
time.)

Fixes #1370.
2014-12-20 18:43:11 +01:00
Stefano Pigozzi
e80d233fd4 cocoa: mark window for redraw after title change
This used to work correctly without the call to displayIfNeeded. I think this
may only be needed for Yosemite.

Fixes #1330
2014-12-20 11:45:51 +01:00
wm4
fcd2ea7601 vo_opengl: remove pointless glFinish calls 2014-12-19 23:50:12 +01:00
wm4
e749d26ac3 vo_opengl: skip GLES when autoprobing
There are probably bugs with GLES support; also, if you somehow get GLES
instead of desktop GL on a desktop computer, something else is probably
wrong. So I see no point in using this automatically. We first need to
find out whether the GLES support works on real hardware, and whether
it is useful at all.
2014-12-19 20:34:11 +01:00
wm4
d31e584292 vo_opengl, x11: add ES context creation via GLX
Apparently GLX can do this, so using EGL is not strictly required.

This code tries to create an ES context if creating a desktop GL context
fails. Also, a "x11es" backend for forcing ES (instead of desktop GL) is
added, mostly for testing and debugging.
2014-12-19 20:29:31 +01:00
wm4
b7277d25e5 vo_opengl: fail if required functions are missing
Before this, missing additional but required functions were ignored.
("Main" functions still made it error out.) But we pretty much expect
that these are present on a given version level, and only an extremely
buggy OpenGL implementation would not do this.
2014-12-19 18:54:39 +01:00
wm4
88982f2855 vo_opengl: better probe handling
Involve detection of software renderers in the probing properly. Other
VOs could handle probing also more gracefully, and e.g. produce less
noise if an API is unavailable. (Although other than the OpenGL VOs,
only vo_wayland will.)

Now the "sw" suboption for vo_opengl[_old] is strictly speaking not
needed anymore. Doing "--vo=opengl" disables the probing logic, and will
always force it, if possible.

Includes some simplifications as well.
2014-12-19 18:54:39 +01:00
wm4
bebc323c6d vo_opengl: minor simplification
The parameter to default_tex_params() is always the same.
2014-12-19 18:32:51 +01:00
wm4
fd6256f9c7 vo_opengl: unbork
Probably.

The version handling schema is a bit strange (and led to a tricky and
obvious bug), but it's quite similar to what OpenGL does at some places,
so I blame the OpenGL standard.
2014-12-19 02:26:14 +01:00
wm4
a0051b9da2 vo_opengl: add GLES 2 support
Rather basic support. Almost nothing works, and even if it does, it's
bound to be inefficient (due to texture upload). This was tested with
the nVidia desktop binary drivers, which provide GLES 2 support only.
However, nVidia is not known to be very strict about OpenGL, and the
driver is very new too, so the vo_opengl code will have bugs too.
2014-12-19 01:21:19 +01:00
wm4
fe35130ba9 vo_opengl: mess with PixelStorei state management
This is needed for GLES 2 support. GLES 2 doesn't support
GL_UNPACK_ROW_LENGTH, and we shouldn't even use this constant, since a
GLES implementation could raise an error.

So set it only if neccessary, and leave it in the default state
otherwise. This also smuggles in a ES 2 fallback for glUploadTex(),
and querying an extension relevant for ES 2. For the alignment state
(GL_[UN]PACK_ALIGNMENT) do the same for symmetry. All 4 states
(alignment/rows x pack/unpack) are now assumed to be in their initial
states by default.

Also redo the PixelStorei handling in the function table. I could rebase
this, but look at the commit time.
2014-12-19 01:21:18 +01:00
wm4
de3e26bc84 vo_opengl: disable some unavailable features under ES
There are probably many more which I overlooked.
2014-12-19 00:15:38 +01:00
wm4
f64665e7e9 vo_opengl: clean up GL ES function loading
Previously, this was sort of messed together with desktop OpenGL
loading. Add explicit support for ES, and clean up the mess. Also sort
the function arrays alphabetically (at least most of them).

In some cases, add functions to multiple sections. This keeps the number
of sections down.

Don't check for GL_ARB_vertex_array_object. This feature must be used in
OpenGL 3 core, while it may be not available at all in earlier versions,
and not using it if it's available as extension only has no advantages.

This commit also considers GLES 2, because actual support for it will be
added with a later commit.

Also get rid of some MPGL_VER() uses (see some commits ago).
2014-12-18 23:51:21 +01:00
wm4
1b766ab208 vo_opengl: do not use 4x3 matrix
This was a nice trick to get the mpv colormatrix directly into OpenGL,
because the memory representation happened to match.

Unfortunately, OpenGL ES 2 doesn't have glUniformMatrix4x3fv().

Even more unfortunately, the memory representation is now incompatible.
It would be nice to change it, but that would mean getting into a big
mess.
2014-12-18 22:24:45 +01:00
wm4
32fb3dae87 vo_opengl: simplify some aspects of the GL function loader 2014-12-18 21:06:17 +01:00
wm4
da997db095 vo_opengl, x11: make legacy context warning not an error
Really, this doesn't actually matter. It's printed as error only because
it was once thought to be an mostly unneeded fallback, but it turned out
this is still frequently needed, and users are getting confused.
2014-12-18 20:58:37 +01:00
wm4
eec4b86bbc x11: fix mysterious issue with window embedding on OpenBox
For some reason, when using window embedding, and the window manager is
OpenBox, calling XSetWMNormalHints() before the window is mapped, the
initial window position will be off. It leaves some vertical space,
instead of placing it on the top/left corner. Suspiciously, the vertical
space is as much as a the height of normal window decoration.

I don't know what kind of issue this is. Possibly an OpenBox bug, but
then this happens even if the override-redirect flag is set. (This flag
basically tells the X server to ignore the window manager. Normally we
don't set it.) On other window managers, it works fine. So I don't know
why this is happening.

But this is easy to workaround. XSetWMNormalHints() isn't needed at all
if embedding.

Should fix #1235.
2014-12-18 16:45:55 +01:00
wm4
7098f33077 x11: minor improvements
Always include the window position in winrc, even if the window
embedded. This should give the correct positions for things which still
interact with global coordinates, such as the xrandr code.
2014-12-18 16:30:13 +01:00
wm4
6f0da71c6b vo_opengl: minor simplification in function loader
Don't force every entries without functions to define a dummy array.
2014-12-18 15:29:47 +01:00
wm4
541f6731a0 vo_opengl: simplify the case without texture_rg
If GL_RED was not available, we used GL_ALPHA. But this is an
unnecessary complication, and it's easier to use GL_LUMINANCE instead.
With the latter, a texture will return the .r component set, and as long
as the shader doesn't look at the other components, the shader doesn't
need any changes.

Some of the changes added in 0e8fbdbd are now unneeeded.

Also, realign the entire gl_byte_formats_legacy table.
2014-12-18 14:46:59 +01:00