vmware/xorg: Stop video ports on leave vt
authorJakob Bornecrantz <jakob@vmware.com>
Fri, 4 Dec 2009 15:25:59 +0000 (16:25 +0100)
committerJakob Bornecrantz <jakob@vmware.com>
Fri, 4 Dec 2009 15:50:20 +0000 (16:50 +0100)
src/gallium/winsys/drm/vmware/xorg/vmw_driver.h
src/gallium/winsys/drm/vmware/xorg/vmw_screen.c
src/gallium/winsys/drm/vmware/xorg/vmw_video.c

index db6b89b8bcd822e3a057158f0115277372e4bd6d..85c21ca60e3c12418d1a4009c634c7d51c297d40 100644 (file)
@@ -66,6 +66,8 @@ Bool vmw_video_init(ScrnInfoPtr pScrn, struct vmw_driver *vmw);
 
 Bool vmw_video_close(ScrnInfoPtr pScrn, struct vmw_driver *vmw);
 
+void vmw_video_stop_all(ScrnInfoPtr pScrn, struct vmw_driver *vmw);
+
 
 /***********************************************************************
  * vmw_ioctl.c
index 18cb509189a872376420f08d878b48ef5c4cfe88..7c9757cce9528d8617cde78c718824febe8880b5 100644 (file)
@@ -124,6 +124,26 @@ vmw_screen_close(ScrnInfoPtr pScrn)
     return TRUE;
 }
 
+static Bool
+vmw_screen_enter_vt(ScrnInfoPtr pScrn)
+{
+    debug_printf("%s: enter\n", __func__);
+
+    return TRUE;
+}
+
+static Bool
+vmw_screen_leave_vt(ScrnInfoPtr pScrn)
+{
+    struct vmw_driver *vmw = vmw_driver(pScrn);
+
+    debug_printf("%s: enter\n", __func__);
+
+    vmw_video_stop_all(pScrn, vmw);
+
+    return TRUE;
+}
+
 /*
  * Functions for setting up hooks into the xorg state tracker
  */
@@ -142,6 +162,8 @@ vmw_screen_pre_init(ScrnInfoPtr pScrn, int flags)
     ms = modesettingPTR(pScrn);
     ms->winsys_screen_init = vmw_screen_init;
     ms->winsys_screen_close = vmw_screen_close;
+    ms->winsys_enter_vt = vmw_screen_enter_vt;
+    ms->winsys_leave_vt = vmw_screen_leave_vt;
 
     return TRUE;
 }
index d62c3b7296f46ff66e090f3954f8fadf3f0cdfd2..ef1e2f1e731e6f452803187430e1248a6dca259f 100644 (file)
@@ -358,6 +358,38 @@ vmw_video_close(ScrnInfoPtr pScrn, struct vmw_driver *vmw)
 }
 
 
+/*
+ *-----------------------------------------------------------------------------
+ *
+ * vmw_video_stop_all --
+ *
+ *    Stop all video streams from playing.
+ *
+ * Results:
+ *    None.
+ *
+ * Side effects:
+ *    All buffers are freed.
+ *
+ *-----------------------------------------------------------------------------
+ */
+
+void vmw_video_stop_all(ScrnInfoPtr pScrn, struct vmw_driver *vmw)
+{
+    struct vmw_video_private *video = vmw->video_priv;
+    int i;
+
+    debug_printf("%s: enter\n", __func__);
+
+    if (!video)
+       return;
+
+    for (i = 0; i < VMWARE_VID_NUM_PORTS; ++i) {
+       vmw_xv_stop_video(pScrn, &video->port[i], TRUE);
+    }
+}
+
+
 /*
  *-----------------------------------------------------------------------------
  *