summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@openbsd.org>2013-03-09 13:13:00 +0100
committerMark Kettenis <kettenis@openbsd.org>2013-03-09 13:13:00 +0100
commit4be621b6c9556458a195a7ae0e2dd9b39beff441 (patch)
treeb2c15de71f2e596183ff0f3b8ee6ec077a8c354d
parent29ef1c73dd123c46689aee02bbbb943e8e44d17d (diff)
Do the proper callback dance when switching screens
-rw-r--r--sys/dev/pci/drm/i915_drv.c22
-rw-r--r--sys/dev/pci/drm/i915_drv.h3
2 files changed, 24 insertions, 1 deletions
diff --git a/sys/dev/pci/drm/i915_drv.c b/sys/dev/pci/drm/i915_drv.c
index ca89e2681b7..cf890710068 100644
--- a/sys/dev/pci/drm/i915_drv.c
+++ b/sys/dev/pci/drm/i915_drv.c
@@ -593,6 +593,7 @@ int inteldrm_alloc_screen(void *, const struct wsscreen_descr *,
void inteldrm_free_screen(void *, void *);
int inteldrm_show_screen(void *, void *, int,
void (*)(void *, int, int), void *);
+void inteldrm_doswitch(void *, void *);
struct wsscreen_descr inteldrm_stdscreen = {
"std",
@@ -686,11 +687,30 @@ inteldrm_show_screen(void *v, void *cookie, int waitok,
void (*cb)(void *, int, int), void *cbarg)
{
struct inteldrm_softc *dev_priv = v;
+
+ dev_priv->switchcb = cb;
+ dev_priv->switchcbarg = cbarg;
+ if (cb) {
+ workq_queue_task(NULL, &dev_priv->switchwqt, 0,
+ inteldrm_doswitch, v, cookie);
+ return (EAGAIN);
+ }
+
+ inteldrm_doswitch(v, cookie);
+
+ return (0);
+}
+
+void
+inteldrm_doswitch(void *v, void *cookie)
+{
+ struct inteldrm_softc *dev_priv = v;
struct drm_device *dev = (struct drm_device *)dev_priv->drmdev;
intel_fb_restore_mode(dev);
- return (0);
+ if (dev_priv->switchcb)
+ (*dev_priv->switchcb)(dev_priv->switchcbarg, 0, 0);
}
/*
diff --git a/sys/dev/pci/drm/i915_drv.h b/sys/dev/pci/drm/i915_drv.h
index 175aa3d5628..16b3d9fe2d2 100644
--- a/sys/dev/pci/drm/i915_drv.h
+++ b/sys/dev/pci/drm/i915_drv.h
@@ -506,6 +506,9 @@ struct inteldrm_softc {
struct vga_pci_bar *regs;
int nscreens;
+ void (*switchcb)(void *, int, int);
+ void *switchcbarg;
+ struct workq_task switchwqt;
struct rasops_info ro;
int noaccel;