summaryrefslogtreecommitdiffstats
path: root/libvo/vo_gl.c
Commit message (Collapse)AuthorAgeFilesLines
* VO: remove VO direct renderingwm42012-08-021-2/+0
| | | | | | | | | | | | | | | | | | | This was disabled by default, and could be enabled with -dr. It was disabled by default because it was buggy: there were issues with OSD corruption. It wasn't entirely sane for OpenGL based VOs either. OpenGL can chose to drop mapped pixel buffer objects, requiring the application to map and fill the buffer again. But there was no mechanism in mplayer to fill the lost buffer again. (It seems this rarely happened in practice, though.) On the other side, users liked the --dr flag, because it promised them more speed. I'm not sure if it actually helped with speed, but it's unlikely it had any real advantages on modern systems. In order to evade the --dr cargo culting in mplayer config files, it's best to get rid of it.
* osd: minor simplification of vo_osd_changed()wm42012-08-011-1/+1
| | | | | | | | | | | | | | | | | | vo_osd_changed() was a weird function: it was used both to query and mutate state, which is a bad combination. The VOs used it to query and reset the state, and the mplayer frontend mostly used it to set the state. In some cases, the frontend did both (that code used a variable "int hack" to backup the state and set it again). Simplify it and make the VOs use a vo_osd_has_changed() function to query whether the OSD bitmaps have to be recreated. vo_osd_changed() on the other hand is now used to update state only. The OSD change state is reset when osd_draw_text() is called. Update vo_corevideo.m to use vo_osd_resized() as well (forgotten change from libass-OSD merge). Simplify osd_set_text() and its usages.
* vo_gl, vo_gl3: honor global --vsync optionwm42012-07-301-1/+1
| | | | | | | | | Both VOs will now by default try to set vsync according to the global vsync setting. By default, vsync is enabled, and passing --no-vsync will disable it. The --vsync option used to matter for vo_vesa only, but that VO has been removed.
* osd: use libass for OSD renderingwm42012-07-281-8/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The OSD will now be rendered with libass. The old rendering code, which used freetype/fontconfig and did text layout manually, is disabled. To re-enable the old code, use the --disable-libass-osd configure switch. Some switches do nothing with the new code enabled, such as -subalign, -sub-bg-alpha, -sub-bg-color, and many more. (The reason is mostly that the code for rendering unstyled subtitles with libass doesn't make any attempts to support them. Some of them could be supported in theory.) Teletext rendering is not implemented in the new OSD rendering code. I don't have any teletext sources for testing, and since teletext is being phased out world-wide, the need for this is questionable. Note that rendering is extremely inefficient, mostly because the libass output is blended with the extremely strange mplayer OSD format. This could be improved at a later point. Remove most OSD rendering from vo_aa.c, because that was extremely hacky, can't be made work with osd_libass, and didn't work anyway in my tests. Internally, some cleanup is done. Subtitle and OSD related variable declarations were literally all over the place. Move them to sub.h and sub.c, which were hoarding most of these declarations already. Make the player core in mplayer.c free of concerns like bitmap font loading. The old OSD rendering code has been moved to osd_ft.c. The font_load.c and font_load_ft.c are only needed and compiled if the old OSD rendering code is configured.
* libvo, libao: remove useless video and audio output driverswm42012-07-281-8/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some of these have only limited use, and some of these have no use at all. Remove them. They make maintainance harder and nobody needs them. It's possible that many of the removed drivers were very useful a dozen of years ago, but now it's 2012. Note that some of these could be added back, in case they were more useful than I thought. But right now, they are just a burden. Reason for removal for each module: vo_3dfx, vo_dfbmga, vo_dxr3, vo_ivtv, vo_mga, vo_s3fb, vo_tdfxfb, vo_xmga, vo_tdfx_vid: All of these are for very specific and outdated hardware. Some of them require non-standard kernel drivers or do direct HW access. vo_dga: the most crappy and ancient way to get fast output on X. vo_aa: there's vo_caca for the same purpose. vo_ggi: this never lived, and is entirely useless. vo_mpegpes: for DVB cards, I can't test this and it's crappy. vo_fbdev, vo_fbdev2: there's vo_directfb2 vo_bl: what is this even? But it's neither important, nor alive. vo_svga, vo_vesa: you want to use this? You can't be serious. vo_wii: I can't test this, and who the hell uses this? vo_xvr100: some Sun thing. vo_xover: only useful in connection with xvr100. ao_nas: still alive, but I doubt it has any meaning today. ao_sun: Sun. ao_win32: use ao_dsound or ao_portaudio instead. ao_ivtv: removed along vo_ivtv. Also get rid of anything SDL related. SDL 1.x is total crap for video output, and will be replaced with SDL 2.x soon (perhaps), so if you want to use SDL, write output drivers for SDL 2.x. Additionally, I accidentally damaged Sun support, which made me completely remove Sun/Solaris support. Nobody cares about this anyway. Some left overs from previous commits removing modules were cleaned up.
* vo_gl: reject MS Windows native OpenGL as software rasterizerwm42012-04-241-1/+3
| | | | | | | | If the graphics driver doesn't provide its own OpenGL implementation, applications get Microsoft's OpenGL emulation. Even if it should be the case that it's not strictly a software renderer, it provides OpenGL 1.1 only, no shaders in any form, and has other limitations that make it almost completely useless for mplayer.
* vo_gl: refuse to use software renderer, unless explicitly requestedwm42012-04-241-15/+11
| | | | | | | | | | | | | | | vo_gl will now fail at initialization if a software renderer is detected. This is the same behavior as vo_gl_nosw. Making this the default behavior is preferable, because it will simplify positioning vo_gl in the VO autoprobe list (video_out_drivers[]). Also, vo_gl_nosw exists only if X11 support is configured. Move gl in place of gl_nosw. Add the "sw" suboption to vo_gl to allow using vo_gl even if a software renderer is detected. vo_gl_nosw is now completely equivalent to vo_gl. It is kept in order not to break too many user configurations, but should be considered deprecated.
* Merge remote-tracking branch 'origin/master' into my_masterwm42012-03-161-1/+2
|\ | | | | | | | | | | | | | | Conflicts: command.c mp_core.h mplayer.c screenshot.c
| * vo_gl: improve 10-bit YUV->RGB conversion accuracy slightlyUoti Urpala2012-03-091-1/+2
| | | | | | | | | | | | | | | | | | | | Modify the YUV->RGB conversion matrix to take into account the difference between the same color value being x/255 in a 8-bit texture and x*256/65535 in a 16-bit texture (actually things are stored as x*4/65535 for 10-bit color, but that can be ignored here). This 0.4 % difference in the shader float value could make shades of gray in 10-bit (or generally more than 8 bit) YUV produce RGB values with green slightly higher than red/blue.
* | mpcodecs: remove mp_image_t.x/ywm42012-02-241-5/+3
| | | | | | | | These were never used.
* | vo_gl: add "backend" suboption to allow selecting the GUI backendwm42012-02-091-31/+22
| | | | | | | | | | | | | | | | | | | | | | | | The "backend" suboption allows selecting the GUI backend used by vo_gl. Normally, it's auto-selected, but sometimes it's desireable to explicitly select it. Remove the gl_sdl VO. This can now be done by using: --vo=gl:backend=sdl This is based on svn commit 34438, and tries to be compatible with it. The undocumented numeric backend names serve this purpose. (They are undocumented because names are preferred.)
* | vo_gl: minor cleanupsreimar2012-02-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix spelling. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@34006 b3059339-0415-0410-9bf9-f77b7e298cf2 Fix disabled code. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@34007 b3059339-0415-0410-9bf9-f77b7e298cf2 Remove pointless pointer indirection for shader program strings. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@34016 b3059339-0415-0410-9bf9-f77b7e298cf2 Remove usage of glColor3f, there is not really a point in it. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@34149 b3059339-0415-0410-9bf9-f77b7e298cf2
* | vo_gl: add noise filterreimar2012-02-091-1/+6
| | | | | | | | | | | | | | | | | | | | Add disabled feature: noise filter for vo_gl. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@34014 b3059339-0415-0410-9bf9-f77b7e298cf2 Hook up -vo gl noise support. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@34015 b3059339-0415-0410-9bf9-f77b7e298cf2
* | vo_gl: use generic eosd codewm42011-12-251-145/+111
|/ | | | | | | | | | | | | | | | | | | | | | | | | | This is an experiment. The change probably doesn't matter much. One issue with the old code was that "large" images caused each sub-image to be created and rendered as a new texture. "Large" in this case means larger than 32x32 pixels, which actually isn't very large with screen sizes beyond 1500x1000 pixels. This means rendering a simple subtitle for a fullscreened video may allocate many small textures, one for each glyph. On the other hand, the old code could be fixed by tuning the texture sizes for "modern" work loads. Also, the new code uses less deprecated OpenGL features and draws all sub-images in one batch. There are two possible issues the new code could cause: - Drivers could have performance issues with the larger texture sizes and the number of glTexSubImage2D calls on it - There is only one EOSD texture, which could become full (it's enlarged on demand, but restricted by driver texture size limitations) It has been reported that this is faster on OSX with ATI GPUs than the old code.
* Merge remote-tracking branch 'wm4/window_title'Uoti Urpala2011-12-071-5/+5
|\
| * libvo: remove title argument from struct vo_driver.configwm42011-12-061-5/+5
| | | | | | | | | | | | | | | | | | | | This affects only the "new" VO API. The config() title argument was barely used, and it's hardcoded to "MPlayer" in vf_vo.c. The X11 and the Cocoa GUI backends, which are the only ones properly supporting window titles, ignored this argument. Remove the title argument. Add the vo_get_window_title function. All GUI VOs are supposed to use it for the window title.
* | core, vo: new window refresh logic, add slow-video OSD redrawUoti Urpala2011-12-061-20/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove code refreshing window contents after events such as resize from vo_vdpau, vo_gl and vo_xv. Instead have them simply set a flag indicating that a refresh is needed, and have the player core perform that refresh by doing an OSD redraw. Also add support for updating the OSD contents over existing frames during slow-but-not-paused playback. The VOs now also request a refresh if parameters affecting the picture change (equalizer settings, colormatrix, VDPAU deinterlacing setting). Even previously the picture was typically redrawn with the new settings while paused because new OSD messages associated with setting changes triggered a redraw, but this did not happen if OSD was turned off. A minor imperfection is that now window system events can trigger a single one-frame step forward when using vo_xv after pausing so that vo_xv does not yet have a copy of the current image. This could be fixed but I think it's not important enough to bother.
* | core, vo: modify OSD redraw architecture, support EOSDUoti Urpala2011-12-061-6/+2
|/ | | | | | | | | | | | | | | | Previously the core sent VFCTRL_REDRAW_OSD to change OSD contents over the current frame. Change this to VFCTRL_REDRAW_FRAME followed by normal EOSD and OSD drawing calls, then vo_flip_page(). The new version supports changing EOSD contents for libass-rendered subtitles and simplifies the redraw support code needed per VO. vo_xv doesn't support EOSD changes because it relies on vf_ass to render EOSD contents earlier in the filter chain. vo_xv logic is additionally simplified because the previous commit removed the need to track the status of current and next images separately (now each frame is guaranteed to become "visible" soon after we receive it as "next", with no VO code running in the interval between).
* vo_gl: fix 10 bit with Mesa drivers (Intel/Nouveau on Linux)wm42011-11-251-2/+5
| | | | | | | | | | | | | | | | | | The GL_LUMINANCE16 texture format had only 8 bit precision on Mesa based drivers. This caused heavy degradation of the image when playing formats with more than 8 bits per pixel, such as 10 bit h264. Use GL_R16 instead, which at least Mesa and Nvidia drivers actually implement as 16 bit textures. Since sampling from this texture format doesn't return anything meaningful in the other color components (unlike luminance textures), the shader code has to be slightly changed. GL_R16 requires the GL_ARB_texture_rg extension. Check for it, and fall back to the old texture format if it's not available. The low precision of the GL_LUMINANCE16 format has just been fixed in upstream Mesa, but it'll take a while before that fix is available in distros.
* vo_gl: implement screenshotswm42011-11-251-0/+59
|
* vo_gl: fix crash with backends lacking control() featureswm42011-10-241-0/+6
| | | | | | | | Some functionality provided by the windowing backend (such as x11, win32) is optional. The function pointers in MPGLContext are NULL if the functionality is not implemented. Check them before calling them, instead of crashing. This happened at least on Windows with the "vo_ontop" command.
* vo_gl: remove support for nvidia register combiners (yuv=1)wm42011-10-241-1/+6
| | | | | | | | | | | | | The register combiner color conversion is broken and seems to use a slightly incorrect color matrix (the image looks gray-ish). Completely remove all code related to nVidia register combiners. Unless you have an ancient nVidia GPU, there's no reason to prefer register combiners over fragment shaders. Users with ancient GPUs without fragment shader support can just use -vo xv. Passing yuv=1 (register combiners) as sub option will print a warning and use yuv=2 (fragment shaders) instead.
* vo_gl: fix crash with ati-hack after 20256a8a64c9679bc9136bbwm42011-10-241-28/+34
| | | | | | | | | | | | | | | | | | | | | | Using the ati-hack and force-pbo suboptions (both can be enabled automatically when particular ATI drivers are detected) could lead to segfaults due to incorrect length calculation. The problem is that width*((bpp+7)/8) == width*(bpp+7)/8 doesn't hold true in general. The old code used bpp/8, because bpp was always guaranteed to be divisible by 8. When commit 20256a8a64c96 fixed bugs around 10 bit pixel formats, this assumption was broken, and resulted in out of bounds memory accesses. Additionally, the color values that were used to clear image borders were incorrect and showed up as pink borders on the right/bottom sides of the video when playing 10 bit content. Make the clear value approximately correct; the borders are still filled with a single byte value even though formats with 9-16 bits should be cleared with 2-byte values with the low byte 0. This commit also contains some other minor cleanups with no functional changes.
* vo_gl: remove mesa-buffer suboptionwm42011-10-241-72/+28
| | | | | | | This option enabled using Mesa specific functions, which have never been widely supported, and were removed from Mesa in 2010. http://cgit.freedesktop.org/mesa/mesa/commit/?id=cb2a66fd0c095fe03be5aaf88c8d48f5867425d3
* vo_gl: move window creation functions from vo_gl.c into gl_common.cwm42011-10-241-58/+1
| | | | | | | Now all windowing specific code is in gl_common.c. init_mpglcontext() used to set dummy callbacks for non-optional windowing callbacks. Remove these, as they only lead to confusion.
* vo_gl: add new vo name "gl_sdl" to make SDL+GL mode availablewm42011-10-241-9/+41
| | | | | | | | | | | | | | | | | The actual work is done by the existing SDL code. This commit merely makes it possible to explicitly select the SDL backend ("gl" alone uses SDL only if the X11 and win32 backends are not available, while the new "gl_sdl" always forces use of SDL). Also disable YUV conversion method autodetection when SDL is used. This gets rid of a temporary window that appears for a moment and is immediately closed again. SDL can't deal with the VOFLAG_HIDDEN flag, which is needed to create an invisible GL context (when the autodetection is run, the video size isn't yet known to the VO, and creating a window then resizing would cause problems with window placement). Instead always pick the fragment program method by default (yuv=2). This change affects the normal "gl" VO too if it chooses the SDL backend.
* vo_gl: remove "noaspect" suboptionwm42011-10-241-13/+13
| | | | | | Apparently this is fully redundant given the global "noaspect" option. Refuse this suboption, and output an error message suggesting the correct option.
* vo_gl: convert to new API, clean up codewm42011-10-241-1149/+1336
| | | | | | | Reformat vo_gl.c, gl_common.c, gl_common.h. Remove all global variables and move them into a context struct (the Windows and SDL backends still refer to global_vo though). Change vo_gl.c to use the "new" VO API.
* video, options: implement better YUV->RGB conversion controlwm42011-10-161-75/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Rewrite control of the colorspace and input/output level parameters used in YUV-RGB conversions, replacing VO-specific suboptions with new common options and adding configuration support to more cases. Add new option --colormatrix which selects the colorspace the original video is assumed to have in YUV->RGB conversions. The default behavior changes from assuming BT.601 to colorspace autoselection between BT.601 and BT.709 using a simple heuristic based on video size. Add new options --colormatrix-input-range and --colormatrix-output-range which select input YUV and output RGB range. Disable the previously existing VO-specific colorspace and level conversion suboptions in vo_gl and vo_vdpau. Remove the "yuv_colorspace" property and replace it with one named "colormatrix" and semantics matching the new option. Add new properties matching the options for level conversion. Colorspace selection is currently supported by vo_gl, vo_vdpau, vo_xv and vf_scale, and all can change it at runtime (previously only vo_vdpau and vo_xv could). vo_vdpau now uses the same conversion matrix generation as vo_gl instead of libvdpau functionality; the main functional difference is that the "contrast" equalizer control behaves somewhat differently (it scales the Y component around 1/2 instead of around 0, so that contrast 0 makes the image gray rather than black). vo_xv does not support level conversion. vf_scale supports range setting for input, but always outputs full-range RGB. The value of the slave properties is the policy setting used for conversions. This means they can be set to any value regardless of whether the current VO supports that value or whether there currently even is any video. Possibly separate properties could be added to query the conversion actually used at the moment, if any. Because the colorspace and level settings are now set with a single VF/VO control call, the return value of that is no longer used to signal whether all the settings are actually supported. Instead code should set all the details it can support, and ignore the rest. The core will use GET_YUV_COLORSPACE to check which colorspace details have been set and which not. In other words, the return value for SET_YUV_COLORSPACE only signals whether any kind of YUV colorspace conversion handling exists at all, and VOs have to take care to return the actual state with GET_YUV_COLORSPACE instead. To be changed in later commits: add missing option documentation.
* vo_gl: fix image corruption with PBOs when playing 10 bit videowm42011-10-061-10/+14
| | | | | | | | vo_gl.c hardcoded the assumption that YUV formats always use 1 byte per component. This corrupted the output when playing 10 bit h264 video. Only the PBO code path was affected. PBOs are normally unused, unless ATI is detected, or the force-pbo option is used.
* vo_gl: fix YUY2/YVYU colorspace mixupreimar2011-07-061-1/+1
| | | | | | Second GL_YCBCR_MESA format is YVYU, not YUY2. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33694 b3059339-0415-0410-9bf9-f77b7e298cf2
* vo_gl: Support 9- and 10-bit YUV input for OpenGL VOsreimar2011-07-061-8/+13
| | | | | | | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33502 b3059339-0415-0410-9bf9-f77b7e298cf2 Fix clear/border color of chroma texture for 9- and 10-bit formats. Avoids pink borders for those formats. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33504 b3059339-0415-0410-9bf9-f77b7e298cf2
* vo_gl: don't accept 9/10-bit formats as inputreimar2011-06-291-8/+10
| | | | | | | | | Make mp_get_chroma_shift() simpler/more generic and add an argument to get the per-component bit depth. Use this to check more properly for supported formats in gl and gl2 vos (only 8 and 16 bit are supported, 9 and 10 are not). git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33452 b3059339-0415-0410-9bf9-f77b7e298cf2
* vo_gl: fix "gamma" equalizer settingreimar2011-04-121-0/+2
| | | | | | | The "gamma" setting only changed red gamma. Fix it to change all of red, green and blue gamma. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32895 b3059339-0415-0410-9bf9-f77b7e298cf2
* vo_gl: mark llvmpipe as a software rendererreimar2011-01-291-1/+2
| | | | | | | llvmpipe, while only slow instead of insanely slow, is a software renderer. Recognize it as such and disable -vo gl_nosw on it. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32719 b3059339-0415-0410-9bf9-f77b7e298cf2
* sub/OSD: move some related files to sub/Uoti Urpala2011-01-261-3/+3
|
* cleanup: remove NULL checks before free() all over the codecboesch2010-11-141-2/+2
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32624 b3059339-0415-0410-9bf9-f77b7e298cf2
* vo_gl: create stereo-capable window when using Quadbuffer 3Dreimar2010-11-141-0/+2
| | | | | | | Select a stereo pixel format for window when Quadbuffer OpenGL was selected as 3D mode. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32620 b3059339-0415-0410-9bf9-f77b7e298cf2
* vo_gl.c: Use early return instead of large if blockreimar2010-11-021-26/+26
| | | | | | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31887 b3059339-0415-0410-9bf9-f77b7e298cf2 Reindent. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31888 b3059339-0415-0410-9bf9-f77b7e298cf2
* vo_gl: Make OSD rendering code more readablereimar2010-11-021-7/+12
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31886 b3059339-0415-0410-9bf9-f77b7e298cf2
* vo_gl: Make it possible to select GL_NEAREST scalingreimar2010-11-021-1/+9
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31743 b3059339-0415-0410-9bf9-f77b7e298cf2
* vo_gl: add helper macros to build the yuv conversion type numberreimar2010-11-021-1/+3
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31742 b3059339-0415-0410-9bf9-f77b7e298cf2
* vo_gl: Cosmetics: create luma texture firstreimar2010-11-021-4/+5
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31740 b3059339-0415-0410-9bf9-f77b7e298cf2
* vo_gl: remove unused label</