summaryrefslogtreecommitdiffstats
path: root/video
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* build: switch preliminary LGPL mode from v3 to v2.1wm42017-10-051-9/+1
| | | | | | | | | | | iive agreed to relicense things that are still in mpv to LGPLv2.1. So change the licenses of the affected files, and rename the configure switch for LGPL mode to --enable-preliminary-lgpl2. (The "preliminary" part will probably be removed from the configure switch soon as well.) Also player/main.c hasn't had GPL parts since a few commits ago.
* 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.
* vf_vavpp: restrict allowed sw upload formats to nv12/yuv420pwm42017-09-301-20/+3
| | | | | | | | | | | | | | | | | | | | We allowed any input format that was generally supported by libva, but this is probably nonsense, as the actual surface format was always fixed to nv12. We would have to check whether libva can upload a given pixel format to a nv12 surface. Or we would have to use a separate frame pool for input surfaces with the exact sw_format - but then we'd also need to check whether the vaapi VideoProc supports the surface type. Hardcode nv12 and yuv420p as input formats, which we know can be uploaded to nv12 surfaces. In theory we could get a list of supported upload formats from libavutil, but that also require allocating a dummy hw frames context just for the query. Add a comment to the upload code why we can allocate an output surface for input. In the long run, we'll probably want to use libavfilter's vaapi deinterlacer, but for now this would break at least user options.
* vaapi: replace error macro implementationwm42017-09-302-12/+3
| | | | | | | | | | The current check_va_status() function could probably be argued to be derived from the original VAAPI's patch check_status() function, thus GPL-only. While I have my doubts that it applies to an idiom on this level, it's better to replace it. Similar idea, different expression equals no copyright association. An earlier commit message promised this, but it was forgotten.
* video: fix green shitwm42017-09-301-1/+1
|
* vaapi: change license to LGPLwm42017-09-293-15/+15
| | | | | | | | | | | | | | | | | | | | | | 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-293-440/+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.
* vf_vavpp: use error checking macrowm42017-09-291-19/+11
|
* vf_vavpp: use libavutil hw frames API for frame pool and uploadwm42017-09-295-49/+119
| | | | | Another step to get rid of the legacy crap in vaapi.c. (Most is still kept, because it's in use by vo_vaapi.c.)
* vaapi: use newer libavutil vaapi pixfmt namewm42017-09-291-1/+1
| | | | | AV_PIX_FMT_VAAPI_VLD is clearly deprecated - it just doesn't raise any compiler warnings.
* vaapi: minor changeswm42017-09-291-7/+7
| | | | | | | | | | | | This is for relicensing. Some of this code is loosely based on vo_vaapi.c from the original MPlayer-vaapi patches. Most of the code has changed, and only the initialization code and check_status() look remotely similar. The initialization code is changed to be like Libav's (hwcontext_vaapi.c). check_va_status() is just a C idiom, but to play it safe, we'll either drop it from LGPL code (or recreate it). vaapi.c still contains plenty of code from the original patches, but the next commits will move them out of the LGPL code paths.
* 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)
* vd_lavc: cuda requires setting hw_device_ctxwm42017-09-261-1/+1
| | | | | | This restores cuda/cuvid under Windows. Cuvid is relatively useless under Windows, but this was requested.
* video: remove old videotoolbox supportwm42017-09-266-277/+1
| | | | | Like as in previous commits, you need a very recent FFmpeg (probably git master).
* video: drop old D3D11/DXVA2 supportwm42017-09-2611-1644/+9
| | | | | | | | | 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.)
* video: drop old cuda/cuvid hwaccelwm42017-09-263-122/+1
| | | | Just use FFmpeg 3.3 (or whatever it was) to get Cuvid support.
* 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 faster than vsync). But apparently, there's simply no better way to do this right now, to the point where even the stupid cube.c examples from LunarG etc. do it wrong. (cf. https://github.com/KhronosGroup/Vulkan-Docs/issues/370) 2. The memory allocator could be improved. (This is a universal constant) 3. Could explore using push descriptors instead of descriptor sets, especially since we expect to switch descriptors semi-often for some passes (like interpolation). Probably won't make a difference, but the synchronization overhead might be a factor. Who knows. 4. Parallelism across frames / async transfer is not well-defined, we either need to use a better semaphore / command buffer strategy or a resource pooling layer to safely handle cross-frame parallelism. (That said, I gave resource pooling a try and was not happy with the result at all - so I'm still exploring the semaphore strategy) 5. We aggressively use pipeline barriers where events would offer a much more fine-grained synchronization mechanism. As a result of this, we might be suffering from GPU bubbles due to too-short dependencies on objects. (That said, I'm also exploring the use of semaphores as a an ordering tactic which would allow cross-frame time slicing in theory) Some minor changes to the vo_gpu and infrastructure, but nothing consequential. NOTE: For safety, all use of asynchronous commands / multiple command pools is currently disabled completely. There are some left-over relics of this in the code (e.g. the distinction between dev_poll and pool_poll), but that is kept in place mostly because this will be re-extended in the future (vulkan rev 2). The queue count is also currently capped to 1, because of the lack of cross-frame semaphores means we need the implicit synchronization from the same-queue semantics to guarantee a correct result.
* vo_opengl_cb: fix deprecated option usageNiklas Haas2017-09-261-1/+1
| | | | opengl-debug was renamed to gpu-debug
* vo_gpu: fix possible segfault on shader miscompileNiklas Haas2017-09-231-5/+6
| | | | | Iterations after the first time will fail to realize that the pass was never created. This function's logic and control flow is so annoying...
* vo_gpu: angle: fix misleading struct nameJames Ross-Gowan2017-09-231-2/+2
| | | | This should have been renamed when it stopped being empty.
* vo_gpu: handle texture initialization errors gracefullyNiklas Haas2017-09-233-19/+27
| | | | | | | | | | Tested by making the ra_tex_resize function always fail (apart from the initial FBO check). This required a few changes: 1. reset shaders on failed dispatch 2. reset cleanup binds on failed dispatch 3. fall back to initializing the struct image to 1x1 on failure 4. handle output_fbo_valid gracefully
* vo_gpu: reduce the --alpha=blend-tiles checkerboard intensityNiklas Haas2017-09-221-1/+1
| | | | | | | | This was sort of grating by default and made it really hard to actually read e.g. text on top of a transparent background. I decided to approach the problem from both directions, making the whites darker and the grays lighter. This brings it closer to the dynamic range of e.g. the wikipedia transparent svg preview.
* vo_gpu: simplify compute shader coordinate calculationNiklas Haas2017-09-221-5/+2
| | | | Since the removal of FBOTEX_FUZZY, this can be made slightly simpler.
* vo_gpu: simplify structs / namesNiklas Haas2017-09-2212-377/+331
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Due to the plethora of historical baggage from different eras getting confusing, I decided to simplify and unify the struct organization and naming scheme. Structs that got renamed: 1. fbodst -> ra_fbo (and moved to gpu/context.h) 2. fbotex -> removed (redundant after 2af2fa7a) 3. fbosurface -> surface 4. img_tex -> image In addition to these structs being renamed, all of the names have been made consistent. The new scheme is as follows: struct image img; struct ra_tex *tex; struct ra_fbo fbo; This also affects derived names, e.g. indirect_fbo -> indirect_tex. Notably also, finish_pass_fbo -> finish_pass_tex and finish_pass_direct -> finish_pass_fbo. The new equivalent of fbotex_change() is called ra_tex_resize(). This commit (should) contain no logic changes, just renaming a bunch of crap.
* vo_gpu: kill off FBOTEX_FUZZYNiklas Haas2017-09-223-35/+18
| | | | | | | | | | I've observed the garbage pixels in more scenarios. They also were never really needed to begin with, originally being a discovered work-around for bug that we fixed since then anyway. Doesn't really seem to even help resizing, since the OpenGL drivers are all smart enough to pool resources internally anyway. Fixes #1814
* Revert "cocoa: re-enable double buffering"James Ross-Gowan2017-09-222-3/+3
| | | | | | | | Enabling double buffering fixed some graphical glitches when entering fullscreen, but it also caused a fullscreen performance regression. We decided that the glitches were preferable to the performance regression. This reverts commit cee764849e4fe22b00fb3f31838a63906e2e0d54.
* vo_gpu: override ra_swapchain_fns for the d3d11 surfaceJames Ross-Gowan2017-09-221-89/+112
| | | | | ANGLE can take advantage of some of these when using the external swapchain-backed surface.
* vo_gpu: opengl: fix possible screenshot window crashNiklas Haas2017-09-221-1/+1
| | | | | | gl_read_fbo_contents can fail Fixes #4905
* vo_opengl_cb: fix segfault on uninitNiklas Haas2017-09-221-1/+3
| | | | | | | | | The code used ra_ctx_destroy even though ra_ctx_create was never called (since it's just a dummy ctx), which led to a conflict of assumptions. The proper fix is to only use ra_gl_ctx_uninit (mirroring the ra_gl_ctx_init) and free the dummy ctx manually. Fixes https://github.com/cmdrkotori/mpc-qt/issues/129
* options: properly handle deprecated options with CLI actionswm42017-09-221-1/+1
| | | | | | | | We want e.g. --opengl-shaders-append=foo to resolve to the new option, all while printing an option name. --opengl-shader is a similar case. These options are special, because they apply "actions" on actual options by specifying a suffix. So the alias/deprecation handling has to be part of resolving the actual option from prefix and suffix.
* vo_gpu: fix autoprobing messagewm42017-09-221-2/+4
|
* build: make vo_gpu + infrastructure non-optionalwm42017-09-221-2/+0
| | | | | Also readd the the error message for when no GL backends are found (why was this removed?).
* vd_lavc: revert accidental vaapi changes revertwm42017-09-221-7/+5
| | | | | | | Commit bfa9b628589068 accidentally reverted these (because my editor did not reload the file correctly). Fixes #4904.
* vo_opengl_cb: hwdec_ios: fix buildAman Gupta2017-09-221-3/+5
| | | | | | | | | | | | | | [179/188] Compiling video/out/vo_lavc.c ../../video/out/opengl/hwdec_ios.m:135:9: warning: unused variable 'gl' [-Wunused-variable] GL *gl = ra_gl_get(mapper->ra); ^ ../../video/out/opengl/hwdec_ios.m:247:48: warning: incompatible pointer to integer conversion passing 'CVOpenGLESTextureRef' (aka 'struct __CVBuffer *') to parameter of type 'GLuint' (aka 'unsigned int') [-Wint-conversion] p->gl_planes[i]); ^~~~~~~~~~~~~~~ ../../video/out/opengl/ra_gl.h:9:45: note: passing argument to parameter 'gl_texture' here GLuint gl_texture); ^ 2 warnings generated.
* vo_gpu: fix vo=opengl legacy aliasNiklas Haas2017-09-211-2/+4
| | | | | | | Turns out the option code apparently tries to directly talloc_free() the allocated strings, instead of going through a tactx wrapper or something. So we can't directly overwrite it. Do something else instead..
* vo_gpu: fix memleak in ra_gl_ctxNiklas Haas2017-09-211-2/+5
| | | | | | The ctx->ra was never freed propely, nor was p->wrapped_fb. (TIL: MPV_LEAK_REPORT exists)
* vo_gpu: drop the RA_CAP_NESTED_ARRAY req from EWA computeNiklas Haas2017-09-212-26/+24
| | | | | | | | | | Almost as fast as the old code, but more general. Notably, glslang doesn't support nested arrays. (cf. https://github.com/KhronosGroup/glslang/issues/1057) Also much cleaner code-wise, so I think I'll keep it even if glslang implements array_of_arrays.
* wayland: allow vo_wayland_uninit(NULL)Niklas Haas2017-09-211-0/+3
|
* vo_gpu: fix possible segfault in shader_cache.cNiklas Haas2017-09-211