From dd36e132fae41d18dbb04f7111b92b4b187bd539 Mon Sep 17 00:00:00 2001 From: Jeremy Huddleston Sequoia Date: Tue, 28 Aug 2012 12:43:55 -0700 Subject: test/list: Fix test_xorg_list_del test We never use child[2], so it's state is undefined. This issue seems to have existed since the test was first written: 92788e677be79bd04e5ef140f4ced50ad8b1bf8e Signed-off-by: Jeremy Huddleston Sequoia Reviewed-by: Peter Hutterer (cherry picked from commit c75c947b6e9bc725821b28835f3667c4aabef9ee) --- test/list.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/list.c b/test/list.c index 82d232706..f9f54ee4e 100644 --- a/test/list.c +++ b/test/list.c @@ -137,7 +137,7 @@ static void test_xorg_list_del(void) { struct parent parent = { 0 }; - struct child child[3]; + struct child child[2]; struct child *c; xorg_list_init(&parent.children); @@ -178,8 +178,8 @@ test_xorg_list_del(void) xorg_list_add(&child[0].node, &parent.children); xorg_list_del(&parent.children); assert(xorg_list_is_empty(&parent.children)); + assert(!xorg_list_is_empty(&child[0].node)); assert(!xorg_list_is_empty(&child[1].node)); - assert(!xorg_list_is_empty(&child[2].node)); } static void -- cgit v1.2.3 From 78c77356c5d88d78d69b1a244c7e27cd85544842 Mon Sep 17 00:00:00 2001 From: Jeremy Huddleston Sequoia Date: Tue, 28 Aug 2012 10:06:51 -0700 Subject: list: Use offsetof() and typeof() to determine member offsets within a structure Some compilers have difficulty with the previous implementation which relies on undefined behavior according to the C standard. Using offsetof() from (which most likely just uses __builtin_offsetof on modern compilers) allows us to accomplish this without ambiguity. This fix also requires support for typeof(). If your compiler does not support typeof(), then the old implementation will be used. If you see failures in test/list, please try a more modern compiler. v2: Added fallback if typeof() is not present. Signed-off-by: Jeremy Huddleston Sequoia Reviewed-by: Peter Hutterer (cherry picked from commit b8ab93dfbc7f292b5bfe7e9113e1af824ccbd1a8) --- configure.ac | 1 + include/dix-config.h.in | 3 +++ include/list.h | 21 +++++++++++++++++---- 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac index 7c7e69e78..24da6e809 100644 --- a/configure.ac +++ b/configure.ac @@ -136,6 +136,7 @@ AC_CHECK_HEADERS([fcntl.h stdlib.h string.h unistd.h dlfcn.h stropts.h fnmatch.h dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST +AC_C_TYPEOF AC_C_BIGENDIAN([ENDIAN="X_BIG_ENDIAN"], [ENDIAN="X_LITTLE_ENDIAN"]) AC_CHECK_SIZEOF([unsigned long]) diff --git a/include/dix-config.h.in b/include/dix-config.h.in index 3fb641367..2e4300e19 100644 --- a/include/dix-config.h.in +++ b/include/dix-config.h.in @@ -417,6 +417,9 @@ /* Define to 64-bit byteswap macro */ #undef bswap_64 +/* Define to 1 if typeof works with your compiler. */ +#undef HAVE_TYPEOF + /* The compiler supported TLS storage class, prefering initial-exec if tls_model is supported */ #undef TLS diff --git a/include/list.h b/include/list.h index d54a207b1..2d48a8646 100644 --- a/include/list.h +++ b/include/list.h @@ -26,6 +26,8 @@ #ifndef _XORG_LIST_H_ #define _XORG_LIST_H_ +#include /* offsetof() */ + /** * @file Classic doubly-link circular list implementation. * For real usage examples of the linked list, see the file test/list.c @@ -232,7 +234,7 @@ xorg_list_is_empty(struct xorg_list *head) */ #ifndef container_of #define container_of(ptr, type, member) \ - (type *)((char *)(ptr) - (char *) &((type *)0)->member) + (type *)((char *)(ptr) - offsetof(type, member)) #endif /** @@ -271,9 +273,20 @@ xorg_list_is_empty(struct xorg_list *head) #define xorg_list_last_entry(ptr, type, member) \ xorg_list_entry((ptr)->prev, type, member) -#define __container_of(ptr, sample, member) \ - (void *)((char *)(ptr) \ - - ((char *)&(sample)->member - (char *)(sample))) +#ifdef HAVE_TYPEOF +#define __container_of(ptr, sample, member) \ + container_of(ptr, typeof(*sample), member) +#else +/* This implementation of __container_of has undefined behavior according + * to the C standard, but it works in many cases. If your compiler doesn't + * support typeof() and fails with this implementation, please try a newer + * compiler. + */ +#define __container_of(ptr, sample, member) \ + (void *)((char *)(ptr) \ + - ((char *)&(sample)->member - (char *)(sample))) +#endif + /** * Loop through the list given by head and set pos to struct in the list. * -- cgit v1.2.3 From 9422321b37ddafb5b12f259842e10c7803039857 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Wed, 3 Oct 2012 13:12:27 +1000 Subject: xfree86: add xf86UpdateDesktopDimensions() This call is required for external drivers (specifically NVIDIA) that do not share the xfree86 infrastructure to update the desktop dimensions. Without it, the driver would update the ScreenRecs but not update the total dimensions the input code relies on for transformation. This call is a thin wrapper around the already-existing internal call and should be backported to all stable series servers, with the minor ABI bump. Signed-off-by: Peter Hutterer CC: Andy Ritger Reviewed-by: Aaron Plattner (cherry picked from commit 0a75bd640b3dc26b89d9e342999a7f4b7e98edbf) Conflicts: hw/xfree86/common/xf86.h hw/xfree86/common/xf86Helper.c hw/xfree86/common/xf86Module.h --- hw/xfree86/common/xf86.h | 3 +++ hw/xfree86/common/xf86Helper.c | 6 ++++++ hw/xfree86/common/xf86Module.h | 2 +- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/hw/xfree86/common/xf86.h b/hw/xfree86/common/xf86.h index fc4c34e92..7b1fc84f0 100644 --- a/hw/xfree86/common/xf86.h +++ b/hw/xfree86/common/xf86.h @@ -451,4 +451,7 @@ VidModeExtensionInit(ScreenPtr pScreen); #endif /* _NO_XF86_PROTOTYPES */ +/* Update the internal total dimensions of all ScreenRecs together */ +extern _X_EXPORT void +xf86UpdateDesktopDimensions(void); #endif /* _XF86_H */ diff --git a/hw/xfree86/common/xf86Helper.c b/hw/xfree86/common/xf86Helper.c index 8c948cf6f..0787171fb 100644 --- a/hw/xfree86/common/xf86Helper.c +++ b/hw/xfree86/common/xf86Helper.c @@ -1834,3 +1834,9 @@ xf86MotionHistoryAllocate(InputInfoPtr pInfo) { AllocateMotionHistory(pInfo->dev); } + +void +xf86UpdateDesktopDimensions(void) +{ + update_desktop_dimensions(); +} diff --git a/hw/xfree86/common/xf86Module.h b/hw/xfree86/common/xf86Module.h index 0036c5935..b5e030fc4 100644 --- a/hw/xfree86/common/xf86Module.h +++ b/hw/xfree86/common/xf86Module.h @@ -82,7 +82,7 @@ typedef enum { * mask is 0xFFFF0000. */ #define ABI_ANSIC_VERSION SET_ABI_VERSION(0, 4) -#define ABI_VIDEODRV_VERSION SET_ABI_VERSION(12, 1) +#define ABI_VIDEODRV_VERSION SET_ABI_VERSION(12, 2) #define ABI_XINPUT_VERSION SET_ABI_VERSION(16, 0) #define ABI_EXTENSION_VERSION SET_ABI_VERSION(6, 0) #define ABI_FONT_VERSION SET_ABI_VERSION(0, 6) -- cgit v1.2.3 From 01aac1f533d211c90a50127cc82a56bebb44dd0d Mon Sep 17 00:00:00 2001 From: Jeremy Huddleston Sequoia Date: Thu, 20 Sep 2012 21:49:40 -0700 Subject: XQuartz: Avoid a possible deadlock with DRI on OS X 10.7.5 and OS X 10.8.2 http://bugs.winehq.org/show_bug.cgi?id=31751 Signed-off-by: Jeremy Huddleston Sequoia (cherry picked from commit 25d26875bc9bd6fd23ae1b5280f015abf1b033b7) --- hw/xquartz/xpr/dri.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/hw/xquartz/xpr/dri.c b/hw/xquartz/xpr/dri.c index 002ec94a7..9bac56851 100644 --- a/hw/xquartz/xpr/dri.c +++ b/hw/xquartz/xpr/dri.c @@ -68,6 +68,7 @@ #include "mi.h" #include "mipointer.h" #include "rootless.h" +#include "rootlessCommon.h" #include "x-hash.h" #include "x-hook.h" #include "driWrap.h" @@ -384,6 +385,11 @@ DRICreateSurface(ScreenPtr pScreen, Drawable id, DRIDrawablePrivPtr pDRIDrawablePriv; if (pDrawable->type == DRAWABLE_WINDOW) { + /* + * http://bugs.winehq.org/show_bug.cgi?id=31751 + */ + RootlessStopDrawing((WindowPtr)pDrawable, FALSE); + pDRIDrawablePriv = CreateSurfaceForWindow(pScreen, (WindowPtr)pDrawable, &wid); -- cgit v1.2.3