From 39ebf87be749c59a06cb1763e11f14c722f77fbd Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Thu, 6 Sep 2012 16:33:54 +1000 Subject: dri2: invalidate drawable after sharing pixmap After we share the pixmap, the backing storage may have changed, and we need to invalidate and buffers pointing at it. This fixes GL compositors and prime windows lacking contents initially. Reviewed-by: Chris Wilson Signed-off-by: Dave Airlie (cherry picked from commit 22746df15b5f75dc85f5cf5b73932eb8a44cb89b) --- hw/xfree86/dri2/dri2.c | 74 ++++++++++++++++++++++++++++---------------------- 1 file changed, 42 insertions(+), 32 deletions(-) diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c index 23f589cdc..40963c3b0 100644 --- a/hw/xfree86/dri2/dri2.c +++ b/hw/xfree86/dri2/dri2.c @@ -766,6 +766,44 @@ static inline PixmapPtr GetDrawablePixmap(DrawablePtr drawable) } } +/* + * A TraverseTree callback to invalidate all windows using the same + * pixmap + */ +static int +DRI2InvalidateWalk(WindowPtr pWin, pointer data) +{ + if (pWin->drawable.pScreen->GetWindowPixmap(pWin) != data) + return WT_DONTWALKCHILDREN; + DRI2InvalidateDrawable(&pWin->drawable); + return WT_WALKCHILDREN; +} + +static void +DRI2InvalidateDrawableAll(DrawablePtr pDraw) +{ + if (pDraw->type == DRAWABLE_WINDOW) { + WindowPtr pWin = (WindowPtr) pDraw; + PixmapPtr pPixmap = pDraw->pScreen->GetWindowPixmap(pWin); + + /* + * Find the top-most window using this pixmap + */ + while (pWin->parent && + pDraw->pScreen->GetWindowPixmap(pWin->parent) == pPixmap) + pWin = pWin->parent; + + /* + * Walk the sub-tree to invalidate all of the + * windows using the same pixmap + */ + TraverseTree(pWin, DRI2InvalidateWalk, pPixmap); + DRI2InvalidateDrawable(&pPixmap->drawable); + } + else + DRI2InvalidateDrawable(pDraw); +} + DrawablePtr DRI2UpdatePrime(DrawablePtr pDraw, DRI2BufferPtr pDest) { DRI2DrawablePtr pPriv = DRI2GetDrawable(pDraw); @@ -831,6 +869,8 @@ DrawablePtr DRI2UpdatePrime(DrawablePtr pDraw, DRI2BufferPtr pDest) spix->screen_x = mpix->screen_x; spix->screen_y = mpix->screen_y; #endif + + DRI2InvalidateDrawableAll(pDraw); return &spix->drawable; } @@ -1048,18 +1088,7 @@ DRI2WaitSwap(ClientPtr client, DrawablePtr pDrawable) return FALSE; } -/* - * A TraverseTree callback to invalidate all windows using the same - * pixmap - */ -static int -DRI2InvalidateWalk(WindowPtr pWin, pointer data) -{ - if (pWin->drawable.pScreen->GetWindowPixmap(pWin) != data) - return WT_DONTWALKCHILDREN; - DRI2InvalidateDrawable(&pWin->drawable); - return WT_WALKCHILDREN; -} + int DRI2SwapBuffers(ClientPtr client, DrawablePtr pDraw, CARD64 target_msc, @@ -1162,26 +1191,7 @@ DRI2SwapBuffers(ClientPtr client, DrawablePtr pDraw, CARD64 target_msc, */ *swap_target = pPriv->swap_count + pPriv->swapsPending; - if (pDraw->type == DRAWABLE_WINDOW) { - WindowPtr pWin = (WindowPtr) pDraw; - PixmapPtr pPixmap = pScreen->GetWindowPixmap(pWin); - - /* - * Find the top-most window using this pixmap - */ - while (pWin->parent && - pScreen->GetWindowPixmap(pWin->parent) == pPixmap) - pWin = pWin->parent; - - /* - * Walk the sub-tree to invalidate all of the - * windows using the same pixmap - */ - TraverseTree(pWin, DRI2InvalidateWalk, pPixmap); - DRI2InvalidateDrawable(&pPixmap->drawable); - } - else - DRI2InvalidateDrawable(pDraw); + DRI2InvalidateDrawableAll(pDraw); return Success; } -- cgit v1.2.3 From c7c07558919102f06aeb3fad5f856f04e6757a76 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Mon, 10 Sep 2012 14:48:37 +1000 Subject: xf86/platform: scan pci after probing devices This solves a race if we are trying to dynamically power off secondary GPUs. Its not the greatest fix ever but it probably as good as we can do for now. The GPU probing causes the devices to be powered up, then when we scan the PCI bus we get the correct information from the kernel, rather than a bunch of 0xff due to the device being powered off. drop gratuitous '&'. Reviewed-by: Keith Packard Signed-off-by: Dave Airlie (cherry picked from commit 10672a5abe7d4e924844d7e41c86c24d6367a52b) --- hw/xfree86/common/xf86platformBus.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/xfree86/common/xf86platformBus.c b/hw/xfree86/common/xf86platformBus.c index 24b947326..6a8fb907a 100644 --- a/hw/xfree86/common/xf86platformBus.c +++ b/hw/xfree86/common/xf86platformBus.c @@ -213,11 +213,12 @@ xf86platformProbe(void) int i; Bool pci = TRUE; + config_odev_probe(xf86PlatformDeviceProbe); + if (!xf86scanpci()) { pci = FALSE; } - config_odev_probe(&xf86PlatformDeviceProbe); for (i = 0; i < xf86_num_platform_devices; i++) { char *busid = xf86_get_platform_attrib(i, ODEV_ATTRIB_BUSID); -- cgit v1.2.3 From 1e8c960f8777a889fbc17c8711b3e68fd094427b Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Thu, 13 Sep 2012 18:44:06 +1000 Subject: config/udev: ignore change on drm devices for input devices we handle change like remove/add, but for drm devices we get change events when we hotplug outputs, so lets just ignore change at this level, and let the drivers handle it. We may in the future want to route driver udev from here instead. Reported-by: Timo Aaltonen Reviewed-by: Keith Packard Signed-off-by: Dave Airlie (cherry picked from commit e0b92f5f86f8ce71ab4c80e9902e51e2525f9705) --- config/udev.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/config/udev.c b/config/udev.c index c2d00bbda..454838f4c 100644 --- a/config/udev.c +++ b/config/udev.c @@ -300,9 +300,15 @@ wakeup_handler(pointer data, int err, pointer read_mask) return; action = udev_device_get_action(udev_device); if (action) { - if (!strcmp(action, "add") || !strcmp(action, "change")) { + if (!strcmp(action, "add")) { device_removed(udev_device); device_added(udev_device); + } else if (!strcmp(action, "change")) { + /* ignore change for the drm devices */ + if (strcmp(udev_device_get_subsystem(udev_device), "drm")) { + device_removed(udev_device); + device_added(udev_device); + } } else if (!strcmp(action, "remove")) device_removed(udev_device); -- cgit v1.2.3 From b87edf1acca7e57139cd6bdf5838c2b4179352dc Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Mon, 27 Aug 2012 15:22:44 +1000 Subject: xf86: fix multi-seat video device support. (v2) If we are not seat 0 the following apply: don't probe any bus other than platform don't probe any drivers other than platform assume the first platform device we match on the bus is the primary GPU. This just adds checks in the correct places to ensure this, and with this X can now start on a secondary seat for an output device. v2: fix Seat0 macros Reviewed-by: Keith Packard Signed-off-by: Dave Airlie (cherry picked from commit 70e5766874a919039678bb2ed75f2ccea0cb4345) --- hw/xfree86/common/xf86Bus.c | 4 ++++ hw/xfree86/common/xf86platformBus.c | 3 +++ 2 files changed, 7 insertions(+) diff --git a/hw/xfree86/common/xf86Bus.c b/hw/xfree86/common/xf86Bus.c index 6de8409fc..4ffbf7e46 100644 --- a/hw/xfree86/common/xf86Bus.c +++ b/hw/xfree86/common/xf86Bus.c @@ -81,6 +81,8 @@ xf86CallDriverProbe(DriverPtr drv, Bool detect_only) if (drv->platformProbe != NULL) { foundScreen = xf86platformProbeDev(drv); } + if (ServerIsNotSeat0()) + return foundScreen; #endif #ifdef XSERVER_LIBPCIACCESS @@ -214,6 +216,8 @@ xf86BusProbe(void) { #ifdef XSERVER_PLATFORM_BUS xf86platformProbe(); + if (ServerIsNotSeat0()) + return; #endif #ifdef XSERVER_LIBPCIACCESS xf86PciProbe(); diff --git a/hw/xfree86/common/xf86platformBus.c b/hw/xfree86/common/xf86platformBus.c index 6a8fb907a..0525e39bc 100644 --- a/hw/xfree86/common/xf86platformBus.c +++ b/hw/xfree86/common/xf86platformBus.c @@ -359,6 +359,9 @@ xf86platformProbeDev(DriverPtr drvp) break; } else { + /* for non-seat0 servers assume first device is the master */ + if (ServerIsNotSeat0()) + break; if (xf86_platform_devices[j].pdev) { if (xf86IsPrimaryPlatform(&xf86_platform_devices[j])) break; -- cgit v1.2.3