summaryrefslogtreecommitdiffstats
path: root/video/out
Commit message (Collapse)AuthorAgeFilesLines
* video : Move drm options to substruct.Lionel CHAZALLON2017-10-235-4/+30
| | | | | This allows to group them and most of all query the group config when needed and when we don't have the access to vo.
* Add DRM_PRIME Format Handling and Display for RockChip MPP decodersLionel CHAZALLON2017-10-2310-19/+761
| | | | | | | | | | | This commit allows to use the AV_PIX_FMT_DRM_PRIME newly introduced format in ffmpeg that allows decoders to provide an AVDRMFrameDescriptor struct. That struct holds dmabuf fds and information allowing zerocopy rendering using KMS / DRM Atomic. This has been tested on RockChip ROCK64 device.
* video : allow drm primary plane to be transparent for egl contextLionel CHAZALLON2017-10-231-2/+2
| | | | | We want primary plane to be one top of overlay (video), so we need it to be 32 bits.
* vo_opengl: hwdec_vaegl: Disable vaExportSurfaceHandle()Mark Thompson2017-10-231-3/+3
| | | | | libva 2.0 (VAAPI 1.0.0) was released without it, but it is scheduled to be included in libva 2.1.
* wayland_common: check monitor scaleRostislav Pehlivanov2017-10-221-3/+9
| | | | | | | Since we divide by it in a couple of places and compositors can be crazy, its better to be safe than sorry. Also checks cursor spawn durinig init (pointless since it does again on cursor entry but its more correct).
* wayland_common: improve cursor code and scale cursor properlyRostislav Pehlivanov2017-10-222-26/+35
| | | | | | It seems the cursor hadn't had its position properly adjusted when scaled. Hence, bring back correct buffer scaling to make the cursor look fine. Also the cursor surface now gets created sooner so that's better.
* wayland_common: don't scale the cursor wl_bufferRostislav Pehlivanov2017-10-191-1/+0
| | | | | Only gnome does something as stupid as always applying scaling to the cursor rather than just using a larger sized one with HIDPI.
* video: fix alpha handlingwm42017-10-191-2/+4
| | | | | | | | | Regression since ec6e8a31e092a1d. Removal of the explicit else case always applies the conversion to premultiplied alpha in the else branch. We want to scale with multiplied alpha, but we don't want to multiply with alpha again on top of it. Fixes #4983, hopefully.
* vo_gpu: add rgba16hf to the list of FBO formatsJames Ross-Gowan2017-10-181-1/+2
| | | | | | | This should be functionally identical to rgba16f, since the formats only differ in their representation on the CPU, but it could be useful for RA backends that don't expose rgba16f, like Vulkan. It's definitely useful for the WIP D3D11 backend.
* vo_rpi: fix build (probably)wm42017-10-171-1/+1
| | | | Untested. If it works, fixes #4919.
* vo_gpu: remove weird p->vo indirectionwm42017-10-171-11/+9
| | | | That's just unnecessary.
* vo_gpu: fix video sometimes not being rerendered on equalizer changewm42017-10-174-4/+9
| | | | | | | | | | | | | | With video paused, changing the brightness controls (or similar) would sometimes not rerender the video frame. So the OSD would redraw, but the video wouldn't change. This is caused by output caching, and a redraw request is free to return the cached frame. Change it such to invalidate the cached frame if any of the options or the equalizer change. In theory, gl_video_reset_surfaces() could be called if the equalizer changes - this would apparently force interpolatzion to redraw all frames. But this looks kind of crappy when changing the equalizer during playback. It'll "eventually" use the correct settings anyway, and when paused interpolation is off.
* vo_gpu: remove some minor dead codewm42017-10-161-3/+1
| | | | | This was for the "opengl" compat VO entry, which is now handled differently.
* vo_gpu: semi-fix --gpu-context/--gpu-api options and help outputwm42017-10-164-17/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This was confusing at best. Change it to output the actual choices. (Seems like in the end it's always me who has to clean up other people's bullshit.) Context names were not unique - but they should be, so fix it. The whole point of the original --opengl-backend option was to side-step the tricky auto-detection, so you know exactly what you get. The goal of this commit is to make --gpu-context work the same way. Fix the non-unique names by appending "vk" to the names. Keep in mind that this was not suitable for slecting the "UI" backend anyway, since "x11" would force GLX, whereas people on not-NVIDIA actually want "x11egl". Users trying to use --gpu-context=x11 to force the X11 backend would always end up with GLX, which would at least break VAAPI hardware decoding for them. Basically the idea that this option could select the "UI" type is completely broken - it selects an implementation, which implies a UI. Selecting the UI type This would require a separate mechanism. (Although in theory this separate mechanism could be part of the --gpu-context option - in any case, someone would have to implement it.) To achieve help output that can actually be understood, just duplicate the code. Most of that code is duplicated anyway, and trying to share just the list code with the result of making the output unreadable doesn't make too much sense. If we wanted to save code/effort, we could just remove the help output altogether. --gpu-api has non-unique entries, and it would be nice to group them (e.g. list all OpenGL capable contexts with "opengl"), but C makes this simple idea too much of a pain, so don't do it. Also remove a stray tab from the android entry on the manpage.
* vo_gpu: mali-fbdev: fix build errorTobias Jakobi2017-10-131-2/+2
| | | | Apparantly the context was renamed.
* wayland_common: init output_list during main struct initRostislav Pehlivanov2017-10-121-1/+2
| | | | | Otherwise if display connection or xkb init failed the uninit function could segfault.
* wayland_common: require wl_output v2 and send MP_INPUT_RELEASE_ALL on uninitRostislav Pehlivanov2017-10-111-8/+13
| | | | | | Every compositor (including toy compositors) has had support for wl_output v2 since forever, so there's little point in supporting degraded output for 5 year old releases (especially considering we require zxdg6 which is far more recent).
* vo_gpu: shaderc: include debug info when --gpu-debug is setJames Ross-Gowan2017-10-111-0/+2
| | | | | | | This adds symbol information to the generated SPIR-V, which shows up in the SPIR-V assembly dump. It's also useful for potential RA backends that use SPIRV-Cross, since the symbol information is used in the generated shader source.
* Add checks for HAVE_GPL to various GPL-only source fileswm42017-10-104-0/+20
| | | | | | | | This should actually cover all of them, if you take into account that some unchanged GPL source files include header files with such checks. Also this was done already for the libaf derived code. This is only for "safety" and to avoid misunderstandings.
* wayland_common: adjust default cursor size and scale its bufferRostislav Pehlivanov2017-10-101-2/+3
| | | | | | | It turns out compositors which do scaling scale the cursor as well, so every single surface needs to get scaled too. Also, 32 corresponds to the default size for both GTK+ and KDE.
* vo: fix reference to mediacodec_embedAman Gupta2017-10-091-2/+2
|
* vo_gpu: android: fix gpu contextAman Gupta2017-10-091-0/+4
|
* vo_opengl: hwdec_vaegl: Use vaExportSurfaceHandle() if presentMark Thompson2017-10-091-0/+80
| | | | | | | | | | | This new interface in libva2 offers a cleaner way to export surfaces which can then be imported to EGL. In particular, this works with the Mesa driver, so we can have proper playback without a pointless download and upload on AMD cards. This change does nothing with libva1, and will fall back to the libva1 interface (vaDeriveImage() + vaAcquireBufferHandle()) if vaExportSurfaceHandle() is not present.
* vo_gpu: simplify opengl aliaswm42017-10-092-31/+2
| | | | | This makes the replacement warning message worse, but I don't think I care enough.
* vo_gpu: remove duplicated optionswm42017-10-091-1/+0
| | | | | All these options (like --gpu-context etc.) were duplicated. It's amazing that it didn't cause more problems than it did.
* vo_opengl: context_drm_egl: Don't create a new framebuffer for every frameMark Thompson2017-10-091-22/+27
|
* vo_gpu: add android opengl backendAman Gupta2017-10-091-0/+151
| | | | | | | | | | At the moment, rendering on Android requires ``--vo=opengl-cb`` and a lot of java<->c++ bridging code to receive the receive and react to the render callback in java. Performance also suffers with opengl-cb, due to the overhead of context switching in JNI. With this patch, Android can render using ``--vo=gpu --gpu-context=android`` (after setting ``--wid`` to point to an android.view.Surface on-screen).
* vo: add mediacodec_embed output driverAman Gupta2017-10-092-0/+93
| | | | | Allows rendering IMGFMT_MEDIACODEC frames directly onto an android.view.Surface
* vo: add VO_CAP_NOREDRAW for upcoming vo_mediacodec_embedAman Gupta2017-10-092-1/+8
| | | | | | | | | | | MediaCodec uses a fixed number of output buffers to hold frames, and expects that output buffers will be released as soon as possible. Once rendered, the underlying frame is automatically released and cannot be reused or rerendered. The new VO_CAP_NOREDRAW forces mpv to release frames immediately after they are rendered or dropped, to ensure that MediaCodec decoder does not run out of buffers and stall out.
* wayland_common: implement output tracking, cleanups and bugfixesRostislav Pehlivanov2017-10-094-215/+246
| | | | | | | | | | | | | | | | | | This commit: - Implements output tracking (e.g. monitor plug/unplug) - Creates the surface during registry (no other dependencies) - Queues the callback immediately after surface creation - Cleaner and better event handling (functions return directly) - Better reconfigure handling (resizes reduced to 1 during init) - Don't unnecessarily resize (if dimensions match) Apart from that fixes 2 potential memory leaks (mime type and window title), 2 string ownership issues (output name and make need to be dup'd), fixes some style issues (switches were indented) and finally adds messages when disabling/enabling idle inhibition. The callback setter function was removed in preparation for the commit which will use the frame event cb because it was unnecessary.
* wayland_common: allow vo_wayland_uninit(NULL)Niklas Haas2017-10-071-0/+2
| | | | ...again
* Revert "wayland_common: add support for embedding"Rostislav Pehlivanov2017-10-052-6/+0
| | | | This reverts commit 8d8d4c5cb1b3553215a8ba547d4db463fdc88831.
* wayland_common: respect close eventsRostislav Pehlivanov2017-10-051-3/+9
| | | | | Overlooked. Also add a comment and only set the parent if WinID is set.
* wayland_common: add support for embeddingRostislav Pehlivanov2017-10-052-0/+5
|
* wayland_common: reset the LIVE_RESIZING flag when resizing endsRostislav Pehlivanov2017-10-051-10/+14
| | | | | | The VO code resets each flag individually, and it doesn't do it for this one. Also make the prints use the struct names rather than the hardcoded ones, forgot to add those to the last wayland_common commit.
* wayland_common: don't hardcode protocol names during registryRostislav Pehlivanov2017-10-041-8/+8
| | | | Use the interface names from the wl_interface structs they provide.
* wayland_common: rewrite from scratchRostislav Pehlivanov2017-10-036-1053/+1209
| | | | | | | | | | | | The wayland code was written more than 4 years ago when wayland wasn't even at version 1.0. This commit rewrites everything in a more modern way, switches to using the new xdg v6 shell interface which solves a lot of bugs and makes mpv tiling-friedly, adds support for drag and drop, adds support for touchscreens, adds support for KDE's server decorations protocol, and finally adds support for the new idle-inhibitor protocol. It does not yet use the frame callback as a main rendering loop driver, this will happen with a later commit.
* vo_wayland: removeRostislav Pehlivanov2017-10-036-1059/+0
| | | | | This VO was buggy and never worked correctly. Like with wayland_common, it needs to be rewritten from scratch.
* vo_gpu: gl: implement proper extension string searchwm42017-10-023-10/+23
| | | | | | | The existing code in check_ext() avoided false positive due to sub-strings, but allowed false negatives. Fix this with slightly better search code, and make it available as function to other source files. (There are some cases of strstr() still around.)
* vo_gpu: enable 3DLUTs in dumb modeNiklas Haas2017-09-301-1/+3
| | | | | | Unless FBOs are unsupported, this works. In particular, it's required to get ICC profiles working in voluntary dumb mode. So instead of blanket-disabling it, only disable it in the !have_fbo false case.
* vaapi: change license to LGPLwm42017-09-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | Originally mpv vaapi support was based on the MPlayer-vaapi patches. These were never merged in upstream MPlayer. The license headers indicated they were GPL-only. Although the actual author agreed to relicensing, the company employing him to write this code did not, so the original code is unusable to us. Fortunately, vaapi support was refactored and rewritten several times, meaning little code is actually left. The previous commits removed or moved that to GPL-only code. Namely, vo_vaapi.c remains GPL-only. The other code went away or became unnecessary mainly because libavcodec itself gained the ability to manage the hw decoder, and libavutil provides code to manage vaapi surfaces. We also changed to mainly using EGL interop, making any of the old rendering code unnecessary. hwdec_vaglx.c is still GPL. It's possibly relicensable, because much of it was changed, but I'm not too sure and further investigation would be required. Also, this has been disabled by default for a while now, so bothering with this is a waste of time. This commit simply disables it at compile time as well in LGPL mode.
* vaapi: move legacy code to vo_vaapi.cwm42017-09-291-4/+310
| | | | | | Done for license reasons. vo_vaapi.c is turned into some kind of dumpster fire, and we'll remove it as soon as I'm mentally ready for unkind users to complain about removal of this old POS.
* vo_gpu: vulkan: reword commentNiklas Haas2017-09-291-3/+4
| | | | | This is fixed upstream (and we now know it's a driver bug) so reword the comment.
* vo_gpu: force layout std430 for PCsNiklas Haas2017-09-291-1/+1
| | | | | | | | Seems to be fixed upstream in the nvidia driver, so it's probably a good idea to 1. force the layout and 2. remove the warning, as it now actually works. Users with older drivers would run into errors, but they can still use shaderc as a replacement. (And it's not like the old status quo was any better)
* vo_gpu: fix --opengl-gamma redirectNiklas Haas2017-09-281-1/+1
| | | | | It still pointed at --gpu-gamma, but we decided on --gamma-factor instead.
* vo_gpu: set the correct number of vertex attribsNiklas Haas2017-09-281-2/+2
| | | | | | | This was always set to the length of the VAO, but it should have been set to the number of vertex attribs actually in use for this frame. No idea how that managed to survive the test framework on nvidia/linux, but ANGLE caught it.
* vo_gpu: vulkan: add support for WindowsJames Ross-Gowan2017-09-283-0/+112
|
* vo_gpu: make the vertex attribs dynamicNiklas Haas2017-09-286-100/+102
| | | | | | | | | | | | | | | | This has several advantages: 1. no more redundant texcoords when we don't need them 2. no more arbitrary limit on how many textures we can bind 3. (that extends to user shaders as well) 4. no more arbitrary limits on tscale radius To realize this, the VAO was moved from a hacky stateful approach (gl_sc_set_vertex_attribs) - which always bothered me since it was required for compute shaders as well even though they ignored it - to be a proper parameter of gl_sc_dispatch_draw, and internally plumbed into gl_sc_generate, which will make a (properly mangled) deep copy into params.vertex_attribs.
* vo_gpu: kill some static arraysNiklas Haas2017-09-282-83/+69
| | | | | This gets rid of the hard-coded limits on the number of hooks, textures and hook points.
* vo_gpu: vulkan: indent queue family enumerationNiklas Haas2017-09-271-1/+1
| | | | Consistency
* vo_gpu: vulkan: normalize use of *Flags and *FlagBitsNiklas Haas2017-09-276-33/+31
| | | | | | | | | | | | FlagBits is just the name of the enum. The actual data type representing a combination of these flags follows the *Flags convention. (The relevant difference is that the latter is defined to be uint32_t instead of left implicit) For consistency, use *Flags everywhere instead of randomly switching between *Flags and *FlagBits. Also fix a wrong type name on `stageFlags`, pointed out by @atomnuker
* vo_gpu: vulkan: optimize redundant pipeline barriersNiklas Haas2017-09-261-5/+15
| | | | | | | | | | | | | | | Using renderpass layout transitions is more optimal and doesn't require a redundant pipeline barrier. Since our render passes are static and don't change throughout the lifetime of a ra_renderpass, we unfortunately don't have much flexibility here - so just hard-code SHADER_READ_ONLY_OPTIMAL as the output format as this will be the most common case. We also can't short-circuit the transition when we need to preserve the framebuffer contents, since that depends on the current layout; so we still use an explicit tex_barrier in this case. (Most optimal for this scenario would be an input attachment anyway)
* video: remove old videotoolbox supportwm42017-09-262-8/+0
| | | | | Like as in previous commits, you need a very recent FFmpeg (probably git master).
* video: drop old D3D11/DXVA2 supportwm42017-09-261-1/+0
| | | | | | | | | Now you need FFmpeg git, or something. This also gets rid of the last real use of gpu_memcpy(). libavutil does that itself. (vaapi.c still used it, but it was essentially unused, because the code path isn't really in use anymore. It wasn't even included due to the d3d-hwaccel dependency in wscript.)
* vo_gpu: fix memleak in spirv.cNiklas Haas2017-09-261-1/+1
|
* vo_gpu: explicitly label storage image formatsNiklas Haas2017-09-261-1/+22
| | | | | | | | | | | | This is apparently required to get storage images working on windows/vulkan, and probably good practice either way. Not entirely sure if it's the best idea to be always storing the value as 32-bit float, but it should hardly matter in practice (since we're only writing one sample per thread). (Leaving them implicit requires the shaderStorageImageWriteWithoutFormat feature to be enabled, which the windows nvidia vulkan driver doesn't support, at least not for a GTX 670)
* vo_gpu: attempt to avoid UBOs for dynamic variablesNiklas Haas2017-09-264-2/+32
| | | | | | | | | This makes the radeon driver shut up about frequently updating STATIC_DRAW UBOs (--opengl-debug), and also reduces the amount of synchronization necessary for vulkan uniform buffers. Also add some extra debugging/tracing code paths. I went with a flags-based approach in case we ever want to extend this.
* vo_gpu: vulkan: add support for push constantsNiklas Haas2017-09-263-25/+112
| | | | Can in theory avoid updating the uniform buffer every frame
* vo_gpu: vulkan: add support for waylandRostislav Pehlivanov2017-09-266-9/+168
|
* vo_gpu: vulkan: generalize SPIR-V compilerNiklas Haas2017-09-2611-94/+544
| | | | | | | | | | | | | | In addition to the built-in nvidia compiler, we now also support a backend based on libshaderc. shaderc is sort of like glslang except it has a C API and is available as a dynamic library. The generated SPIR-V is now cached alongside the VkPipeline in the cached_program. We use a special cache header to ensure validity of this cache before passing it blindly to the vulkan implementation, since passing invalid SPIR-V can cause all sorts of nasty things. It's also designed to self-invalidate if the compiler gets better, by offering a catch-all `int compiler_version` that implementations can use as a cache invalidation marker.
* vo_gpu: vulkan: initial implementationNiklas Haas2017-09-2615-10/+3727
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This time based on ra/vo_gpu. 2017 is the year of the vulkan desktop! Current problems / limitations / improvement opportunities: 1. The swapchain/flipping code violates the vulkan spec, by assuming that the presentation queue will be bounded (in cases where rendering is significantly