svn commit: r257815 - in user/ed/newcons/sys/dev: fb vt vt/hw/fb
Aleksandr Rybalko
ray at FreeBSD.org
Thu Nov 7 21:08:54 UTC 2013
Author: ray
Date: Thu Nov 7 21:08:52 2013
New Revision: 257815
URL: http://svnweb.freebsd.org/changeset/base/257815
Log:
Handle suspend/resume. Switch to console window before suspend, switch back on
resume. That fix issue with broken Xorg image after resume.
Fix some style whilst here.
Sponsored by: The FreeBSD Foundation
Modified:
user/ed/newcons/sys/dev/fb/fbd.c
user/ed/newcons/sys/dev/vt/hw/fb/vt_fb.c
user/ed/newcons/sys/dev/vt/hw/fb/vt_fb.h
user/ed/newcons/sys/dev/vt/vt.h
user/ed/newcons/sys/dev/vt/vt_core.c
Modified: user/ed/newcons/sys/dev/fb/fbd.c
==============================================================================
--- user/ed/newcons/sys/dev/fb/fbd.c Thu Nov 7 21:08:12 2013 (r257814)
+++ user/ed/newcons/sys/dev/fb/fbd.c Thu Nov 7 21:08:52 2013 (r257815)
@@ -393,6 +393,21 @@ fbd_detach(device_t dev)
return (err);
}
+static int
+fbd_suspend(device_t dev)
+{
+
+ vt_fb_suspend();
+ return (bus_generic_suspend(dev));
+}
+
+static int
+fbd_resume(device_t dev)
+{
+
+ vt_fb_resume();
+ return (bus_generic_resume(dev));
+}
static device_method_t fbd_methods[] = {
/* Device interface */
@@ -401,8 +416,8 @@ static device_method_t fbd_methods[] = {
DEVMETHOD(device_detach, fbd_detach),
DEVMETHOD(device_shutdown, bus_generic_shutdown),
- DEVMETHOD(device_suspend, bus_generic_suspend),
- DEVMETHOD(device_resume, bus_generic_resume),
+ DEVMETHOD(device_suspend, fbd_suspend),
+ DEVMETHOD(device_resume, fbd_resume),
{ 0, 0 }
};
Modified: user/ed/newcons/sys/dev/vt/hw/fb/vt_fb.c
==============================================================================
--- user/ed/newcons/sys/dev/vt/hw/fb/vt_fb.c Thu Nov 7 21:08:12 2013 (r257814)
+++ user/ed/newcons/sys/dev/vt/hw/fb/vt_fb.c Thu Nov 7 21:08:52 2013 (r257815)
@@ -211,3 +211,17 @@ vt_fb_attach(struct fb_info *info)
return (0);
}
+
+void
+vt_fb_resume(void)
+{
+
+ vt_resume();
+}
+
+void
+vt_fb_suspend(void)
+{
+
+ vt_suspend();
+}
Modified: user/ed/newcons/sys/dev/vt/hw/fb/vt_fb.h
==============================================================================
--- user/ed/newcons/sys/dev/vt/hw/fb/vt_fb.h Thu Nov 7 21:08:12 2013 (r257814)
+++ user/ed/newcons/sys/dev/vt/hw/fb/vt_fb.h Thu Nov 7 21:08:52 2013 (r257815)
@@ -33,6 +33,8 @@
#define _DEV_VT_HW_FB_VT_FB_H_
/* Generic framebuffer interface call vt_fb_attach to init VT(9) */
int vt_fb_attach(struct fb_info *info);
+void vt_fb_resume(void);
+void vt_fb_suspend(void);
int fb_probe(struct fb_info *info);
Modified: user/ed/newcons/sys/dev/vt/vt.h
==============================================================================
--- user/ed/newcons/sys/dev/vt/vt.h Thu Nov 7 21:08:12 2013 (r257814)
+++ user/ed/newcons/sys/dev/vt/vt.h Thu Nov 7 21:08:52 2013 (r257815)
@@ -61,6 +61,8 @@ TUNABLE_INT("kern.vt." #_name, &vt_##_na
struct vt_driver;
void vt_allocate(struct vt_driver *, void *);
+void vt_resume(void);
+void vt_suspend(void);
typedef unsigned int vt_axis_t;
@@ -81,6 +83,7 @@ typedef unsigned int vt_axis_t;
struct vt_device {
struct vt_window *vd_windows[VT_MAXWINDOWS]; /* (c) Windows. */
struct vt_window *vd_curwindow; /* (d) Current window. */
+ struct vt_window *vd_savedwindow;/* (?) Saved for suspend. */
const struct vt_driver *vd_driver; /* (c) Graphics driver. */
void *vd_softc; /* (u) Driver data. */
vt_axis_t vd_width; /* (?) Screen width. */
Modified: user/ed/newcons/sys/dev/vt/vt_core.c
==============================================================================
--- user/ed/newcons/sys/dev/vt/vt_core.c Thu Nov 7 21:08:12 2013 (r257814)
+++ user/ed/newcons/sys/dev/vt/vt_core.c Thu Nov 7 21:08:52 2013 (r257815)
@@ -977,6 +977,7 @@ vt_proc_alive(struct vt_window *vw)
static int
signal_vt_rel(struct vt_window *vw)
{
+
if (vw->vw_smode.mode != VT_PROCESS)
return FALSE;
if (vw->vw_proc == NULL || vt_proc_alive(vw) == FALSE) {
@@ -995,6 +996,7 @@ signal_vt_rel(struct vt_window *vw)
static int
signal_vt_acq(struct vt_window *vw)
{
+
if (vw->vw_smode.mode != VT_PROCESS)
return FALSE;
if (vw == vw->vw_device->vd_windows[VT_CONSWINDOW])
@@ -1015,6 +1017,7 @@ signal_vt_acq(struct vt_window *vw)
static int
finish_vt_rel(struct vt_window *vw, int release, int *s)
{
+
if (vw->vw_flags & VWF_SWWAIT_REL) {
vw->vw_flags &= ~VWF_SWWAIT_REL;
if (release) {
@@ -1029,6 +1032,7 @@ finish_vt_rel(struct vt_window *vw, int
static int
finish_vt_acq(struct vt_window *vw)
{
+
if (vw->vw_flags & VWF_SWWAIT_ACQ) {
vw->vw_flags &= ~VWF_SWWAIT_ACQ;
return 0;
@@ -1463,3 +1467,23 @@ vt_allocate(struct vt_driver *drv, void
vt_winsize(vd, vd->vd_windows[VT_CONSWINDOW]->vw_font, &wsz);
terminal_set_winsize(vd->vd_windows[VT_CONSWINDOW]->vw_terminal, &wsz);
}
+
+void
+vt_suspend()
+{
+
+ /* Save current window. */
+ main_vd->vd_savedwindow = main_vd->vd_curwindow;
+ /* Ask holding process to free window and switch to console window */
+ vt_proc_window_switch(main_vd->vd_windows[VT_CONSWINDOW]);
+}
+
+void
+vt_resume()
+{
+
+ /* Switch back to saved window */
+ if (main_vd->vd_savedwindow != NULL)
+ vt_proc_window_switch(main_vd->vd_savedwindow);
+ main_vd->vd_savedwindow = NULL;
+}
More information about the svn-src-user
mailing list