Commit Graph

32 Commits

Author SHA1 Message Date
wm4 fcd2ea7601 vo_opengl: remove pointless glFinish calls 2014-12-19 23:50:12 +01:00
Alexander Preisinger 593e5e4a25 gl_wayland: fix crash after eglInitialze failed
Only execute most of the opengl termination procedure if we actually have an
egl context.
2014-08-30 10:17:51 +02:00
Michael Forney 618361c697 gl_wayland: Don't try to resize the egl_window before it exists
If the compositor sends a configure event immediately after a window is
created (for example, if it implements tiling window management), mpv
will attempt to call wl_egl_window_resize before it has actually created
the egl_window, causing a crash.
2014-08-04 09:50:24 +02:00
wm4 caf35e695f gl_wayland: remove probably unneeded workaround
This would imply eglGetProcAddress() doesn't work correctly, but using
dlsym() does. For now get rid of it - it won't work in libmpv, and we'll
probably need a better workaround if it's still broken.

This code was in the initial wayland commit.
2014-05-31 22:00:06 +02:00
wm4 ca343d82a6 video/out: remove unused config() parameters
This was cleaned up yesterday.
2014-05-07 21:34:05 +02:00
wm4 b51664c04a wayland: don't use VOCTRL_UPDATE_SCREENINFO
Not very tested. Appears to work.
2014-05-06 23:16:18 +02:00
Alexander Preisinger 5528ad3031 wayland/shm: Use subsurfaces for OSD 2014-04-16 16:38:54 +02:00
Alexander Preisinger 4b10255008 wayland: fix memory leaks
There are still some leaks from wayland-cursor stuff, but there is no way to
free the memory as user of the cursor library.
2014-01-08 20:59:40 +01:00
Alexander Preisinger 8a130e08e2 Revert "wayland/egl: use redraw callback"
Because of this commit there were problems displaying the frmase in their right
order.

This reverts commit 96e75d234a.

Conflicts:
	video/out/gl_wayland.c
	video/out/wayland_common.h
2014-01-04 21:18:46 +01:00
Alexander Preisinger bb3ea1580e wayland/egl: misc fixes and cleanups 2014-01-04 17:26:55 +01:00
Alexander Preisinger 96e75d234a wayland/egl: use redraw callback
This solves the issue where we would not receive any frame events. The
difference to my earlier tests is that now it looks like eglSwapBuffers uses
it's own event queue or something similiar along the lines. Becaues the
performance is the same as without any redraw callback.
2014-01-04 17:23:35 +01:00
Alexander Preisinger 17b52cc4a9 wayland/egl: add egl_context to the wayland state
At the moment there are visual glitches when we resize the window. This happens
because in wayland there a special function for resizing EGL windows.

To prevent the glitches move the egl_context to the wayland state in
wayland_common.h and add a new control function to gl_wayland.c to wrap the
vo_wayland_control function to check for resize events.

With the new control wrapper the glitches are gone and the resizing is fluid.
2014-01-04 16:43:58 +01:00
Alexander Preisinger f5565f33c7 wayland: Remove nonsense comment and add warning
The reason a segmentation happend here was because we couldn't get the
requested minor version. The major version is enough for differentiating
between OpenGL 3 and OpenGL 2. If it fails there is still a fallback to any
version available.

Also add a warning if we use the fallback.
2014-01-04 15:37:45 +01:00
Alexander Preisinger 52fa38079d wayland/opengl: fix garbage borders
It seems mpv draws garbage in those regions. Now we calculate the aspect and
let weston draw the black borders.
2014-01-02 20:33:39 +01:00
Alexander Preisinger 6bd911d7db wayland/egl: use wayland log 2013-09-12 16:36:52 +02:00
Alexander Preisinger aa5f8ba542 Revert "wayland: don't create our own log context"
This reverts commit beab54506e.

Conflicts:
	video/out/wayland_common.c
2013-09-12 16:29:13 +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 683e58066e wayland: update license headers 2013-09-09 18:37:33 +02:00
Alexander Preisinger beab54506e wayland: don't create our own log context
This was more problematic than useful ([vo/wayland/wayland])
2013-08-26 16:39:05 +02:00
Alexander Preisinger 8fd274ea3b wayland/egl: rework resizing (again)
Moves a good chunk of the resizing code to wayland_common.c. This makes it
possible to share it with future video drivers.

