Commit Graph

24 Commits

Author SHA1 Message Date
wm4 32f726703d vo_opengl: remove remnants of dropped stereo buffer support 2015-01-24 23:29:54 +01:00
wm4 e34957940b vo_opengl: cleanups after vo_opengl_old removal
Don't load all the legacy functions (including ancient extensions).
Slightly simplify function loader and context creation, now that legacy
GL doesn't need to be handled. Remove the code for drawing OSD in legacy
mode.

Remove all the header hacks, which were meant for ancient OpenGL headers
which didn't even support things like OpenGL 1.3. Instead, adjust the
GLX check to make sure we get both OpenGL 3x and 2.1 symbols. For win32
and OSX, we assume that the user has the latest headers anyway. For
wayland, we hope that things somehow go right.
2015-01-21 20:32:42 +01:00
wm4 5f398831d2 x11: always use glXGetProcAddressARB()
glXGetProcAddress() is outdated, and as far as I know doesn't give all
the guarantees the "new" ARB function gives.

Probably doesn't matter too much, because until now it always appeared
to work. On the other hand, since this function is (bogusly) used only
on the gl3 code path, it could have happened that users hit this, and
just reverted to vo_opengl_old instead.
2015-01-07 21:13:26 +01:00
wm4 fcd2ea7601 vo_opengl: remove pointless glFinish calls 2014-12-19 23:50:12 +01:00
wm4 d31e584292 vo_opengl, x11: add ES context creation via GLX
Apparently GLX can do this, so using EGL is not strictly required.

This code tries to create an ES context if creating a desktop GL context
fails. Also, a "x11es" backend for forcing ES (instead of desktop GL) is
added, mostly for testing and debugging.
2014-12-19 20:29:31 +01:00
wm4 88982f2855 vo_opengl: better probe handling
Involve detection of software renderers in the probing properly. Other
VOs could handle probing also more gracefully, and e.g. produce less
noise if an API is unavailable. (Although other than the OpenGL VOs,
only vo_wayland will.)

Now the "sw" suboption for vo_opengl[_old] is strictly speaking not
needed anymore. Doing "--vo=opengl" disables the probing logic, and will
always force it, if possible.

Includes some simplifications as well.
2014-12-19 18:54:39 +01:00
wm4 da997db095 vo_opengl, x11: make legacy context warning not an error
Really, this doesn't actually matter. It's printed as error only because
it was once thought to be an mostly unneeded fallback, but it turned out
this is still frequently needed, and users are getting confused.
2014-12-18 20:58:37 +01:00
wm4 9c0389e841 gl_x11: distinguish missing GLX and too old GLX versions
This probably led to confusing output.

CC: @mpv-player/stable
2014-10-12 01:33:10 +02:00
wm4 c42ac83c7c gl_x11: remove workaround for PPC OSX 10.4
Added in 2010 with commit 4a8486f8 (svn commit 30994). I doubt anyone
still uses X11 on OSX, and we probably don't support 10.4 either.
2014-05-31 21:56:45 +02:00
wm4 8178b80748 gl_x11: always require some GLX API functions, avoid dlsym()
The functions glXGetProcAddressARB() and glXQueryExtensionsString() were
loaded using dlsym(). This could fail when compiling to libmpv, because
then dlopen(NULL, ...) will look in the main program's list of
libraries, and the libGL linked to libmpv is never considered. (Don't
know if this somehow could be worked around.) The result is that using
vo_opengl with libmpv can fail.

Avoid this by not using dlsym(). glXGetProcAddressARB() was already used
directly in the same file, and that never caused any problems. (Still
add it to the configure test.) glXQueryExtensionsString() is documented
as added in GLX 1.1 - that's ancient.
2014-05-31 21:53:04 +02:00
wm4 ca343d82a6 video/out: remove unused config() parameters
This was cleaned up yesterday.
2014-05-07 21:34:05 +02:00
wm4 5eaefaa98a x11: don't use VOCTRL_UPDATE_SCREENINFO
See previous commit.
2014-05-06 20:24:35 +02:00
wm4 67769db1a4 gl_x11: don't require a X visual for modern GL context creation
Legacy GL context creation (glXCreateContext) explicitly requires a X
visual, while the modern one (glXCreateContextAttribsARB) does not for
some reason. So fail only on the legacy code path if we don't find a
visual. Note that vo_x11_config_vo_window() will select a default visual
if a NULL visual is passed to it.
2014-02-06 14:33:30 +01:00
wm4 7134574f53 gl_x11: always request true color visual
This fixes issue #504. For some reason, glXChooseFBConfig() will return
a fbconfig with no associated visual. (I'm not sure if this allowed.
They don't always have a visual, but since GLX_X_RENDERABLE is set
and GLX_DRAWABLE_TYPE is (implicitly) set to GLX_WINDOW_BIT, why would
there be no visual?)

