summaryrefslogtreecommitdiffstats
path: root/video/out
Commit message (Collapse)AuthorAgeFilesLines
* vo_opengl: fix out-of-bounds read in update_uniformNiklas Haas2017-09-111-2/+1
| | | | | | | | | | Since the addition of UBOs, the assumption that the uniform index corresponds to the pass->params.inputs index is no longer true. Also, there's no reason it would even need this - since the `input` is also available directly in sc_uniform. I have no idea how I've been using this code for as long as I have without any segfaults until earlier today.
* vo_opengl: refactor/fix mp_pass_perf codeNiklas Haas2017-09-113-21/+17
| | | | | | | | | | | | | This was needlessly complicated and prone to breakage, because even the references to the ring buffer could end up getting invalidated and containing garbage data on e.g. shader cache flush. For much the same reason why we can't keep around the *timer_pool, we're also forced to hard-copy the entire sample buffer per pass per frame. Not a huge deal, though. This is, what, a few kB per frame? We have more pressing CPU performance concerns anyway. Also simplified/fixed some other code.
* vo_opengl: add a gamut warning featureNiklas Haas2017-09-104-4/+12
| | | | | | | | This clearly highlights all out-of-gamut/clipped pixels. (Either too bright or too saturated) Has some (documented) caveats. Also make TONE_MAPPING_CLIP stop actually clamping the value range (it's unnecessary and breaks this feature).
* vo_opengl: add support for vulkan GLSL dialectNiklas Haas2017-09-044-12/+31
| | | | | | | | | | Redefining texture1D / texture3D seems to be illegal, they are already built-in macros or something. So just use tex1D and tex3D instead. Additionally, GL_KHR_vulkan_glsl requires using explicit vertex locations and bindings, so make some changes to facilitate this. (It also requires explicitly setting location=0 for the color attachment output)
* vo_opengl: use rgba16 for 3DLUTs instead of rgb16Niklas Haas2017-09-042-6/+6
| | | | | | | Vulkan compat. rgb16 doesn't exist on hardware anyway, might as well just generate the 3DLUT against rgba16 as well. We've decided this is the simplest way to do vulkan compatibility: just make sure we never actually need 3-component textures.
* vo_opengl: refactor scaler LUT weight packing/loadingNiklas Haas2017-09-044-36/+24
| | | | | | | | This is mostly done so we can support using textures with more components than the scaler LUTs have entries. But while we're at it, also change the way the weights are packed so that they're always sequential with no gaps. This allows us to simplify pass_sample_separated_get_weights as well.
* vo_opengl: scale deband-grain to the signal rangeNiklas Haas2017-09-033-4/+8
| | | | | This prevents blowing up for high dynamic range sources, where a noise level of 48 can suddenly mean 4800.
* filter_kernels: correct spline64 kernelJames Ross-Gowan2017-09-031-4/+4
| | | | | | This seems to have had some copy/paste errors. It should now match the implementation in fmtconv: https://github.com/EleonoreMizo/fmtconv/blob/00453a86dd73/src/fmtcl/ContFirSpline64.cpp#L58-L76
* input: merge mouse wheel and axis keycodesJames Ross-Gowan2017-09-038-19/+19
| | | | | | | | | | | | | | | | | | | | | | Mouse wheel bindings have always been a cause of user confusion. Previously, on Wayland and macOS, precise touchpads would generate AXIS keycodes and notched mouse wheels would generate mouse button keycodes. On Windows, both types of device would generate AXIS keycodes and on X11, both types of device would generate mouse button keycodes. This made it pretty difficult for users to modify their mouse-wheel bindings, since it differed between platforms and in some cases, between devices. To make it more confusing, the keycodes used on Windows were changed in 18a45a42d524 without a deprecation period or adequate communication to users. This change aims to make mouse wheel binds less confusing. Both the mouse button and AXIS keycodes are now deprecated aliases of the new WHEEL keycodes. This will technically break input configs on Wayland and macOS that assign different commands to precise and non-precise scroll events, but this is probably uncommon (if anyone does it at all) and I think it's a fair tradeoff for finally fixing mouse wheel-related confusion on other platforms.
* cocoa: fix button numbering for back/forwardJames Ross-Gowan2017-09-031-4/+7
| | | | | | It seems like the Cocoa backend used to return the same mpv keycodes for mouse back/forward as it did for scrolling up and down. Fix this by explicitly mapping all Cocoa button numbers to the right mpv keycodes.
* input: use mnemonic names for mouse buttonsJames Ross-Gowan2017-09-036-26/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | mpv's mouse button numbering is based on X11 button numbering, which allows for an arbitrary number of buttons and includes mouse wheel input as buttons 3-6. This button numbering was used throughout the codebase and exposed in input.conf, and it was difficult to remember which physical button each number actually referred to and which referred to the scroll wheel. In practice, PC mice only have between two and five buttons and one or two scroll wheel axes, which are more or less in the same location and have more or less the same function. This allows us to use names to refer to the buttons instead of numbers, which makes input.conf syntax a lot easier to remember. It also makes the syntax robust to changes in mpv's underlying numbering. The old MOUSE_BTNx names are still understood as deprecated aliases of the named buttons. This changes both the input.conf syntax and the MP_MOUSE_BTNx symbols in the codebase, since I think both would benefit from using names over numbers, especially since some platforms don't use X11 button numbering and handle different mouse buttons in different windowing system events. This also makes the names shorter, since otherwise they would be pretty long, and it removes the high-numbered MOUSE_BTNx_DBL names, since they weren't used. Names are the same as used in Qt: https://doc.qt.io/qt-5/qt.html#MouseButton-enum
* vo_opengl: fix overlay mode (again)wm42017-08-301-7/+8
| | | | Did I mention yet that I regret this overlay mode thing?
* vo_opengl: don't discard buffered video on redundant resize callswm42017-08-291-0/+5
| | | | | | | | | | If a VO-area option changes, gl_video_resize() is called unconditionally. This function does something even if the size does not change (at least it discards buffered frames for interpolation), which can lead to stutter when you keep firing option change events during playback. Check for an actual resize, and if nothing changes, exit early.
* vo_opengl: don't assume imgfmt=0 is validwm42017-08-291-1/+1
| | | | | | Could cause a crash if anything called ra_get_imgfmt_desc(imgfmt=0). Let it fail correctly. This can happen if a hwdec backend does not set hw_subfmt correctly.
* vo_opengl: fix the renderpass target format at creation timeNiklas Haas2017-08-273-4/+19
| | | | Required for vulkan.
* vo_opengl: fix misleading comment in ra.hNiklas Haas2017-08-271-6/+6
| | | | tex_upload is not just for buffers
* vo_opengl: use UBOs where supported/requiredNiklas Haas2017-08-274-14/+167
| | | | | | | | | | | | This also introduces RA_CAP_GLOBAL_UNIFORM. If this is not set, UBOs *must* be used for non-bindings. Currently the cap is ignored though, and the shader_cache *always* generates UBO-using code where it can. Could be made an option in principle. Only enabled for drivers new enough to support explicit UBO offsets, just in case... No change to performance, which is probably what we expect.
* vo_opengl: add support for UBOsNiklas Haas2017-08-275-11/+33
| | | | | Not actually used by anything yet, but straightforward enough to add to the RA API for starters.
* vo_opengl: clarify RA_CAP_DIRECT_UPLOADNiklas Haas2017-08-271-1/+2
| | | | | | This no longer concerns the API user except in as much as the API user probably wants to know whether or not PBOs are active, so keep around the CAP field even though it's mostly useless now.
* vo_opengl: refactor shader_cache bindingNiklas Haas2017-08-273-22/+40
| | | | | There's no reason to be needlessly wasteful with our binding points here. Just add a CAP for it.
* vo_opengl: be explicit about IMG_RWNiklas Haas2017-08-273-8/+13
| | | | | | | | | | | | Both vulkan and opengl distinguish between rendering to an image and using an image as a storage attachment. So make this an explicit capability instead of lumping it in with render_dst. (That way we could support, for example, using an image as a storage attachment without requiring a framebuffer) The real reason for this change is that you can directly use the output FBO as a storage attachment on vulkan but you can't on opengl, which makes this param structly separate from render_dst.
* vo_opengl: use size_t offset for vertex offsetsNiklas Haas2017-08-272-1/+2
| | | | | | | | I don't like the feeling of "reusing" the int binding for this. It feels... wrong, somehow. I'd prefer to use an explicit "offset" field. (Plus, I might re-use this for uniform buffers or something) YMMV
* vo_opengl: allow selection of true 32 bit float if float16 unavailablewm42017-08-241-13/+9
| | | | | Shouldn't make a difference for OpenGL (even with the weird duplication of these functions removed). Might be useful for the WIP vulkan backend.
* vo_direct3d: fix buildwm42017-08-221-5/+0
| | | | Broken by previous commit. Fix completely untested.
* video: redo video equalizer option handlingwm42017-08-2211-312/+27
| | | | | | | | | | | | | | | | | | | | | | | I really wouldn't care much about this, but some parts of the core code are under HAVE_GPL, so there's some need to get rid of it. Simply turn the video equalizer from its current fine-grained handling with vf/vo fallbacks into global options. This makes updating them much simpler. This removes any possibility of applying video equalizers in filters, which affects vf_scale, and the previously removed vf_eq. Not a big loss, since the preferred VOs have this builtin. Remove video equalizer handling from vo_direct3d, vo_sdl, vo_vaapi, and vo_xv. I'm not going to waste my time on these legacy VOs. vo.eq_opts_cache exists _only_ to send a VOCTRL_SET_EQUALIZER, which exists _only_ to trigger a redraw. This seems silly, but for now I feel like this is less of a pain. The rest of the equalizer using code is self-updating. See commit 96b906a51d5 for how some video equalizer code was GPL only. Some command line option names and ranges can probably be traced back to a GPL only committer, but we don't consider these copyrightable.
* options: add a thread-safe way to notify option updateswm42017-08-223-2/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | So far, we had a thread-safe way to read options, but no option update notification mechanism. Everything was funneled though the main thread's central mp_option_change_callback() function. For example, if the panscan options were changed, the function called vo_control() with VOCTRL_SET_PANSCAN to manually notify the VO thread of updates. This worked, but's pretty inconvenient. Most of these problems come from the fact that MPlayer was written as a single-threaded program. This commit works towards a more flexible mechanism. It adds an update callback to m_config_cache (the thing that is already used for thread-safe access of global options). This alone would still be rather inconvenient, at least in context of VOs. Add another mechanism on top of it that uses mp_dispatch_queue, and takes care of some annoying synchronization issues. We extend mp_dispatch_queue itself to make this easier and slightly more efficient. As a first application, use this to reimplement certain VO scaling and renderer options. The update_opts() function translates these to the "old" VOCTRLs, though. An annoyingly subtle issue is that m_config_cache's destructor now releases pending notifications, and must be released before the associated dispatch queue. Otherwise, it could happen that option updates during e.g. VO destruction queue or run stale entries, which is not expected. Rather untested. The singly-linked list code in dispatch.c is probably buggy, and I bet some aspects about synchronization are not entirely sane.
* vo_opengl: refactor tex_upload to ra_buf_poolNiklas Haas2017-08-227-84/+124
| | | | | | | | | | Also refactors the usage of tex_upload to make ra_tex_upload_pbo a RA-internal thing again. ra_buf_pool has the main advantage of being dynamically sized depending on buf_poll, so for OpenGL we'll end up only using one buffer (when not persistently mapping) - while for vulkan we'll use as many as necessary, which depends on the swapchain depth anyway.
* x11: fix that window could be resized when using embeddingwm42017-08-211-2/+5
| | | | | | | Somewhat lazy fix. The code isn't particularly robust or correct wrt. window embedding. Fixes #4784.
* Revert "x11: drop xscrnsaver use"Martin Herkt2017-08-201-0/+16
| | | | | | | | | | | | | | This broke screensaver/powersave inhibition with at least KDE and LXDE. This is a release blocker. Since fdo, KDE and GNOME idiots seem to be unable to reach a consensus on a simple protocol, this seems unlikely to get fixed upstream this year, so revert this change. Fixes #4752. Breaks #4706 but I don’t give a damn. This reverts commit 3f75b3c3439241c209349908fa190c0382e44f05.
* Revert "x11: use xdg-screensaver suspend/resume"Martin Herkt2017-08-202-65/+40
| | | | This reverts commit 6694048272619b7f91d161c040b818ff63e65279.
* context_angle: remove unused variableJames Ross-Gowan2017-08-201-2/+0
| | | | Unused since 16e0a3948288.
* context_angle: replace hard-coded array sizeJames Ross-Gowan2017-08-191-1/+1
|
* osx: code cleanups and cosmetic fixesAkemi2017-08-183-13/+5
| | | | silence build warnings, clean up code style and remove unused code.
* vo_opengl: allow texture uploads to failNiklas Haas2017-08-183-9/+8
| | | | Surprisingly makes the code shorter, not longer
* vo_opengl: clarify the ra_fns.debug_markerNiklas Haas2017-08-181-1/+2
|
* vo_opengl: refactor RA texture and buffer updatesNiklas Haas2017-08-1811-189/+221
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - tex_uploads args are moved to a struct - the ability to directly upload texture data without going through a buffer is made explicit - the concept of buffer updates and buffer polling is made more explicit and generalized to buf_update as well (not just mapped buffers) - the ability to call tex_upload/buf_update on a tex/buf is made explicit during tex/buf creation - uploading from buffers now uses an explicit offset instead of implicitly comparing *src against buf->data, because not all buffers may actually be persistently mapped - the initial_data = immutable requirement is dropped. (May be re-added later for D3D11 if that ever becomes a thing) This change helps the vulkan abstraction immensely and also helps move common code (like the PBO pooling) out of ra_gl and into the opengl/utils.c This also technically has the side-benefit / side-constraint of using PBOs for OSD texture uploads as well, which actually seems to help performance on machines where --opengl-pbo is faster than the naive code path. Because of this, I decided to hook up the OSD code to the opengl-pbo option as well. One drawback of this refactor is that the GL_STREAM_COPY hack for texture uploads "got lost", but I think I'm happy with that going away anyway since DR almost fully deprecates it, and it's not the "right thing" anyway - but instead an nvidia-only hack to make this stuff work somewhat better on NUMA systems with discrete GPUs. Another change is that due to the way fencing works with ra_buf (we get one fence per ra_buf per upload) we have to use multiple ra_bufs instead of offsets into a shared buffer. But for OpenGL this is probably better anyway. It's possible that in future, we could support having independent “buffer slices” (each with their own fence/sync object), but this would be an optimization more than anything. I also think that we could address the underlying problem (memory closeness) differently by making the ra_vk memory allocator smart enough to chunk together allocations under the hood.
* vo_opengl: make blitting an explicit capabilityNiklas Haas2017-08-183-6/+10
| | | | | | | | | Instead of merging it into render_dst. This is better for vulkan, because blitting in vulkan both does not require a FBO *and* requires a different image layout. Also less "hacky" for OpenGL, since now the weird blit=FBO requirement is an implementation detail of ra_gl
* vo_opengl: make ra_fns.timer_create optionalNiklas Haas2017-08-182-1/+4
|
* vo_opengl: remove redundant #defines in unsharp_hookNiklas Haas2017-08-171-3/+0
| | | | These are no longer valid anyway, and the code doesn't use them.
* vo_opengl: extract non-ANGLE specific D3D11 codeJames Ross-Gowan2017-08-173-232/+489
| | | | | | | | | | | | This extracts non-ANGLE specific code to d3d11_helpers.c, which is modeled after egl_helpers.c. Currently the only consumer is context_angle.c, but in future this may allow the D3D11 device and swapchain creation logic to be reused in other backends. Also includes small improvements to D3D11 device creation. It is now possible to create feature level 11_1 devices (though ANGLE does not support these,) and BGRA swapchains, which might be slightly more efficient than ARGB, since its the same format used by the compositor.
* x11: use xdg-screensaver suspend/resumewm42017-08-152-40/+65
| | | | | | If it doesn't work this time, I'll remove all X11 screensaver code. Fixes #4763.
* vo_rpi: fix operationwm42017-08-154-5/+17
| | | | Commit 697c4389a9e6 worked "almost". I couldn't test it at the time.
* vo_opengl: fix incorrect glBindFramebuffer() callwm42017-08-151-1/+1
| | | | Used the wrong binding.
* vo_opengl: fix dangling pointers when VAOs are not availablewm42017-08-152-4/+4
| | | | | | | | | | This is for legacy GL: if VAOs are not available, the helper has to specify vertex attributes again on every rendering. gl_vao_init() keeps the vertex array for this purpose. Unfortunately, a temporary argument was passed to the function, instead of the permanent copy. Also, it didn't use num_entries (instead expected the array being terminated by a {0} entry). Fix that source code indentation too.
* vo_opengl: support float pixel formatswm42017-08-151-6/+32
| | | | Like AV_PIX_FMT_GBRPF32LE.
* vo_opengl: remove DR image layouting code to rendererwm42017-08-143-26/+31
| | | | No reason to have it in a higher level.
* vo_opengl: hwdec_vdpau: use correct source texture sizewm42017-08-141-42/+45
| | | | | | | | | | | | | | | | In commit c6fafbffaca1 we accidentally set the logical texture size to the cropped video size, which is not correct. This caused rendering artifacts in some cases. Use the video surfaces size instead. Since the current mp_image_params contains the cropped size only, wrapper texture creation has to be moved to the _map function. Move the same code for the mixer case (strictly speaking this is not needed, but seems more symmetric). (Also there is no need to clear gl_textures on uninit - leftover from the old hwdec mapper API. So we just drop that part.) Fixes #4760.
* vo_opengl: hwdec_ios: fix buildwm42017-08-111-1/+1
|
* vo_opengl: remove some dead codewm42017-08-112-187/+0
| | | | | These were replaced by ra equivalents, and with the recent changes, all of them became fully unused.
* vo_opengl: handle probing GL texture formats betterwm42017-08-114-36/+46
| | | | | | | | | | | | | | | | | | Retrieve the depth for each component and internal texture format separately. Only for 8 bit per component textures we assume that all bits are used (or else we would in my opinion create too many probe textures). Assuming 8 bit components are always correct also fixes operation in GLES3, where we assumed that each component had -1 bits depth, and this all UNORM formats were considered unusable. On GLES, the function to check the real bit depth is not available. Since GLES has no 16 bit UNORM textures at all, except with the MPGL_CAP_EXT16 extension, just drop the special condition for it. (Of course GLES still manages to introduce a funny special case by allowing GL_LUMINANCE , but not defining GL_TEXTURE_LUMINANCE_SIZE.) Should fix #4749.
* vo_opengl: remove another unneeded GL includewm42017-08-112-1/+7
| | | | Getting mp_pass_perf seriously requires including vo.h???
* rpi: fix buildwm42017-08-116-59/+63
| | | | | | | | | | | Runtime untested, because I get this: [vo/rpi] Could not get DISPMANX objects. This happened even when building older git versions, and on a RPI image that hasn't changed in the recent years. I don't know how to make this POS work again, so I guess if there's a bug in the new code, it will remain broken.
* vo_opengl: move strictly private ra_gl structs to .c filewm42017-08-112-35/+35
| | | | So that nothing accidentally accesses these.
* vo_opengl: remove some indirect GL header inclusions from core rendererwm42017-08-106-7/+4
|
* vo_opengl: separate hwdec context and mapping, port it to use rawm42017-08-1019-1138/+1425
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This does two separate rather intrusive things: 1. Make the hwdec context (which does initialization, provides the device to the decoder, and other basic state) and frame mapping (getting textures from a mp_image) separate. This is more flexible, and you could map multiple images at once. It will help removing some hwdec special-casing from video.c. 2. Switch all hwdec API use to ra. Of course all code is still GL specific, but in theory it would be possible to support other backends. The most important change is that the hwdec interop returns ra objects, instead of anything GL specific. This removes the last dependency on GL-specific header files from video.c. I'm mixing these separate changes because both requires essentially rewriting all the glue code, so better do them at once. For the same reason, this change isn't done incrementally. hwdec_ios.m is untested, since I can't test it. Apart from superficial mistakes, this also requires dealing with Apple's texture format fuckups: they force you to use GL_LUMINANCE[_ALPHA] instead of GL_RED and GL_RG. We also need to report the correct format via ra_tex to the renderer, which is done by find_la_variant(). It's unknown whether this works correctly. hwdec_rpi.c as well as vo_rpi.c are still broken. (I need to pull my RPI o