summaryrefslogtreecommitdiffstats
path: root/video/out/vo_opengl.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2016-07-20 20:42:30 +0200
committerwm4 <wm4@nowhere>2016-07-20 20:42:30 +0200
commitbd9c0a10e577e7f839aabc27af6e186a9ba0cdaa (patch)
tree30ef3d3bbffa7e0e7693aed2619e26c2001269a3 /video/out/vo_opengl.c
parente11a20a8122b370b66235284dd4f67ce1f1bbc0b (diff)
downloadmpv-bd9c0a10e577e7f839aabc27af6e186a9ba0cdaa.tar.bz2
mpv-bd9c0a10e577e7f839aabc27af6e186a9ba0cdaa.tar.xz
vo_opengl: allow backends to provide callbacks for custom event loops
Until now, this has been either handled over vo.event_fd (which should go away), or by putting event handling on a separate thread. The backends which do the latter do it for a reason and won't need this, but X11 and Wayland will, in order to get rid of event_fd.
Diffstat (limited to 'video/out/vo_opengl.c')
-rw-r--r--video/out/vo_opengl.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/video/out/vo_opengl.c b/video/out/vo_opengl.c
index 095308f9b5..8c8da4affd 100644
--- a/video/out/vo_opengl.c
+++ b/video/out/vo_opengl.c
@@ -357,6 +357,23 @@ static int control(struct vo *vo, uint32_t request, void *data)
return r;
}
+static void wakeup(struct vo *vo)
+{
+ struct gl_priv *p = vo->priv;
+ if (p->glctx->driver->wakeup)
+ p->glctx->driver->wakeup(p->glctx);
+}
+
+static void wait_events(struct vo *vo, int64_t until_time_us)
+{
+ struct gl_priv *p = vo->priv;
+ if (p->glctx->driver->wait_events) {
+ p->glctx->driver->wait_events(p->glctx, until_time_us);
+ } else {
+ vo_wait_default(vo, until_time_us);
+ }
+}
+
static void uninit(struct vo *vo)
{
struct gl_priv *p = vo->priv;
@@ -466,6 +483,8 @@ const struct vo_driver video_out_opengl = {
.control = control,
.draw_frame = draw_frame,
.flip_page = flip_page,
+ .wait_events = wait_events,
+ .wakeup = wakeup,
.uninit = uninit,
.priv_size = sizeof(struct gl_priv),
.options = options,
@@ -481,6 +500,8 @@ const struct vo_driver video_out_opengl_hq = {
.control = control,
.draw_frame = draw_frame,
.flip_page = flip_page,
+ .wait_events = wait_events,
+ .wakeup = wakeup,
.uninit = uninit,
.priv_size = sizeof(struct gl_priv),
.priv_defaults = &(const struct gl_priv){