From fc4e81726d03399bfbbba79d2e76556836f03bd2 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Fri, 23 Aug 2013 02:25:34 +0100 Subject: [PATCH] sna/video: Disable the existing sprite when switching CRTCs After starting a new video on another CRTC, disable the old one as we currently only track the single video port. However, showing a video split across multiple CRTCs would be a useful extension in the future. Signed-off-by: Chris Wilson --- src/sna/sna_video_sprite.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/sna/sna_video_sprite.c b/src/sna/sna_video_sprite.c index 0323e461..8b094c4f 100644 --- a/src/sna/sna_video_sprite.c +++ b/src/sna/sna_video_sprite.c @@ -201,6 +201,8 @@ sna_video_sprite_show(struct sna *sna, { struct drm_mode_set_plane s; + /* XXX handle video spanning multiple CRTC */ + VG_CLEAR(s); s.plane_id = sna_crtc_to_plane(crtc); @@ -300,7 +302,15 @@ sna_video_sprite_show(struct sna *sna, } frame->bo->domain = DOMAIN_NONE; - video->plane = s.plane_id; + + if (video->plane != s.plane_id) { + if (video->plane) { + memset(&s, 0, sizeof(s)); + s.plane_id = video->plane; + drmIoctl(video->sna->kgem.fd, DRM_IOCTL_MODE_SETPLANE, &s); + } + video->plane = s.plane_id; + } if (video->bo != frame->bo) { if (video->bo)