summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrr- <mkurczew@gmail.com>2015-06-28 16:02:22 +0200
committerwm4 <wm4@nowhere>2015-06-28 17:11:51 +0200
commit745cc7a8cd1b7dd92bb4d4256a8ef7330b627a1d (patch)
tree10f5ac7d8e6172458e6bddfd4ba05a9c5bb5989a
parentfb1b8f93aa0c1f08b62dfd68fa8830d4d0f06b71 (diff)
downloadmpv-745cc7a8cd1b7dd92bb4d4256a8ef7330b627a1d.tar.bz2
mpv-745cc7a8cd1b7dd92bb4d4256a8ef7330b627a1d.tar.xz
vo_drm: make VT switching non mandatory
-rw-r--r--video/out/vo_drm.c31
1 files changed, 20 insertions, 11 deletions
diff --git a/video/out/vo_drm.c b/video/out/vo_drm.c
index d45e037750..f853b90dc6 100644
--- a/video/out/vo_drm.c
+++ b/video/out/vo_drm.c
@@ -72,11 +72,13 @@ struct priv {
int mode_id;
int fd;
- struct vt_switcher vt_switcher;
struct modeset_dev *dev;
drmModeCrtc *old_crtc;
drmEventContext ev;
+ bool vt_switcher_active;
+ struct vt_switcher vt_switcher;
+
bool active;
bool pflip_happening;
@@ -433,16 +435,19 @@ static void acquire_vt(void *data)
static int wait_events(struct vo *vo, int64_t until_time_us)
{
struct priv *p = vo->priv;
- int64_t wait_us = until_time_us - mp_time_us();
- int timeout_ms = MPCLAMP((wait_us + 500) / 1000, 0, 10000);
- vt_switcher_poll(&p->vt_switcher, timeout_ms);
+ if (p->vt_switcher_active) {
+ int64_t wait_us = until_time_us - mp_time_us();
+ int timeout_ms = MPCLAMP((wait_us + 500) / 1000, 0, 10000);
+ vt_switcher_poll(&p->vt_switcher, timeout_ms);
+ }
return 0;
}
static void wakeup(struct vo *vo)
{
struct priv *p = vo->priv;
- vt_switcher_interrupt_poll(&p->vt_switcher);
+ if (p->vt_switcher_active)
+ vt_switcher_interrupt_poll(&p->vt_switcher);
}
static int reconfig(struct vo *vo, struct mp_image_params *params, int flags)
@@ -568,7 +573,9 @@ static void uninit(struct vo *vo)
drmModeFreeEncoder(p->dev->enc);
}
- vt_switcher_destroy(&p->vt_switcher);
+ if (p->vt_switcher_active)
+ vt_switcher_destroy(&p->vt_switcher);
+
talloc_free(p->last_input);
talloc_free(p->cur_frame);
talloc_free(p->dev);
@@ -583,11 +590,13 @@ static int preinit(struct vo *vo)
p->ev.version = DRM_EVENT_CONTEXT_VERSION;
p->ev.page_flip_handler = modeset_page_flipped;
- if (vt_switcher_init(&p->vt_switcher, vo->log))
- goto err;
-
- vt_switcher_acquire(&p->vt_switcher, acquire_vt, vo);
- vt_switcher_release(&p->vt_switcher, release_vt, vo);
+ p->vt_switcher_active = vt_switcher_init(&p->vt_switcher, vo->log) == 0;
+ if (p->vt_switcher_active) {
+ vt_switcher_acquire(&p->vt_switcher, acquire_vt, vo);
+ vt_switcher_release(&p->vt_switcher, release_vt, vo);
+ } else {
+ MP_WARN(vo, "Failed to set up VT switcher. Terminal switching will be unavailable.\n");
+ }
if (modeset_open(vo, &p->fd, p->device_path))
goto err;