summaryrefslogtreecommitdiffstats
path: root/video
Commit message (Collapse)AuthorAgeFilesLines
* vo_drm: relicense to LGPLrr-2015-11-083-10/+15
| | | | | Also removed authorship information (as per convention seen in other files)
* vo_drm: use bool rather than integer return valuesrr-2015-11-084-78/+60
| | | | | Since the errors weren't used for anything other than simple success/fail checks, I simplified things a bit.
* vo_opengl: add DRM EGL backendrr-2015-11-082-0/+439
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Notes: - Unfortunately the only way to talk to EGL from within DRM I could find involves linking with GBM (generic buffer management for Mesa.) Because of this, I'm pretty sure it won't work with proprietary NVidia drivers, but then again, last time I checked NVidia didn't offer proper screen resolution for VT. - VT switching doesn't seem to work at all. It's worth mentioning that using vo_drm before introduction of VT switcher had an anomaly where user could switch to another VT and input text to it, while video played on top of that VT. However, that isn't the case with drm_egl: I can't switch to other VT during playback like this. This makes me think that it's either a limitation coming from my firmware or from EGL/KMS itself rather than a bug with my code. Nonetheless, I still left (untestable) VT switching code in place, in case it's useful to someone else. - The mode_id, connector_id and device_path should be configurable for power users and people who wish to watch videos on nonprimary screen. Unfortunately I didn't see anything that would allow OpenGL backends to register their own set of options. At the same time, adding them to global namespace is pointless. - A few dozens of lines could be shared with vo_drm (setting up VT switching, most of code behind page flipping). I don't have any strong opinion on this. - Sometimes I get minor visual glitches. I'm not sure if there's a race condition of some sort, unitialized variable (doubtful), or if it's buggy driver. (I'm using integrated Intel HD Graphics 4400 with Mesa) - .config and .control are very minimal. Signed-off-by: wm4 <wm4@nowhere>
* vo_drm: move initialization to drm_commonrr-2015-11-083-219/+278
| | | | | Makes KMS initialization procedures reusable so that they can be used by the upcoming DRM EGL adapter.
* vo_opengl: fix typorr-2015-11-071-1/+1
|
* vo_opengl: rename fancy-downscaling to correct-downscalingwm42015-11-072-10/+9
| | | | The old name was stupid. Very stupid.
* vo_opengl: fancy-downscaling: enable also for anamorphic clipsAvi Halachmi (:avih)2015-11-071-4/+9
|
* x11: print Xlib errors in verbose mode if Xlib messages are silencedwm42015-11-071-9/+5
| | | | Follow up to commit b984ec52.
* vo_opengl: x11: silence error messages when using legacy GL contextwm42015-11-063-2/+16
| | | | | | | | glXCreateContextAttribsARB() by design can throw some X11 errors. We ignore these, but we generally still print error messages to the terminal. This was confusing/annoying users, so silence it. The stupid part is that the Xlib error handler is global, so we have to be slightly careful here.
* Remove some VLAswm42015-11-063-14/+16
| | | | | | | | They are evil and should be eradicated. Some of these were pretty dumb anyway. There are probably some more around in platform specific code or other code not enabled by default on Linux.
* w32: use DisplayConfig API to retrieve correct monitor refresh rateJames Ross-Gowan2015-11-063-18/+301
| | | | | | | | | | This is based on an older patch by James Ross-Gowan. It was rebased and cleaned up. Also, the DWM API usage present in the older patch was removed, because DWM reports nonsense rates at least on Windows 8.1 (they are rounded to integers, just like with the old GDI API - except the GDI API had a good excuse, as it could report only integers). Signed-off-by: wm4 <wm4@nowhere>
* w32: always get screenrc from an HMONITORJames Ross-Gowan2015-11-061-21/+41
| | | | | | | | | | | | | | | | This simplifies update_screen_rect a bit. Unless --fs-screen=all is used, it will always get an HMONITOR and call GetMonitorInfo to determine its dimensions. This will make it easier for the next few commits to determine the colour profile and the refresh rate from the HMONITOR. There is a slight change in behaviour. When selecting a screen that is out of range, such as --screen=9 on a machine with only two monitors, the old code would silently select the last existing monitor. The new code prints an error message and falls back to the default screen (same as the Cocoa code.) Signed-off-by: wm4 <wm4@nowhere>
* w32: remove Win95 and NT4 monitor codeJames Ross-Gowan2015-11-061-25/+4
| | | | | | | | | | | | | | The call to EnumDisplaySettings seems to be a relic from when MPlayer ran on systems that didn't have GetMonitorInfo or SM_CX/CYVIRTUALSCREEN. GetMonitorInfo was loaded dynamically, so it was possible for MPlayer to run without it and use the values returned by EnumDisplaySettings. These are always present in modern versions of Windows, so the values returned from EnumDisplaySettings are always overwritten. Remove the call to EnumDisplaySettings and assume SM_CX/CYVIRTUALSCREEN is always present. Signed-off-by: wm4 <wm4@nowhere>
* video: increase avi pts buffer sizewm42015-11-061-1/+1
| | | | | When decoding on RPI/MMAL, the buffering between decoder input and output can be quite excessive.
* vo_opengl: simplify function loader slightlywm42015-11-061-6/+0
| | | | | We don't use any functions that have been deprecated in any later GL or GLES functions. (This is a leftover of vo_opengl_old support.)
* vo_opengl: glBindBufferBase is not part of GL 2.1/GLES 2.0wm42015-11-062-2/+2
| | | | | | | | Commit 27dc834f added it as such. Also remove the check for glUniformBlockBinding() - it's part of an extension, and the check glGetUniformBlockIndex() already checks whether the extension is fully available.
* vo_opengl: implement NNEDI3 prescalerBin Jin2015-11-059-5/+368
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implement NNEDI3, a neural network based deinterlacer. The shader is reimplemented in GLSL and supports both 8x4 and 8x6 sampling window now. This allows the shader to be licensed under LGPL2.1 so that it can be used in mpv. The current implementation supports uploading the NN weights (up to 51kb with placebo setting) in two different way, via uniform buffer object or hard coding into shader source. UBO requires OpenGL 3.1, which only guarantee 16kb per block. But I find that 64kb seems to be a default setting for recent card/driver (which nnedi3 is targeting), so I think we're fine here (with default nnedi3 setting the size of weights is 9kb). Hard-coding into shader requires OpenGL 3.3, for the "intBitsToFloat()" built-in function. This is necessary to precisely represent these weights in GLSL. I tried several human readable floating point number format (with really high precision as for single precision float), but for some reason they are not working nicely, bad pixels (with NaN value) could be produced with some weights set. We could also add support to upload these weights with texture, just for compatibility reason (etc. upscaling a still image with a low end graphics card). But as I tested, it's rather slow even with 1D texture (we probably had to use 2D texture due to dimension size limitation). Since there is always better choice to do NNEDI3 upscaling for still image (vapoursynth plugin), it's not implemented in this commit. If this turns out to be a popular demand from the user, it should be easy to add it later. For those who wants to optimize the performance a bit further, the bottleneck seems to be: 1. overhead to upload and access these weights, (in particular, the shader code will be regenerated for each frame, it's on CPU though). 2. "dot()" performance in the main loop. 3. "exp()" performance in the main loop, there are various fast implementation with some bit tricks (probably with the help of the intBitsToFloat function). The code is tested with nvidia card and driver (355.11), on Linux. Closes #2230
* vo_opengl: add Super-xBR filter for upscalingBin Jin2015-11-056-7/+499
| | | | | | | | | | | Add the Super-xBR filter for image doubling, and the prescaling framework to support it. The shader code was ported from MPDN extensions project, with modification to process luma only. This commit is largely inspired by code from #2266, with `gl_transform_trans()` authored by @haasn taken directly.
* vo_opengl: make image size dynamic during renderingBin Jin2015-11-051-24/+33
| | | | | This commit marks the image size variables temporary, and renames them in order to prevent any potential confusion in the future.
* rpi: add support for codecs other than h264wm42015-11-053-7/+20
| | | | FFmpeg now supports h264 and mpeg2. At least vc-1 will probably follow.
* vo_vdpau: check VDP_RGBA_FORMAT_A8 supportwm42015-11-041-2/+6
| | | | | Apparently not all vdpau drivers in the wild support this format (VDPAU SUNXI can't). Revert to RGB in these cases.
* vo_opengl_cb: log some eventswm42015-11-041-0/+4
| | | | | | | | | | The noframe event is logged whenever there is no new frame. This can happen due to normal redraws, but also due to video frame queue underflow. The mpv_opengl_cb_report_flip() API function is currently pretty useless, because blocking on the video frame queue is more reliable and simpler. But at least we can log the actual vsync.
* vo_opengl, vo_opengl_cb: drop unneeded vo_frame fieldswm42015-11-044-28/+6
| | | | | | | | | next_vsync/prev_vsync was only used to retrieve the vsync duration. We can get this in a simpler way. This also removes the vsync duration estimation from vo_opengl_cb.c, which is probably worthless anyway. (And once interpolation is made display-sync only, this won't matter at all.)
* vo: do not go to sleep if there's a new frame queuedwm42015-11-031-3/+3
| | | | | | This affects only the display-sync code path, as for normal timing the wakeup_pts stuff handles proper wakeup. It's probably mostly a theoretical issue.
* vd_lavc: make hwdec fallback more tolerantwm42015-11-032-6/+14
| | | | | | | | | | | | A hw decoder might fail to decode a frame for multiple reasons, and not always just because decoding is impossible. We can't generally distinguish these reasons well. Make it more tolerant by accepting failures of 3 frames, but not more. The threshold can be adjusted by the repurposed --vd-lavc-software-fallback option. (This behavior was suggested much earlier in some PR, but at the time the "proper" hwdec fallback was indistinguishable from decoding error. With the current situation, "proper" fallback is still instantious.)
* vo: fix display-sync frame drop accounting againwm42015-11-031-1/+1
| | | | | Commit acd5816a fixed this, except when vo_opengl interpolation was active. (And again, the old interpolation code path should be removed.)
* vdpau: fix uninit when init failswm42015-11-012-5/+2
| | | | | | | | | | The uninit() function was called twice if the uninit() function failed (once by init(), once by vd_lavc.c code), which caused crashes due to double-free. (This failure is a corner case, and all other hwdec backends appear to handle this case gracefully.) I do not think this code should be able to deal with uninit() being called other than once. Guarantee that it's called exactly once.
* vo_opengl: win32: fix cross-compilationwm42015-11-011-1/+1
| | | | MXE uses an all-lowercase convention for MS headers.
* vo_opengl: win32: always request MMCSS for DWMwm42015-11-011-0/+5
| | | | | | | | | | | | | | | | | | Quoting MSDN: "Notifies the Desktop Window Manager (DWM) to opt in to or out of Multimedia Class Schedule Service (MMCSS) scheduling while the calling process is alive.". Whatever this means. (An application can change the scheduling priority of the window manager?) Does this improve anything? I have no idea. Certainly this is a program that does multimedia and graphics, so we seem to be a good match for this. Is it bad if we enable this even while playback is inactive or paused? I have no idea either. Is there a magic cargo cult function that will mark our renderer thread as multimedia thing? I have no idea. (We use a function to enable MMCSS for our audio thread in ao_wasapi.)
* vo_opengl: win32: try to enable DwmFlush by defaultwm42015-11-012-9/+46
| | | | | | | | | | | | | | Enable it by default, but not unconditionally. Add an "auto" mode, which disable DwmFlush if the compositor is (probably) inactive. Let's see how this goes. Since I accidentally enabled DwmFlush always by default (more or less) in a previous commit touching this code, this is probably mostly just cargo-culting, and it's uncertain whether it does anything. Note that I still got bad vsync behavior when fullscreening mpv, and making another window visible on the same screen. This happens even if forcing DWM.
* vo: fix no-audio mode with interpolation enabled/display-sync disabledwm42015-11-011-1/+1
| | | | | | | Commit acd5816a broke this. It was stopping playback occasionally. Another case where the non-display-sync interpolation mode (in->vsync_timed==true) is causing a lot of subtle issues and will be removed soon.
* video: fix playback of pal8wm42015-11-011-1/+2
| | | | | | | | | | | PAL8 is the only format that is RGB, has only 1 component, is byte- aligned. It was accidentally detected by the GBRP case as planar RGB. (It would have been ok if it were gray; what ruins it is that it's actually paletted, and the color values do not correspond to colors (but palette entries). Pseudo-pal formats are ok; in fact AV_PIX_FMT_GRAY is rightfully marked as MP_IMGFLAG_YUV_P.
* vo_direct3d: fix operationwm42015-10-313-10/+3
| | | | | | | | | Regression since commit 93db4233. I think the bit that was forgotten here was to remove the vo_w32_config() return value completely. The VO failed to init because that function always returned 0. This commit removes these bits and fixes the VO. Fixes #2434.
* vo_opengl: add vsync-fences optionwm42015-10-303-0/+32
| | | | | | | | | | | | | | | | | | | | | | Yet another relatively useless option that tries to make OpenGL's sync behavior somewhat sane. The results are not too encouraging. With a value of 1, vsync jitter is gone on nVidia, but there are frame drops (less than with glfinish). With 2, I get the usual vsync jitter _and_ frame drops. There's still some hope that it might prevent too deep queuing with some GPUs, I guess. The timeout for the wait call is 1 second. The value is pretty arbitrary; it should just not be too high to freeze the process (if the GPU is un-nice), and not too low to trigger the timeout in normal cases, even if the GPU load is very high. So I guess 1 second is ok as a timeout. The idea to use fences this way to control the queue depth was stolen from RetroArch: https://github.com/libretro/RetroArch/blob/df01279cf318e7ec90ace039d60515296e3de908/gfx/drivers/gl.c#L1856
* vo_opengl: cosmetics: flip the order of 2 functionswm42015-10-301-16/+16
| | | | | draw_frame() is called first, then flip_page(). Order them in the order they're called.
* vo_drm: uninstall signal handlers after quittingrr-2015-10-301-0/+2
|
* vo_drm: handle possible errors from sigactionrr-2015-10-301-6/+17
|
* vo_drm: check if signal already usedrr-2015-10-301-5/+23
|
* video: fix framedrop accounting in display-sync modewm42015-10-301-0/+1
| | | | | | | | | | | | | | Commit a1315c76 broke this slightly. Frame drops got counted multiple times, and also vo.c was actually trying to "render" the dropped frame over and over again (normally not a problem, since frames are always queued "tightly" in display-sync mode, but could have caused 100% CPU usage in some rare corner cases). Do not repeat already dropped frames, but still treat new frames with num_vsyncs==0 as dropped frames. Also, strictly count dropped frames in the VO. This means we don't count "soft" dropped frames anymore (frames that are shown, but for fewer vsyncs than intended). This will be adjusted in the next commit.
* vo_opengl: cache frames only in display-sync modewm42015-10-301-1/+3
| | | | | | | vo_frame.num_vsyncs can be != 1 in some cases in normal sync mode too. This is not a very exact fix, but in exchange it's robust. (These vo_frame flags are way too tricky in combination with redrawing and such.)
* vo_opengl: do not attempt to cache frames in FBO in dumb-modewm42015-10-301-1/+1
| | | | | | | | | | There were occasional shader compilation and rendering failures if FBOs were unavailable. This is caused by the FBO caching code getting active, even though FBOs are unavailable (i.e. dumb-mode). Boken by commit 97fc4f. Fixes #2432.
* vd_lavc: fix declarationswm42015-10-301-6/+6
| | | | | | | Fixes linker failure. How did this ever work? Apparently it did most of the time, but apparently we just got the first case where it didn't. Fixes #2433.
* vo: take normal drop path when dropping in display-sync modewm42015-10-291-4/+3
| | | | I hope there wasn't a deeper reason for exiting early.
* vo_drm: show osd in audio only modePaul B Mahol2015-10-291-8/+13
| | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* Replace deprecated av_free_packet() callswm42015-10-281-1/+1
| | | | | | av_free_packet() got finally deprecated. Use av_packet_unref() instead, which has almost the same semantics, has existed for a while, and is available in all FFmpeg and Libav versions we support.
* vo: kill non-working missed frame detectionwm42015-10-271-6/+0
| | | | | | | | | | | | | | | This was not very reliable. In the normal vo_opengl case, this didn't deal well enough with vsync jitter. Vsync timings can jitter quite extremely, up to a whole vsync duration, in which case the "missed" frame counter keeps growing, even though nothing is wrong. This behavior also messes up the A/V difference calculation, but as long as it's within tolerance, it won't provoke extra frame dropping/repeating. Real misses are harder to detect, and I might add such detection later. In the vo_opengl_cb case, this was additionally broken due to the asynchronity between renderer and VO threads.
* vd_lavc: make software decoding fallback an optionRodger Combs2015-10-251-1/+5
|
* vo_opengl: remove source shader leftoverBin Jin2015-10-242-3/+0
| | | | The source shader was removed after deband was introduced.
* vo_opengl: always cache to an FBO when not interpolatingNiklas Haas2015-10-231-4/+29
| | | | | | This speeds up redraws considerably (improving eg. <60 Hz material on a 60 Hz monitor with display-sync active, or redraws while paused), but slightly slows down the worst case (eg. video FPS = display FPS).
* vo: expose frame->num_vsyncs to the VO backendNiklas Haas2015-10-231-1/+0
| | | | | It's not clear why this was originally hidden, but the information is useful for allowing the VO backend to make decisions about caching.
* w32_common: disable IMEJames Ross-Gowan2015-10-231-9/+16
| | | | | | | | | | The IME is not useful for key-bindings. Handle the base ASCII chars instead and don't show the IME window. For the sake of libmpv users, the IME should only be disabled on mpv's GUI thread and not application- wide. No IME on the GUI thread should also mean that VK_PROCESSKEY will never have to be handled, so the logic for that can be removed as well.
* vo_opengl: wayland: use a more standard symbolwm42015-10-231-1/+2
| | | | | They're the same, but EGL_CONTEXT_MAJOR_VERSION_KHR technically is an extension, while EGL_CONTEXT_CLIENT_VERSION is the standardized alias.
* vo_opengl: vaapi: fix compilation failure on older systemswm42015-10-231-1/+2
| | | | | | | Older systems have certain EGL extension definitions missing. We redefine them to make the build system easier, and because it's trivial. But we forgot to define the EGL_LINUX_DMA_BUF_EXT identifier. (I hope it's the only missing one.)
* vo_opengl_cb: fix passing through some video equalizer propertieswm42015-10-231-2/+7
| | | | | | | | | | | | | | | | | | | | | | The equalizer code as it exists in vo_opengl works perfectly fine. The situation in vo_opengl_cb is pretty different. The playback thread can't communicate with the renderer thread synchronously (essentially to give the API user more flexibility). So the equalizer communication has to be done in an asynchronous way too. There were two problems. First, the eq capabilities can change with the pixel format, and the renderer initializes them on config only. This means equalizers were disabled on the first config run, and options like --video-output-levels or --brightness would not work. So we just initialize the caps with a known superset. The player will not correctly indicate when setting an eq doesn't work, but we're fine with it, as it is a relatively cosmetic issue. Second, it copied back the eq settings in the "wrong" moment (what for?), which overwrote the settings in some cases. Third, the eq was not reset correctly on vo init. This is needed to make it behave the same as vo_opengl.
* vo_opengl: make the default debanding settings less excessiveNiklas Haas2015-10-211-2/+2
| | | | | | | | | It's great that the new algorithm supports multiple placebo iterations and all, but it's really not necessary and hurts performance in the general case for the sake of the 0.1% that actually pause the screen and look for minute differences. Signed-off-by: wm4 <wm4@nowhere>
* Revert "vo_wayland: define opaque region"Ricardo Vieira2015-10-201-9/+0
| | | | | | This reverts commit c10fb4ce9fcd3dbbf69741eb8499c4cfabbf5412. This is already done in vo_wayland.c:resize,324 doing it here makes the window bigger before the video resizes showing a black area while dragging the border.
* vd_lavc: attempt to fallback from hwdec before anything is decodedwm42015-10-191-4/+4
| | | | | | | | | | The previous commit moved the av_frame_unref() after the got_picture check. This accidentally also deferred the software fallback reinitialization to until a software picture was decoded (instead of the