It doesn't resizit it immediatly, it calcutlates the new position and size and
then shedules a resizing event. This removes the ugly callback and void pointer
from the wayland data structure.
2013-08-25 22:46:26 +02:00
Alexander Preisinger 6443a9b16c wayland: switch to the new mp_msg api 2013-07-31 21:52:16 +02:00
Michael Forney 906315f075 wayland: Fallback to any GL version if 3.0 is not supported
This fixes playback on Wayland with older GPUs.
2013-07-19 04:30:23 -07:00
Alexander Preisinger 3dc063a330 wayland: use a unified struct for the state
This commit removes the pointer to the single different structures for input
and window and puts them as anonymous structures inside the wayland_state
structure.

This has the disadvantage of passing the substructure to the listeners, but the
advantage is that we don't have to allocate them and check for NULL pointers.
This makes it more reliable and easier to follow.
2013-07-18 17:52:56 +02:00
Alexander Preisinger c5b76714a0 wayland: don't resize in gl_wayland.c
The vo_wayland_fullscreen handles resizing for the video, because the video
could still be in fullscreen mode and resizing it in gl_wayland could make it
grow or shrink.
2013-07-18 14:17:30 +02:00
wm4 c4b08a9a11 video: remove fullscreen flags chaos
There was a MPOpts fullscreen field, a mp_vo_opts.fs field, and
VOFLAG_FULLSCREEN. Remove all these and introduce a
mp_vo_opts.fullscreen flag instead.

When VOs receive VOCTRL_FULLSCREEN, they are supposed to set the
current fullscreen mode to the state in mp_vo_opts.fullscreen. They
also should do this implicitly on config().

VOs which are capable of doing so can update the mp_vo_opts.fullscreen
if the actual fullscreen mode changes (e.g. if the user uses the
window manager controls). If fullscreen mode switching fails, they
can also set mp_vo_opts.fullscreen to the actual state.

Note that the X11 backend does almost none of this, and it has a
private fs flag to store the fullscreen flag, instead of getting it
from the WM. (Possibly because it has to deal with broken WMs.)

The fullscreen option has to be checked on config() to deal with
the -fs option, especially with something like:

   mpv --fs file1.mkv --{ --no-fs file2.mkv --}

(It should start in fullscreen mode, but go to windowed mode when
playing file2.mkv.)

Wayland changes by: Alexander Preisinger <alexander.preisinger@gmail.com>
Cocoa changes by: Stefano Pigozzi <stefano.pigozzi@gmail.com>
2013-07-18 14:07:21 +02:00
Alexander Preisinger 6230e0b896 wayland: early aspect calculation in vo_config
Calculate the aspect ratio in vo_config, when we get the window size and in the
inside the resize function we calculate the aspect ratio of the output in order
to determine if we have to change the height or the width of the video.

If the ratio of the output is bigger than the ratio of the video then we have
to set the width accordingly and if the ratio is smaller we change the size.
But only if no resize edges are passed, because this indicates that we want to
change the windows state instead of just a simple resize and the video should
not grow bigger than the requested size.
2013-07-16 19:13:29 +02:00
Alexander Preisinger bb9b6501fd wayland: introduce vo_wayland_config
This removes the need for exposing vo_wayland_fullscreen and other functions
also this will be usefull for other vos in the future.
2013-05-26 16:44:19 +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
Alexander Preisinger 2c6c842719 wayland: reworked resizing
This fixes 2 bugs:
 * Resizing very fast breaks the aspect of the window and the width and height
   don't match with the video anymore
 * Pressing 'f' for fullscreen very fast can overwrite the backup variables for
   the previous width and height.

Also includes a better aspect calculation with fluid resizing.
2013-05-07 21:21:37 +02:00
Alexander Preisinger 8f1168b73f wayland: use vo flags for enabling alpha support
I missed the VOFLAG for enabling alpha support
2013-04-02 21:10:22 +02:00
Alexander Preisinger 39116ecf31 wayland: enable alpha support
It is now possible to show images and videos with alpha information correctly.
This was disalbed before, because there was a bug that made black parts of
videos also transparent.
2013-04-02 20:50:54 +02: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