From d31c7931532e2d3d891c85087a23d3d7f6299194 Mon Sep 17 00:00:00 2001 From: Federico Mena Quintero Date: Mon, 4 May 2009 19:24:47 -0500 Subject: [PATCH 1/2] randr: bug #21554 - re-probe outputs when coming back from laptop unsuspend Make RANDR wrap the EnterVT call chain, so it can re-probe the outputs when a laptop comes back from suspend/unsuspend. The X server should then send RRNotify events to clients, so they can cope with a monitor that was unplugged while the laptop was suspended. Signed-off-by: Federico Mena Quintero --- hw/xfree86/modes/xf86RandR12.c | 19 +++++++++++++++++++ randr/randrstr.h | 5 +++++ 2 files changed, 24 insertions(+), 0 deletions(-) diff --git a/hw/xfree86/modes/xf86RandR12.c b/hw/xfree86/modes/xf86RandR12.c index f941a3b..6cf3a9e 100644 --- a/hw/xfree86/modes/xf86RandR12.c +++ b/hw/xfree86/modes/xf86RandR12.c @@ -1744,6 +1744,21 @@ xf86RandR12ChangeGamma(int scrnIndex, Gamma gamma) } static Bool +xf86RandR12EnterVT (int index, int flags) +{ + ScrnInfoPtr pScrn = xf86Screens[index]; + rrScrPrivPtr rp = rrGetScrPriv(pScrn->pScreen); + ScreenPtr pScreen = screenInfo.screens[pScrn->scrnIndex]; + + if (rp->orig_EnterVT) { + if (!rp->orig_EnterVT (index, flags)) + return FALSE; + } + + return RRGetInfo (pScreen, TRUE); /* force a re-probe of outputs and notify clients about changes */ +} + +static Bool xf86RandR12Init12 (ScreenPtr pScreen) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; @@ -1765,6 +1780,10 @@ xf86RandR12Init12 (ScreenPtr pScreen) rp->rrSetConfig = NULL; pScrn->PointerMoved = xf86RandR12PointerMoved; pScrn->ChangeGamma = xf86RandR12ChangeGamma; + + rp->orig_EnterVT = pScrn->EnterVT; + pScrn->EnterVT = xf86RandR12EnterVT; + if (!xf86RandR12CreateObjects12 (pScreen)) return FALSE; diff --git a/randr/randrstr.h b/randr/randrstr.h index af14374..6af9cce 100644 --- a/randr/randrstr.h +++ b/randr/randrstr.h @@ -299,6 +299,11 @@ typedef struct _rrScrPriv { int rate; int size; #endif + + /* Used to wrap EnterVT so we can re-probe the outputs when a laptop unsuspends + * See https://bugs.freedesktop.org/show_bug.cgi?id=21554 + */ + xf86EnterVTProc *orig_EnterVT; } rrScrPrivRec, *rrScrPrivPtr; extern _X_EXPORT DevPrivateKey rrPrivKey; -- 1.6.0.2 From 6304ddb37f76814bc6e6703aaa34a5f2e140466c Mon Sep 17 00:00:00 2001 From: Federico Mena Quintero Date: Mon, 4 May 2009 20:51:30 -0500 Subject: [PATCH 2/2] Include xf86str.h to get the declaration for xf86EnterVTProc Signed-off-by: Federico Mena Quintero --- hw/kdrive/ephyr/Makefile.am | 19 +++++++++++-------- hw/kdrive/linux/Makefile.am | 10 +++++++--- hw/kdrive/src/Makefile.am | 9 ++++++--- randr/Makefile.am | 5 +++++ randr/randrstr.h | 1 + 5 files changed, 30 insertions(+), 14 deletions(-) diff --git a/hw/kdrive/ephyr/Makefile.am b/hw/kdrive/ephyr/Makefile.am index ec6f445..8eca8d1 100644 --- a/hw/kdrive/ephyr/Makefile.am +++ b/hw/kdrive/ephyr/Makefile.am @@ -1,11 +1,14 @@ -INCLUDES = \ - @KDRIVE_INCS@ \ - @KDRIVE_CFLAGS@ \ - @XEPHYR_INCS@ \ - @XEPHYR_CFLAGS@ \ - @DRIPROTO_CFLAGS@ \ - -I$(top_srcdir) \ - -I$(top_srcdir)/exa +INCLUDES = \ + @KDRIVE_INCS@ \ + @KDRIVE_CFLAGS@ \ + @XEPHYR_INCS@ \ + @XEPHYR_CFLAGS@ \ + @DRIPROTO_CFLAGS@ \ + -I$(top_srcdir) \ + -I$(top_srcdir)/exa \ + -I$(top_srcdir)/hw/xfree86/os-support \ + -I$(top_srcdir)/hw/xfree86/os-support/bus \ + -I$(top_srcdir)/hw/xfree86/common if XV LIBXEPHYR_HOSTXV=libxephyr-hostxv.la diff --git a/hw/kdrive/linux/Makefile.am b/hw/kdrive/linux/Makefile.am index be07561..d4ada08 100644 --- a/hw/kdrive/linux/Makefile.am +++ b/hw/kdrive/linux/Makefile.am @@ -1,6 +1,10 @@ -INCLUDES = \ - @KDRIVE_INCS@ \ - @KDRIVE_CFLAGS@ +INCLUDES = \ + @KDRIVE_INCS@ \ + @KDRIVE_CFLAGS@ \ + -I$(top_srcdir)/hw/xfree86/os-support \ + -I$(top_srcdir)/hw/xfree86/os-support/bus \ + -I$(top_srcdir)/hw/xfree86/common + AM_CFLAGS = -DHAVE_DIX_CONFIG_H diff --git a/hw/kdrive/src/Makefile.am b/hw/kdrive/src/Makefile.am index 968978e..a7eeaec 100644 --- a/hw/kdrive/src/Makefile.am +++ b/hw/kdrive/src/Makefile.am @@ -1,6 +1,9 @@ -INCLUDES = \ - @KDRIVE_INCS@ \ - @KDRIVE_CFLAGS@ +INCLUDES = \ + @KDRIVE_INCS@ \ + @KDRIVE_CFLAGS@ \ + -I$(top_srcdir)/hw/xfree86/os-support \ + -I$(top_srcdir)/hw/xfree86/os-support/bus \ + -I$(top_srcdir)/hw/xfree86/common AM_CFLAGS = -DHAVE_DIX_CONFIG_H diff --git a/randr/Makefile.am b/randr/Makefile.am index 1f1bea0..aa6a9a8 100644 --- a/randr/Makefile.am +++ b/randr/Makefile.am @@ -8,6 +8,11 @@ if XORG sdk_HEADERS = randrstr.h rrtransform.h endif +INCLUDES = \ + -I$(top_srcdir)/hw/xfree86/os-support \ + -I$(top_srcdir)/hw/xfree86/os-support/bus \ + -I$(top_srcdir)/hw/xfree86/common + librandr_la_SOURCES = \ mirandr.c \ randr.c \ diff --git a/randr/randrstr.h b/randr/randrstr.h index 6af9cce..46baaed 100644 --- a/randr/randrstr.h +++ b/randr/randrstr.h @@ -52,6 +52,7 @@ #include "picturestr.h" #endif #include +#include /* required for ABI compatibility for now */ #define RANDR_10_INTERFACE 1 -- 1.6.0.2