summaryrefslogtreecommitdiffstats
path: root/libvo/vo_direct3d.c
Commit message (Collapse)AuthorAgeFilesLines
* vo_direct3d: add some debugging optionswm42012-03-171-12/+53
| | | | | This is for testing. Most of these make no sense, or even if they do, might not improve anything.
* vo_direct3d: refactor D3D initialization and reconfigure codewm42012-03-171-171/+111
| | | | | | | | | | | | | | | | | | | | | | | | | This simplifies the code and removes code duplication. There should be no actual semantic differences to the previous code. The only exception is that the new code doesn't query the display adapter's desktop pixel format on backbuffer resizing anymore. In my opinion the format can never change anyway, and if it does, it will cause the D3D device to become "uncooperative" and we will recreate it in flip_page. Remove attempts to handle d3d_device when it's NULL (outside of the initialization paths). d3d_device can only be NULL if recreating a D3D device, that was in "incooperative" state, fails. The current (and previous) code seems to assume that this never happens. It is unlikely that these NULL checks improved correct operation in any way, or at least they won't anymore after the recent changes done to the code. If it should be possible that a device can't be reset/recreated for a while (during display resolution changes? when another D3D application is in fullscreen mode?), another solution has to be found. It is unknown why the code recreates the IDirect3D9 interface when the device was uncooperative. At least on Windows XP + reference rasterizer, resuming works without recreating it. Leave this code just in case.
* vo_direct3d: disable using shaders by default, and add direct3d_shaders VOwm42012-03-171-10/+42
| | | | | | | | | | | | | | Now using the "direct3d" VO will never make use of shaders. Instead, users are supposed to use the direct3d_shaders VO entry, which is exactly the same as direct3d, except with shaders enabled by default. "direct3d" always uses the Direct3D StretcRect API call to render videos. Playing formats not supported by this function will force mplayer to insert a scale filter to convert video frames in software. "direct3d_shaders" prefers shader color conversion, but can fall back to StretchRect if the format can be handled. (This happens only with some insignificant packed YUV formats.)
* vo_direct3d: use new VO API, and do some minor reformattingwm42012-03-171-269/+298
| | | | | | | | | | | | | | | | The minor reformats are mainly about adding more line breaks to fit a 80 column limit. Using the new VO API implies removing all non-const global variables (because that is one important goal of the new API), so do that as well. The code already had all variables in a context struct, and changing all the functions to pass this context struct along was all what had to be done. Also handle redrawing properly: if something changes that requires an immediate redrawing operation (e.g. setting video equalizers when paused or when playback is slow), vo->want_redraw should be set, instead of redrawing on your own.
* vo_direct3d: implement YUV conversion using shaderswm42012-03-171-192/+680
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Use the 3D rendering functions and shaders to render the video frame. This is very similar to vo_gl. Most planar formats with varying chroma shifts and bit depths are supported (including 10 bit), as well as some RGB formats. The old code that used D3D's StretchRect function is still available, but will by default be used with the least priority. Also implement video equalizers and colorspace selection. These use the same code as vo_gl and vo_vdpau, and are available only if shader YUV conversion is active. The rendering is extremely simple and naive, there are no filters etc. Since compiling shaders seems to require the 500 MB DirectX SDK, all shaders come in pre-compiled form, and there is no make rule to compile them. mplayer should be compilable without 500 MB of garbage. The main problem is that compiling shaders within an application seems to require d3dx9_*.dll, which isn't installed by default. Add an option ("disable-texture-align") that allows making the video textures exactly the same size as the source video. The code used to align the OSD texture size on 16 for unknown reasons, but since this was perhaps a good reason, this behavior is kept for video textures as well. (There is a chance that the alignment improves performance and stability with some drivers.) Passing this option disables this behavior. It is useful for reducing texture filtering artifacts at the bottom/right borders.
* vo_direct3d: reduce number of lock calls in OSD renderingwm42012-03-171-29/+21
| | | | | | The code locked the texture once for each OSD object that was rendered. But there doesn't seem to be any good reason to do that, so lock it only once during OSD rendering.
* vo_direct3d: use the same texture management for EOSD and OSDwm42012-03-171-152/+166
| | | | | | | | | | | | | | | | | | | The OSD code used a shadow texture on systems that don't report D3DDEVCAPS_TEXTURESYSTEMMEMORY. Do that for EOSD as well. Refactor the OSD texture management code to reduce code duplication. I have not the slightest clue about Direct3D9 texture management, so it seems like a good idea not to do something different for EOSD textures, even though the OSD code does exactly the same as far as texture handling goes. It's also worth noting that D3DDEVCAPS_TEXTURESYSTEMMEMORY doesn't seem to be supported by most real systems [1], and maintaining a shadow copy in system memory in order to update textures is required. The previous EOSD texture code may or may not have worked on some or all real systems, I can't really tell by reading the MSDN documentation only. [1] http://www.kludx.com/capability.php?capability=17
* vo_direct3d: make VO re-config faster by not recreating the whole D3D statewm42012-03-171-36/+38
| | | | | | | | | | | The D3D state (the IDirect3DDevice9 and all textures and buffers) were released and recreated in the config() function. This is completely unnecessary. Instead explicitly handle changes. The video surface is only reallocated if the video format or the video size changes. The OSD texture is only reallocated if the window size is increased. The EOSD texture is not released. Since the resize code is reused to deal with reconfig changes, some of these improvements (and possible bugs) apply to normal window resizing as well.
* vo_direct3d: don't framestep when paused and OSD is updatedwm42012-03-171-4/+23
| | | | | | | | | | The required feature for this, VOCTRL_REDRAW_OSD, was unimplemented for unknown reasons. It is trivial to add. There is still a weird issue when switching the fullscreen state while paused. I have no idea why this happens. The contents of the video should survive the window reconfiguration (at least we don't free it), and we explicitly redraw the screen after fullscreen.
* vo_direct3d: add EOSD supportwm42012-03-171-36/+335
| | | | | This allows rendering subtitles in display resolution. It also makes inserting the vf_ass video filter unnecessary.
* vo_direct3d: minor cleanupwm42012-03-171-10/+23
| | | | | | The code assumed the last format passed to query_format will be the one that is used on playback. This is probably true and thus didn't cause any bugs, but make query_format side effect free just like the other VOs.
* cleanup: vo_direct3d: Mark a function staticdiego2011-07-061-2/+3
| | | | | | | This fixes the warning: libvo/vo_direct3d.c:984:6: warning: no previous prototype for 'vo_draw_alpha_l8a8' git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33499 b3059339-0415-0410-9bf9-f77b7e298cf2
* sub/OSD: move some related files to sub/Uoti Urpala2011-01-261-2/+2
|
* Merge svn changes up to r30195Uoti Urpala2010-01-081-7/+30
|\
| * Avoid memleaks when vo_direct3d initialization fails.reimar2010-01-031-8/+14
| | | | | | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30191 b3059339-0415-0410-9bf9-f77b7e298cf2
| * Modify -vo direct3d so we do not have to link against d3d9.dll, it mightreimar2010-01-031-2/+19
| | | | | | | | | | | | | | | | not be available on some rare systems. Based on patch used for builds by Gianluigi Tiesi [sherpya netfarm it] git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30190 b3059339-0415-0410-9bf9-f77b7e298cf2
* | Remove the internal GUIAnton Khirnov2009-07-071-2/+0
| | | | | | | | | | | | | | | | | | The GUI is badly designed and too closely coupled to the internal details of other code. The GUI code is in bad shape and unmaintained for years. There is no indication that anyone would maintain it in the future either. Even if someone did volunteer to implement a better integrated GUI having the current code in the tree probably wouldn't help much. So get rid of it.
* | Merge svn changes up to r28641Uoti Urpala2009-02-181-2/+8
|\| | | | | | | | | | | | | | | Convert vo_x11_border (used in vo_gl/gl2 though the vo_gl_border macro) to use a wrapper macro in old-style VOs which do not provide a VO object argument. Before this function had an explicit global_vo argument in vo_gl/gl2. New vo_vdpau uses it too so use the same mechanism as most other functions.
| * Extend calc_src_dst_rects to also calculate the border values needed forreimar2009-02-171-2/+8
| | | | | | | | | | | | | | correctly placed dvdnav highlights, and fix direct3d and vdpau accordingly. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28633 b3059339-0415-0410-9bf9-f77b7e298cf2
* | Merge svn changes up to r28549Uoti Urpala2009-02-131-41/+12
|\|
| * Add a calc_src_dst_rects that calculates from window size, panscan etc.reimar2009-02-121-41/+12
| | | | | | | | | | | | | | | | | | which part of the video source must be scaled onto which part of the window. Direct3D and (future) VDPAU need this, for XvMC it makes it easier to add cropping support and Xv is changed to keep the diff to XvMC small. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28546 b3059339-0415-0410-9bf9-f77b7e298cf2
* | Merge svn changes up to r28537Uoti Urpala2009-02-121-44/+44
|\|
| * Avoid message spam during video adapter uncooperative state.gogothebee2009-02-051-1/+1
| | | | | | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28469 b3059339-0415-0410-9bf9-f77b7e298cf2
| * Unify info/error messages to a common style:gogothebee2009-02-051-43/+43
| | | | | | | | | | | | | | <vo_direct3d> in the beginning, "." at the end. Shorter/more descriptive sentences. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28468 b3059339-0415-0410-9bf9-f77b7e298cf2
* | Merge svn changes up to r28461Uoti Urpala2009-02-041-18/+28
|\|
| * Add checks that a D3D device is available before attempting rendering.reimar2009-02-031-1/+16
| | | | | | | | | | | | | | | | | | We may have lost the device e.g. because it became uncooperative e.g. when using remote desktop or Vista's UAC is activated. Patch by Georgi Petrov [gogothebee gmail com] git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28457 b3059339-0415-0410-9bf9-f77b7e298cf2
| * Remove the Present call after adapter reinitialization, it can not work anywayreimar2009-02-031-4/+0
| | | | | | | | | | | | | | since no video frame is uploaded to the new context yet. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28456 b3059339-0415-0410-9bf9-f77b7e298cf2
| * Cosmetics: remove empty line, improve some messages.reimar2009-02-031-5/+3
| | | | | | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28454 b3059339-0415-0410-9bf9-f77b7e298cf2
| * Whitespace/comment typo cosmetics.reimar2009-02-031-5/+5
| | | | | | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28453 b3059339-0415-0410-9bf9-f77b7e298cf2
| * Check for change_d3d_backbuffer failure.reimar2009-02-031-1/+2
| | | | | | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28452 b3059339-0415-0410-9bf9-f77b7e298cf2
| * Fix several return valuesreimar2009-02-031-3/+3
| | | | | | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28451 b3059339-0415-0410-9bf9-f77b7e298cf2
* | Merge svn changes up to r28403Uoti Urpala2009-01-311-43/+113
|\|
| * Allocate a larger backbuffer to allow resizing without reinit.reimar2009-01-271-43/+113
| | | | | | | | | | | | | | Patch by Georgi Petrov [gogothebee gmail com] and Jim Hauxwell [james (at) dattrax co uk] git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28379 b3059339-0415-0410-9bf9-f77b7e298cf2
* | Merge svn changes up to r28149Uoti Urpala2008-12-141-31/+295
|\|
| * Set d3d_handle to NULL after release.reimar2008-12-091-0/+1
| | | | | | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28121 b3059339-0415-0410-9bf9-f77b7e298cf2
| * Forgotten part of previous cosmetics commitreimar2008-12-091-3/+2
| | | | | | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28120 b3059339-0415-0410-9bf9-f77b7e298cf2
| * Slightly simplify the conditional release/free codereimar2008-12-091-21/+14
| | | | | | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28119 b3059339-0415-0410-9bf9-f77b7e298cf2
| * First version of OSD support for vo_direct3dreimar2008-12-091-7/+282
| | | | | | | | | | | | | | Patch by Jim Hauxwell [james dattrax co uk] with modifications by me git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28118 b3059339-0415-0410-9bf9-f77b7e298cf2
| * cosmetics: indentationdiego2008-12-081-1/+2
| | | | | | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28113 b3059339-0415-0410-9bf9-f77b7e298cf2
| * Remove pointless or even wrong N/A return values doxy commentsreimar2008-12-081-5/+0
| | | | | | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28112 b3059339-0415-0410-9bf9-f77b7e298cf2
* | Merge svn changes up to r28087Uoti Urpala2008-12-041-1/+1
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: command.c libao2/ao_ivtv.c libao2/ao_v4l2.c libmpcodecs/dec_video.h libvo/aspect.h libvo/sub.c libvo/sub.h libvo/vo_directx.c libvo/vo_macosx.m libvo/vo_quartz.c mp_core.h mplayer.c mplayer.h osdep/getch2.h osdep/timer.h
| * Fix indentation.reimar2008-12-031-1/+1
| | | | | | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28076 b3059339-0415-0410-9bf9-f77b7e298cf2
* | w32_common.c, vo_direct3d.c: Fix Windows compilation issuesUoti Urpala2008-12-021-1/+1
|/ | | | | | In w32_common.c the special "old_vo_defines.h" header was included too late. vo_direct3d.c was copied from svn without fixing the type of the control() function.
* Remove resize_d3d call from render_d3d_frame that was made uselessreimar2008-12-021-2/+0
| | | | | | | | | by previous commit. If this is necessary e.g. to prevent flicker while resizing, check_events should be called instead or even better the functionality be moved to some higher layer. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28065 b3059339-0415-0410-9bf9-f77b7e298cf2
* 100l, do not call check_events from resize_d3d since there should bereimar2008-12-021-3/+0
| | | | | | | | no reason to do it and it might call resize_d3d again which makes it hard to guarantee that it works correctly. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28064 b3059339-0415-0410-9bf9-f77b7e298cf2
* Cosmetics: Remove unnecessary ()reimar2008-12-021-1/+1
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28063 b3059339-0415-0410-9bf9-f77b7e298cf2
* Consistency cosmetics: do not compare against NULL in ifsreimar2008-12-021-6/+6
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28062 b3059339-0415-0410-9bf9-f77b7e298cf2
* Cosmetics: remove spaces before argument (reimar2008-12-021-3/+3
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28061 b3059339-0415-0410-9bf9-f77b7e298cf2
* Reorganize Direct3D initialization code.reimar2008-12-021-51/+150
| | | | | | | Patch by Georgi Petrov [gogothebee gmail com] git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28060 b3059339-0415-0410-9bf9-f77b7e298cf2
* whitespace cosmetics: prettyprinting and indentationdiego2008-11-281-77/+81
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28045 b3059339-0415-0410-9bf9-f77b7e298cf2
* Use D3DFMT_ constants where possible instead of MAKEFOURCCreimar2008-11-261-2/+2
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28041 b3059339-0415-0410-9bf9-f77b7e298cf2
* Add support for RGB formats to vo_direct3dreimar2008-11-261-0/+6
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28040 b3059339-0415-0410-9bf9-f77b7e298cf2
* Remove a ColorFill that is not necessary since the surface it is usedreimar2008-11-241-4/+0
| | | | | | | | on has exactly the same size as the video image and the video will be copied into it before it is used the first time. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28019 b3059339-0415-0410-9bf9-f77b7e298cf2
* Make sure the backbuffer is cleared when the border size might have changed.reimar2008-11-241-1/+14
| | | | | | | Patch by Georgi Petrov [gogothebee gmail com] git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28018 b3059339-0415-0410-9bf9-f77b7e298cf2
* Patch to improve/consistify coding style.reimar2008-11-231-20/+20
| | | | | | | Patch by Georgi Petrov [gogothebee gmail com] git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28005 b3059339-0415-0410-9bf9-f77b7e298cf2
* Fix indentationreimar2008-11-231-12/+12
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28004 b3059339-0415-0410-9bf9-f77b7e298cf2
* Lock/unlock surface only once even when drawing many slices.reimar2008-11-231-7/+14
| | | | | | | Patch originally by Jim Hauxwell [james dattrax co.uk] git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28003 b3059339-0415-0410-9bf9-f77b7e298cf2
* Move locked_rect from stack to priv struct in preparation for following patch.reimar2008-11-231-17/+13
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28002 b3059339-0415-0410-9bf9-f77b7e298cf2
* Move the StretchRect call from draw_slices to render_d3d_frame.reimar2008-11-231-28/+8
| | | | | | | |