From 9c5049ab4d639088b6b5180fbbb7cbe0f14af801 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Mon, 6 Oct 2014 21:37:14 +0100 Subject: [PATCH] sna: Wrap rrGetInfo so that we can probe when udev is not active References: https://bugs.freedesktop.org/show_bug.cgi?id=84718 Signed-off-by: Chris Wilson --- src/sna/sna.h | 2 ++ src/sna/sna_driver.c | 23 ++++++++++++++++++----- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/src/sna/sna.h b/src/sna/sna.h index e035634..4cd85d1 100644 --- a/src/sna/sna.h +++ b/src/sna/sna.h @@ -312,6 +312,8 @@ struct sna { struct udev_monitor *backlight_monitor; pointer backlight_handler; #endif + + Bool (*rrGetInfo)(ScreenPtr, Rotation *); } mode; struct { diff --git a/src/sna/sna_driver.c b/src/sna/sna_driver.c index f28ca87..82d07cd 100644 --- a/src/sna/sna_driver.c +++ b/src/sna/sna_driver.c @@ -773,6 +773,15 @@ sna_wakeup_handler(WAKEUPHANDLER_ARGS_DECL) sna_mode_wakeup(sna); } +static Bool +sna_randr_probe(ScreenPtr screen, Rotation *rotations) +{ + struct sna *sna = to_sna_from_screen(screen); + + sna_mode_discover(sna); + return sna->mode.rrGetInfo(screen, rotations); +} + #if HAVE_UDEV static void sna_handle_uevents(int fd, void *closure) @@ -812,7 +821,7 @@ sna_handle_uevents(int fd, void *closure) udev_device_unref(dev); } -static void +static bool sna_uevent_init(struct sna *sna) { struct udev *u; @@ -820,7 +829,7 @@ sna_uevent_init(struct sna *sna) MessageType from = X_CONFIG; if (sna->flags & SNA_IS_HOSTED) - return; + return true; DBG(("%s\n", __FUNCTION__)); @@ -857,7 +866,7 @@ sna_uevent_init(struct sna *sna) out: xf86DrvMsg(sna->scrn->scrnIndex, from, "display hotplug detection %s\n", sna->uevent_monitor ? "enabled" : "disabled"); - return; + return sna->uevent_monitor != NULL; err_monitor: udev_monitor_unref(mon); @@ -886,7 +895,7 @@ sna_uevent_fini(struct sna *sna) DBG(("%s: removed uvent handler\n", __FUNCTION__)); } #else -static void sna_uevent_init(struct sna *sna) { } +static bool sna_uevent_init(struct sna *sna) { return sna->flags & SNA_IS_HOSTED;} static void sna_uevent_fini(struct sna *sna) { } #endif /* HAVE_UDEV */ @@ -1165,7 +1174,11 @@ sna_screen_init(SCREEN_INIT_ARGS_DECL) sna->suspended = FALSE; - sna_uevent_init(sna); + if (!sna_uevent_init(sna)) { + rrScrPrivPtr rp = rrGetScrPriv(screen); + sna->mode.rrGetInfo = rp->rrGetInfo; + rp->rrGetInfo = sna_randr_probe; + } return TRUE; } -- 1.9.1