From 77313bdc76b2dc4e9992432379e8d54a99d27d1f Mon Sep 17 00:00:00 2001 From: Aaron Plattner Date: Mon, 9 Jun 2008 09:52:04 -0700 Subject: [PATCH 01/14] CreateColormap returns Success on success, not TRUE. Fixes a problem where enabling color index overlays disables the RENDER extension. (cherry picked from commit 607b0d09ea003f87cfb3331e59e13495a483832a) --- render/picture.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/render/picture.c b/render/picture.c index 35e2a28b3..2fbd09e8b 100644 --- a/render/picture.c +++ b/render/picture.c @@ -413,8 +413,9 @@ PictureInitIndexedFormat(ScreenPtr pScreen, PictFormatPtr format) (ColormapPtr) LookupIDByType(pScreen->defColormap, RT_COLORMAP); } else { VisualPtr pVisual = PictureFindVisual(pScreen, format->index.vid); - if (!CreateColormap(FakeClientID (0), pScreen, pVisual, - &format->index.pColormap, AllocNone, 0)) + if (CreateColormap(FakeClientID (0), pScreen, pVisual, + &format->index.pColormap, AllocNone, 0) + != Success) return FALSE; } if (!ps->InitIndexed(pScreen, format)) From 50e77eb8384b8d9c569ef3726bb7f4abf43b2af8 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Tue, 20 May 2008 13:59:09 +1000 Subject: [PATCH 02/14] int10: add pci_device_enable support on Linux (cherry picked from commit ea4ec9e9983e25d94a3edf8a77ed2ad1db193284) --- configure.ac | 1 + hw/xfree86/os-support/linux/int10/linux.c | 4 ++++ include/xorg-config.h.in | 3 +++ 3 files changed, 8 insertions(+) diff --git a/configure.ac b/configure.ac index 07df3dbef..e53801bb4 100644 --- a/configure.ac +++ b/configure.ac @@ -1331,6 +1331,7 @@ if test "x$XORG" = xyes -o "x$XGL" = xyes; then CFLAGS=$PCIACCESS_CFLAGS LIBS=$PCIACCESS_LIBS AC_CHECK_FUNCS([pci_system_init_dev_mem]) + AC_CHECK_FUNCS([pci_device_enable]) LIBS=$SAVE_LIBS CFLAGS=$SAVE_CFLAGS XORG_SYS_LIBS="$XORG_SYS_LIBS $PCIACCESS_LIBS $DLOPEN_LIBS $GLX_SYS_LIBS" diff --git a/hw/xfree86/os-support/linux/int10/linux.c b/hw/xfree86/os-support/linux/int10/linux.c index 574843473..9e2c6199c 100644 --- a/hw/xfree86/os-support/linux/int10/linux.c +++ b/hw/xfree86/os-support/linux/int10/linux.c @@ -278,6 +278,10 @@ xf86ExtendedInitInt10(int entityIndex, int Flags) struct pci_device *rom_device = xf86GetPciInfoForEntity(pInt->entityIndex); +#if HAVE_PCI_DEVICE_ENABLE + pci_device_enable(rom_device); +#endif + err = pci_device_read_rom(rom_device, (unsigned char *)(V_BIOS)); if (err) { xf86DrvMsg(screen,X_ERROR,"Cannot read V_BIOS (%s)\n", diff --git a/include/xorg-config.h.in b/include/xorg-config.h.in index 5587c0a8d..e05d3bfd3 100644 --- a/include/xorg-config.h.in +++ b/include/xorg-config.h.in @@ -118,6 +118,9 @@ /* Have pci_system_init_dev_mem() */ #undef HAVE_PCI_SYSTEM_INIT_DEV_MEM +/* Have pci_enable_device */ +#undef HAVE_PCI_DEVICE_ENABLE + /* Path to text files containing PCI IDs */ #undef PCI_TXT_IDS_PATH From 0fba91a5324662c10d15bc0e41cc8737c51340bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Mon, 21 Apr 2008 10:45:11 +0200 Subject: [PATCH 03/14] EXA: Offscreen memory eviction improvements. * Make sure available areas are considered to have no eviction cost. This seems to help for https://bugs.freedesktop.org/show_bug.cgi?id=15513 but I'm afraid that may just be coincidence. * Only calculate eviction cost of each area once for each eviction pass. Safeguard against potential (though unlikely) division by zero. * Cosmetic enhancements: Name eviction cost related variables 'cost' instead of 'score' to emphasize that smaller values are better, update Doxygen file comment to the way eviction works now. (cherry picked from commit 6c95fae1e9d6b0eb64bc78eced05a6e9f5faf02e) --- exa/exa.h | 2 ++ exa/exa_offscreen.c | 49 +++++++++++++++++++++++++++++++-------------- 2 files changed, 36 insertions(+), 15 deletions(-) diff --git a/exa/exa.h b/exa/exa.h index 97ae6c0a5..256209418 100644 --- a/exa/exa.h +++ b/exa/exa.h @@ -64,6 +64,8 @@ struct _ExaOffscreenArea { ExaOffscreenState state; ExaOffscreenArea *next; + + unsigned eviction_cost; }; /** diff --git a/exa/exa_offscreen.c b/exa/exa_offscreen.c index 85b538896..4aaa2c132 100644 --- a/exa/exa_offscreen.c +++ b/exa/exa_offscreen.c @@ -21,11 +21,9 @@ */ /** @file - * This allocator allocates blocks of memory by maintaining a list of areas - * and a score for each area. As an area is marked used, its score is - * incremented, and periodically all of the areas have their scores decayed by - * a fraction. When allocating, the contiguous block of areas with the minimum - * score is found and evicted in order to make room for the new allocation. + * This allocator allocates blocks of memory by maintaining a list of areas. + * When allocating, the contiguous block of areas with the minimum eviction + * cost is found and evicted in order to make room for the new allocation. */ #include "exa_priv.h" @@ -71,19 +69,36 @@ ExaOffscreenKickOut (ScreenPtr pScreen, ExaOffscreenArea *area) return exaOffscreenFree (pScreen, area); } -#define AREA_SCORE(area) (area->size / (double)(pExaScr->offScreenCounter - area->last_use)) +static void +exaUpdateEvictionCost(ExaOffscreenArea *area, unsigned offScreenCounter) +{ + unsigned age; + + if (area->state == ExaOffscreenAvail) + return; + + age = offScreenCounter - area->last_use; + + /* This is unlikely to happen, but could result in a division by zero... */ + if (age > (UINT_MAX / 2)) { + age = UINT_MAX / 2; + area->last_use = offScreenCounter - age; + } + + area->eviction_cost = area->size / age; +} static ExaOffscreenArea * exaFindAreaToEvict(ExaScreenPrivPtr pExaScr, int size, int align) { ExaOffscreenArea *begin, *end, *best; - double score, best_score; + unsigned cost, best_cost; int avail, real_size, tmp; - best_score = UINT_MAX; + best_cost = UINT_MAX; begin = end = pExaScr->info->offScreenAreas; avail = 0; - score = 0; + cost = 0; best = 0; while (end != NULL) @@ -106,23 +121,24 @@ exaFindAreaToEvict(ExaScreenPrivPtr pExaScr, int size, int align) if (end->state == ExaOffscreenLocked) { /* Can't more room here, restart after this locked area */ avail = 0; - score = 0; + cost = 0; begin = end; goto restart; } avail += end->size; - score += AREA_SCORE(end); + exaUpdateEvictionCost(end, pExaScr->offScreenCounter); + cost += end->eviction_cost; end = end->next; } - /* Check the score, update best */ - if (avail >= real_size && score < best_score) { + /* Check the cost, update best */ + if (avail >= real_size && cost < best_cost) { best = begin; - best_score = score; + best_cost = cost; } avail -= begin->size; - score -= AREA_SCORE(begin); + cost -= begin->eviction_cost; begin = begin->next; } @@ -244,6 +260,7 @@ exaOffscreenAlloc (ScreenPtr pScreen, int size, int align, new_area->state = ExaOffscreenAvail; new_area->save = NULL; new_area->last_use = 0; + new_area->eviction_cost = 0; new_area->next = area->next; area->next = new_area; area->size = real_size; @@ -409,6 +426,7 @@ exaOffscreenFree (ScreenPtr pScreen, ExaOffscreenArea *area) area->state = ExaOffscreenAvail; area->save = NULL; area->last_use = 0; + area->eviction_cost = 0; /* * Find previous area */ @@ -474,6 +492,7 @@ exaOffscreenInit (ScreenPtr pScreen) area->save = NULL; area->next = NULL; area->last_use = 0; + area->eviction_cost = 0; /* Add it to the free areas */ pExaScr->info->offScreenAreas = area; From 2df83b491e87b27a3bba2fd874afe74a6af7e2cc Mon Sep 17 00:00:00 2001 From: Tilman Sauerbeck Date: Mon, 21 Apr 2008 11:03:27 +0200 Subject: [PATCH 04/14] EXA: Update sys_pitch/fb_pitch in exaModifyPixmapHeader. exaModifyPixmapHeader now also only evaluates arguments that have a meaningful value. (cherry picked from commit 26c1801a27b81fdd988d5bd210ba0e76ecc274ae) --- exa/exa.c | 43 ++++++++++++++++++++++++++++--------------- 1 file changed, 28 insertions(+), 15 deletions(-) diff --git a/exa/exa.c b/exa/exa.c index 81dc3e2ab..0e3ea7036 100644 --- a/exa/exa.c +++ b/exa/exa.c @@ -248,6 +248,19 @@ exaSetAccelBlock(ExaScreenPrivPtr pExaScr, ExaPixmapPrivPtr pExaPixmap, pExaPixmap->accel_blocked |= EXA_RANGE_HEIGHT; } +static void +exaSetFbPitch(ExaScreenPrivPtr pExaScr, ExaPixmapPrivPtr pExaPixmap, + int w, int h, int bpp) +{ + if (pExaScr->info->flags & EXA_OFFSCREEN_ALIGN_POT && w != 1) + pExaPixmap->fb_pitch = (1 << (exaLog2(w - 1) + 1)) * bpp / 8; + else + pExaPixmap->fb_pitch = w * bpp / 8; + + pExaPixmap->fb_pitch = EXA_ALIGN(pExaPixmap->fb_pitch, + pExaScr->info->pixmapPitchAlign); +} + /** * exaCreatePixmap() creates a new pixmap. * @@ -292,12 +305,8 @@ exaCreatePixmap(ScreenPtr pScreen, int w, int h, int depth, if (paddedWidth / 4 > 32767 || h > 32767) return NullPixmap; - if (pExaScr->info->flags & EXA_OFFSCREEN_ALIGN_POT && w != 1) - pExaPixmap->fb_pitch = (1 << (exaLog2(w - 1) + 1)) * bpp / 8; - else - pExaPixmap->fb_pitch = w * bpp / 8; - pExaPixmap->fb_pitch = EXA_ALIGN(pExaPixmap->fb_pitch, - pExaScr->info->pixmapPitchAlign); + exaSetFbPitch(pExaScr, pExaPixmap, w, h, bpp); + if (paddedWidth < pExaPixmap->fb_pitch) paddedWidth = pExaPixmap->fb_pitch; @@ -331,12 +340,7 @@ exaCreatePixmap(ScreenPtr pScreen, int w, int h, int depth, pExaPixmap->offscreen = FALSE; pExaPixmap->fb_ptr = NULL; - if (pExaScr->info->flags & EXA_OFFSCREEN_ALIGN_POT && w != 1) - pExaPixmap->fb_pitch = (1 << (exaLog2(w - 1) + 1)) * bpp / 8; - else - pExaPixmap->fb_pitch = w * bpp / 8; - pExaPixmap->fb_pitch = EXA_ALIGN(pExaPixmap->fb_pitch, - pExaScr->info->pixmapPitchAlign); + exaSetFbPitch(pExaScr, pExaPixmap, w, h, bpp); pExaPixmap->fb_size = pExaPixmap->fb_pitch * h; if (pExaPixmap->fb_pitch > 131071) { @@ -384,10 +388,19 @@ exaModifyPixmapHeader(PixmapPtr pPixmap, int width, int height, int depth, pExaPixmap = ExaGetPixmapPriv(pPixmap); if (pExaPixmap) { - pExaPixmap->sys_ptr = pPixData; + if (pPixData) + pExaPixmap->sys_ptr = pPixData; - exaSetAccelBlock(pExaScr, pExaPixmap, - width, height, bitsPerPixel); + if (devKind > 0) + pExaPixmap->sys_pitch = devKind; + + if (width > 0 && height > 0 && bitsPerPixel > 0) { + exaSetFbPitch(pExaScr, pExaPixmap, + width, height, bitsPerPixel); + + exaSetAccelBlock(pExaScr, pExaPixmap, + width, height, bitsPerPixel); + } } From 200d676be2de8d83899420655efe870ac0b61d24 Mon Sep 17 00:00:00 2001 From: Tilman Sauerbeck Date: Mon, 21 Apr 2008 11:22:07 +0200 Subject: [PATCH 05/14] EXA: Set pixmap->accel_blocked on the screen pixmap, too. (cherry picked from commit 3f081b4de55e1378728a24d069bf06575ffca2d8) --- exa/exa.c | 32 ++++++++++++++++++++++++++++++++ exa/exa_priv.h | 1 + 2 files changed, 33 insertions(+) diff --git a/exa/exa.c b/exa/exa.c index 0e3ea7036..3a6ad988e 100644 --- a/exa/exa.c +++ b/exa/exa.c @@ -699,6 +699,34 @@ exaBitmapToRegion(PixmapPtr pPix) return ret; } +static Bool +exaCreateScreenResources(ScreenPtr pScreen) +{ + ExaScreenPriv(pScreen); + PixmapPtr pScreenPixmap; + Bool b; + + pScreen->CreateScreenResources = pExaScr->SavedCreateScreenResources; + b = pScreen->CreateScreenResources(pScreen); + pScreen->CreateScreenResources = exaCreateScreenResources; + + if (!b) + return FALSE; + + pScreenPixmap = pScreen->GetScreenPixmap(pScreen); + + if (pScreenPixmap) { + ExaPixmapPriv(pScreenPixmap); + + exaSetAccelBlock(pExaScr, pExaPixmap, + pScreenPixmap->drawable.width, + pScreenPixmap->drawable.height, + pScreenPixmap->drawable.bitsPerPixel); + } + + return TRUE; +} + /** * exaCloseScreen() unwraps its wrapped screen functions and tears down EXA's * screen private, before calling down to the next CloseSccreen. @@ -720,6 +748,7 @@ exaCloseScreen(int i, ScreenPtr pScreen) pScreen->CopyWindow = pExaScr->SavedCopyWindow; pScreen->ChangeWindowAttributes = pExaScr->SavedChangeWindowAttributes; pScreen->BitmapToRegion = pExaScr->SavedBitmapToRegion; + pScreen->CreateScreenResources = pExaScr->SavedCreateScreenResources; #ifdef RENDER if (ps) { ps->Composite = pExaScr->SavedComposite; @@ -877,6 +906,9 @@ exaDriverInit (ScreenPtr pScreen, pExaScr->SavedBitmapToRegion = pScreen->BitmapToRegion; pScreen->BitmapToRegion = exaBitmapToRegion; + pExaScr->SavedCreateScreenResources = pScreen->CreateScreenResources; + pScreen->CreateScreenResources = exaCreateScreenResources; + #ifdef RENDER if (ps) { pExaScr->SavedComposite = ps->Composite; diff --git a/exa/exa_priv.h b/exa/exa_priv.h index e41f46aba..0138e4a7d 100644 --- a/exa/exa_priv.h +++ b/exa/exa_priv.h @@ -107,6 +107,7 @@ typedef struct { CopyWindowProcPtr SavedCopyWindow; ChangeWindowAttributesProcPtr SavedChangeWindowAttributes; BitmapToRegionProcPtr SavedBitmapToRegion; + CreateScreenResourcesProcPtr SavedCreateScreenResources; ModifyPixmapHeaderProcPtr SavedModifyPixmapHeader; #ifdef RENDER CompositeProcPtr SavedComposite; From 30774d6b3cde6deda7a21ad25e396449fb791237 Mon Sep 17 00:00:00 2001 From: Drew Parsons Date: Mon, 10 Mar 2008 13:48:05 +1100 Subject: [PATCH 06/14] Define XPRINT in XPRINT_CFLAGS (configure.ac) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -DXPRINT had only been set for Xprt in hw/xprint/Makefile.am After commit 7c0709a736c0f3aa011de67dd2c2962585ab146e it is also required for ps/PsArea.c and PsFonts.c to ensure ‘requestingClient’ is defined, so make it a global Xprint definition in configure.ac. (cherry picked from commit 28a6719fd486d9a9cecad0b057d9ea7c59c66055) (cherry picked from commit 571206832d454771e3c638c7515767958365c19c) --- configure.ac | 2 +- hw/xprint/Makefile.am | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index e53801bb4..4bb437086 100644 --- a/configure.ac +++ b/configure.ac @@ -1601,7 +1601,7 @@ AC_MSG_RESULT([$XPRINT]) if test "x$XPRINT" = xyes; then PKG_CHECK_MODULES([XPRINTMODULES], [printproto x11 xfont $XDMCP_MODULES xau]) - XPRINT_CFLAGS="$XPRINTMODULES_CFLAGS" + XPRINT_CFLAGS="$XPRINTMODULES_CFLAGS -DXPRINT" XPRINT_LIBS="$XEXT_LIB $CONFIG_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $RENDER_LIB $COMPOSITE_LIB $RANDR_LIB $XI_LIB $FIXES_LIB $DAMAGE_LIB $XI_LIB $GLX_LIBS $MIEXT_DAMAGE_LIB $XKB_LIB $XKB_STUB_LIB" XPRINT_SYS_LIBS="$XPRINTMODULES_LIBS" diff --git a/hw/xprint/Makefile.am b/hw/xprint/Makefile.am index 1b8004841..5ca04ffc1 100644 --- a/hw/xprint/Makefile.am +++ b/hw/xprint/Makefile.am @@ -3,7 +3,7 @@ SUBDIRS = doc pcl pcl-mono raster ps etc config bin_PROGRAMS = Xprt Xprt_CFLAGS = @DIX_CFLAGS@ @XPRINT_CFLAGS@ \ - -DXPRINT -DPRINT_ONLY_SERVER -D_XP_PRINT_SERVER_ \ + -DPRINT_ONLY_SERVER -D_XP_PRINT_SERVER_ \ -DXPRINTDIR=\"$(libdir)/X11/xserver\" \ -DXPRASTERDDX -DXPPCLDDX -DXPMONOPCLDDX -DXPPSDDX \ -DXFree86Server From 2f994cb00e9b6d0e8362b9d777091dd673960d53 Mon Sep 17 00:00:00 2001 From: Drew Parsons Date: Mon, 10 Mar 2008 22:54:49 +1100 Subject: [PATCH 07/14] Create dix/libXpdix.la for Xprint-specific build of libdix.la (cherry picked from commit 4e2c6dbabdbbaaca213fd08edd422de15d0900cc) required because of commit 7c0709a736c0f3aa011de67dd2c2962585ab146e, which made requestingClient in dix specific to Xprint only. Add to XPRINT_LIBS in hw/xprint/Makefile.am in front of $(XSERVER_LIBS) to override definitions in libdix.la for standard xservers. Follows 571206832d454771e3c638c7515767958365c19c (providing -DXPRINT to xprint subdirs). Note it may be possible to restructure the code so that requestingClient is stored elsewhere than in dix. See discussions following http://lists.freedesktop.org/archives/xorg/2008-March/033844.html If this is done it may be possible to revert this commit (if not 571206...). (cherry picked from commit 966ae1781f3ca563e15a9a1b8cab6fab94e07fe9) --- dix/Makefile.am | 14 ++++++++++++-- hw/xprint/Makefile.am | 1 + 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/dix/Makefile.am b/dix/Makefile.am index b7b1ec071..e44b51081 100644 --- a/dix/Makefile.am +++ b/dix/Makefile.am @@ -1,4 +1,10 @@ -noinst_LTLIBRARIES = libdix.la libxpstubs.la +standard_dix_libs = libdix.la libxpstubs.la + +if XPRINT +noinst_LTLIBRARIES = $(standard_dix_libs) libXpdix.la +else +noinst_LTLIBRARIES = $(standard_dix_libs) +endif AM_CFLAGS = $(DIX_CFLAGS) \ -DVENDOR_NAME=\""@VENDOR_NAME@"\" \ @@ -39,7 +45,11 @@ libdix_la_SOURCES = \ libxpstubs_la_SOURCES = \ xpstubs.c -INCLUDES = -I$(top_srcdir)/Xprint +if XPRINT +libXpdix_la_SOURCES = $(libdix_la_SOURCES) +libXpdix_la_CPPFLAGS = -I$(top_srcdir)/hw/xprint +libXpdix_la_CFLAGS = $(AM_CFLAGS) $(XPRINT_CFLAGS) +endif EXTRA_DIST = buildatoms BuiltInAtoms CHANGES Xserver.d Xserver-dtrace.h.in diff --git a/hw/xprint/Makefile.am b/hw/xprint/Makefile.am index 5ca04ffc1..2ed7aaf57 100644 --- a/hw/xprint/Makefile.am +++ b/hw/xprint/Makefile.am @@ -17,6 +17,7 @@ XPRINT_LIBS = \ pcl-mono/libpcl.la \ $(top_builddir)/fb/libfb.la \ $(top_builddir)/render/librender.la \ + $(top_builddir)/dix/libXpdix.la \ $(XSERVER_LIBS) \ $(top_builddir)/Xext/libXext.la \ $(top_builddir)/xkb/libxkb.la \ From c00ff932f88f497dd638662c151ea63ffbc8bed1 Mon Sep 17 00:00:00 2001 From: Drew Parsons Date: Fri, 9 May 2008 23:20:11 +1000 Subject: [PATCH 08/14] Disable D-BUS from Xprint. Use dummy config functions to replace those from config/config.c, and therefore do not link Xprt with $CONFIG_LIB. Works around an endlessly spinning loop in dix/dispatch.c::Dispatch() (WaitForSomething() not waiting) when built with dbus, which was causing Xprt to use 95% cpu. (cherry picked from commit 2a3d1421e0cc18822ae8f478fcc272e16a9e9340) --- configure.ac | 2 +- hw/xprint/ddxInit.c | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 4bb437086..3b2e7618c 100644 --- a/configure.ac +++ b/configure.ac @@ -1602,7 +1602,7 @@ AC_MSG_RESULT([$XPRINT]) if test "x$XPRINT" = xyes; then PKG_CHECK_MODULES([XPRINTMODULES], [printproto x11 xfont $XDMCP_MODULES xau]) XPRINT_CFLAGS="$XPRINTMODULES_CFLAGS -DXPRINT" - XPRINT_LIBS="$XEXT_LIB $CONFIG_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $RENDER_LIB $COMPOSITE_LIB $RANDR_LIB $XI_LIB $FIXES_LIB $DAMAGE_LIB $XI_LIB $GLX_LIBS $MIEXT_DAMAGE_LIB $XKB_LIB $XKB_STUB_LIB" + XPRINT_LIBS="$XEXT_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $RENDER_LIB $COMPOSITE_LIB $RANDR_LIB $XI_LIB $FIXES_LIB $DAMAGE_LIB $XI_LIB $GLX_LIBS $MIEXT_DAMAGE_LIB $XKB_LIB $XKB_STUB_LIB" XPRINT_SYS_LIBS="$XPRINTMODULES_LIBS" xpconfigdir=$libdir/X11/xserver diff --git a/hw/xprint/ddxInit.c b/hw/xprint/ddxInit.c index d744121aa..795052120 100644 --- a/hw/xprint/ddxInit.c +++ b/hw/xprint/ddxInit.c @@ -291,6 +291,12 @@ ddxProcessArgument ( #include "XIstubs.h" #include "exglobals.h" +/* Place dummy config functions here instead of config/config.c, + since Xprint does not use D-BUS */ +void config_init() { } +void config_fini() { } + + int ChangePointerDevice ( DeviceIntPtr old_dev, From 3943a3a567c76aa3aee2ffe577e8d1d8c2c0f26b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Sat, 24 May 2008 20:01:21 +0200 Subject: [PATCH 09/14] EXA: Specify region used for source pixmap migration in exaCopyNtoN. Avoids excessive migration overhead in some pathological cases. See http://bugs.freedesktop.org/show_bug.cgi?id=15845 . (cherry picked from commit 3baf3b42e079b4e7b61c1e20df305db0724d21f8) --- exa/exa_accel.c | 52 +++++++++++++++++++++++++++++-------------------- 1 file changed, 31 insertions(+), 21 deletions(-) diff --git a/exa/exa_accel.c b/exa/exa_accel.c index c2bfdee6b..da9e7146a 100644 --- a/exa/exa_accel.c +++ b/exa/exa_accel.c @@ -487,7 +487,8 @@ exaCopyNtoN (DrawablePtr pSrcDrawable, int src_off_x, src_off_y; int dst_off_x, dst_off_y; ExaMigrationRec pixmaps[2]; - RegionPtr region = NULL; + RegionPtr srcregion = NULL, dstregion = NULL; + xRectangle *rects; pSrcPixmap = exaGetDrawablePixmap (pSrcDrawable); pDstPixmap = exaGetDrawablePixmap (pDstDrawable); @@ -495,33 +496,38 @@ exaCopyNtoN (DrawablePtr pSrcDrawable, exaGetDrawableDeltas (pSrcDrawable, pSrcPixmap, &src_off_x, &src_off_y); exaGetDrawableDeltas (pDstDrawable, pDstPixmap, &dst_off_x, &dst_off_y); - if (!pGC || !exaGCReadsDestination(pDstDrawable, pGC->planemask, - pGC->fillStyle, pGC->alu)) { - xRectangle *rects = xalloc(nbox * sizeof(xRectangle)); + rects = xalloc(nbox * sizeof(xRectangle)); - if (rects) { - int i; + if (rects) { + int i; - for (i = 0; i < nbox; i++) { - rects[i].x = pbox[i].x1 + dst_off_x; - rects[i].y = pbox[i].y1 + dst_off_y; - rects[i].width = pbox[i].x2 - pbox[i].x1; - rects[i].height = pbox[i].y2 - pbox[i].y1; - } + for (i = 0; i < nbox; i++) { + rects[i].x = pbox[i].x1 + dx + src_off_x; + rects[i].y = pbox[i].y1 + dy + src_off_y; + rects[i].width = pbox[i].x2 - pbox[i].x1; + rects[i].height = pbox[i].y2 - pbox[i].y1; + } - region = RECTS_TO_REGION(pScreen, nbox, rects, CT_YXBANDED); - xfree(rects); + srcregion = RECTS_TO_REGION(pScreen, nbox, rects, CT_YXBANDED); + xfree(rects); + + if (!pGC || !exaGCReadsDestination(pDstDrawable, pGC->planemask, + pGC->fillStyle, pGC->alu)) { + dstregion = REGION_CREATE(pScreen, NullBox, 0); + REGION_COPY(pScreen, dstregion, srcregion); + REGION_TRANSLATE(pScreen, dstregion, dst_off_x - dx - src_off_x, + dst_off_y - dy - src_off_y); } } pixmaps[0].as_dst = TRUE; pixmaps[0].as_src = FALSE; pixmaps[0].pPix = pDstPixmap; - pixmaps[0].pReg = region; + pixmaps[0].pReg = dstregion; pixmaps[1].as_dst = FALSE; pixmaps[1].as_src = TRUE; pixmaps[1].pPix = pSrcPixmap; - pixmaps[1].pReg = NULL; + pixmaps[1].pReg = srcregion; pSrcExaPixmap = ExaGetPixmapPriv (pSrcPixmap); pDstExaPixmap = ExaGetPixmapPriv (pDstPixmap); @@ -574,17 +580,21 @@ fallback: EXA_FALLBACK(("from %p to %p (%c,%c)\n", pSrcDrawable, pDstDrawable, exaDrawableLocation(pSrcDrawable), exaDrawableLocation(pDstDrawable))); - exaPrepareAccessReg (pDstDrawable, EXA_PREPARE_DEST, region); - exaPrepareAccess (pSrcDrawable, EXA_PREPARE_SRC); + exaPrepareAccessReg (pDstDrawable, EXA_PREPARE_DEST, dstregion); + exaPrepareAccessReg (pSrcDrawable, EXA_PREPARE_SRC, srcregion); fbCopyNtoN (pSrcDrawable, pDstDrawable, pGC, pbox, nbox, dx, dy, reverse, upsidedown, bitplane, closure); exaFinishAccess (pSrcDrawable, EXA_PREPARE_SRC); exaFinishAccess (pDstDrawable, EXA_PREPARE_DEST); out: - if (region) { - REGION_UNINIT(pScreen, region); - REGION_DESTROY(pScreen, region); + if (dstregion) { + REGION_UNINIT(pScreen, dstregion); + REGION_DESTROY(pScreen, dstregion); + } + if (srcregion) { + REGION_UNINIT(pScreen, srcregion); + REGION_DESTROY(pScreen, srcregion); } } From 6dee3fdf18f618dea034ad3b5cb028da0fb51639 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Sat, 24 May 2008 20:01:31 +0200 Subject: [PATCH 10/14] EXA: Don't suggest exaCopyDirty be inlined. Leave the decision to the compiler toolchain. (cherry picked from commit d73304398255e0c3b03a497a8d4a2f8d900eef44) --- exa/exa_migration.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exa/exa_migration.c b/exa/exa_migration.c index d3646b0b6..5f22474e9 100644 --- a/exa/exa_migration.c +++ b/exa/exa_migration.c @@ -116,7 +116,7 @@ exaPixmapShouldBeInFB (PixmapPtr pPix) * If the pixmap is currently dirty, this copies at least the dirty area from * FB to system or vice versa. Both areas must be allocated. */ -static _X_INLINE void +static void exaCopyDirty(ExaMigrationPtr migrate, RegionPtr pValidDst, RegionPtr pValidSrc, Bool (*transfer) (PixmapPtr pPix, int x, int y, int w, int h, char *sys, int sys_pitch), CARD8 *fallback_src, From 1667ed6e2474c274d6cf9cdbd83518450dea4d44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Sat, 24 May 2008 20:01:36 +0200 Subject: [PATCH 11/14] EXA: Don't migrate twice in exaImageGlyphBlt. exaPrepareAccess already handles migration. (cherry picked from commit f6d61d3d86971d6a202b46ff2fab8c8799a4d057) --- exa/exa_accel.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/exa/exa_accel.c b/exa/exa_accel.c index da9e7146a..d66dd4718 100644 --- a/exa/exa_accel.c +++ b/exa/exa_accel.c @@ -950,10 +950,8 @@ exaImageGlyphBlt (DrawablePtr pDrawable, int dstBpp; int dstXoff, dstYoff; FbBits depthMask; - Bool fallback; PixmapPtr pPixmap = exaGetDrawablePixmap(pDrawable); ExaPixmapPriv(pPixmap); - ExaMigrationRec pixmaps[1]; RegionPtr pending_damage = DamagePendingRegion(pExaPixmap->pDamage); BoxRec extents = *REGION_EXTENTS(pScreen, pending_damage); int xoff, yoff; @@ -962,16 +960,8 @@ exaImageGlyphBlt (DrawablePtr pDrawable, return; depthMask = FbFullMask(pDrawable->depth); - fallback = (pGC->planemask & depthMask) != depthMask; - pixmaps[0].as_dst = TRUE; - pixmaps[0].as_src = FALSE; - pixmaps[0].pPix = pPixmap; - pixmaps[0].pReg = fallback ? NULL : pending_damage; - - exaDoMigration(pixmaps, 1, FALSE); - - if (fallback) + if ((pGC->planemask & depthMask) != depthMask) { ExaCheckImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppciInit, pglyphBase); return; @@ -994,7 +984,7 @@ exaImageGlyphBlt (DrawablePtr pDrawable, extents.y1 -= yoff; extents.y2 -= yoff; - exaPrepareAccessReg (pDrawable, EXA_PREPARE_DEST, pixmaps[0].pReg); + exaPrepareAccessReg (pDrawable, EXA_PREPARE_DEST, pending_damage); if (TERMINALFONT (pGC->font) && !glyph) { From 60990c69b43046795bbc2311b3e4f27771b988c1 Mon Sep 17 00:00:00 2001 From: Paulo Cesar Pereira de Andrade Date: Fri, 23 May 2008 13:50:39 -0300 Subject: [PATCH 12/14] Correct a NULL pointer deference The problem happens if Monitor/Card combo doesn't provide EDID info, and the XFree86-VidModeExtension extension is used. Signed-off-by: Peter Hutterer (cherry picked from commit c8af7ce35a900ac9b898f51c1b95dabad3ba1d76) --- hw/xfree86/common/xf86VidMode.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/hw/xfree86/common/xf86VidMode.c b/hw/xfree86/common/xf86VidMode.c index 38d605c88..9260bb57b 100644 --- a/hw/xfree86/common/xf86VidMode.c +++ b/hw/xfree86/common/xf86VidMode.c @@ -150,10 +150,14 @@ VidModeGetCurrentModeline(int scrnIndex, pointer *mode, int *dotClock) return FALSE; pScrn = xf86Screens[scrnIndex]; - *mode = (pointer)(pScrn->currentMode); - *dotClock = pScrn->currentMode->Clock; - return TRUE; + if (pScrn->currentMode) { + *mode = (pointer)(pScrn->currentMode); + *dotClock = pScrn->currentMode->Clock; + + return TRUE; + } + return FALSE; } _X_EXPORT int From facf271b052eb1ee6b9c577d51991333372fa8c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Fri, 6 Jun 2008 11:01:03 +0200 Subject: [PATCH 13/14] EXA: Fix exaGetPixmapFirstPixel() crash if the driver has a CreatePixmap hook. Fixes http://bugs.freedesktop.org/show_bug.cgi?id=16243 (cherry picked from commit 6b96281100f2118fe9d99536c33d48298a5bce7b) --- exa/exa_unaccel.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/exa/exa_unaccel.c b/exa/exa_unaccel.c index c55ef032b..8e19886a9 100644 --- a/exa/exa_unaccel.c +++ b/exa/exa_unaccel.c @@ -359,6 +359,7 @@ ExaCheckComposite (CARD8 op, CARD32 exaGetPixmapFirstPixel (PixmapPtr pPixmap) { + ExaScreenPriv(pPixmap->drawable.pScreen); CARD32 pixel; void *fb; Bool need_finish = FALSE; @@ -373,7 +374,8 @@ exaGetPixmapFirstPixel (PixmapPtr pPixmap) fb = pExaPixmap->sys_ptr; /* Try to avoid framebuffer readbacks */ - if ((!offscreen && !sys_valid && !damaged) || + if (pExaScr->info->CreatePixmap || + (!offscreen && !sys_valid && !damaged) || (offscreen && (!sys_valid || damaged))) { box.x1 = 0; From 4e3cf7cd893e10fee21bc3c92d1cb3d308be1fe3 Mon Sep 17 00:00:00 2001 From: Julien Cristau Date: Fri, 23 May 2008 03:09:04 +0200 Subject: [PATCH 14/14] Add xkbstr.h and xkbsrv.h to sdk_HEADERS (cherry picked from commit 150c2f55a508ed24b230f68e30ec140c0901d9ae) --- include/Makefile.am | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/Makefile.am b/include/Makefile.am index 673a97685..7d5fee70b 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -50,10 +50,12 @@ sdk_HEADERS = \ validate.h \ window.h \ windowstr.h \ + xkbsrv.h \ + xkbstr.h \ xorg-server.h endif AM_CFLAGS = $(DIX_CFLAGS) EXTRA_DIST = $(sdk_HEADERS) do-not-use-config.h dix-config.h xorg-config.h \ - xkb-config.h xkbfile.h xkbsrv.h xkbstr.h + xkb-config.h xkbfile.h