summaryrefslogtreecommitdiffstats
path: root/video/out
Commit message (Collapse)AuthorAgeFilesLines
* 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 out of a dusty pile of devices and cables, so, later.)
* vo_opengl: hwdec_cuda: fix filtering modewm42017-08-091-1/+1
| | | | Probably explains quality issues in some cases.
* vo_opengl: shrink the hwdec overlay APIwm42017-08-093-25/+20
| | | | | Just remove one callback, and fold the functionality into the other one. RPI will still not compile, so the hwdec_rpi.c changes are untested.
* vo_opengl: add a hack for Apple's broken iOS hwdec stuffwm42017-08-082-1/+11
| | | | | As seen in hwdec_ios.m, it insists on using the legacy luminance alpha formats for mapped textures.
* vo_opengl: go back to using GL_TIME_ELAPSEDNiklas Haas2017-08-082-16/+26
| | | | | | | | Less flexible than GL_TIMESTAMP but supported by more platforms. This will mean that nested queries have to be detected and silently omitted, but oh well. Not much use for them anyway. Fixes #4721.
* vo_opengl: don't call glGetProgramBinary if GL_PROGRAM_BINARY_LENGTH==0wm42017-08-081-2/+4
| | | | Noticed in #4717, although the issue might be about something else.
* x11: drop xscrnsaver usewm42017-08-081-16/+0
| | | | | | | | | | | It's an ancient X11 protocol extension that apparently nobody uses anymore (desktop environments in particular have replaced it with equally bad protocols that require tons of dependencies). Users keep complaining about it being a required dependency. The impact is likely minimal to none. Fixes #4706 and other annoying people.
* vo_opengl: cosmetics to commentswm42017-08-081-5/+3
|
* vo_opengl: call ra_free() in the correct contextwm42017-08-072-1/+1
| | | | This also fixes a double free in vo_opengl_cb.c.
* client API: more opengl_cb clarificationswm42017-08-071-1/+1
| | | | Also fix a typo in ra_gl.c. Too greedy for a separate commit.
* vo_opengl: add another ra_format field to exclude insane formatswm42017-08-073-2/+6
| | | | | | Generic description of pixel formats is hard. In this case, the Apple special format for packed YUV could have been interpreted as a RGB format with funny packing.
* vo_opengl: further GL API use separationwm42017-08-0712-122/+160
| | | | | | | | | | | | | | | Move multiple GL-specific things from the renderer to other places like vo_opengl.c, vo_opengl_cb.c, and ra_gl.c. The vp_w/vp_h parameters to gl_video_resize() make no sense anymore, and are implicitly part of struct fbodst. Checking the main framebuffer depth is moved to vo_opengl.c. For vo_opengl_cb.c it always assumes 8. The API user now has to override this manually. The previous heuristic didn't make much sense anyway. The only remaining dependency on GL is the hwdec stuff, which is harder to change.
* vo_opengl: fix minor memory leakwm42017-08-071-1/+4
| | | | Don't leak the buffer if glGetProgramBinary() fails.
* vo_opengl: nuke ra_gl->first_runNiklas Haas2017-08-072-7/+12
| | | | | | Completely unnecessary, we can just update the uniforms immediately after creating the program. In theory, for GLSL 4.20+, we could even skip this, but oh well.
* vo_opengl: better formatting for enum RA_CAPNiklas Haas2017-08-071-7/+7
| | | | | Also fixes an issue where 1 << 5 was used twice, probably because of the terrible formatting obscuring this bug
* vo_opengl: also support RA_VARTYPE_INT vertex attribsNiklas Haas2017-08-071-0/+3
| | | | No reason not to.
* vo_opengl: simplify mirroring and fix it if glBlitFramebuffer is usedwm42017-08-077-65/+76
| | | | | | | | | | | | | | | | | | The vp_w/vp_h variables and parameters were not really used anymore (they were redundant with ra_tex w/h) - but vp_h was still used to identify whether rendering should be done mirrored. Simplify this by adding a fbodst struct (some bad naming), which contains the render target texture, and some parameters how it should be rendered to (for now only flipping). It would not be appropriate to make this a member of ra_tex, so it's a separate struct. Introduces a weird regression for the first frame rendered after interpolation is toggled at runtime, but seems to work otherwise. This is possibly due to the change that blit() now mirrors, instead of just copying. (This is also why ra_fns.blit is changed.) Fixes #4719.
* vo_opengl: drop pointless fbotex_init() functionwm42017-08-073-13/+2
|
* vo_opengl: generalize ra_buf to support other buffer objectsNiklas Haas2017-08-077-111/+182
| | | | | This allows us to integrate PBOs and SSBOs into the same abstraction, with the potential to easily add UBOs if the need arises.
* cocoa: add an option to disable the native macOS fullscreenAkemi2017-08-063-10/+39
| | | | Fixes #4014
* vo_opengl: only mark frames as fresh if they contain a new imageNiklas Haas2017-08-061-1/+1
| | | | | | | When using dumb mode, we can actually redraw a frame without uploading it. Marking this as fresh as well results in unpredictable pass behavior, which is confusing and makes debugging harder. So mark it as a redraw instead, in that case.
* vo_opengl: drop ra_gl.h from shader_cache.cNiklas Haas2017-08-066-25/+23
| | | | | | Since the GL *gl is no longer needed for the timers, we can get rid of the sc->gl dependency. This requires moving a utility function (which is not GL-specific anyway) out of gl_utils.h and into utils.h
* vo_opengl: measure pass_draw_osd as a wholeNiklas Haas2017-08-061-1/+8
| | | | | | | | | | | | | | In the past, this always measured the per-shader execution times of the individual OSD parts, which was thrown off because the shader was reused anyway. (And apparently recording the OSD shader execution times was removed completely, probably because of them being so unrealiably anyway) Since ra_timer no longer has the restriction of not allowing timers to run concurrently, we can just wrap the entire OSD block inside a single osd_timer now, and record that. (Technically, this can still be off when using --blend-subtitles=video/yes and showing a full-screen OSD at the same time. Maybe this can be done better?)
* vo_opengl: move timers to struct raNiklas Haas2017-08-069-168/+247
| | | | | | | In order to prevent code duplication and keep the ra abstraction as small as possible, `ra` only implements the actual timer queries, it does not do pooling/averaging of the results. This is instead moved to a ra-neutral struct timer_pool in utils.c.
* vo_opengl: ra_gl: make getting GL ptr slightly less tediouswm42017-08-051-35/+20
|
* vo_opengl: move GL state resetting to vo_opengl_cbwm42017-08-053-23/+13
| | | | | | | | | This code is pretty much for the sake of vo_opengl_cb API users. It resets certain state that either the user or our code doesn't reset correctly. This is somewhat outdated. With GL implicit state being so awfully large, it seems more reasonable require that any code restores the default state when returning to the caller. Some exceptions are defined in opengl_cb.h.
* vo_opengl: move shader handling to rawm42017-08-0511-617/+1016
| | | | | | | | | | | | | Now all GL-specifics of shader compilation are abstracted through ra. Of course we still have everything hardcoded to GLSL - that isn't going to change. Some things will probably change later - in particular, the way we pass uniforms and textures to the shader. Currently, there is a confusing mismatch between "primitive" uniforms like floats, and others like textures. Also, SSBOs are not abstracted yet.
* vo_opengl: organize ra PBO flag slightly differentlywm42017-08-055-19/+8
| | | | | | | | Instead of having a mutable ra_tex field (and the only one), move the flag to struct ra, since we have only 2 tex_upload user calls anyway, and both want the same PBO behavior. (At first I considered making it a RA_TEX_UPLOAD_ flag, but why bother. PBOs are a terribly GL-specific thing, so we can't expect a reasonable abstraction of it anyway.)
* vo_opengl: make OSD code use ra for textureswm42017-08-055-44/+78
| | | | | | | | | <