summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authorMarcin Kurczewski <mkurczew@gmail.com>2015-04-20 21:30:26 +0200
committerwm4 <wm4@nowhere>2015-04-21 11:45:55 +0200
commit7f29172baf7a4ae57eb5af3e3ccd667553aa73f8 (patch)
treefc374eadd66b2abd5b12c653f8ff7255a00ad50a /video
parenta7cf35c1ca08cf59ae9f1d9e56c7fb486af6e9ff (diff)
downloadmpv-7f29172baf7a4ae57eb5af3e3ccd667553aa73f8.tar.bz2
mpv-7f29172baf7a4ae57eb5af3e3ccd667553aa73f8.tar.xz
vo_drm: fix releasing VT if received signal twice
If user switched terminals frantically, mpv could get SIGUSR1 twice in a row, which, up until now, resulted in destroying CRTC twice. This caused it to segfault. After this fix, double SIGUSR1 should be ignored.
Diffstat (limited to 'video')
-rw-r--r--video/out/vo_drm.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/video/out/vo_drm.c b/video/out/vo_drm.c
index 3722f07db6..1c05b24008 100644
--- a/video/out/vo_drm.c
+++ b/video/out/vo_drm.c
@@ -350,6 +350,7 @@ static void modeset_page_flipped(int fd, unsigned int frame, unsigned int sec,
static int setup_vo_crtc(struct vo *vo)
{
struct priv *p = vo->priv;
+ if (p->active) return;
p->old_crtc = drmModeGetCrtc(p->fd, p->dev->crtc);
int ret = drmModeSetCrtc(p->fd, p->dev->crtc,
p->dev->bufs[p->dev->front_buf + BUF_COUNT - 1].fb,
@@ -362,6 +363,7 @@ static void release_vo_crtc(struct vo *vo)
{
struct priv *p = vo->priv;
+ if (!p->active) return;
p->active = false;
// wait for current page flip
@@ -383,6 +385,7 @@ static void release_vo_crtc(struct vo *vo)
1,
&p->dev->mode);
drmModeFreeCrtc(p->old_crtc);
+ p->old_crtc = NULL;
}
}