Even worse, a test program seems to show that a 16 bit fbconfig is
selected (instead of 24/32 bit), which doesn't sound nice at all. Since
there _are_ better fbconfigs available, glXChooseFBConfig() should
normally sort them by quality, and return the better ones first. It's
worth noting that this function should also prefer GLX_TRUE_COLOR
over anything else, although this comes last in the sort order.

Whatever is going on, requesting GLX_X_VISUAL_TYPE with GLX_TRUE_COLOR
seems to fix it.
2014-02-06 14:12:04 +01:00
wm4 302e8ff464 vo_opengl: don't assume there'a always 1 fbconfig on success
Seems to be a reasonable assumption, but it's probably not guaranteed.
2014-01-21 23:34:02 +01:00
wm4 905029ec0c video/out: remove pointless x/y parameter from vo_x11_config_vo_window
This never made any real sense; the "backend" has to access vo->dx/dy
anyway.
2014-01-11 18:58:07 +01:00
wm4 597a143ec6 gl_common: remove unneeded callback
We got rid of this some time ago, but apparently not completely.
2013-11-14 19:51:40 +01:00
wm4 884b4600a4 gl_x11: change error message when GL3 context creation fails
On systems that provide legacy OpenGL (up to 2.1), but not GL3 and
later, creating a GL3 context will fail. We then revert to legacy GL.

Apparently the error message printed when the GL3 context creation
fails is confusing. We could just silence it, but there's still a X
error ("X11 error: GLXBadFBConfig"), which would be quite hard to
filter out. For one, it would require messing with the X11 error
handler, which doesn't even carry a context pointer (for application
private data), so we don't even want to touch it. Instead, change
the error message to inform the user what's actually happening: a
fallback to an older version of OpenGL.
2013-10-28 23:54:02 +01:00
wm4 76f32e3881 gl_x11: fail gracefully if selected FBconfig has no X visual
glXGetVisualFromFBConfig() specifies specifies that it can return NULL
if there is no associated X visual. Instead of crashing, let
initialization fail. I'm not sure if this is actually supposed to work
with a fallback visual (passing a NULL visual to vo_x11_config_vo_window
would just do this), but let's play safe for now.

Apparently this can happen when trying to use vo_opengl over a remote
X display.
2013-10-03 23:50:48 +02:00
wm4 beb1aa5988 gl_common: complete mp_msg conversion
Hopefully this works on Wayland and Cocoa, which I didn't test.
2013-09-12 01:34:42 +02:00
Alexander Preisinger df5606afe0 gl_x11: mp_msg conversion 2013-09-11 22:41:13 +02:00
wm4 bf10a4fdfa video/out: introduce vo_control for gl_common based VOs
Instead of having separate callbacks for each backend-handled feature
(like MPGLContext.fullscreen, MPGLContext.border, etc.), pass the
VOCTRL responsible for this directly to the backend. This allows
removing a bunch of callbacks, that currently must be set even for
optional/lesser features (like VOCTRL_BORDER).

This requires changes to all VOs using gl_common, as well as all
backends that support gl_common.

Also introduce VOCTRL_CHECK_EVENTS. vo.check_events is now optional.
VO backends can use VOCTRL_CHECK_EVENTS instead to implementing
check_events. This has the advantage that the event handling code in
VOs doesn't have to be duplicated if vo_control() is used.
2013-05-26 16:44:18 +02:00
wm4 8099cbe9dd vo_opengl: add alpha output
Allows playing video with alpha information on X11, as long as the video
contains alpha and the window manager does compositing. See vo.rst.

Whether a window can be transparent is decided by the choice of the X
Visual used for window creation. Unfortunately, there's no direct way to
request such a Visual through the GLX or the X API, and use of the
XRender extension is required to find out whether a Visual implies a
framebuffer with alpha used by XRender (see for example [1]). Instead of
depending on the XRender wrapper library (which would require annoying
configure checks, even though XRender is virtually always supported),
use a simple heuristics to find out whether a Visual has alpha. Since
getting it wrong just means an optional feature will not work as
expected, we consider this ok.

[1] http://stackoverflow.com/questions/4052940/how-to-make-an-opengl-
rendering-context-with-transparent-background/9215724#9215724
2013-03-28 21:46:17 +01:00
wm4 16e951c2cd gl_common: split into platform specific files
Do this instead of stuffing all x11/cocoa/win32/wayland specific code
into gl_common.c. The cocoa specific parts could probably go directly
into cocoa_common.m, possibly same with wayland.

Also redo how the list of backends is managed. Get rid of the GLTYPE_
constants. Instead of having a big switch() on GLTYPE_, each backend
entry has a function pointer to setup the MPGLContext callback (e.g.
mpgl_set_backend_x11()).
2013-03-28 21:46:17 +01:00