From 1680ed87f202cedafa8e80239a825c2694172de2 Mon Sep 17 00:00:00 2001 From: Nikhil Devshatwar Date: Mon, 10 Jun 2013 19:28:41 +0530 Subject: [PATCH] Removing debian/patches directory --- debian/patches/0001-add-dri2video.patch | 1182 ------------ debian/patches/001_fedora_extramodes.patch | 83 - .../02_Add-libnettle-as-option-for-sha1.diff | 90 - ...07-xfree86-fix-build-with-xv-disabled.diff | 50 - ...-Let-the-driver-handle-the-transform.patch | 333 ---- ...ke-cursor-position-transform-a-helpe.patch | 117 -- debian/patches/100_rethrow_signals.patch | 375 ---- .../patches/105_nvidia_fglrx_autodetect.patch | 83 - debian/patches/111_armel-drv-fallbacks.patch | 62 - ...22_xext_fix_card32_overflow_in_xauth.patch | 38 - .../13_debian_add_xkbpath_env_variable.diff | 27 - debian/patches/15-nouveau.diff | 68 - debian/patches/157_check_null_modes.patch | 14 - .../patches/162_null_crtc_in_rotation.patch | 14 - .../165_man_xorg_conf_no_device_ident.patch | 26 - .../166_nullptr_xinerama_keyrepeat.patch | 27 - debian/patches/167_nullptr_xisbread.patch | 14 - .../patches/168_glibc_trace_to_stderr.patch | 17 - ...72_cwgetbackingpicture_nullptr_check.patch | 35 - .../188_default_primary_to_first_busid.patch | 20 - ...che-xkbcomp_output_for_fast_start_up.patch | 343 ---- .../191-Xorg-add-an-extra-module-path.patch | 99 - debian/patches/198_nohwaccess.patch | 55 - debian/patches/200_randr-null.patch | 14 - debian/patches/201_report-real-dpi.patch | 46 - debian/patches/208_switch_on_release.diff | 109 -- .../209_add_legacy_bgnone_option.patch | 21 - debian/patches/214_glx_dri_searchdirs.patch | 240 --- .../217_revert_bgnonevisitwindow.patch | 43 - .../patches/219_fedora-pointer-barriers.diff | 1020 ---------- .../224_return_BadWindow_not_BadMatch.diff | 47 - .../patches/225_non-root_config_paths.patch | 247 --- .../226_fall_back_to_autoconfiguration.patch | 105 - debian/patches/227_null_ptr_midispcur.patch | 14 - debian/patches/228_log-format-fix.patch | 441 ----- ...ck_pScrPriv_before_using_the_pointer.patch | 30 - ..._more_potential_unset_rrScrPriv_uses.patch | 52 - debian/patches/233-xf86events-valgrind.patch | 19 - debian/patches/235-composite-tracking.diff | 63 - debian/patches/238-xrandr-fix-panning.patch | 129 -- .../500_pointer_barrier_thresholds.diff | 1694 ----------------- .../505_query_pointer_touchscreen.patch | 32 - ...touchscreen_pointer_emulation_checks.patch | 159 -- debian/patches/507_touchscreen_fixes.patch | 540 ------ .../508_device_off_release_buttons.patch | 37 - ...-from-DisableDevice-if-the-device-is.patch | 29 - ...e-freeing-the-sprite-into-a-function.patch | 62 - ...the-sprite-when-disabling-the-device.patch | 31 - ...sprite-owners-first-when-disabling-p.patch | 41 - ...npairing-when-changing-the-hierarchy.patch | 33 - ...-disable-all-devices-before-shutdown.patch | 85 - ...-scroll-events-for-non-existing-axes.patch | 39 - ...ck-pScrPriv-before-using-the-pointer.patch | 30 - ...-more-potential-unset-rrScrPriv-uses.patch | 52 - debian/patches/series | 62 - 55 files changed, 8738 deletions(-) delete mode 100644 debian/patches/0001-add-dri2video.patch delete mode 100644 debian/patches/001_fedora_extramodes.patch delete mode 100644 debian/patches/02_Add-libnettle-as-option-for-sha1.diff delete mode 100644 debian/patches/07-xfree86-fix-build-with-xv-disabled.diff delete mode 100644 debian/patches/1001-xfree86-modes-Let-the-driver-handle-the-transform.patch delete mode 100644 debian/patches/1002-xfree86-modes-Make-cursor-position-transform-a-helpe.patch delete mode 100644 debian/patches/100_rethrow_signals.patch delete mode 100644 debian/patches/105_nvidia_fglrx_autodetect.patch delete mode 100644 debian/patches/111_armel-drv-fallbacks.patch delete mode 100644 debian/patches/122_xext_fix_card32_overflow_in_xauth.patch delete mode 100644 debian/patches/13_debian_add_xkbpath_env_variable.diff delete mode 100644 debian/patches/15-nouveau.diff delete mode 100644 debian/patches/157_check_null_modes.patch delete mode 100644 debian/patches/162_null_crtc_in_rotation.patch delete mode 100644 debian/patches/165_man_xorg_conf_no_device_ident.patch delete mode 100644 debian/patches/166_nullptr_xinerama_keyrepeat.patch delete mode 100644 debian/patches/167_nullptr_xisbread.patch delete mode 100644 debian/patches/168_glibc_trace_to_stderr.patch delete mode 100644 debian/patches/172_cwgetbackingpicture_nullptr_check.patch delete mode 100644 debian/patches/188_default_primary_to_first_busid.patch delete mode 100644 debian/patches/190_cache-xkbcomp_output_for_fast_start_up.patch delete mode 100644 debian/patches/191-Xorg-add-an-extra-module-path.patch delete mode 100644 debian/patches/198_nohwaccess.patch delete mode 100644 debian/patches/200_randr-null.patch delete mode 100644 debian/patches/201_report-real-dpi.patch delete mode 100644 debian/patches/208_switch_on_release.diff delete mode 100644 debian/patches/209_add_legacy_bgnone_option.patch delete mode 100644 debian/patches/214_glx_dri_searchdirs.patch delete mode 100644 debian/patches/217_revert_bgnonevisitwindow.patch delete mode 100644 debian/patches/219_fedora-pointer-barriers.diff delete mode 100644 debian/patches/224_return_BadWindow_not_BadMatch.diff delete mode 100644 debian/patches/225_non-root_config_paths.patch delete mode 100644 debian/patches/226_fall_back_to_autoconfiguration.patch delete mode 100644 debian/patches/227_null_ptr_midispcur.patch delete mode 100644 debian/patches/228_log-format-fix.patch delete mode 100644 debian/patches/229_randr_first_check_pScrPriv_before_using_the_pointer.patch delete mode 100644 debian/patches/230_randr_catch_two_more_potential_unset_rrScrPriv_uses.patch delete mode 100644 debian/patches/233-xf86events-valgrind.patch delete mode 100644 debian/patches/235-composite-tracking.diff delete mode 100644 debian/patches/238-xrandr-fix-panning.patch delete mode 100644 debian/patches/500_pointer_barrier_thresholds.diff delete mode 100644 debian/patches/505_query_pointer_touchscreen.patch delete mode 100644 debian/patches/506_touchscreen_pointer_emulation_checks.patch delete mode 100644 debian/patches/507_touchscreen_fixes.patch delete mode 100644 debian/patches/508_device_off_release_buttons.patch delete mode 100644 debian/patches/510-dix-return-early-from-DisableDevice-if-the-device-is.patch delete mode 100644 debian/patches/511-dix-move-freeing-the-sprite-into-a-function.patch delete mode 100644 debian/patches/512-dix-free-the-sprite-when-disabling-the-device.patch delete mode 100644 debian/patches/513-dix-disable-non-sprite-owners-first-when-disabling-p.patch delete mode 100644 debian/patches/514-Xi-drop-forced-unpairing-when-changing-the-hierarchy.patch delete mode 100644 debian/patches/515-dix-disable-all-devices-before-shutdown.patch delete mode 100644 debian/patches/516-dix-dont-emulate-scroll-events-for-non-existing-axes.patch delete mode 100644 debian/patches/516-randr-first-check-pScrPriv-before-using-the-pointer.patch delete mode 100644 debian/patches/517-randr-Catch-two-more-potential-unset-rrScrPriv-uses.patch delete mode 100644 debian/patches/series diff --git a/debian/patches/0001-add-dri2video.patch b/debian/patches/0001-add-dri2video.patch deleted file mode 100644 index 7922f66..0000000 --- a/debian/patches/0001-add-dri2video.patch +++ /dev/null @@ -1,1182 +0,0 @@ -From 1301542b17a9ea3cc185e24a3e40d33daa66e8ce Mon Sep 17 00:00:00 2001 -From: Rob Clark -Date: Tue, 15 Nov 2011 14:28:06 -0600 -Subject: [PATCH] add dri2video - -TODO: - + implement OSD support.. core should register damage and automatically - re-call ScheduleSwapVid.. - + automatically re-call ScheduleSwapVid on dri2 drawable resize... ---- - hw/xfree86/dri2/dri2.c | 364 +++++++++++++++++++++++++++++++++++++-------- - hw/xfree86/dri2/dri2.h | 127 ++++++++++++++++- - hw/xfree86/dri2/dri2ext.c | 214 +++++++++++++++++++++++++- - 3 files changed, 632 insertions(+), 73 deletions(-) - -Index: xserver/hw/xfree86/dri2/dri2.c -=================================================================== ---- xserver.orig/hw/xfree86/dri2/dri2.c 2012-02-22 11:04:26.000000000 +0100 -+++ xserver/hw/xfree86/dri2/dri2.c 2012-02-22 16:32:28.000000000 +0100 -@@ -91,6 +91,8 @@ - int refcnt; - unsigned int numDrivers; - const char **driverNames; -+ unsigned int numFormats; -+ unsigned int *formats; - const char *deviceName; - int fd; - unsigned int lastSequence; -@@ -102,12 +104,29 @@ - DRI2GetMSCProcPtr GetMSC; - DRI2ScheduleWaitMSCProcPtr ScheduleWaitMSC; - DRI2AuthMagicProcPtr AuthMagic; -+ DRI2ReuseBufferNotifyProcPtr ReuseBufferNotify; -+ DRI2SwapLimitValidateProcPtr SwapLimitValidate; -+ DRI2GetExtraBufferNamesProcPtr GetExtraBufferNames; -+ DRI2CreateBufferVidProcPtr CreateBufferVid; -+ DRI2ScheduleSwapVidProcPtr ScheduleSwapVid; -+ DRI2SetAttributeProcPtr SetAttribute; -+ DRI2GetAttributeProcPtr GetAttribute; - - HandleExposuresProcPtr HandleExposures; - - ConfigNotifyProcPtr ConfigNotify; - } DRI2ScreenRec; - -+static Bool -+supports_video(DRI2ScreenPtr ds) -+{ -+ /* it would be easier if we had a way to track the driverType in the -+ * DRI2DrawablePtr.. but the DRI2DrawablePtr isn't created at the -+ * time of DRI2Connect().. -+ */ -+ return ds && ds->numFormats && ds->CreateBufferVid && ds->ScheduleSwapVid; -+} -+ - static DRI2ScreenPtr - DRI2GetScreen(ScreenPtr pScreen) - { -@@ -179,6 +198,7 @@ - pPriv->last_swap_ust = 0; - list_init(&pPriv->reference_list); - pPriv->serialNumber = DRI2DrawableSerial(pDraw); -+ pPriv->needInvalidate = FALSE; - - if (pDraw->type == DRAWABLE_WINDOW) { - pWin = (WindowPtr) pDraw; -@@ -191,6 +211,35 @@ - return pPriv; - } - -+Bool -+DRI2SwapLimit(DrawablePtr pDraw, int swap_limit) -+{ -+ DRI2DrawablePtr pPriv = DRI2GetDrawable(pDraw); -+ DRI2ScreenPtr ds; -+ if (!pPriv) -+ return FALSE; -+ -+ ds = pPriv->dri2_screen; -+ -+ if (!ds->SwapLimitValidate -+ || !ds->SwapLimitValidate(pDraw, swap_limit)) -+ return FALSE; -+ -+ pPriv->swap_limit = swap_limit; -+ -+ /* Check throttling */ -+ if (pPriv->swapsPending >= pPriv->swap_limit) -+ return TRUE; -+ -+ if (pPriv->target_sbc == -1 && !pPriv->blockedOnMsc) { -+ if (pPriv->blockedClient) { -+ AttendClient(pPriv->blockedClient); -+ pPriv->blockedClient = NULL; -+ } -+ } -+ -+ return TRUE; -+} - typedef struct DRI2DrawableRefRec { - XID id; - XID dri2_id; -@@ -264,15 +313,26 @@ - return Success; - } - -+static void destroy_buffers(DrawablePtr pDraw, DRI2BufferPtr *buffers, int count) -+{ -+ if (buffers != NULL) { -+ DRI2ScreenPtr ds = DRI2GetScreen(pDraw->pScreen); -+ int i; -+ for (i = 0; i < count; i++) -+ if (buffers[i]) -+ (*ds->DestroyBuffer)(pDraw, buffers[i]); -+ -+ free(buffers); -+ } -+} -+ - static int DRI2DrawableGone(pointer p, XID id) - { - DRI2DrawablePtr pPriv = p; -- DRI2ScreenPtr ds = pPriv->dri2_screen; - DRI2DrawableRefPtr ref, next; - WindowPtr pWin; - PixmapPtr pPixmap; - DrawablePtr pDraw; -- int i; - - list_for_each_entry_safe(ref, next, &pPriv->reference_list, link) { - if (ref->dri2_id == id) { -@@ -304,12 +364,7 @@ - dixSetPrivate(&pPixmap->devPrivates, dri2PixmapPrivateKey, NULL); - } - -- if (pPriv->buffers != NULL) { -- for (i = 0; i < pPriv->bufferCount; i++) -- (*ds->DestroyBuffer)(pDraw, pPriv->buffers[i]); -- -- free(pPriv->buffers); -- } -+ destroy_buffers(pDraw, pPriv->buffers, pPriv->bufferCount); - - free(pPriv); - -@@ -317,7 +372,7 @@ - } - - static int --find_attachment(DRI2DrawablePtr pPriv, unsigned attachment) -+find_attachment(DRI2DrawablePtr pPriv, unsigned attachment, DRI2BufferPtr *buf) - { - int i; - -@@ -328,6 +383,8 @@ - for (i = 0; i < pPriv->bufferCount; i++) { - if ((pPriv->buffers[i] != NULL) - && (pPriv->buffers[i]->attachment == attachment)) { -+ if (buf) -+ *buf = pPriv->buffers[i]; - return i; - } - } -@@ -336,14 +393,27 @@ - } - - static Bool -+valid_format(DRI2ScreenPtr ds, unsigned int format) -+{ -+ int i; -+ for (i = 0; i < ds->numFormats; i++) { -+ if (format == ds->formats[i]) { -+ return TRUE; -+ } -+ } -+ return FALSE; -+} -+ -+static Bool - allocate_or_reuse_buffer(DrawablePtr pDraw, DRI2ScreenPtr ds, - DRI2DrawablePtr pPriv, - unsigned int attachment, unsigned int format, - int dimensions_match, DRI2BufferPtr *buffer) - { -- int old_buf = find_attachment(pPriv, attachment); -+ int old_buf = find_attachment(pPriv, attachment, NULL); - - if ((old_buf < 0) -+ || attachment == DRI2BufferFrontLeft - || !dimensions_match - || (pPriv->buffers[old_buf]->format != format)) { - *buffer = (*ds->CreateBuffer)(pDraw, attachment, format); -@@ -352,6 +422,8 @@ - - } else { - *buffer = pPriv->buffers[old_buf]; -+ if (ds->ReuseBufferNotify) -+ (*ds->ReuseBufferNotify)(pDraw, *buffer); - pPriv->buffers[old_buf] = NULL; - return FALSE; - } -@@ -361,18 +433,7 @@ - update_dri2_drawable_buffers(DRI2DrawablePtr pPriv, DrawablePtr pDraw, - DRI2BufferPtr *buffers, int out_count, int *width, int *height) - { -- DRI2ScreenPtr ds = DRI2GetScreen(pDraw->pScreen); -- int i; -- -- if (pPriv->buffers != NULL) { -- for (i = 0; i < pPriv->bufferCount; i++) { -- if (pPriv->buffers[i] != NULL) { -- (*ds->DestroyBuffer)(pDraw, pPriv->buffers[i]); -- } -- } -- -- free(pPriv->buffers); -- } -+ destroy_buffers(pDraw, pPriv->buffers, pPriv->bufferCount); - - pPriv->buffers = buffers; - pPriv->bufferCount = out_count; -@@ -417,6 +478,15 @@ - const unsigned attachment = *(attachments++); - const unsigned format = (has_format) ? *(attachments++) : 0; - -+ /* note: don't require a valid format for old drivers which don't -+ * register their supported formats.. -+ */ -+ if (has_format && (ds->numFormats > 0) && !valid_format(ds, format)) { -+ xf86DrvMsg(pDraw->pScreen->myNum, X_ERROR, -+ "[DRI2] %s: bad format: %d\n", __func__, format); -+ goto err_out; -+ } -+ - if (allocate_or_reuse_buffer(pDraw, ds, pPriv, attachment, - format, dimensions_match, - &buffers[i])) -@@ -506,19 +576,11 @@ - - *out_count = 0; - -- if (buffers) { -- for (i = 0; i < count; i++) { -- if (buffers[i] != NULL) -- (*ds->DestroyBuffer)(pDraw, buffers[i]); -- } -+ destroy_buffers(pDraw, buffers, count); - -- free(buffers); -- buffers = NULL; -- } -+ update_dri2_drawable_buffers(pPriv, pDraw, NULL, *out_count, width, height); - -- update_dri2_drawable_buffers(pPriv, pDraw, buffers, *out_count, width, height); -- -- return buffers; -+ return NULL; - } - - DRI2BufferPtr * -@@ -537,6 +599,95 @@ - out_count, TRUE); - } - -+DRI2BufferPtr * -+DRI2GetBuffersVid(DrawablePtr pDraw, int width, int height, -+ unsigned int *attachments, int count, int *out_count) -+{ -+ DRI2ScreenPtr ds = DRI2GetScreen(pDraw->pScreen); -+ DRI2DrawablePtr pPriv = DRI2GetDrawable(pDraw); -+ DRI2BufferPtr *buffers; -+ int i, n = 0; -+ -+ if (!pPriv || !supports_video(ds)) { -+ *out_count = 0; -+ return NULL; -+ } -+ -+ buffers = calloc(count, sizeof(buffers[0])); -+ if (!buffers) -+ goto err_out; -+ -+ for (i = 0; i < count; i++) { -+ DRI2BufferPtr buf; -+ const unsigned attachment = *(attachments++); -+ const unsigned format = *(attachments++); -+ -+ /* grow array of stored buffers if needed: */ -+ if (attachment >= pPriv->bufferCount) { -+ int n = attachment + 1; -+ DRI2BufferPtr *newBuffers = realloc(pPriv->buffers, -+ sizeof(pPriv->buffers[0]) * n); -+ if (!newBuffers) { -+ xf86DrvMsg(pDraw->pScreen->myNum, X_ERROR, -+ "[DRI2] %s: allocation failed for buffer: %d\n", -+ __func__, attachment); -+ goto err_out; -+ } -+ pPriv->buffers = newBuffers; -+ memset(&pPriv->buffers[pPriv->bufferCount], 0, -+ (n - pPriv->bufferCount) * sizeof(pPriv->buffers[0])); -+ pPriv->bufferCount = n; -+ } -+ -+ /* destroy any previous buffer at this attachment slot */ -+ if (pPriv->buffers[attachment]) { -+ (*ds->DestroyBuffer)(pDraw, pPriv->buffers[attachment]); -+ pPriv->buffers[attachment] = NULL; -+ } -+ -+ if ((width == 0) && (height == 0)) { -+ /* client just wanted us to delete the buffer */ -+ continue; -+ } -+ -+ if (!valid_format(ds, format)) { -+ xf86DrvMsg(pDraw->pScreen->myNum, X_ERROR, -+ "[DRI2] %s: bad format: %d\n", __func__, format); -+ goto err_out; -+ } -+ -+ if (attachment == DRI2BufferFrontLeft) { -+ buf = (*ds->CreateBuffer)(pDraw, attachment, format); -+ /* note: don't expose front buffer to client */ -+ } else { -+ buf = (*ds->CreateBufferVid)(pDraw, attachment, format, width, height); -+ buffers[n++] = buf; -+ } -+ -+ if (! buf) { -+ goto err_out; -+ } -+ -+ pPriv->buffers[attachment] = buf; -+ } -+ -+ *out_count = n; -+ -+ return buffers; -+ -+err_out: -+ -+ *out_count = 0; -+ -+ for (i = 0; i < n; i++) -+ if (buffers[i]) -+ pPriv->buffers[buffers[i]->attachment] = NULL; -+ -+ destroy_buffers(pDraw, buffers, n); -+ -+ return NULL; -+} -+ - static void - DRI2InvalidateDrawable(DrawablePtr pDraw) - { -@@ -549,7 +700,7 @@ - pPriv->needInvalidate = FALSE; - - list_for_each_entry(ref, &pPriv->reference_list, link) -- ref->invalidate(pDraw, ref->priv); -+ ref->invalidate(pDraw, ref->priv, ref->id); - } - - /* -@@ -609,22 +760,14 @@ - { - DRI2ScreenPtr ds = DRI2GetScreen(pDraw->pScreen); - DRI2DrawablePtr pPriv; -- DRI2BufferPtr pDestBuffer, pSrcBuffer; -- int i; -+ DRI2BufferPtr pDestBuffer = NULL, pSrcBuffer = NULL; - - pPriv = DRI2GetDrawable(pDraw); - if (pPriv == NULL) - return BadDrawable; - -- pDestBuffer = NULL; -- pSrcBuffer = NULL; -- for (i = 0; i < pPriv->bufferCount; i++) -- { -- if (pPriv->buffers[i]->attachment == dest) -- pDestBuffer = (DRI2BufferPtr) pPriv->buffers[i]; -- if (pPriv->buffers[i]->attachment == src) -- pSrcBuffer = (DRI2BufferPtr) pPriv->buffers[i]; -- } -+ find_attachment(pPriv, dest, &pDestBuffer); -+ find_attachment(pPriv, src, &pSrcBuffer); - if (pSrcBuffer == NULL || pDestBuffer == NULL) - return BadValue; - -@@ -792,31 +935,41 @@ - return FALSE; - } - --int --DRI2SwapBuffers(ClientPtr client, DrawablePtr pDraw, CARD64 target_msc, -- CARD64 divisor, CARD64 remainder, CARD64 *swap_target, -- DRI2SwapEventPtr func, void *data) -+/* -+ * 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 int -+swap_buffers(ClientPtr client, DrawablePtr pDraw, CARD64 target_msc, -+ CARD64 divisor, CARD64 remainder, CARD64 *swap_target, -+ DRI2SwapEventPtr func, void *data, -+ Bool vid, unsigned int source, BoxPtr b) - { - ScreenPtr pScreen = pDraw->pScreen; - DRI2ScreenPtr ds = DRI2GetScreen(pDraw->pScreen); -- DRI2DrawablePtr pPriv; -+ DRI2DrawablePtr pPriv = DRI2GetDrawable(pDraw); - DRI2BufferPtr pDestBuffer = NULL, pSrcBuffer = NULL; -- int ret, i; -+ int ret; - CARD64 ust, current_msc; - -- pPriv = DRI2GetDrawable(pDraw); -- if (pPriv == NULL) { -+ if ((pPriv == NULL) || (vid && !supports_video(ds))) { - xf86DrvMsg(pScreen->myNum, X_ERROR, - "[DRI2] %s: bad drawable\n", __func__); - return BadDrawable; - } - -- for (i = 0; i < pPriv->bufferCount; i++) { -- if (pPriv->buffers[i]->attachment == DRI2BufferFrontLeft) -- pDestBuffer = (DRI2BufferPtr) pPriv->buffers[i]; -- if (pPriv->buffers[i]->attachment == DRI2BufferBackLeft) -- pSrcBuffer = (DRI2BufferPtr) pPriv->buffers[i]; -- } -+ find_attachment(pPriv, DRI2BufferFrontLeft, &pDestBuffer); -+ find_attachment(pPriv, source, &pSrcBuffer); -+ - if (pSrcBuffer == NULL || pDestBuffer == NULL) { - xf86DrvMsg(pScreen->myNum, X_ERROR, - "[DRI2] %s: drawable has no back or front?\n", __func__); -@@ -824,7 +977,7 @@ - } - - /* Old DDX or no swap interval, just blit */ -- if (!ds->ScheduleSwap || !pPriv->swap_interval) { -+ if ((!ds->ScheduleSwap || !pPriv->swap_interval) && !vid) { - BoxRec box; - RegionRec region; - -@@ -860,7 +1013,6 @@ - - if (current_msc < pPriv->last_swap_target) - pPriv->last_swap_target = current_msc; -- - } - - /* -@@ -876,8 +1028,14 @@ - } - - pPriv->swapsPending++; -- ret = (*ds->ScheduleSwap)(client, pDraw, pDestBuffer, pSrcBuffer, -- swap_target, divisor, remainder, func, data); -+ if (vid) { -+ DrawablePtr osd = NULL; // TODO -+ ret = (*ds->ScheduleSwapVid)(client, pDraw, pDestBuffer, pSrcBuffer, -+ b, osd, swap_target, divisor, remainder, func, data); -+ } else { -+ ret = (*ds->ScheduleSwap)(client, pDraw, pDestBuffer, pSrcBuffer, -+ swap_target, divisor, remainder, func, data); -+ } - if (!ret) { - pPriv->swapsPending--; /* didn't schedule */ - xf86DrvMsg(pScreen->myNum, X_ERROR, -@@ -892,11 +1050,50 @@ - */ - *swap_target = pPriv->swap_count + pPriv->swapsPending; - -+ if (vid) { -+ return Success; -+ } -+ -+ 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); - - return Success; - } - -+int -+DRI2SwapBuffers(ClientPtr client, DrawablePtr pDraw, CARD64 target_msc, -+ CARD64 divisor, CARD64 remainder, CARD64 *swap_target, -+ DRI2SwapEventPtr func, void *data) -+{ -+ return swap_buffers(client, pDraw, target_msc, divisor, remainder, -+ swap_target, func, data, FALSE, DRI2BufferBackLeft, NULL); -+} -+ -+int -+DRI2SwapBuffersVid(ClientPtr client, DrawablePtr pDraw, CARD64 target_msc, -+ CARD64 divisor, CARD64 remainder, CARD64 *swap_target, -+ unsigned int source, BoxPtr b, DRI2SwapEventPtr func, void *data) -+{ -+ return swap_buffers(client, pDraw, target_msc, divisor, remainder, -+ swap_target, func, data, TRUE, source, b); -+} -+ - void - DRI2SwapInterval(DrawablePtr pDrawable, int interval) - { -@@ -1014,6 +1211,77 @@ - return ds->ScheduleSwap && ds->GetMSC; - } - -+#define ATOM(a) MakeAtom(a, sizeof(a) - 1, TRUE) -+ -+/* length in multiple of CARD32's, passed in value should be copied by -+ * receiver -+ */ -+int -+DRI2SetAttribute(DrawablePtr pDraw, Atom attribute, int len, const CARD32 *val) -+{ -+ DRI2ScreenPtr ds = DRI2GetScreen(pDraw->pScreen); -+ int ret = BadMatch; -+ -+ if (!supports_video(ds)) { -+ return BadDrawable; -+ } -+ -+ if (attribute == ATOM("XV_OSD")) { -+ } else if (ds->SetAttribute) { -+ ret = (*ds->SetAttribute)(pDraw, attribute, len, val); -+ } -+ -+ return ret; -+} -+ -+/* length in multiple of CARD32's, returned val should *not* be free'd -+ * (unlike similar function on client side) to avoid temporary allocation -+ * and extra copy. -+ */ -+int -+DRI2GetAttribute(DrawablePtr pDraw, Atom attribute, int *len, const CARD32 **val) -+{ -+ DRI2ScreenPtr ds = DRI2GetScreen(pDraw->pScreen); -+ int ret = BadMatch; -+ -+ if (!supports_video(ds)) { -+ return BadDrawable; -+ } -+ -+ if (attribute == ATOM("XV_OSD")) { -+ } else if (ds->GetAttribute) { -+ ret = (*ds->GetAttribute)(pDraw, attribute, len, val); -+ } -+ -+ return ret; -+} -+ -+int -+DRI2GetFormats(ScreenPtr pScreen, unsigned int *nformats, unsigned int **formats) -+{ -+ DRI2ScreenPtr ds = DRI2GetScreen(pScreen); -+ -+ if (! supports_video(ds)) { -+ return BadDrawable; -+ } -+ -+ *nformats = ds->numFormats; -+ *formats = ds->formats; -+ -+ return Success; -+} -+ -+unsigned int -+DRI2GetExtraBufferNames(DrawablePtr pDraw, DRI2BufferPtr buf, -+ unsigned int **names, unsigned int **pitches) -+{ -+ DRI2ScreenPtr ds = DRI2GetScreen(pDraw->pScreen); -+ if (ds->GetExtraBufferNames) { -+ return (*ds->GetExtraBufferNames)(pDraw, buf, names, pitches); -+ } -+ return 0; -+} -+ - Bool - DRI2Connect(ScreenPtr pScreen, unsigned int driverType, int *fd, - const char **driverName, const char **deviceName) -@@ -1081,9 +1349,10 @@ - const char* driverTypeNames[] = { - "DRI", /* DRI2DriverDRI */ - "VDPAU", /* DRI2DriverVDPAU */ -+ "XV", /* DRI2DriverXV */ - }; - unsigned int i; -- CARD8 cur_minor; -+ CARD8 cur_minor = 1; - - if (info->version < 3) - return FALSE; -@@ -1121,14 +1390,45 @@ - ds->ScheduleWaitMSC = info->ScheduleWaitMSC; - ds->GetMSC = info->GetMSC; - cur_minor = 3; -- } else { -- cur_minor = 1; - } - - if (info->version >= 5) { - ds->AuthMagic = info->AuthMagic; - } - -+ if (info->version >= 6) { -+ ds->ReuseBufferNotify = info->ReuseBufferNotify; -+ ds->SwapLimitValidate = info->SwapLimitValidate; -+ } -+ -+ if (info->version >= 7) { -+ if ((info->numDrivers > DRI2DriverXV) && -+ info->driverNames[DRI2DriverXV]) { -+ /* if driver claims to support DRI2DriverXV, then ensure -+ * it provides the required fxn ptrs: -+ */ -+ if (!info->CreateBufferVid || !info->ScheduleSwapVid) { -+ xf86DrvMsg(pScreen->myNum, X_WARNING, -+ "[DRI2] DRI2DriverXV must implement " -+ "CreateBuffersVid and ScheduleSwapVid.\n"); -+ goto err_out; -+ } -+ } -+ ds->numFormats = info->numFormats; -+ ds->formats = malloc(info->numFormats * sizeof(*ds->formats)); -+ if (!ds->formats) -+ goto err_out; -+ memcpy(ds->formats, info->formats, -+ info->numFormats * sizeof(*ds->formats)); -+ ds->GetExtraBufferNames = info->GetExtraBufferNames; -+ ds->CreateBufferVid = info->CreateBufferVid; -+ ds->ScheduleSwapVid = info->ScheduleSwapVid; -+ ds->SetAttribute = info->SetAttribute; -+ ds->GetAttribute = info->GetAttribute; -+ -+ cur_minor = 4; -+ } -+ - /* - * if the driver doesn't provide an AuthMagic function or the info struct - * version is too low, it relies on the old method (using libdrm) or fail -@@ -1178,6 +1478,10 @@ - err_out: - xf86DrvMsg(pScreen->myNum, X_WARNING, - "[DRI2] Initialization failed for info version %d.\n", info->version); -+ if (ds) { -+ free(ds->formats); -+ free(ds->driverNames); -+ } - free(ds); - return FALSE; - } -Index: xserver/hw/xfree86/dri2/dri2.h -=================================================================== ---- xserver.orig/hw/xfree86/dri2/dri2.h 2012-02-22 11:04:26.000000000 +0100 -+++ xserver/hw/xfree86/dri2/dri2.h 2012-02-22 16:31:43.000000000 +0100 -@@ -104,12 +104,73 @@ - CARD64 remainder, - DRI2SwapEventPtr func, - void *data); -+ -+/** -+ * Schedule a video buffer swap -+ * -+ * Drivers should queue an event for the frame count that satisfies the -+ * parameters passed in. If the event is in the future (i.e. the conditions -+ * aren't currently satisfied), the server may block the client at the next -+ * GLX request using DRI2WaitSwap. When the event arrives, drivers should call -+ * \c DRI2SwapComplete, which will handle waking the client and returning -+ * the appropriate data. -+ * -+ * The DDX is responsible for doing an overlay buffer flip/exchange, or -+ * scaling/colorconvert blit when the corresponding event arrives. -+ * -+ * If the target drawable is resized/damaged, or the osd pixmap is changed/ -+ * damaged, ScheduleSwapVid can be re-invoked by the core with the same -+ * source buffer to repair the dri2 video drawable. -+ * XXX TODO this part isn't implemented in core yet.. -+ * -+ * \param client client pointer (used for block/unblock) -+ * \param pDraw drawable whose count we want -+ * \param pDestBuffer current front buffer -+ * \param pSrcBuffer current back buffer -+ * \param b the crop box -+ * \param osd the on-screen-display overlay pixmap, should be an ARGB pixmap -+ * that is blended on top of the video as part of swap. Multiple layers -+ * to blend over the video should be flattened into a single layer by the -+ * client -+ * \param target_msc frame count to wait for -+ * \param divisor divisor for condition equation -+ * \param remainder remainder for division equation -+ * \param func function to call when the swap completes -+ * \param data data for the callback \p func. -+ */ -+typedef int (*DRI2ScheduleSwapVidProcPtr)(ClientPtr client, -+ DrawablePtr pDraw, -+ DRI2BufferPtr pDestBuffer, -+ DRI2BufferPtr pSrcBuffer, -+ BoxPtr b, -+ DrawablePtr osd, -+ CARD64 *target_msc, -+ CARD64 divisor, -+ CARD64 remainder, -+ DRI2SwapEventPtr func, -+ void *data); -+ - typedef DRI2BufferPtr (*DRI2CreateBufferProcPtr)(DrawablePtr pDraw, - unsigned int attachment, - unsigned int format); -+typedef DRI2BufferPtr (*DRI2CreateBufferVidProcPtr)(DrawablePtr pDraw, -+ unsigned int attachment, -+ unsigned int format, -+ unsigned int width, -+ unsigned int height); - typedef void (*DRI2DestroyBufferProcPtr)(DrawablePtr pDraw, - DRI2BufferPtr buffer); - /** -+ * Notifies driver when DRI2GetBuffers reuses a dri2 buffer. -+ * -+ * Driver may rename the dri2 buffer in this notify if it is required. -+ * -+ * \param pDraw drawable whose count we want -+ * \param buffer buffer that will be returned to client -+ */ -+typedef void (*DRI2ReuseBufferNotifyProcPtr)(DrawablePtr pDraw, -+ DRI2BufferPtr buffer); -+/** - * Get current media stamp counter values - * - * This callback is used to support the SGI_video_sync and OML_sync_control -@@ -156,12 +217,62 @@ - CARD64 remainder); - - typedef void (*DRI2InvalidateProcPtr)(DrawablePtr pDraw, -- void *data); -+ void *data, -+ XID id); -+ -+/** -+ * DRI2 calls this hook when ever swap_limit is going to be changed. Default -+ * implementation for the hook only accepts one as swap_limit. If driver can -+ * support other swap_limits it has to implement supported limits with this -+ * callback. -+ * -+ * \param pDraw drawable whos swap_limit is going to be changed -+ * \param swap_limit new swap_limit that going to be set -+ * \return TRUE if limit is support, FALSE if not. -+ */ -+typedef Bool (*DRI2SwapLimitValidateProcPtr)(DrawablePtr pDraw, -+ int swap_limit); -+ -+ -+/** -+ * An ugly approach to avoid changing DRI2BufferPtr and cause ABI breakage -+ * between driver and xserver. This only needs to be implemented by drivers -+ * supporting planar formats with one buffer per plane. -+ * -+ * This might be a good argument for having drivers in-tree ;-) -+ * -+ * \param pDraw drawable that the buffer belongs to -+ * \param buf the DRI2 buffer -+ * \param names array of buffer names -+ * \param pitches array of buffer pitches -+ * \return the number of additional buffers, ie. for I420 tri-planar buffer, -+ * if represented as multiple buffer names, the Y buffer name would be in -+ * buf->name, this function would return 2, and return the U and V buffer -+ * names by reference. -+ */ -+typedef unsigned int (*DRI2GetExtraBufferNamesProcPtr)(DrawablePtr pDraw, -+ DRI2BufferPtr buf, unsigned int **names, unsigned int **pitches); -+ -+/** -+ * Length in multiple of CARD32's, passed in value should be copied by -+ * receiver -+ */ -+typedef int (*DRI2SetAttributeProcPtr)(DrawablePtr pDraw, Atom attribute, -+ int len, const CARD32 *val); -+ -+/** -+ * Length in multiple of CARD32's, returned val should *not* be free'd -+ * (unlike similar function on client side) to avoid temporary allocation -+ * and extra copy. -+ */ -+typedef int (*DRI2GetAttributeProcPtr)(DrawablePtr pDraw, Atom attribute, -+ int *len, const CARD32 **val); -+ - - /** - * Version of the DRI2InfoRec structure defined in this header - */ --#define DRI2INFOREC_VERSION 5 -+#define DRI2INFOREC_VERSION 7 - - typedef struct { - unsigned int version; /**< Version of this struct */ -@@ -189,6 +300,20 @@ - /* added in version 5 */ - - DRI2AuthMagicProcPtr AuthMagic; -+ /* added in version 6 */ -+ -+ DRI2ReuseBufferNotifyProcPtr ReuseBufferNotify; -+ DRI2SwapLimitValidateProcPtr SwapLimitValidate; -+ -+ /* added in version 7 */ -+ -+ unsigned int numFormats; -+ const unsigned int *formats; -+ DRI2GetExtraBufferNamesProcPtr GetExtraBufferNames; -+ DRI2CreateBufferVidProcPtr CreateBufferVid; -+ DRI2ScheduleSwapVidProcPtr ScheduleSwapVid; -+ DRI2SetAttributeProcPtr SetAttribute; -+ DRI2GetAttributeProcPtr GetAttribute; - } DRI2InfoRec, *DRI2InfoPtr; - - extern _X_EXPORT int DRI2EventBase; -@@ -250,11 +375,19 @@ - int *width, int *height, unsigned int *attachments, int count, - int *out_count); - -+extern _X_EXPORT DRI2BufferPtr * DRI2GetBuffersVid(DrawablePtr pDraw, -+ int width, int height, unsigned int *attachments, int count, -+ int *out_count); -+ - extern _X_EXPORT void DRI2SwapInterval(DrawablePtr pDrawable, int interval); -+extern _X_EXPORT Bool DRI2SwapLimit(DrawablePtr pDraw, int swap_limit); - extern _X_EXPORT int DRI2SwapBuffers(ClientPtr client, DrawablePtr pDrawable, - CARD64 target_msc, CARD64 divisor, - CARD64 remainder, CARD64 *swap_target, - DRI2SwapEventPtr func, void *data); -+extern _X_EXPORT int DRI2SwapBuffersVid(ClientPtr client, DrawablePtr pDraw, -+ CARD64 target_msc, CARD64 divisor, CARD64 remainder, CARD64 *swap_target, -+ unsigned int source, BoxPtr b, DRI2SwapEventPtr func, void *data); - extern _X_EXPORT Bool DRI2WaitSwap(ClientPtr client, DrawablePtr pDrawable); - - extern _X_EXPORT int DRI2GetMSC(DrawablePtr pDrawable, CARD64 *ust, -@@ -284,4 +417,22 @@ - int frame, unsigned int tv_sec, - unsigned int tv_usec); - -+extern _X_EXPORT int DRI2SetAttribute(DrawablePtr pDraw, Atom attribute, -+ int len, const CARD32 *val); -+extern _X_EXPORT int DRI2GetAttribute(DrawablePtr pDraw, Atom attribute, -+ int *len, const CARD32 **val); -+extern _X_EXPORT int DRI2GetFormats(ScreenPtr pScreen, -+ unsigned int *nformats, unsigned int **formats); -+ -+extern _X_EXPORT unsigned int DRI2GetExtraBufferNames(DrawablePtr pDraw, -+ DRI2BufferPtr buf, unsigned int **names, unsigned int **pitches); -+ -+ -+/* some utility macros.. maybe could go elsewhere? */ -+#define FOURCC(a, b, c, d) (((uint32_t)(uint8_t)(a) | ((uint32_t)(uint8_t)(b) << 8) | ((uint32_t)(uint8_t)(c) << 16) | ((uint32_t)(uint8_t)(d) << 24 ))) -+#define FOURCC_STR(str) FOURCC(str[0], str[1], str[2], str[3]) -+#ifndef ARRAY_SIZE -+# define ARRAY_SIZE(_a) (sizeof((_a)) / sizeof((_a)[0])) -+#endif -+ - #endif -Index: xserver/hw/xfree86/dri2/dri2ext.c -=================================================================== ---- xserver.orig/hw/xfree86/dri2/dri2ext.c 2012-02-22 11:04:26.000000000 +0100 -+++ xserver/hw/xfree86/dri2/dri2ext.c 2012-02-22 16:37:21.000000000 +0100 -@@ -78,6 +78,7 @@ - swaps(&stuff->length, n); - - REQUEST_SIZE_MATCH(xDRI2QueryVersionReq); -+ - rep.type = X_Reply; - rep.length = 0; - rep.sequenceNumber = client->sequence; -@@ -157,7 +158,7 @@ - } - - static void --DRI2InvalidateBuffersEvent(DrawablePtr pDraw, void *priv) -+DRI2InvalidateBuffersEvent(DrawablePtr pDraw, void *priv, XID id) - { - xDRI2InvalidateBuffers event; - ClientPtr client = priv; -@@ -206,12 +207,13 @@ - - - static int --send_buffers_reply(ClientPtr client, DrawablePtr pDrawable, -+send_buffers_reply(ClientPtr client, DrawablePtr pDrawable, int vid, - DRI2BufferPtr *buffers, int count, int width, int height) - { - xDRI2GetBuffersReply rep; -- int skip = 0; -- int i; -+ int skip = 0, extra = 0; -+ unsigned int *names, *pitches; -+ int i, j; - - if (buffers == NULL) - return BadAlloc; -@@ -227,8 +229,24 @@ - } - } - -+ if (vid) { -+ extra = 4 * (count - skip); -+ -+ for (i = 0; i < count; i++) { -+ /* Do not send the real front buffer of a window to the client. -+ */ -+ if ((pDrawable->type == DRAWABLE_WINDOW) -+ && (buffers[i]->attachment == DRI2BufferFrontLeft)) { -+ continue; -+ } -+ -+ extra += 8 * DRI2GetExtraBufferNames(pDrawable, buffers[i], -+ &names, &pitches); -+ } -+ } -+ - rep.type = X_Reply; -- rep.length = (count - skip) * sizeof(xDRI2Buffer) / 4; -+ rep.length = ((count - skip) * sizeof(xDRI2Buffer) + extra) / 4; - rep.sequenceNumber = client->sequence; - rep.width = width; - rep.height = height; -@@ -251,6 +269,17 @@ - buffer.cpp = buffers[i]->cpp; - buffer.flags = buffers[i]->flags; - WriteToClient(client, sizeof(xDRI2Buffer), &buffer); -+ -+ if (vid) { -+ CARD32 n = DRI2GetExtraBufferNames(pDrawable, buffers[i], -+ &names, &pitches); -+ WriteToClient(client, sizeof(n), &n); -+ for (j = 0; j < n; j++) { -+ CARD32 name = names[j], pitch = pitches[j]; -+ WriteToClient(client, sizeof(name), &name); -+ WriteToClient(client, sizeof(pitch), &pitch); -+ } -+ } - } - return Success; - } -@@ -278,8 +307,8 @@ - attachments, stuff->count, &count); - - -- return send_buffers_reply(client, pDrawable, buffers, count, width, height); -- -+ return send_buffers_reply(client, pDrawable, FALSE, -+ buffers, count, width, height); - } - - static int -@@ -303,7 +332,40 @@ - buffers = DRI2GetBuffersWithFormat(pDrawable, &width, &height, - attachments, stuff->count, &count); - -- return send_buffers_reply(client, pDrawable, buffers, count, width, height); -+ return send_buffers_reply(client, pDrawable, FALSE, -+ buffers, count, width, height); -+} -+ -+static int -+ProcDRI2GetBuffersVid(ClientPtr client) -+{ -+ REQUEST(xDRI2GetBuffersVidReq); -+ DrawablePtr pDrawable; -+ DRI2BufferPtr *buffers; -+ int status, count; -+ unsigned int *attachments; -+ -+ REQUEST_FIXED_SIZE(xDRI2GetBuffersVidReq, stuff->count * (2 * 4)); -+ if (!validDrawable(client, stuff->drawable, DixReadAccess | DixWriteAccess, -+ &pDrawable, &status)) -+ return status; -+ -+ if (DRI2ThrottleClient(client, pDrawable)) -+ return Success; -+ -+ attachments = (unsigned int *) &stuff[1]; -+ buffers = DRI2GetBuffersVid(pDrawable, stuff->width, stuff->height, -+ attachments, stuff->count, &count); -+ -+ status = send_buffers_reply(client, pDrawable, TRUE, buffers, count, 0, 0); -+ -+ /* note, unlike other DRI2GetBuffers variants, we allow requesting/ -+ * returning just a subset of buffers.. so array that is returned is -+ * not the one held in pPriv, so must be free'd -+ */ -+ free(buffers); -+ -+ return status; - } - - static int -@@ -416,6 +478,53 @@ - return Success; - } - -+static int -+ProcDRI2SwapBuffersVid(ClientPtr client) -+{ -+ REQUEST(xDRI2SwapBuffersVidReq); -+ xDRI2SwapBuffersReply rep; -+ DrawablePtr pDrawable; -+ CARD64 target_msc, divisor, remainder, swap_target; -+ BoxRec b; -+ int status; -+ -+ REQUEST_SIZE_MATCH(xDRI2SwapBuffersVidReq); -+ -+ if (!validDrawable(client, stuff->drawable, -+ DixReadAccess | DixWriteAccess, &pDrawable, &status)) -+ return status; -+ -+ /* -+ * Ensures an out of control client can't exhaust our swap queue, and -+ * also orders swaps. -+ */ -+ if (DRI2ThrottleClient(client, pDrawable)) -+ return Success; -+ -+ target_msc = vals_to_card64(stuff->target_msc_lo, stuff->target_msc_hi); -+ divisor = vals_to_card64(stuff->divisor_lo, stuff->divisor_hi); -+ remainder = vals_to_card64(stuff->remainder_lo, stuff->remainder_hi); -+ -+ b.x1 = stuff->x1; -+ b.y1 = stuff->y1; -+ b.x2 = stuff->x2; -+ b.y2 = stuff->y2; -+ -+ status = DRI2SwapBuffersVid(client, pDrawable, target_msc, divisor, remainder, -+ &swap_target, stuff->source, &b, DRI2SwapEvent, pDrawable); -+ if (status != Success) -+ return BadDrawable; -+ -+ rep.type = X_Reply; -+ rep.length = 0; -+ rep.sequenceNumber = client->sequence; -+ load_swap_reply(&rep, swap_target); -+ -+ WriteToClient(client, sizeof(xDRI2SwapBuffersReply), &rep); -+ -+ return Success; -+} -+ - static void - load_msc_reply(xDRI2MSCReply *rep, CARD64 ust, CARD64 msc, CARD64 sbc) - { -@@ -539,6 +648,87 @@ - } - - static int -+ProcDRI2SetAttribute(ClientPtr client) -+{ -+ REQUEST(xDRI2SetAttributeReq); -+ DrawablePtr pDrawable; -+ int status; -+ int len = (stuff->length * 4 - sizeof(xDRI2SetAttributeReq)) / 4; -+ -+ REQUEST_FIXED_SIZE(xDRI2SetAttributeReq, len * 4); -+ -+ if (!validDrawable(client, stuff->drawable, -+ DixReadAccess | DixWriteAccess, &pDrawable, &status)) -+ return status; -+ -+ status = DRI2SetAttribute(pDrawable, stuff->attribute, len, -+ (const CARD32 *)&stuff[1]); -+ if (status != Success) -+ return status; -+ -+ return Success; -+} -+ -+static int -+ProcDRI2GetAttribute(ClientPtr client) -+{ -+ REQUEST(xDRI2GetAttributeReq); -+ xDRI2GetAttributeReply rep; -+ DrawablePtr pDrawable; -+ const CARD32 *val; -+ int status, len; -+ -+ REQUEST_SIZE_MATCH(xDRI2GetAttributeReq); -+ -+ if (!validDrawable(client, stuff->drawable, DixReadAccess, &pDrawable, -+ &status)) -+ return status; -+ -+ status = DRI2GetAttribute(pDrawable, stuff->attribute, &len, &val); -+ if (status != Success) -+ return status; -+ -+ rep.type = X_Reply; -+ rep.length = len; -+ rep.sequenceNumber = client->sequence; -+ WriteToClient(client, sizeof(xDRI2GetAttributeReply), &rep); -+ WriteToClient(client, len * 4, val); -+ -+ return Success; -+} -+ -+static int -+ProcDRI2GetFormats(ClientPtr client) -+{ -+ REQUEST(xDRI2GetFormatsReq); -+ xDRI2GetFormatsReply rep; -+ DrawablePtr pDrawable; -+ unsigned int i, nformats, *formats; -+ int status; -+ -+ REQUEST_SIZE_MATCH(xDRI2GetFormatsReq); -+ -+ if (!validDrawable(client, stuff->drawable, DixReadAccess, &pDrawable, -+ &status)) -+ return status; -+ -+ status = DRI2GetFormats(pDrawable->pScreen, &nformats, &formats); -+ if (status != Success) -+ return status; -+ -+ rep.type = X_Reply; -+ rep.length = nformats * sizeof(*formats) / 4; -+ rep.sequenceNumber = client->sequence; -+ WriteToClient(client, sizeof(xDRI2GetFormatsReply), &rep); -+ -+ for (i = 0; i < nformats; i++) { -+ WriteToClient(client, sizeof(formats[i]), &formats[i]); -+ } -+ -+ return Success; -+} -+ -+static int - ProcDRI2Dispatch (ClientPtr client) - { - REQUEST(xReq); -@@ -576,6 +766,16 @@ - return ProcDRI2WaitSBC(client); - case X_DRI2SwapInterval: - return ProcDRI2SwapInterval(client); -+ case X_DRI2GetBuffersVid: -+ return ProcDRI2GetBuffersVid(client); -+ case X_DRI2SwapBuffersVid: -+ return ProcDRI2SwapBuffersVid(client); -+ case X_DRI2SetAttribute: -+ return ProcDRI2SetAttribute(client); -+ case X_DRI2GetAttribute: -+ return ProcDRI2GetAttribute(client); -+ case X_DRI2GetFormats: -+ return ProcDRI2GetFormats(client); - default: - return BadRequest; - } diff --git a/debian/patches/001_fedora_extramodes.patch b/debian/patches/001_fedora_extramodes.patch deleted file mode 100644 index 77005b2..0000000 --- a/debian/patches/001_fedora_extramodes.patch +++ /dev/null @@ -1,83 +0,0 @@ -From: Adam Jackson -Date: Sun, 28 Oct 2007 09:37:52 +0100 -Subject: [PATCH] Fedora extra modes list - ---- ---- a/hw/xfree86/common/extramodes -+++ b/hw/xfree86/common/extramodes -@@ -3,16 +3,75 @@ - // - // $XFree86: xc/programs/Xserver/hw/xfree86/etc/extramodes,v 1.5 2002/06/05 19:43:05 dawes Exp $ - // -+// NOTE: Please keep all video modes sorted in order of X res, then Y res for -+// ease of maintenance and readability. - - # 832x624 @ 75Hz (74.55Hz) (fix if the official/Apple spec is different) hsync: 49.725kHz - ModeLine "832x624" 57.284 832 864 928 1152 624 625 628 667 -Hsync -Vsync - -+# 1152x864 @ 60.00 Hz (GTF) hsync: 53.70 kHz; pclk: 81.62 MHz -+Modeline "1152x864" 81.62 1152 1216 1336 1520 864 865 868 895 -HSync +Vsync -+ -+# 1152x864 @ 70.00 Hz (GTF) hsync: 63.00 kHz; pclk: 96.77 MHz -+Modeline "1152x864" 96.77 1152 1224 1344 1536 864 865 868 900 -HSync +Vsync -+ -+# 1152x864 @ 75.00 Hz (GTF) hsync: 67.65 kHz; pclk: 104.99 MHz -+Modeline "1152x864" 104.99 1152 1224 1352 1552 864 865 868 902 -HSync +Vsync -+ -+# 1152x864 @ 85.00 Hz (GTF) hsync: 77.10 kHz; pclk: 119.65 MHz -+Modeline "1152x864" 119.65 1152 1224 1352 1552 864 865 868 907 -HSync +Vsync -+ -+# 1152x864 @ 85Hz (Red Hat custom modeline) -+ModeLine "1152x864" 121.5 1152 1216 1344 1568 864 865 868 911 +hsync -vsync -+ -+# 1152x864 @ 100.00 Hz (GTF) hsync: 91.50 kHz; pclk: 143.47 MHz -+Modeline "1152x864" 143.47 1152 1232 1360 1568 864 865 868 915 -HSync +Vsync -+ -+# 1360x768 59.96 Hz (CVT) hsync: 47.37 kHz; pclk: 72.00 MHz -+Modeline "1360x768" 72.00 1360 1408 1440 1520 768 771 781 790 +hsync -vsync -+ -+# 1360x768 59.80 Hz (CVT) hsync: 47.72 kHz; pclk: 84.75 MHz -+Modeline "1360x768" 84.75 1360 1432 1568 1776 768 771 781 798 -hsync +vsync -+ - # 1400x1050 @ 60Hz (VESA GTF) hsync: 65.5kHz - ModeLine "1400x1050" 122.0 1400 1488 1640 1880 1050 1052 1064 1082 +hsync +vsync - -+# 1400x1050 @ 70.00 Hz (GTF) hsync: 76.51 kHz; pclk: 145.06 MHz -+Modeline "1400x1050" 145.06 1400 1496 1648 1896 1050 1051 1054 1093 -HSync +Vsync -+ - # 1400x1050 @ 75Hz (VESA GTF) hsync: 82.2kHz - ModeLine "1400x1050" 155.8 1400 1464 1784 1912 1050 1052 1064 1090 +hsync +vsync - -+# 1400x1050 @ 85.00 Hz (GTF) hsync: 93.76 kHz; pclk: 179.26 MHz -+Modeline "1400x1050" 179.26 1400 1504 1656 1912 1050 1051 1054 1103 -HSync +Vsync -+ -+# 1440x900 @ 60.00 Hz (CVT) field rate 59.89 Hz; hsync: 55.93 kHz; pclk: 106.50 MHz -+Modeline "1440x900" 106.50 1440 1520 1672 1904 900 903 909 934 -HSync +Vsync -+ -+# 1600x1024 for SGI 1600 SW -+ModeLine "1600x1024" 103.125 1600 1600 1656 1664 1024 1024 1029 1030 +Hsync +Vsync -+ -+# 1680x1050 59.88 Hz (CVT 1.76MA-R) hsync: 64.67 kHz; pclk: 119.00 MHz -+Modeline "1680x1050" 119.00 1680 1728 1760 1840 1050 1053 1059 1080 +hsync -vsync -+ -+# 1680x1050 59.95 Hz (CVT 1.76MA) hsync: 65.29 kHz; pclk: 146.25 MHz -+Modeline "1680x1050" 146.25 1680 1784 1960 2240 1050 1053 1059 1089 -hsync +vsync -+ -+# 1680x1050 69.88 Hz (CVT) hsync: 76.58 kHz; pclk: 174.00 MHz -+Modeline "1680x1050" 174.00 1680 1800 1976 2272 1050 1053 1059 1096 -hsync +vsync -+ -+# 1680x1050 74.89 Hz (CVT 1.76MA) hsync: 82.31 kHz; pclk: 187.00 MHz -+Modeline "1680x1050" 187.00 1680 1800 1976 2272 1050 1053 1059 1099 -hsync +vsync -+ -+# 1680x1050 84.94 Hz (CVT 1.76MA) hsync: 93.86 kHz; pclk: 214.75 MHz -+Modeline "1680x1050" 214.75 1680 1808 1984 2288 1050 1053 1059 1105 -hsync +vsync -+ -+# 1920x1080 59.93 Hz (CVT 2.07M9-R) hsync: 66.59 kHz; pclk: 138.50 MHz -+Modeline "1920x1080" 138.50 1920 1968 2000 2080 1080 1083 1088 1111 +hsync -vsync -+ -+# 1920x1200 59.95 Hz (CVT 2.30MA-R) hsync: 74.04 kHz; pclk: 154.00 MHz -+Modeline "1920x1200" 154.00 1920 1968 2000 2080 1200 1203 1209 1235 +hsync -vsync -+ - # 1920x1440 @ 85Hz (VESA GTF) hsync: 128.5kHz - Modeline "1920x1440" 341.35 1920 2072 2288 2656 1440 1441 1444 1512 -hsync +vsync - diff --git a/debian/patches/02_Add-libnettle-as-option-for-sha1.diff b/debian/patches/02_Add-libnettle-as-option-for-sha1.diff deleted file mode 100644 index bb0c338..0000000 --- a/debian/patches/02_Add-libnettle-as-option-for-sha1.diff +++ /dev/null @@ -1,90 +0,0 @@ -From a6119f6cd7e47041044fcc9c15a6e3f9f189b3ed Mon Sep 17 00:00:00 2001 -From: Cyril Brulebois -Date: Sun, 14 Mar 2010 22:01:47 +0100 -Subject: [PATCH] Add libnettle as option for sha1. - -Signed-off-by: Cyril Brulebois - -[jcristau: forward-ported from 1.7 to 1.8] -Signed-off-by: Julien Cristau ---- -Index: xorg-server/configure.ac -=================================================================== ---- xorg-server.orig/configure.ac -+++ xorg-server/configure.ac -@@ -1315,7 +1315,7 @@ CORE_INCS='-I$(top_srcdir)/include -I$(t - - # SHA1 hashing - AC_ARG_WITH([sha1], -- [AS_HELP_STRING([--with-sha1=libc|libmd|libgcrypt|libcrypto|libsha1|CommonCrypto], -+ [AS_HELP_STRING([--with-sha1=libc|libmd|libgcrypt|libcrypto|libsha1|CommonCrypto|nettle], - [choose SHA1 implementation])]) - AC_CHECK_FUNC([SHA1Init], [HAVE_SHA1_IN_LIBC=yes]) - if test "x$with_sha1" = x && test "x$HAVE_SHA1_IN_LIBC" = xyes; then -@@ -1398,6 +1398,16 @@ if test "x$with_sha1" = xlibcrypto; then - SHA1_CFLAGS="$OPENSSL_CFLAGS" - fi - fi -+AC_CHECK_LIB([nettle], [nettle_sha1_init], [HAVE_LIBNETTLE=yes]) -+if test "x$with_sha1" = x && test "x$HAVE_LIBNETTLE" = xyes; then -+ with_sha1=nettle -+fi -+if test "x$with_sha1" = xnettle; then -+ AC_DEFINE([HAVE_SHA1_IN_LIBNETTLE], [1], -+ [Use libnettle SHA1 functions]) -+ # XXX hack for d-i: use the static lib -+ SHA1_LIBS=-l:libnettle.a -+fi - AC_MSG_CHECKING([for SHA1 implementation]) - if test "x$with_sha1" = x; then - AC_MSG_ERROR([No suitable SHA1 implementation found]) -Index: xorg-server/include/dix-config.h.in -=================================================================== ---- xorg-server.orig/include/dix-config.h.in -+++ xorg-server/include/dix-config.h.in -@@ -175,6 +175,9 @@ - /* Define to use libsha1 for SHA1 */ - #undef HAVE_SHA1_IN_LIBSHA1 - -+/* Define to use libnettle SHA1 */ -+#undef HAVE_SHA1_IN_LIBNETTLE -+ - /* Define to 1 if you have the `shmctl64' function. */ - #undef HAVE_SHMCTL64 - -Index: xorg-server/os/xsha1.c -=================================================================== ---- xorg-server.orig/os/xsha1.c -+++ xorg-server/os/xsha1.c -@@ -127,6 +127,31 @@ int x_sha1_final(void *ctx, unsigned cha - return 1; - } - -+#elif defined(HAVE_SHA1_IN_LIBNETTLE) -+ -+# include -+ -+void *x_sha1_init(void) -+{ -+ struct sha1_ctx *ctx = xalloc(sizeof(*ctx)); -+ if (!ctx) -+ return NULL; -+ sha1_init(ctx); -+ return ctx; -+} -+ -+int x_sha1_update(void *ctx, void *data, int size) -+{ -+ sha1_update(ctx, size, data); -+ return 1; -+} -+ -+int x_sha1_final(void *ctx, unsigned char result[20]) -+{ -+ sha1_digest(ctx, 20, result); -+ return 1; -+} -+ - #else /* Use OpenSSL's libcrypto */ - - # include /* buggy openssl/sha.h wants size_t */ diff --git a/debian/patches/07-xfree86-fix-build-with-xv-disabled.diff b/debian/patches/07-xfree86-fix-build-with-xv-disabled.diff deleted file mode 100644 index 1bd6b70..0000000 --- a/debian/patches/07-xfree86-fix-build-with-xv-disabled.diff +++ /dev/null @@ -1,50 +0,0 @@ -From fe7575e929d65e8c798104ec2f72b879051694d3 Mon Sep 17 00:00:00 2001 -From: Julien Cristau -Date: Mon, 8 Feb 2010 02:04:33 +0100 -Subject: [PATCH] xfree86: fix build with xv disabled - ---- - hw/xfree86/modes/xf86Crtc.c | 2 ++ - hw/xfree86/modes/xf86Crtc.h | 2 ++ - 2 files changed, 4 insertions(+), 0 deletions(-) - -Index: xorg-server/hw/xfree86/modes/xf86Crtc.c -=================================================================== ---- xorg-server.orig/hw/xfree86/modes/xf86Crtc.c -+++ xorg-server/hw/xfree86/modes/xf86Crtc.c -@@ -3089,6 +3089,7 @@ xf86_crtc_box_area(BoxPtr box) - return (int) (box->x2 - box->x1) * (int) (box->y2 - box->y1); - } - -+#ifdef XV - /* - * Return the crtc covering 'box'. If two crtcs cover a portion of - * 'box', then prefer 'desired'. If 'desired' is NULL, then prefer the crtc -@@ -3177,6 +3178,7 @@ xf86_crtc_clip_video_helper(ScrnInfoPtr - - return ret; - } -+#endif - - xf86_crtc_notify_proc_ptr - xf86_wrap_crtc_notify (ScreenPtr screen, xf86_crtc_notify_proc_ptr new) -Index: xorg-server/hw/xfree86/modes/xf86Crtc.h -=================================================================== ---- xorg-server.orig/hw/xfree86/modes/xf86Crtc.h -+++ xorg-server/hw/xfree86/modes/xf86Crtc.h -@@ -934,6 +934,7 @@ xf86_hide_cursors (ScrnInfoPtr scrn); - extern _X_EXPORT void - xf86_cursors_fini (ScreenPtr screen); - -+#ifdef XV - /* - * For overlay video, compute the relevant CRTC and - * clip video to that. -@@ -952,6 +953,7 @@ xf86_crtc_clip_video_helper(ScrnInfoPtr - RegionPtr reg, - INT32 width, - INT32 height); -+#endif - - extern _X_EXPORT xf86_crtc_notify_proc_ptr - xf86_wrap_crtc_notify (ScreenPtr pScreen, xf86_crtc_notify_proc_ptr new); diff --git a/debian/patches/1001-xfree86-modes-Let-the-driver-handle-the-transform.patch b/debian/patches/1001-xfree86-modes-Let-the-driver-handle-the-transform.patch deleted file mode 100644 index 3f3fb6d..0000000 --- a/debian/patches/1001-xfree86-modes-Let-the-driver-handle-the-transform.patch +++ /dev/null @@ -1,333 +0,0 @@ -From 245cb8e94fd15990e1b7d6622added460f104dba Mon Sep 17 00:00:00 2001 -From: Aaron Plattner -Date: Thu, 25 Aug 2011 10:19:48 -0700 -Subject: [PATCH 1/2] xfree86/modes: Let the driver handle the transform - -If a driver can use hardware to handle the crtc transform, then -there's no need for the server's shadow layer to do it. Add a crtc -flag that lets the driver indicate that it is handling the transform. -If it's set, consider the transformed size of the screen but don't -actually enable the shadow layer. Also stop adjusting the cursor -image and position. - -Signed-off-by: Aaron Plattner ---- - hw/xfree86/modes/xf86Crtc.h | 16 +++++- - hw/xfree86/modes/xf86Cursors.c | 31 +++++++--- - hw/xfree86/modes/xf86Rotate.c | 131 +++++++++++++++++++++------------------- - 3 files changed, 107 insertions(+), 71 deletions(-) - -diff --git a/hw/xfree86/modes/xf86Crtc.h b/hw/xfree86/modes/xf86Crtc.h -index 68a968c..0d7a6a6 100644 ---- a/hw/xfree86/modes/xf86Crtc.h -+++ b/hw/xfree86/modes/xf86Crtc.h -@@ -1,5 +1,6 @@ - /* - * Copyright © 2006 Keith Packard -+ * Copyright © 2011 Aaron Plattner - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that -@@ -223,7 +224,7 @@ typedef struct _xf86CrtcFuncs { - - } xf86CrtcFuncsRec, *xf86CrtcFuncsPtr; - --#define XF86_CRTC_VERSION 3 -+#define XF86_CRTC_VERSION 4 - - struct _xf86Crtc { - /** -@@ -361,6 +362,19 @@ struct _xf86Crtc { - * Clear the shadow - */ - Bool shadowClear; -+ -+ /** -+ * Indicates that the driver is handling the transform, so the shadow -+ * surface should be disabled. The driver writes this field before calling -+ * xf86CrtcRotate to indicate that it is handling the transform (including -+ * rotation and reflection). -+ * -+ * Setting this flag also causes the server to stop adjusting the cursor -+ * image and position. -+ * -+ * Added in ABI version 4 -+ */ -+ Bool driverIsPerformingTransform; - }; - - typedef struct _xf86OutputFuncs { -diff --git a/hw/xfree86/modes/xf86Cursors.c b/hw/xfree86/modes/xf86Cursors.c -index 23c48eb..02dea5c 100644 ---- a/hw/xfree86/modes/xf86Cursors.c -+++ b/hw/xfree86/modes/xf86Cursors.c -@@ -1,6 +1,6 @@ - /* - * Copyright © 2007 Keith Packard -- * Copyright © 2010 Aaron Plattner -+ * Copyright © 2010-2011 Aaron Plattner - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that -@@ -47,6 +47,18 @@ - #include "inputstr.h" - - /* -+ * Returns the rotation being performed by the server. If the driver indicates -+ * that it's handling the screen transform, then this returns RR_Rotate_0. -+ */ -+static Rotation -+xf86_crtc_cursor_rotation (xf86CrtcPtr crtc) -+{ -+ if (crtc->driverIsPerformingTransform) -+ return RR_Rotate_0; -+ return crtc->rotation; -+} -+ -+/* - * Given a screen coordinate, rotate back to a cursor source coordinate - */ - static void -@@ -214,6 +226,7 @@ xf86_crtc_convert_cursor_to_argb (xf86CrtcPtr crtc, unsigned char *src) - int xin, yin; - int flags = cursor_info->Flags; - CARD32 bits; -+ const Rotation rotation = xf86_crtc_cursor_rotation(crtc); - - #ifdef ARGB_CURSOR - crtc->cursor_argb = FALSE; -@@ -222,7 +235,7 @@ xf86_crtc_convert_cursor_to_argb (xf86CrtcPtr crtc, unsigned char *src) - for (y = 0; y < cursor_info->MaxHeight; y++) - for (x = 0; x < cursor_info->MaxWidth; x++) - { -- xf86_crtc_rotate_coord (crtc->rotation, -+ xf86_crtc_rotate_coord (rotation, - cursor_info->MaxWidth, - cursor_info->MaxHeight, - x, y, &xin, &yin); -@@ -338,7 +351,7 @@ xf86_crtc_set_cursor_position (xf86CrtcPtr crtc, int x, int y) - /* - * Transform position of cursor on screen - */ -- if (crtc->transform_in_use) -+ if (crtc->transform_in_use && !crtc->driverIsPerformingTransform) - { - ScreenPtr screen = scrn->pScreen; - xf86CursorScreenPtr ScreenPriv = -@@ -420,12 +433,13 @@ xf86_crtc_load_cursor_image (xf86CrtcPtr crtc, CARD8 *src) - xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); - xf86CursorInfoPtr cursor_info = xf86_config->cursor_info; - CARD8 *cursor_image; -+ const Rotation rotation = xf86_crtc_cursor_rotation(crtc); - - #ifdef ARGB_CURSOR - crtc->cursor_argb = FALSE; - #endif - -- if (crtc->rotation == RR_Rotate_0) -+ if (rotation == RR_Rotate_0) - cursor_image = src; - else - { -@@ -439,7 +453,7 @@ xf86_crtc_load_cursor_image (xf86CrtcPtr crtc, CARD8 *src) - for (y = 0; y < cursor_info->MaxHeight; y++) - for (x = 0; x < cursor_info->MaxWidth; x++) - { -- xf86_crtc_rotate_coord (crtc->rotation, -+ xf86_crtc_rotate_coord (rotation, - cursor_info->MaxWidth, - cursor_info->MaxHeight, - x, y, &xin, &yin); -@@ -532,12 +546,13 @@ xf86_crtc_load_cursor_argb (xf86CrtcPtr crtc, CursorPtr cursor) - int source_height = cursor->bits->height; - int image_width = cursor_info->MaxWidth; - int image_height = cursor_info->MaxHeight; -- -+ const Rotation rotation = xf86_crtc_cursor_rotation(crtc); -+ - for (y = 0; y < image_height; y++) - for (x = 0; x < image_width; x++) - { -- xf86_crtc_rotate_coord (crtc->rotation, image_width, image_height, -- x, y, &xin, &yin); -+ xf86_crtc_rotate_coord (rotation, image_width, image_height, x, y, -+ &xin, &yin); - if (xin < source_width && yin < source_height) - bits = cursor_source[yin * source_width + xin]; - else -diff --git a/hw/xfree86/modes/xf86Rotate.c b/hw/xfree86/modes/xf86Rotate.c -index 57c3499..45aabf0 100644 ---- a/hw/xfree86/modes/xf86Rotate.c -+++ b/hw/xfree86/modes/xf86Rotate.c -@@ -1,5 +1,6 @@ - /* - * Copyright © 2006 Keith Packard -+ * Copyright © 2011 Aaron Plattner - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that -@@ -84,7 +85,10 @@ xf86RotateCrtcRedisplay (xf86CrtcPtr crtc, RegionPtr region) - int n = RegionNumRects(region); - BoxPtr b = RegionRects(region); - XID include_inferiors = IncludeInferiors; -- -+ -+ if (crtc->driverIsPerformingTransform) -+ return; -+ - src = CreatePicture (None, - &root->drawable, - format, -@@ -290,7 +294,7 @@ xf86RotateDestroy (xf86CrtcPtr crtc) - } - - for (c = 0; c < xf86_config->num_crtc; c++) -- if (xf86_config->crtc[c]->transform_in_use) -+ if (xf86_config->crtc[c]->rotatedData) - return; - - /* -@@ -414,52 +418,73 @@ xf86CrtcRotate (xf86CrtcPtr crtc) - } - else - { -- /* -- * these are the size of the shadow pixmap, which -- * matches the mode, not the pre-rotated copy in the -- * frame buffer -- */ -- int width = crtc->mode.HDisplay; -- int height = crtc->mode.VDisplay; -- void *shadowData = crtc->rotatedData; -- PixmapPtr shadow = crtc->rotatedPixmap; -- int old_width = shadow ? shadow->drawable.width : 0; -- int old_height = shadow ? shadow->drawable.height : 0; -- -- /* Allocate memory for rotation */ -- if (old_width != width || old_height != height) -- { -- if (shadow || shadowData) -+ if (crtc->driverIsPerformingTransform) { -+ xf86RotateDestroy(crtc); -+ } else { -+ /* -+ * these are the size of the shadow pixmap, which -+ * matches the mode, not the pre-rotated copy in the -+ * frame buffer -+ */ -+ int width = crtc->mode.HDisplay; -+ int height = crtc->mode.VDisplay; -+ void *shadowData = crtc->rotatedData; -+ PixmapPtr shadow = crtc->rotatedPixmap; -+ int old_width = shadow ? shadow->drawable.width : 0; -+ int old_height = shadow ? shadow->drawable.height : 0; -+ -+ /* Allocate memory for rotation */ -+ if (old_width != width || old_height != height) - { -- crtc->funcs->shadow_destroy (crtc, shadow, shadowData); -- crtc->rotatedPixmap = NULL; -- crtc->rotatedData = NULL; -+ if (shadow || shadowData) -+ { -+ crtc->funcs->shadow_destroy (crtc, shadow, shadowData); -+ crtc->rotatedPixmap = NULL; -+ crtc->rotatedData = NULL; -+ } -+ shadowData = crtc->funcs->shadow_allocate (crtc, width, height); -+ if (!shadowData) -+ goto bail1; -+ crtc->rotatedData = shadowData; -+ /* shadow will be damaged in xf86RotatePrepare */ -+ } -+ else -+ { -+ /* mark shadowed area as damaged so it will be repainted */ -+ damage = TRUE; - } -- shadowData = crtc->funcs->shadow_allocate (crtc, width, height); -- if (!shadowData) -- goto bail1; -- crtc->rotatedData = shadowData; -- /* shadow will be damaged in xf86RotatePrepare */ -- } -- else -- { -- /* mark shadowed area as damaged so it will be repainted */ -- damage = TRUE; -- } - -- if (!xf86_config->rotation_damage) -- { -- /* Create damage structure */ -- xf86_config->rotation_damage = DamageCreate (NULL, NULL, -- DamageReportNone, -- TRUE, pScreen, pScreen); - if (!xf86_config->rotation_damage) -- goto bail2; -- -- /* Wrap block handler */ -- if (!xf86_config->BlockHandler) { -- xf86_config->BlockHandler = pScreen->BlockHandler; -- pScreen->BlockHandler = xf86RotateBlockHandler; -+ { -+ /* Create damage structure */ -+ xf86_config->rotation_damage = DamageCreate (NULL, NULL, -+ DamageReportNone, -+ TRUE, pScreen, pScreen); -+ if (!xf86_config->rotation_damage) -+ goto bail2; -+ -+ /* Wrap block handler */ -+ if (!xf86_config->BlockHandler) { -+ xf86_config->BlockHandler = pScreen->BlockHandler; -+ pScreen->BlockHandler = xf86RotateBlockHandler; -+ } -+ } -+ -+ if (0) -+ { -+ bail2: -+ if (shadow || shadowData) -+ { -+ crtc->funcs->shadow_destroy (crtc, shadow, shadowData); -+ crtc->rotatedPixmap = NULL; -+ crtc->rotatedData = NULL; -+ } -+ bail1: -+ if (old_width && old_height) -+ crtc->rotatedPixmap = -+ crtc->funcs->shadow_create (crtc, NULL, old_width, -+ old_height); -+ return FALSE; - } - } - #ifdef RANDR_12_INTERFACE -@@ -482,24 +507,6 @@ xf86CrtcRotate (xf86CrtcPtr crtc) - } - } - #endif -- -- if (0) -- { -- bail2: -- if (shadow || shadowData) -- { -- crtc->funcs->shadow_destroy (crtc, shadow, shadowData); -- crtc->rotatedPixmap = NULL; -- crtc->rotatedData = NULL; -- } -- bail1: -- if (old_width && old_height) -- crtc->rotatedPixmap = crtc->funcs->shadow_create (crtc, -- NULL, -- old_width, -- old_height); -- return FALSE; -- } - crtc->transform_in_use = TRUE; - } - crtc->crtc_to_framebuffer = crtc_to_fb; --- -1.7.4.1 - diff --git a/debian/patches/1002-xfree86-modes-Make-cursor-position-transform-a-helpe.patch b/debian/patches/1002-xfree86-modes-Make-cursor-position-transform-a-helpe.patch deleted file mode 100644 index bbb3d07..0000000 --- a/debian/patches/1002-xfree86-modes-Make-cursor-position-transform-a-helpe.patch +++ /dev/null @@ -1,117 +0,0 @@ -From 57cd32e93425597317b4b7722859155419836e4c Mon Sep 17 00:00:00 2001 -From: Aaron Plattner -Date: Thu, 25 Aug 2011 15:41:55 -0700 -Subject: [PATCH 2/2] xfree86/modes: Make cursor position transform a helper function - -When the driver can handle the crtc transform in hardware, it sets -crtc->driverIsPerformingTransform, which turns off both the shadow -layer and the cursor's position-transforming code. However, some -drivers actually do require the cursor position to still be -transformed in these cases. Move the cursor position transform into a -helper function that can be called by such drivers. - -Signed-off-by: Aaron Plattner ---- - hw/xfree86/modes/xf86Crtc.h | 8 +++++ - hw/xfree86/modes/xf86Cursors.c | 57 +++++++++++++++++++++------------------ - 2 files changed, 39 insertions(+), 26 deletions(-) - -Index: xserver/hw/xfree86/modes/xf86Crtc.h -=================================================================== ---- xserver.orig/hw/xfree86/modes/xf86Crtc.h 2012-03-21 16:16:55.085740513 +0100 -+++ xserver/hw/xfree86/modes/xf86Crtc.h 2012-03-21 16:16:55.121740513 +0100 -@@ -903,6 +903,14 @@ - extern _X_EXPORT char * - xf86ConnectorGetName(xf86ConnectorType connector); - -+/** -+ * Transform the cursor's coordinates based on the crtc transform. Normally -+ * this is done by the server, but if crtc->driverIsPerformingTransform is TRUE, -+ * then the server does not transform the cursor position automatically. -+ */ -+extern _X_EXPORT void -+xf86CrtcTransformCursorPos (xf86CrtcPtr crtc, int *x, int *y); -+ - /* - * Using the desired mode information in each crtc, set - * modes (used in EnterVT functions, or at server startup) -Index: xserver/hw/xfree86/modes/xf86Cursors.c -=================================================================== ---- xserver.orig/hw/xfree86/modes/xf86Cursors.c 2012-03-21 16:16:55.089740513 +0100 -+++ xserver/hw/xfree86/modes/xf86Cursors.c 2012-03-21 16:16:55.121740513 +0100 -@@ -337,7 +337,36 @@ - xf86_crtc_show_cursor (crtc); - } - } -- -+ -+void xf86CrtcTransformCursorPos (xf86CrtcPtr crtc, int *x, int *y) -+{ -+ ScrnInfoPtr scrn = crtc->scrn; -+ ScreenPtr screen = scrn->pScreen; -+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); -+ xf86CursorInfoPtr cursor_info = xf86_config->cursor_info; -+ xf86CursorScreenPtr ScreenPriv = -+ (xf86CursorScreenPtr)dixLookupPrivate(&screen->devPrivates, -+ xf86CursorScreenKey); -+ struct pict_f_vector v; -+ int dx, dy; -+ -+ v.v[0] = (*x + ScreenPriv->HotX) + 0.5; -+ v.v[1] = (*y + ScreenPriv->HotY) + 0.5; -+ v.v[2] = 1; -+ pixman_f_transform_point (&crtc->f_framebuffer_to_crtc, &v); -+ /* cursor will have 0.5 added to it already so floor is sufficent */ -+ *x = floor (v.v[0]); -+ *y = floor (v.v[1]); -+ /* -+ * Transform position of cursor upper left corner -+ */ -+ xf86_crtc_rotate_coord_back (crtc->rotation, cursor_info->MaxWidth, -+ cursor_info->MaxHeight, ScreenPriv->HotX, -+ ScreenPriv->HotY, &dx, &dy); -+ *x -= dx; -+ *y -= dy; -+} -+ - static void - xf86_crtc_set_cursor_position (xf86CrtcPtr crtc, int x, int y) - { -@@ -346,36 +375,12 @@ - xf86CursorInfoPtr cursor_info = xf86_config->cursor_info; - DisplayModePtr mode = &crtc->mode; - Bool in_range; -- int dx, dy; - - /* - * Transform position of cursor on screen - */ - if (crtc->transform_in_use && !crtc->driverIsPerformingTransform) -- { -- ScreenPtr screen = scrn->pScreen; -- xf86CursorScreenPtr ScreenPriv = -- (xf86CursorScreenPtr)dixLookupPrivate(&screen->devPrivates, -- xf86CursorScreenKey); -- struct pict_f_vector v; -- -- v.v[0] = (x + ScreenPriv->HotX) + 0.5; -- v.v[1] = (y + ScreenPriv->HotY) + 0.5; -- v.v[2] = 1; -- pixman_f_transform_point (&crtc->f_framebuffer_to_crtc, &v); -- /* cursor will have 0.5 added to it already so floor is sufficent */ -- x = floor (v.v[0]); -- y = floor (v.v[1]); -- /* -- * Transform position of cursor upper left corner -- */ -- xf86_crtc_rotate_coord_back (crtc->rotation, -- cursor_info->MaxWidth, -- cursor_info->MaxHeight, -- ScreenPriv->HotX, ScreenPriv->HotY, &dx, &dy); -- x -= dx; -- y -= dy; -- } -+ xf86CrtcTransformCursorPos(crtc, &x, &y); - else - { - x -= crtc->x; diff --git a/debian/patches/100_rethrow_signals.patch b/debian/patches/100_rethrow_signals.patch deleted file mode 100644 index ffbc4b0..0000000 --- a/debian/patches/100_rethrow_signals.patch +++ /dev/null @@ -1,375 +0,0 @@ -Index: xorg-server/hw/dmx/dmxinit.c -=================================================================== ---- xorg-server.orig/hw/dmx/dmxinit.c 2011-09-10 21:40:27.000000000 -0700 -+++ xorg-server/hw/dmx/dmxinit.c 2011-09-10 21:45:50.066123727 -0700 -@@ -821,7 +821,7 @@ - /** This function is called in Xserver/os/utils.c from \a AbortServer(). - * We must ensure that backend and console state is restored in the - * event the server shutdown wasn't clean. */ --void AbortDDX(enum ExitCode error) -+void SigAbortDDX(int signo, enum ExitCode error) - { - int i; - -@@ -839,6 +839,11 @@ - } - #endif - -+void AbortDDX(enum ExitCode error) -+{ -+ SigAbortDDX(0, error); -+} -+ - /** This function is called in Xserver/dix/main.c from \a main() when - * dispatchException & DE_TERMINATE (which is the only way to exit the - * main loop without an interruption. */ -Index: xorg-server/hw/kdrive/src/kdrive.c -=================================================================== ---- xorg-server.orig/hw/kdrive/src/kdrive.c 2011-09-10 21:40:27.000000000 -0700 -+++ xorg-server/hw/kdrive/src/kdrive.c 2011-09-10 21:52:09.393274790 -0700 -@@ -232,7 +232,7 @@ - } - - void --AbortDDX(enum ExitCode error) -+SigAbortDDX(int signo, enum ExitCode error) - { - KdDisableScreens (); - if (kdOsFuncs) -@@ -248,6 +248,11 @@ - OsAbort(); - } - -+AbortDDX(enum ExitCode error) -+{ -+ SigAbortDDX(0, error); -+} -+ - void - ddxGiveUp (enum ExitCode error) - { -Index: xorg-server/hw/vfb/InitOutput.c -=================================================================== ---- xorg-server.orig/hw/vfb/InitOutput.c 2011-09-10 21:40:27.000000000 -0700 -+++ xorg-server/hw/vfb/InitOutput.c 2011-09-10 21:53:51.404181875 -0700 -@@ -201,11 +201,17 @@ - } - - void --AbortDDX(enum ExitCode error) -+SigAbortDDX(int signo, enum ExitCode error) - { - ddxGiveUp(error); - } -- -+ -+void -+AbortDDX(enum ExitCode error) -+{ -+ SigAbortDDX(0, error); -+} -+ - #ifdef __APPLE__ - void - DarwinHandleGUI(int argc, char *argv[]) -Index: xorg-server/hw/xfree86/common/xf86Events.c -=================================================================== ---- xorg-server.orig/hw/xfree86/common/xf86Events.c 2011-09-10 21:40:27.000000000 -0700 -+++ xorg-server/hw/xfree86/common/xf86Events.c 2011-09-10 21:45:50.066123727 -0700 -@@ -348,6 +348,8 @@ - int - xf86SigWrapper(int signo) - { -+ static Bool beenhere = FALSE; -+ - if ((signo == SIGILL) && xf86SigIllHandler) { - (*xf86SigIllHandler)(); - return 0; /* continue */ -Index: xorg-server/hw/xfree86/common/xf86Init.c -=================================================================== ---- xorg-server.orig/hw/xfree86/common/xf86Init.c 2011-09-10 21:40:27.000000000 -0700 -+++ xorg-server/hw/xfree86/common/xf86Init.c 2011-09-11 09:58:17.741645191 -0700 -@@ -895,14 +895,17 @@ - } - - /* -- * ddxGiveUp -- -+ * ddxSigGiveUp -- - * Device dependent cleanup. Called by by dix before normal server death. - * For SYSV386 we must switch the terminal back to normal mode. No error- - * checking here, since there should be restored as much as possible. -+ * -+ * If a non-zero signo is passed, re-raise that signal rather than -+ * calling abort(). - */ - - void --ddxGiveUp(enum ExitCode error) -+ddxSigGiveUp(int signo, enum ExitCode error) - { - int i; - -@@ -929,24 +932,46 @@ - if (xorgHWOpenConsole) - xf86CloseConsole(); - -+ ErrorF (" ddxSigGiveUp: Closing log\n"); -+ - xf86CloseLog(error); - - /* If an unexpected signal was caught, dump a core for debugging */ -- if (xf86Info.caughtSignal) -- OsAbort(); -+ if (xf86Info.caughtSignal) { -+ if (signo != 0) { -+ raise(signo); -+ } else { -+ OsAbort(); -+ } -+ } - } - -+/* -+ * ddxGiveUp -- -+ * Device dependent cleanup. Called by by dix before normal server death. -+ * For SYSV386 we must switch the terminal back to normal mode. No error- -+ * checking here, since there should be restored as much as possible. -+ */ -+ -+void -+ddxGiveUp(enum ExitCode error) -+{ -+ ddxSigGiveUp(0, error); -+} - - - /* -- * AbortDDX -- -+ * SigAbortDDX -- - * DDX - specific abort routine. Called by AbortServer(). The attempt is - * made to restore all original setting of the displays. Also all devices - * are closed. -+ * -+ * If a non-zero signo is passed, re-raise that signal rather than calling -+ * abort() - */ - - void --AbortDDX(enum ExitCode error) -+SigAbortDDX(int signo, enum ExitCode error) - { - int i; - -@@ -979,7 +1004,20 @@ - * This is needed for an abnormal server exit, since the normal exit stuff - * MUST also be performed (i.e. the vt must be left in a defined state) - */ -- ddxGiveUp(error); -+ ddxSigGiveUp(signo, error); -+} -+ -+/* -+ * AbortDDX -- -+ * DDX - specific abort routine. The attempt is made to restore -+ * all original setting of the displays. Also all devices are -+ * closed. -+ */ -+ -+void -+AbortDDX(enum ExitCode error) -+{ -+ SigAbortDDX(0, error); - } - - void -Index: xorg-server/hw/xnest/Init.c -=================================================================== ---- xorg-server.orig/hw/xnest/Init.c 2011-09-10 21:40:27.000000000 -0700 -+++ xorg-server/hw/xnest/Init.c 2011-09-10 21:45:50.076124422 -0700 -@@ -114,12 +114,17 @@ - /* - * DDX - specific abort routine. Called by AbortServer(). - */ --void AbortDDX(enum ExitCode error) -+void SigAbortDDX(int signo, enum ExitCode error) - { - xnestDoFullGeneration = True; - xnestCloseDisplay(); - } - -+void AbortDDX(enum ExitCode error) -+{ -+ SigAbortDDX(0, error); -+} -+ - /* Called by GiveUp(). */ - void ddxGiveUp(enum ExitCode error) - { -Index: xorg-server/hw/xquartz/darwin.c -=================================================================== ---- xorg-server.orig/hw/xquartz/darwin.c 2011-09-10 21:40:27.000000000 -0700 -+++ xorg-server/hw/xquartz/darwin.c 2011-09-10 22:01:07.976518255 -0700 -@@ -773,14 +773,20 @@ - - - /* -- * AbortDDX -- -+ * [Sig]AbortDDX -- - * DDX - specific abort routine. Called by AbortServer(). The attempt is - * made to restore all original setting of the displays. Also all devices - * are closed. - */ - _X_NORETURN --void AbortDDX( enum ExitCode error ) { -+void SigAbortDDX( int signo, enum ExitCode error ) -+{ - ErrorF( " AbortDDX\n" ); - OsAbort(); - } - -+_X_NORETURN -+void AbortDDX( enum ExitCode error ) -+{ -+ SigAbortDDX(signo, error); -+} -Index: xorg-server/hw/xwin/InitOutput.c -=================================================================== ---- xorg-server.orig/hw/xwin/InitOutput.c 2011-09-10 21:40:27.000000000 -0700 -+++ xorg-server/hw/xwin/InitOutput.c 2011-09-10 22:02:02.515804736 -0700 -@@ -258,7 +258,7 @@ - - /* See Porting Layer Definition - p. 57 */ - void --AbortDDX (enum ExitCode error) -+SigAbortDDX (int signo, enum ExitCode error) - { - #if CYGDEBUG - winDebug ("AbortDDX\n"); -@@ -266,6 +266,12 @@ - ddxGiveUp (error); - } - -+void -+AbortDDX (enum ExitCode error) -+{ -+ SigAbortDDX(0, error); -+} -+ - #ifdef __CYGWIN__ - /* hasmntopt is currently not implemented for cygwin */ - static const char *winCheckMntOpt(const struct mntent *mnt, const char *opt) -Index: xorg-server/include/os.h -=================================================================== ---- xorg-server.orig/include/os.h 2011-09-10 21:40:27.000000000 -0700 -+++ xorg-server/include/os.h 2011-09-11 09:51:52.766866712 -0700 -@@ -466,7 +466,9 @@ - EXIT_ERR_DRIVERS = 3, - }; - -+extern _X_EXPORT void SigAbortDDX(int signo, enum ExitCode error); - extern _X_EXPORT void AbortDDX(enum ExitCode error); -+extern _X_EXPORT void ddxSigGiveUp(int signo, enum ExitCode error); - extern _X_EXPORT void ddxGiveUp(enum ExitCode error); - extern _X_EXPORT int TimeSinceLastInputEvent(void); - -Index: xorg-server/os/log.c -=================================================================== ---- xorg-server.orig/os/log.c 2011-09-10 21:40:27.000000000 -0700 -+++ xorg-server/os/log.c 2011-09-11 09:51:21.555668560 -0700 -@@ -89,6 +89,8 @@ - #include /* for malloc() */ - #include - -+#include /* for raise() */ -+ - #include "input.h" - #include "site.h" - #include "opaque.h" -@@ -403,9 +405,11 @@ - - void - AbortServer(void) _X_NORETURN; -+void -+SigAbortServer(int signo) _X_NORETURN; - - void --AbortServer(void) -+SigAbortServer(int signo) - { - #ifdef XF86BIGFONT - XF86BigfontCleanup(); -@@ -413,11 +417,22 @@ - CloseWellKnownConnections(); - OsCleanup(TRUE); - CloseDownDevices(); -- AbortDDX(EXIT_ERR_ABORT); -+ SigAbortDDX(signo, EXIT_ERR_ABORT); - fflush(stderr); -- if (CoreDump) -- OsAbort(); -- exit (1); -+ if (CoreDump) { -+ if (signo != 0) -+ raise(signo); -+ else -+ OsAbort(); -+ } else { -+ exit (1); -+ } -+} -+ -+void -+AbortServer() -+{ -+ SigAbortServer(0); - } - - #define AUDIT_PREFIX "AUDIT: %s: %ld: " -@@ -518,6 +533,27 @@ - } - - void -+FatalSignal(int signo) -+{ -+ static Bool beenhere = FALSE; -+ -+ if (beenhere) -+ ErrorF("\nFatalSignal re-entered, aborting\n"); -+ else -+ ErrorF("\nCaught signal %d (%s). Server aborting\n", -+ signo, strsignal(signo)); -+ -+ if (!beenhere) -+ OsVendorFatalError(); -+ if (!beenhere) { -+ beenhere = TRUE; -+ SigAbortServer(signo); -+ } else -+ abort(); -+ /*NOTREACHED*/ -+} -+ -+void - FatalError(const char *f, ...) - { - va_list args; -Index: xorg-server/os/osinit.c -=================================================================== ---- xorg-server.orig/os/osinit.c 2011-09-10 21:40:27.000000000 -0700 -+++ xorg-server/os/osinit.c 2011-09-10 21:45:50.076124422 -0700 -@@ -138,13 +138,13 @@ - case SIGBUS: - case SIGILL: - case SIGFPE: -+ signal(signo,SIG_DFL); - ErrorF("%s at address %p\n", strsignal(signo), sip->si_addr); - } - } - #endif - -- FatalError("Caught signal %d (%s). Server aborting\n", -- signo, strsignal(signo)); -+ FatalSignal(signo); - } - - void diff --git a/debian/patches/105_nvidia_fglrx_autodetect.patch b/debian/patches/105_nvidia_fglrx_autodetect.patch deleted file mode 100644 index 5668e71..0000000 --- a/debian/patches/105_nvidia_fglrx_autodetect.patch +++ /dev/null @@ -1,83 +0,0 @@ -From 0366a844c36bf8424a2625425c181b9b97f35bee Mon Sep 17 00:00:00 2001 -From: Robert Hooker -Date: Wed, 1 Sep 2010 13:23:21 -0400 -Subject: [PATCH] Attempt to get nvidia and fglrx working without an xorg.conf. - -Signed-off-by: Robert Hooker ---- - hw/xfree86/common/xf86AutoConfig.c | 12 +++++++++++- - hw/xfree86/common/xf86pciBus.c | 14 +++++++++----- - 2 files changed, 20 insertions(+), 6 deletions(-) - -Index: xorg-server/hw/xfree86/common/xf86AutoConfig.c -=================================================================== ---- xorg-server.orig/hw/xfree86/common/xf86AutoConfig.c 2011-08-24 12:52:45.775647148 +0300 -+++ xorg-server/hw/xfree86/common/xf86AutoConfig.c 2011-08-24 12:58:12.485651804 +0300 -@@ -75,6 +75,13 @@ - "\tDevice\t" BUILTIN_DEVICE_NAME "\n" \ - "EndSection\n\n" - -+#define BUILTIN_SCREEN_SECTION_PROPRIETARY \ -+ "Section \"Screen\"\n" \ -+ "\tIdentifier\t" BUILTIN_SCREEN_NAME "\n" \ -+ "\tDevice\t" BUILTIN_DEVICE_NAME "\n" \ -+ "\tDefaultDepth\t24\n" \ -+ "EndSection\n\n" -+ - #define BUILTIN_LAYOUT_SECTION_PRE \ - "Section \"ServerLayout\"\n" \ - "\tIdentifier\t\"Builtin Default Layout\"\n" -@@ -153,7 +160,10 @@ - for (p = deviceList; *p; p++) { - snprintf(buf, sizeof(buf), BUILTIN_DEVICE_SECTION, *p, 0, *p); - AppendToConfig(buf); -- snprintf(buf, sizeof(buf), BUILTIN_SCREEN_SECTION, *p, 0, *p, 0); -+ if( strcmp(*p, "fglrx") == 0 || strcmp(*p, "nvidia") == 0) -+ snprintf(buf, sizeof(buf), BUILTIN_SCREEN_SECTION_PROPRIETARY, *p, 0, *p, 0); -+ else -+ snprintf(buf, sizeof(buf), BUILTIN_SCREEN_SECTION, *p, 0, *p, 0); - AppendToConfig(buf); - } - -Index: xorg-server/hw/xfree86/common/xf86pciBus.c -=================================================================== ---- xorg-server.orig/hw/xfree86/common/xf86pciBus.c 2011-08-24 12:56:49.535650619 +0300 -+++ xorg-server/hw/xfree86/common/xf86pciBus.c 2011-08-24 12:57:52.775651523 +0300 -@@ -1107,7 +1107,10 @@ - case 0x1142: driverList[0] = "apm"; break; - case 0xedd8: driverList[0] = "ark"; break; - case 0x1a03: driverList[0] = "ast"; break; -- case 0x1002: driverList[0] = "ati"; break; -+ case 0x1002: -+ driverList[0] = "fglrx"; -+ driverList[1] = "ati"; -+ break; - case 0x102c: driverList[0] = "chips"; break; - case 0x1013: driverList[0] = "cirrus"; break; - case 0x3d3d: driverList[0] = "glint"; break; -@@ -1124,20 +1127,21 @@ - case 0x102b: driverList[0] = "mga"; break; - case 0x10c8: driverList[0] = "neomagic"; break; - case 0x10de: case 0x12d2: -+ driverList[0] = "nvidia"; - switch (dev->device_id) { - /* NV1 */ - case 0x0008: - case 0x0009: -- driverList[0] = "vesa"; -+ driverList[1] = "vesa"; - break; - /* NV3 */ - case 0x0018: - case 0x0019: -- driverList[0] = "nv"; -+ driverList[1] = "nv"; - break; - default: -- driverList[0] = "nouveau"; -- driverList[1] = "nv"; -+ driverList[1] = "nouveau"; -+ driverList[2] = "nv"; - break; - } - break; diff --git a/debian/patches/111_armel-drv-fallbacks.patch b/debian/patches/111_armel-drv-fallbacks.patch deleted file mode 100644 index 50d0c6f..0000000 --- a/debian/patches/111_armel-drv-fallbacks.patch +++ /dev/null @@ -1,62 +0,0 @@ -Index: xorg-server-1.11.4/hw/xfree86/common/xf86AutoConfig.c -=================================================================== ---- xorg-server-1.11.4.orig/hw/xfree86/common/xf86AutoConfig.c 2012-05-21 13:27:14.460110121 -0300 -+++ xorg-server-1.11.4/hw/xfree86/common/xf86AutoConfig.c 2012-05-21 13:29:49.620879524 -0300 -@@ -44,6 +44,12 @@ - # include "xf86sbusBus.h" - #endif - -+#if defined(__arm__) && defined(__linux__) -+# include "loaderProcs.h" -+# include /* For opendir in test_sysfs_device */ -+# include /* For opendir in test_sysfs_device */ -+#endif -+ - #ifdef sun - # include - # include -@@ -198,6 +204,26 @@ - return ret == CONFIG_OK; - } - -+#if defined(__arm__) && defined(__linux__) -+static int -+test_sysfs_device (char * device_name, char * driver_name) -+{ -+ DIR* dir = opendir("/sys/devices/platform"); -+ struct dirent *current_dir; -+ int len = strlen(device_name); -+ -+ while (current_dir = readdir(dir)) { -+ if (strlen(current_dir->d_name) >= len && strncmp(device_name, current_dir->d_name, len) == 0) -+ break; -+ } -+ closedir(dir); -+ if(!current_dir) -+ return 0; -+ -+ return 1; -+} -+#endif /* defined(__arm__) && defined(__linux__) */ -+ - static void - listPossibleVideoDrivers(char *matches[], int nmatches) - { -@@ -282,6 +308,17 @@ - #if !defined(__linux__) && defined(__sparc__) - matches[i++] = xnfstrdup("wsfb"); - #else -+#if defined(__linux__) && defined(__arm__) -+ if (test_sysfs_device("mxc_gpu", "imx")) -+ matches[i++] = xnfstrdup("imx"); -+ else if (test_sysfs_device("dovefb", "dovefb")) -+ matches[i++] = xnfstrdup("dovefb"); -+ else if (test_sysfs_device("omap", "pvr")) { -+ matches[i++] = xnfstrdup("pvr"); -+ matches[i++] = xnfstrdup("omap"); -+ } else if (test_sysfs_device("omapfb", "omapfb")) -+ matches[i++] = xnfstrdup("omapfb"); -+#endif /* defined(__linux__) && defined(__arm__) */ - matches[i++] = xnfstrdup("fbdev"); - #endif - } diff --git a/debian/patches/122_xext_fix_card32_overflow_in_xauth.patch b/debian/patches/122_xext_fix_card32_overflow_in_xauth.patch deleted file mode 100644 index 69b7300..0000000 --- a/debian/patches/122_xext_fix_card32_overflow_in_xauth.patch +++ /dev/null @@ -1,38 +0,0 @@ -Description: Xext: "xauth generate" with large timeout crashes Xorg #27134 - The security timout CARD32 millis would overflow with large timeouts, causing - the timer callback to be called immediately and hit an assertion in - SecurityAuthorizationExpired. - . - This has not been applied upstream yet. Discussion of the patch faltered - without resolution. This patch has a problem when the epoch time is - sufficiently far in the future (about 2035) that it doesn't matter right now. -Origin: http://patchwork.freedesktop.org/patch/242/ -Bug: https://bugs.freedesktop.org/show_bug.cgi?id=27134 -Bug-Ubuntu: https://launchpad.net/bugs/519049 - -Index: xorg-server/Xext/security.c -=================================================================== ---- xorg-server.orig/Xext/security.c 2011-08-24 12:52:45.635647146 +0300 -+++ xorg-server/Xext/security.c 2011-08-24 12:56:49.595650621 +0300 -@@ -271,10 +271,10 @@ - /* maxSecs is the number of full seconds that can be expressed in - * 32 bits worth of milliseconds - */ -- CARD32 maxSecs = (CARD32)(~0) / (CARD32)MILLI_PER_SECOND; -+ CARD32 maxSecs = (CARD32)(MAXINT) / (CARD32)MILLI_PER_SECOND; - - if (seconds > maxSecs) -- { /* only come here if we want to wait more than 49 days */ -+ { /* only come here if we want to wait more than 24 days */ - pAuth->secondsRemaining = seconds - maxSecs; - return maxSecs * MILLI_PER_SECOND; - } -@@ -312,8 +312,6 @@ - { - SecurityAuthorizationPtr pAuth = (SecurityAuthorizationPtr)pval; - -- assert(pAuth->timer == timer); -- - if (pAuth->secondsRemaining) - { - return SecurityComputeAuthorizationTimeout(pAuth, diff --git a/debian/patches/13_debian_add_xkbpath_env_variable.diff b/debian/patches/13_debian_add_xkbpath_env_variable.diff deleted file mode 100644 index bd6ca5b..0000000 --- a/debian/patches/13_debian_add_xkbpath_env_variable.diff +++ /dev/null @@ -1,27 +0,0 @@ ---- xorg-server.orig/xkb/xkbInit.c -+++ xorg-server/xkb/xkbInit.c -@@ -805,6 +805,14 @@ - extern unsigned char XkbDfltAccessXOptions; - - int -+xkbInitGlobals() -+{ -+ char * xkbpath= getenv("XKBPATH"); -+ if (xkbpath!=NULL) -+ XkbBaseDirectory= xkbpath; -+} -+ -+int - XkbProcessArguments(int argc,char *argv[],int i) - { - if (strcmp(argv[i],"-kb")==0) { ---- xorg-server.orig/os/utils.c -+++ xorg-server/os/utils.c -@@ -685,6 +685,7 @@ - */ - void InitGlobals(void) - { -+ xkbInitGlobals(); - ddxInitGlobals(); - } - diff --git a/debian/patches/15-nouveau.diff b/debian/patches/15-nouveau.diff deleted file mode 100644 index 98fec87..0000000 --- a/debian/patches/15-nouveau.diff +++ /dev/null @@ -1,68 +0,0 @@ -From a685b5cf34532cef96fc9b05f735088ac0c0c7ad Mon Sep 17 00:00:00 2001 -From: Fedora X Ninjas -Date: Tue, 16 Feb 2010 11:38:17 +1000 -Subject: [PATCH 08/17] autoconfig: select nouveau by default for NVIDIA GPUs - -Also, don't treat DRI setup failure as an error for nouveau. ---- - glx/glxdri.c | 7 +++++-- - glx/glxdri2.c | 7 +++++-- - hw/xfree86/common/xf86AutoConfig.c | 19 ++++++++++++++++++- - 3 files changed, 28 insertions(+), 5 deletions(-) ---- -v2: Adapt the (II) part for nouveau after the move from glx/glxdri*.c to - glx/glxdricommon.c; the callers will still report (EE) after that - when mentioning the fallback to software rendering (since the error - case can be triggered in many various ways). - -Signed-off-by: Cyril Brulebois - ---- a/hw/xfree86/common/xf86pciBus.c -+++ b/hw/xfree86/common/xf86pciBus.c -@@ -1123,7 +1123,24 @@ videoPtrToDriverList(struct pci_device * - break; - case 0x102b: driverList[0] = "mga"; break; - case 0x10c8: driverList[0] = "neomagic"; break; -- case 0x10de: case 0x12d2: driverList[0] = "nv"; break; -+ case 0x10de: case 0x12d2: -+ switch (dev->device_id) { -+ /* NV1 */ -+ case 0x0008: -+ case 0x0009: -+ driverList[0] = "vesa"; -+ break; -+ /* NV3 */ -+ case 0x0018: -+ case 0x0019: -+ driverList[0] = "nv"; -+ break; -+ default: -+ driverList[0] = "nouveau"; -+ driverList[1] = "nv"; -+ break; -+ } -+ break; - case 0x1106: driverList[0] = "openchrome"; break; - case 0x1b36: driverList[0] = "qxl"; break; - case 0x1163: driverList[0] = "rendition"; break; ---- a/glx/glxdricommon.c -+++ b/glx/glxdricommon.c -@@ -217,6 +217,7 @@ glxProbeDriver(const char *driverName, - void *driver; - char filename[PATH_MAX]; - const __DRIextension **extensions; -+ int from = X_ERROR; - - snprintf(filename, sizeof filename, "%s/%s_dri.so", - dri_driver_path, driverName); -@@ -248,7 +249,9 @@ glxProbeDriver(const char *driverName, - } - - if (*coreExt == NULL || *renderExt == NULL) { -- LogMessage(X_ERROR, -+ if (!strcmp(driverName, "nouveau")) -+ from = X_INFO; -+ LogMessage(from, - "AIGLX error: %s does not export required DRI extension\n", - driverName); - goto cleanup_failure; diff --git a/debian/patches/157_check_null_modes.patch b/debian/patches/157_check_null_modes.patch deleted file mode 100644 index a0d6370..0000000 --- a/debian/patches/157_check_null_modes.patch +++ /dev/null @@ -1,14 +0,0 @@ -Index: xorg-server/hw/xfree86/common/xf86VidMode.c -=================================================================== ---- xorg-server.orig/hw/xfree86/common/xf86VidMode.c 2011-08-24 12:52:45.565647144 +0300 -+++ xorg-server/hw/xfree86/common/xf86VidMode.c 2011-08-24 12:56:49.605650623 +0300 -@@ -222,6 +222,9 @@ - - pScrn = xf86Screens[scrnIndex]; - pVidMode = VMPTR(pScrn->pScreen); -+ if (pScrn->modes == NULL) -+ return FALSE; -+ - pVidMode->First = pScrn->modes; - pVidMode->Next = pVidMode->First->next; - diff --git a/debian/patches/162_null_crtc_in_rotation.patch b/debian/patches/162_null_crtc_in_rotation.patch deleted file mode 100644 index 0f01921..0000000 --- a/debian/patches/162_null_crtc_in_rotation.patch +++ /dev/null @@ -1,14 +0,0 @@ -Index: xorg-server/hw/xfree86/modes/xf86RandR12.c -=================================================================== ---- xorg-server.orig/hw/xfree86/modes/xf86RandR12.c 2011-08-24 12:52:45.505647142 +0300 -+++ xorg-server/hw/xfree86/modes/xf86RandR12.c 2011-08-24 12:56:49.615650622 +0300 -@@ -930,7 +930,8 @@ - for (c = 0; c < config->num_crtc; c++) { - xf86CrtcPtr crtc = config->crtc[c]; - -- RRCrtcSetRotations (crtc->randr_crtc, rotations); -+ if (crtc != NULL) -+ RRCrtcSetRotations (crtc->randr_crtc, rotations); - } - #endif - randrp->supported_rotations = rotations; diff --git a/debian/patches/165_man_xorg_conf_no_device_ident.patch b/debian/patches/165_man_xorg_conf_no_device_ident.patch deleted file mode 100644 index a11d2a1..0000000 --- a/debian/patches/165_man_xorg_conf_no_device_ident.patch +++ /dev/null @@ -1,26 +0,0 @@ -From b3bb14b11a58f7bfc3ba5617c524d01a6e683de1 Mon Sep 17 00:00:00 2001 -From: Bryce Harrington -Date: Wed, 18 Mar 2009 21:08:19 -0700 -Subject: [PATCH] X boots up without a 'Device' identifier; don't need to say it - is mandatory in the xorg.conf man page anymore. - -Signed-off-by: Bryce Harrington ---- - hw/xfree86/man/xorg.conf.man.pre | 4 +--- - 1 files changed, 1 insertions(+), 3 deletions(-) - -Index: xorg-server/hw/xfree86/doc/man/xorg.conf.man -=================================================================== ---- xorg-server.orig/hw/xfree86/man/xorg.conf.man 2011-08-24 12:52:45.445647143 +0300 -+++ xorg-server/hw/xfree86/man/xorg.conf.man 2011-08-24 12:56:49.625650620 +0300 -@@ -1816,9 +1816,7 @@ - .PP - The - .B Identifier --and --.B Device --entries are mandatory. -+entry is mandatory. - All others are optional. - .PP - The diff --git a/debian/patches/166_nullptr_xinerama_keyrepeat.patch b/debian/patches/166_nullptr_xinerama_keyrepeat.patch deleted file mode 100644 index cbff596..0000000 --- a/debian/patches/166_nullptr_xinerama_keyrepeat.patch +++ /dev/null @@ -1,27 +0,0 @@ -From f0ef98d8d54f5dfa3081b62ff672e0fe992b0a01 Mon Sep 17 00:00:00 2001 -From: Bryce Harrington -Date: Wed, 18 Mar 2009 23:28:51 -0700 -Subject: [PATCH] Check for null pointer dereference to prevent crash - on non-primary Xinerama screens when key repeating. - (LP: #324465) - -Signed-off-by: Bryce Harrington ---- - mi/mipointer.c | 4 ++++ - 1 files changed, 4 insertions(+), 0 deletions(-) - -Index: xorg-server/mi/mipointer.c -=================================================================== ---- xorg-server.orig/mi/mipointer.c 2011-08-24 12:52:45.385647143 +0300 -+++ xorg-server/mi/mipointer.c 2011-08-24 12:57:30.295651201 +0300 -@@ -300,6 +300,10 @@ - SetupScreen (pScreen); - pPointer = MIPOINTER(pDev); - -+ /* Null pointer causes crash on keyrepeat with Xinerama LP: (#324465) */ -+ if (pPointer == NULL) -+ return; -+ - if (pPointer->pScreen != pScreen) - { - (*pScreenPriv->screenFuncs->NewEventScreen) (pDev, pScreen, TRUE); diff --git a/debian/patches/167_nullptr_xisbread.patch b/debian/patches/167_nullptr_xisbread.patch deleted file mode 100644 index 0fa56bd..0000000 --- a/debian/patches/167_nullptr_xisbread.patch +++ /dev/null @@ -1,14 +0,0 @@ -Index: xorg-server/hw/xfree86/common/xisb.c -=================================================================== ---- xorg-server.orig/hw/xfree86/common/xisb.c 2011-08-24 12:52:45.315647139 +0300 -+++ xorg-server/hw/xfree86/common/xisb.c 2011-08-24 12:56:49.655650624 +0300 -@@ -98,6 +98,9 @@ - { - int ret; - -+ if (b == NULL) -+ return -2; -+ - if (b->current >= b->end) - { - if (b->block_duration >= 0) diff --git a/debian/patches/168_glibc_trace_to_stderr.patch b/debian/patches/168_glibc_trace_to_stderr.patch deleted file mode 100644 index 5503a1c..0000000 --- a/debian/patches/168_glibc_trace_to_stderr.patch +++ /dev/null @@ -1,17 +0,0 @@ -Report abort traces to stderr instead of terminal. This enables apport -to catch the error so it can file a bug report about the crash. - -Index: xorg-server/hw/xfree86/common/xf86Init.c -=================================================================== ---- xorg-server.orig/hw/xfree86/common/xf86Init.c 2011-08-24 12:56:49.555650622 +0300 -+++ xorg-server/hw/xfree86/common/xf86Init.c 2011-08-24 12:56:49.665650623 +0300 -@@ -866,6 +866,9 @@ - - if (!beenHere) { - umask(022); -+ /* have glibc report internal abort traces to stderr instead of -+ the controlling terminal */ -+ setenv("LIBC_FATAL_STDERR_","1",0); - xf86LogInit(); - } - diff --git a/debian/patches/172_cwgetbackingpicture_nullptr_check.patch b/debian/patches/172_cwgetbackingpicture_nullptr_check.patch deleted file mode 100644 index 8d5bd4b..0000000 --- a/debian/patches/172_cwgetbackingpicture_nullptr_check.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 7813adf66be31d8b0e8df21821e786e688f7fe78 Mon Sep 17 00:00:00 2001 -From: Bryce Harrington -Date: Fri, 27 Mar 2009 19:01:32 -0700 -Subject: [PATCH] cwGetBackingPicture can segfault when minimizing/maximizing firefox with - a flash video playing. This appears to be a race condition in which the - backing picture's data is not always fully defined. - -Signed-off-by: Bryce Harrington ---- - miext/cw/cw_render.c | 13 +++++++++---- - 1 files changed, 9 insertions(+), 4 deletions(-) - -Index: xorg-server/miext/cw/cw_render.c -=================================================================== ---- xorg-server.orig/miext/cw/cw_render.c 2011-08-24 12:52:45.195647139 +0300 -+++ xorg-server/miext/cw/cw_render.c 2011-08-24 12:56:49.675650621 +0300 -@@ -123,10 +123,15 @@ - WindowPtr pWindow = (WindowPtr) pDrawable; - PixmapPtr pPixmap = getCwPixmap (pWindow); - -- *x_off = pDrawable->x - pPixmap->screen_x; -- *y_off = pDrawable->y - pPixmap->screen_y; -+ if (pDrawable && pPixmap) { -+ *x_off = pDrawable->x - pPixmap->screen_x; -+ *y_off = pDrawable->y - pPixmap->screen_y; - -- return pPicturePrivate->pBackingPicture; -+ return pPicturePrivate->pBackingPicture; -+ } else { -+ *x_off = *y_off = 0; -+ return pPicture; -+ } - } - else - { diff --git a/debian/patches/188_default_primary_to_first_busid.patch b/debian/patches/188_default_primary_to_first_busid.patch deleted file mode 100644 index 2115a52..0000000 --- a/debian/patches/188_default_primary_to_first_busid.patch +++ /dev/null @@ -1,20 +0,0 @@ -If there seems to be more than one possible primary device, just -pick the first device and carry on (LP 459512) - -signed-off-by: Bryce Harrington - -Index: xorg-server/hw/xfree86/common/xf86pciBus.c -=================================================================== ---- xorg-server.orig/hw/xfree86/common/xf86pciBus.c 2011-08-24 12:56:49.565650621 +0300 -+++ xorg-server/hw/xfree86/common/xf86pciBus.c 2011-08-24 12:56:49.685650622 +0300 -@@ -147,8 +147,8 @@ - primaryBus.id.pci = info; - } else { - xf86Msg(X_NOTICE, -- "More than one possible primary device found\n"); -- primaryBus.type ^= (BusType)(-1); -+ "More than one possible primary device found. Using first one seen.\n"); -+ break; - } - } - } diff --git a/debian/patches/190_cache-xkbcomp_output_for_fast_start_up.patch b/debian/patches/190_cache-xkbcomp_output_for_fast_start_up.patch deleted file mode 100644 index ca4a57c..0000000 --- a/debian/patches/190_cache-xkbcomp_output_for_fast_start_up.patch +++ /dev/null @@ -1,343 +0,0 @@ -Patch from Moblin to cache xkbcomp output for faster booting - -Signed-off-by: Bryce Harrington ---- - -Index: xorg-server/configure.ac -=================================================================== ---- xorg-server.orig/configure.ac 2011-08-24 12:56:49.505650620 +0300 -+++ xorg-server/configure.ac 2011-08-24 12:57:47.895651453 +0300 -@@ -537,9 +537,9 @@ - AC_ARG_WITH(xkb-path, AS_HELP_STRING([--with-xkb-path=PATH], [Path to XKB base dir (default: ${datadir}/X11/xkb)]), - [ XKBPATH="$withval" ], - [ XKBPATH="${datadir}/X11/xkb" ]) --AC_ARG_WITH(xkb-output, AS_HELP_STRING([--with-xkb-output=PATH], [Path to XKB output dir (default: ${datadir}/X11/xkb/compiled)]), -+AC_ARG_WITH(xkb-output, AS_HELP_STRING([--with-xkb-output=PATH], [Path to XKB output dir (default: ${localstatedir}/cache/xkb)]), - [ XKBOUTPUT="$withval" ], -- [ XKBOUTPUT="compiled" ]) -+ [ XKBOUTPUT="${localstatedir}/cache/xkb" ]) - AC_ARG_WITH(default-xkb-rules, AS_HELP_STRING([--with-default-xkb-rules=RULES], - [Keyboard ruleset (default: base/evdev)]), - [ XKB_DFLT_RULES="$withval" ], -@@ -1173,7 +1173,7 @@ - dnl Make sure XKM_OUTPUT_DIR is an absolute path - XKBOUTPUT_FIRSTCHAR=`echo $XKBOUTPUT | cut -b 1` - if [[ x$XKBOUTPUT_FIRSTCHAR != x/ -a x$XKBOUTPUT_FIRSTCHAR != 'x$' ]] ; then -- XKBOUTPUT="$XKB_BASE_DIRECTORY/$XKBOUTPUT" -+ AC_MSG_ERROR([xkb-output must be an absolute path.]) - fi - - dnl XKM_OUTPUT_DIR (used in code) must end in / or file names get hosed -Index: xorg-server/xkb/README.compiled -=================================================================== ---- xorg-server.orig/xkb/README.compiled 2011-08-24 12:52:45.055647137 +0300 -+++ xorg-server/xkb/README.compiled 2011-08-24 12:56:49.705650623 +0300 -@@ -4,10 +4,10 @@ - or some other tool might destroy or replace the files in this directory, - so it is not a safe place to store compiled keymaps for long periods of - time. The default keymap for any server is usually stored in: -- X-default.xkm --where is the display number of the server in question, which makes --it possible for several servers *on the same host* to share the same --directory. -+ server-.xkm -+ -+where is the SHA1 hash of keymap source, so that compiled -+keymap of different keymap sources are stored in different files. - - Unless the X server is modified, sharing this directory between servers on - different hosts could cause problems. -Index: xorg-server/xkb/ddxLoad.c -=================================================================== ---- xorg-server.orig/xkb/ddxLoad.c 2011-08-24 12:52:45.065647139 +0300 -+++ xorg-server/xkb/ddxLoad.c 2011-08-24 12:56:49.705650623 +0300 -@@ -30,6 +30,12 @@ - - #include - -+#ifdef HAVE_SHA1_IN_LIBGCRYPT /* Use libgcrypt for SHA1 */ -+# include -+#else /* Use OpenSSL's libcrypto */ -+#warning "xkbcomp caching support disabled" -+#endif -+ - #include - #include - #include -@@ -43,20 +49,9 @@ - #define XKBSRV_NEED_FILE_FUNCS - #include - #include -+#include - #include "xkb.h" - -- /* -- * If XKM_OUTPUT_DIR specifies a path without a leading slash, it is -- * relative to the top-level XKB configuration directory. -- * Making the server write to a subdirectory of that directory -- * requires some work in the general case (install procedure -- * has to create links to /var or somesuch on many machines), -- * so we just compile into /usr/tmp for now. -- */ --#ifndef XKM_OUTPUT_DIR --#define XKM_OUTPUT_DIR "compiled/" --#endif -- - #define PRE_ERROR_MSG "\"The XKEYBOARD keymap compiler (xkbcomp) reports:\"" - #define ERROR_PREFIX "\"> \"" - #define POST_ERROR_MSG1 "\"Errors from xkbcomp are not fatal to the X server\"" -@@ -170,6 +165,47 @@ - } - } - -+#ifndef SHA_DIGEST_LENGTH -+#define SHA_DIGEST_LENGTH 20 -+#endif -+ -+static Bool -+Sha1Asc(char sha1Asc[SHA_DIGEST_LENGTH*2+1], const char * input) -+{ -+ int i; -+ unsigned char sha1[SHA_DIGEST_LENGTH]; -+ -+#ifdef HAVE_SHA1_IN_LIBGCRYPT /* Use libgcrypt for SHA1 */ -+ static int init; -+ gcry_md_hd_t h; -+ gcry_error_t err; -+ -+ if (!init) { -+ if (!gcry_check_version(NULL)) -+ return BadAlloc; -+ gcry_control(GCRYCTL_DISABLE_SECMEM, 0); -+ gcry_control(GCRYCTL_INITIALIZATION_FINISHED, 0); -+ init = 1; -+ } -+ -+ err = gcry_md_open(&h, GCRY_MD_SHA1, 0); -+ if (err) -+ return BadAlloc; -+ gcry_md_write(h, input, strlen(input)); -+ memcpy(sha1, gcry_md_read(h, GCRY_MD_SHA1), 20); -+ gcry_md_close(h); -+#endif -+ -+ /* convert sha1 to sha1_asc */ -+ for(i=0; i nameRtrnLen) && nameRtrn) { -+ ErrorF("[xkb] nameRtrn too small to hold xkmfile name\n"); -+ return FALSE; -+ } -+ strncpy(nameRtrn, xkmfile, nameRtrnLen); -+ -+ /* if the xkm file already exists, reuse it */ -+ canonicalXkmFileName = Xprintf("%s%s.xkm", xkm_output_dir, xkmfile); -+ if (access(canonicalXkmFileName, R_OK) == 0) { -+ /* yes, we can reuse the old xkm file */ -+ LogMessage(X_INFO, "XKB: reuse xkmfile %s\n", canonicalXkmFileName); -+ result = TRUE; -+ goto _ret; -+ } -+ LogMessage(X_INFO, "XKB: generating xkmfile %s\n", canonicalXkmFileName); -+ -+ /* continue to call xkbcomp to compile the keymap. to avoid race -+ condition, we compile it to a tmpfile then rename it to -+ xkmfile */ - - #ifdef WIN32 - strcpy(tmpname, Win32TempDir()); -@@ -222,15 +315,21 @@ - } - } - -+ if ( (tmpXkmFile = tempnam(xkm_output_dir, NULL)) == NULL ) { -+ ErrorF("[xkb] Can't generate temp xkm file name"); -+ result = FALSE; -+ goto _ret; -+ } -+ - if (asprintf(&buf, - "\"%s%sxkbcomp\" -w %d %s -xkm \"%s\" " -- "-em1 %s -emp %s -eml %s \"%s%s.xkm\"", -+ "-em1 %s -emp %s -eml %s \"%s\"", - xkbbindir, xkbbindirsep, - ((xkbDebugFlags < 2) ? 1 : - ((xkbDebugFlags > 10) ? 10 : (int) xkbDebugFlags)), -- xkbbasedirflag ? xkbbasedirflag : "", xkmfile, -+ xkbbasedirflag ? xkbbasedirflag : "", xkbfile, - PRE_ERROR_MSG, ERROR_PREFIX, POST_ERROR_MSG1, -- xkm_output_dir, keymap) == -1) -+ tmpXkmFile) == -1) - buf = NULL; - - free(xkbbasedirflag); -@@ -240,6 +339,11 @@ - return FALSE; - } - -+ /* there's a potential race condition between calling tempnam() -+ and invoking xkbcomp to write the result file (potential temp -+ file name conflicts), but since xkbcomp is a standalone -+ program, we have to live with this */ -+ - #ifndef WIN32 - out= Popen(buf,"w"); - #else -@@ -247,30 +351,42 @@ - #endif - - if (out!=NULL) { --#ifdef DEBUG -- if (xkbDebugFlags) { -- ErrorF("[xkb] XkbDDXCompileKeymapByNames compiling keymap:\n"); -- XkbWriteXKBKeymapForNames(stderr,names,xkb,want,need); -- } --#endif -- XkbWriteXKBKeymapForNames(out,names,xkb,want,need); -+ /* write XKBKeyMapBuf to xkbcomp */ -+ if (EOF==fputs(xkbKeyMapBuf, out)) -+ { -+ ErrorF("[xkb] Sending keymap to xkbcomp failed\n"); -+ result = FALSE; -+ goto _ret; -+ } - #ifndef WIN32 - if (Pclose(out)==0) - #else - if (fclose(out)==0 && System(buf) >= 0) - #endif - { -+ /* xkbcomp success */ - if (xkbDebugFlags) -- DebugF("[xkb] xkb executes: %s\n",buf); -- if (nameRtrn) { -- strncpy(nameRtrn,keymap,nameRtrnLen); -- nameRtrn[nameRtrnLen-1]= '\0'; -- } -- free(buf); -- return TRUE; -+ DebugF("[xkb] xkb executes: %s\n",buf); -+ -+ /* if canonicalXkmFileName already exists now, we simply -+ overwrite it, this is OK */ -+ ret = rename(tmpXkmFile, canonicalXkmFileName); -+ if (0 != ret) { -+ ErrorF("[xkb] Can't rename %s to %s, error: %s\n", -+ tmpXkmFile, canonicalXkmFileName, -+ strerror(errno)); -+ -+ /* in case of error, don't unlink tmpXkmFile, leave i -+ for debugging */ -+ -+ result = FALSE; -+ goto _ret; -+ } -+ result = TRUE; -+ goto _ret; - } - else -- LogMessage(X_ERROR, "Error compiling keymap (%s)\n", keymap); -+ LogMessage(X_ERROR, "Error compiling keymap (%s)\n", xkbfile); - #ifdef WIN32 - /* remove the temporary file */ - unlink(tmpname); -@@ -285,8 +401,17 @@ - } - if (nameRtrn) - nameRtrn[0]= '\0'; -- free(buf); -- return FALSE; -+ result = FALSE; -+ -+_ret: -+ if (tmpXkmFile) -+ free(tmpXkmFile); -+ if (canonicalXkmFileName) -+ free(canonicalXkmFileName); -+ if (buf) -+ free(buf); -+ -+ return result; - } - - static FILE * -@@ -370,7 +495,6 @@ - DebugF("Loaded XKB keymap %s, defined=0x%x\n",fileName,(*xkbRtrn)->defined); - } - fclose(file); -- (void) unlink (fileName); - return (need|want)&(~missing); - } - diff --git a/debian/patches/191-Xorg-add-an-extra-module-path.patch b/debian/patches/191-Xorg-add-an-extra-module-path.patch deleted file mode 100644 index 59ae2c1..0000000 --- a/debian/patches/191-Xorg-add-an-extra-module-path.patch +++ /dev/null @@ -1,99 +0,0 @@ -From 416a66de9d428a11776331926c23a61188b8fc16 Mon Sep 17 00:00:00 2001 -From: Ander Conselvan de Oliveira -Date: Thu, 12 Mar 2009 09:45:57 -0300 -Subject: [PATCH 908/911] Xorg: add an extra module path - -If the extra module path is not an empty string (the default value), -module path will be searched first in the extra module path and then in -the default module path. This should simplify the alternatives system -used on Mandriva's fglrx package. ---- -Index: xorg-server/configure.ac -=================================================================== ---- xorg-server.orig/configure.ac 2011-08-24 12:56:49.705650623 +0300 -+++ xorg-server/configure.ac 2011-08-24 12:57:34.655651265 +0300 -@@ -489,6 +489,10 @@ - [Directory where modules are installed (default: $libdir/xorg/modules)]), - [ moduledir="$withval" ], - [ moduledir="${libdir}/xorg/modules" ]) -+AC_ARG_WITH(extra-module-dir,AS_HELP_STRING([--with-extra-module-dir=DIR], -+ [Extra module directory to search for modules before the default one (default: empty)]), -+ [ extra_moduledir="$withval" ], -+ [ extra_moduledir="" ]) - AC_ARG_WITH(log-dir, AS_HELP_STRING([--with-log-dir=DIR], - [Directory where log files are kept (default: $localstatedir/log)]), - [ logdir="$withval" ], -@@ -1815,6 +1819,7 @@ - AC_DEFINE_DIR(XF86CONFIGFILE, XF86CONFIGFILE, [Name of configuration file]) - AC_DEFINE_DIR(__XCONFIGDIR__, XF86CONFIGDIR, [Name of configuration directory]) - AC_DEFINE_DIR(DEFAULT_MODULE_PATH, moduledir, [Default module search path]) -+ AC_DEFINE_DIR(EXTRA_MODULE_PATH, extra_moduledir, [Extra module search path, searched before the default one]) - AC_DEFINE_DIR(DEFAULT_LIBRARY_PATH, libdir, [Default library install path]) - AC_DEFINE_DIR(DEFAULT_LOGPREFIX, LOGPREFIX, [Default log location]) - AC_DEFINE_UNQUOTED(__VENDORDWEBSUPPORT__, ["$VENDOR_WEB"], [Vendor web address for support]) -Index: xorg-server/hw/xfree86/common/xf86Config.c -=================================================================== ---- xorg-server.orig/hw/xfree86/common/xf86Config.c 2011-08-24 12:52:44.925647137 +0300 -+++ xorg-server/hw/xfree86/common/xf86Config.c 2011-08-24 12:56:49.715650621 +0300 -@@ -628,11 +628,21 @@ - - /* ModulePath */ - -- if (fileconf) { -- if (xf86ModPathFrom != X_CMDLINE && fileconf->file_modulepath) { -+ if (xf86ModPathFrom != X_CMDLINE) { -+ if (fileconf && fileconf->file_modulepath) { - xf86ModulePath = fileconf->file_modulepath; - xf86ModPathFrom = X_CONFIG; - } -+ else if (strcmp(xf86ExtraModulePath, "") != 0) { -+ char *newpath = malloc(strlen(xf86ExtraModulePath) -+ + strlen(xf86ModulePath) -+ + 2); -+ strcpy(newpath, xf86ExtraModulePath); -+ strcat(newpath, ","); -+ strcat(newpath, xf86ModulePath); -+ -+ xf86ModulePath = newpath; -+ } - } - - xf86Msg(xf86ModPathFrom, "ModulePath set to \"%s\"\n", xf86ModulePath); -Index: xorg-server/hw/xfree86/common/xf86Globals.c -=================================================================== ---- xorg-server.orig/hw/xfree86/common/xf86Globals.c 2011-08-24 12:52:44.935647136 +0300 -+++ xorg-server/hw/xfree86/common/xf86Globals.c 2011-08-24 12:56:49.715650621 +0300 -@@ -139,6 +139,7 @@ - const char *xf86ConfigFile = NULL; - const char *xf86ConfigDir = NULL; - const char *xf86ModulePath = DEFAULT_MODULE_PATH; -+const char *xf86ExtraModulePath = EXTRA_MODULE_PATH; - MessageType xf86ModPathFrom = X_DEFAULT; - const char *xf86LogFile = DEFAULT_LOGPREFIX; - MessageType xf86LogFileFrom = X_DEFAULT; -Index: xorg-server/hw/xfree86/common/xf86Priv.h -=================================================================== ---- xorg-server.orig/hw/xfree86/common/xf86Priv.h 2011-08-24 12:52:44.945647134 +0300 -+++ xorg-server/hw/xfree86/common/xf86Priv.h 2011-08-24 12:56:49.715650621 +0300 -@@ -75,6 +75,7 @@ - - extern _X_EXPORT xf86InfoRec xf86Info; - extern _X_EXPORT const char *xf86ModulePath; -+extern _X_EXPORT const char *xf86ExtraModulePath; - extern _X_EXPORT MessageType xf86ModPathFrom; - extern _X_EXPORT const char *xf86LogFile; - extern _X_EXPORT MessageType xf86LogFileFrom; -Index: xorg-server/include/xorg-config.h.in -=================================================================== ---- xorg-server.orig/include/xorg-config.h.in 2011-08-24 12:52:44.965647137 +0300 -+++ xorg-server/include/xorg-config.h.in 2011-08-24 12:56:49.715650621 +0300 -@@ -42,6 +42,9 @@ - /* Path to loadable modules. */ - #undef DEFAULT_MODULE_PATH - -+/* Path to extra loadable modules. */ -+#undef EXTRA_MODULE_PATH -+ - /* Path to installed libraries. */ - #undef DEFAULT_LIBRARY_PATH - diff --git a/debian/patches/198_nohwaccess.patch b/debian/patches/198_nohwaccess.patch deleted file mode 100644 index 0bc9169..0000000 --- a/debian/patches/198_nohwaccess.patch +++ /dev/null @@ -1,55 +0,0 @@ -Two chunks of jbarne's nohwaccess patch got taken upstream; this patch -contains just the remainder, which implements a -nohwaccess option. - -Index: xorg-server/hw/xfree86/os-support/linux/lnx_init.c -=================================================================== ---- xorg-server.orig/hw/xfree86/os-support/linux/lnx_init.c 2011-08-24 12:52:44.815647133 +0300 -+++ xorg-server/hw/xfree86/os-support/linux/lnx_init.c 2011-08-24 12:56:49.725650622 +0300 -@@ -41,6 +41,7 @@ - static Bool KeepTty = FALSE; - static Bool VTSwitch = TRUE; - static Bool ShareVTs = FALSE; -+Bool NoHwAccess = FALSE; - static int activeVT = -1; - - static char vtname[11]; -@@ -321,6 +322,11 @@ - ShareVTs = TRUE; - return 1; - } -+ if (!strcmp(argv[i], "-nohwaccess")) -+ { -+ NoHwAccess = TRUE; -+ return(1); -+ } - if ((argv[i][0] == 'v') && (argv[i][1] == 't')) - { - if (sscanf(argv[i], "vt%2d", &xf86Info.vtno) == 0) -@@ -342,4 +348,5 @@ - ErrorF("don't detach controlling tty (for debugging only)\n"); - ErrorF("-novtswitch don't immediately switch to new VT\n"); - ErrorF("-sharevts share VTs with another X server\n"); -+ ErrorF("-nohwaccess don't access hardware ports directly\n"); - } -Index: xorg-server/hw/xfree86/os-support/linux/lnx_video.c -=================================================================== ---- xorg-server.orig/hw/xfree86/os-support/linux/lnx_video.c 2011-08-24 12:52:44.825647135 +0300 -+++ xorg-server/hw/xfree86/os-support/linux/lnx_video.c 2011-08-24 12:56:49.725650622 +0300 -@@ -50,6 +50,7 @@ - #define MAP_FAILED ((void *)-1) - #endif - -+extern Bool NoHwAccess; - static Bool ExtendedEnabled = FALSE; - - #ifdef __ia64__ -@@ -497,6 +498,9 @@ - int fd; - unsigned int ioBase_phys; - #endif -+ /* Fake it... */ -+ if (NoHwAccess) -+ return TRUE; - - if (ExtendedEnabled) - return TRUE; diff --git a/debian/patches/200_randr-null.patch b/debian/patches/200_randr-null.patch deleted file mode 100644 index d2ddbaa..0000000 --- a/debian/patches/200_randr-null.patch +++ /dev/null @@ -1,14 +0,0 @@ -=== modified file 'randr/randr.c' -Index: xorg-server/randr/randr.c -=================================================================== ---- xorg-server.orig/randr/randr.c 2011-08-24 12:52:44.745647133 +0300 -+++ xorg-server/randr/randr.c 2011-08-24 12:57:30.195651199 +0300 -@@ -235,7 +235,7 @@ - /* - * Calling function best set these function vectors - */ -- pScrPriv->rrGetInfo = 0; -+ pScrPriv->rrGetInfo = NULL; - pScrPriv->maxWidth = pScrPriv->minWidth = pScreen->width; - pScrPriv->maxHeight = pScrPriv->minHeight = pScreen->height; - diff --git a/debian/patches/201_report-real-dpi.patch b/debian/patches/201_report-real-dpi.patch deleted file mode 100644 index 253f38d..0000000 --- a/debian/patches/201_report-real-dpi.patch +++ /dev/null @@ -1,46 +0,0 @@ -Description: Report physical DPI when EDID data exists. - . - This reverts git commit fff00df94d7ebd18a8e24537ec96073717375a3f, which - made X report 96DPI via the core protocol. - . - We want to make this policy decision higher up the stack than the X server, - so revert this and make X report the physical DPI when the EDID contains - physical size data. -Author: Christopher James Halse Rogers - -Index: xorg-server/hw/xfree86/modes/xf86RandR12.c -=================================================================== ---- xorg-server.orig/hw/xfree86/modes/xf86RandR12.c 2010-08-03 15:59:57.750272356 +1000 -+++ xorg-server/hw/xfree86/modes/xf86RandR12.c 2010-08-03 16:00:00.750380508 +1000 -@@ -805,6 +805,7 @@ - else - { - xf86OutputPtr output = xf86CompatOutput(pScrn); -+ rrScrPriv(pScreen); - - if (output && - output->conf_monitor && -@@ -817,6 +818,23 @@ - mmWidth = output->conf_monitor->mon_width; - mmHeight = output->conf_monitor->mon_height; - } -+ else if (pScrPriv && pScrPriv->primaryOutput) -+ { -+ /* Calculate DPI based on primary display size, not the entire display size */ -+ mmWidth = pScrPriv->primaryOutput->mmWidth * width / pScrPriv->primaryOutput->crtc->mode->mode.width; -+ mmHeight = pScrPriv->primaryOutput->mmHeight * height / pScrPriv->primaryOutput->crtc->mode->mode.height; -+ } -+ else if (output && output->crtc && output->crtc->mode.HDisplay && -+ output->mm_width && output->mm_height) -+ { -+ /* -+ * If the output has a mode and a declared size, use that -+ * to scale the screen size -+ */ -+ DisplayModePtr mode = &output->crtc->mode; -+ mmWidth = output->mm_width * width / mode->HDisplay; -+ mmHeight = output->mm_height * height / mode->VDisplay; -+ } - else - { - /* diff --git a/debian/patches/208_switch_on_release.diff b/debian/patches/208_switch_on_release.diff deleted file mode 100644 index 3eefde7..0000000 --- a/debian/patches/208_switch_on_release.diff +++ /dev/null @@ -1,109 +0,0 @@ -Index: xorg-server/xkb/xkbActions.c -=================================================================== ---- xorg-server.orig/xkb/xkbActions.c 2011-12-14 15:15:20.000000000 -0800 -+++ xorg-server/xkb/xkbActions.c 2011-12-14 15:26:43.372680253 -0800 -@@ -328,24 +328,83 @@ _XkbFilterLatchState( XkbSrvInfoPtr xkbi - return 1; - } - -+static int xkbSwitchGroupOnRelease(void) -+{ -+ /* TODO: user configuring */ -+ return TRUE; -+} -+ -+static void xkbUpdateLockedGroup(XkbSrvInfoPtr xkbi, XkbAction* pAction) -+{ -+ XkbGroupAction ga = pAction->group; -+ if (ga.flags&XkbSA_GroupAbsolute) -+ xkbi->state.locked_group= XkbSAGroup(&ga); -+ else xkbi->state.locked_group+= XkbSAGroup(&ga); -+} -+ -+static XkbFilterPtr _XkbNextFreeFilter(XkbSrvInfoPtr xkbi); -+ - static int --_XkbFilterLockState( XkbSrvInfoPtr xkbi, -+_XkbFilterLockGroup( XkbSrvInfoPtr xkbi, - XkbFilterPtr filter, - unsigned keycode, - XkbAction * pAction) - { -- if (pAction&&(pAction->type==XkbSA_LockGroup)) { -- if (pAction->group.flags&XkbSA_GroupAbsolute) -- xkbi->state.locked_group= XkbSAGroup(&pAction->group); -- else xkbi->state.locked_group+= XkbSAGroup(&pAction->group); -- return 1; -+ int sendEvent = 1; -+ -+ if (!xkbSwitchGroupOnRelease()) { -+ xkbUpdateLockedGroup(xkbi, pAction); -+ return sendEvent; -+ } -+ -+ /* Delay switch till button release */ -+ if (filter->keycode==0) { /* initial press */ -+ filter->keycode = keycode; -+ filter->active = 1; -+ filter->filterOthers = 0; /* for what? */ -+ filter->filter = _XkbFilterLockGroup; -+ -+ /* filter->priv = 0; */ -+ filter->upAction = *pAction; -+ -+ /* Ok, now we need to simulate the action which would go if this action didn't block it. -+ XkbSA_SetMods is the one: it is to set modifier' flag up. */ -+ { -+ XkbStateRec fake_state = xkbi->state; -+ XkbAction act; -+ -+ fake_state.mods = 0; -+ act = XkbGetKeyAction(xkbi, &fake_state, keycode); -+ -+ /* KLUDGE: XkbSA_SetMods only? */ -+ if (act.type == XkbSA_SetMods) { -+ XkbFilterPtr filter = _XkbNextFreeFilter(xkbi); -+ sendEvent = _XkbFilterSetState(xkbi,filter,keycode,&act); -+ } -+ } -+ } -+ else { -+ /* do nothing if some button else is pressed */ -+ if (!pAction) -+ xkbUpdateLockedGroup(xkbi, &filter->upAction); -+ filter->active = 0; - } -+ -+ return sendEvent; -+} -+ -+static int -+_XkbFilterLockMods( XkbSrvInfoPtr xkbi, -+ XkbFilterPtr filter, -+ unsigned keycode, -+ XkbAction * pAction) -+{ - if (filter->keycode==0) { /* initial press */ - filter->keycode = keycode; - filter->active = 1; - filter->filterOthers = 0; - filter->priv = xkbi->state.locked_mods&pAction->mods.mask; -- filter->filter = _XkbFilterLockState; -+ filter->filter = _XkbFilterLockMods; - filter->upAction = *pAction; - if (!(filter->upAction.mods.flags&XkbSA_LockNoLock)) - xkbi->state.locked_mods|= pAction->mods.mask; -@@ -1118,9 +1177,12 @@ xkbDeviceInfoPtr xkbPrivPtr = XKBDEVICEI - sendEvent=_XkbFilterLatchState(xkbi,filter,key,&act); - break; - case XkbSA_LockMods: -+ filter = _XkbNextFreeFilter(xkbi); -+ sendEvent=_XkbFilterLockMods(xkbi,filter,key,&act); -+ break; - case XkbSA_LockGroup: - filter = _XkbNextFreeFilter(xkbi); -- sendEvent=_XkbFilterLockState(xkbi,filter,key,&act); -+ sendEvent=_XkbFilterLockGroup(xkbi,filter,key,&act); - break; - case XkbSA_ISOLock: - filter = _XkbNextFreeFilter(xkbi); diff --git a/debian/patches/209_add_legacy_bgnone_option.patch b/debian/patches/209_add_legacy_bgnone_option.patch deleted file mode 100644 index e53d24d..0000000 --- a/debian/patches/209_add_legacy_bgnone_option.patch +++ /dev/null @@ -1,21 +0,0 @@ -Index: xorg-server/os/utils.c -=================================================================== ---- xorg-server.orig/os/utils.c 2011-08-24 12:52:44.625647130 +0300 -+++ xorg-server/os/utils.c 2011-08-24 12:57:14.805650982 +0300 -@@ -513,6 +513,7 @@ - ErrorF("-nolisten string don't listen on protocol\n"); - ErrorF("-noreset don't reset after last client exists\n"); - ErrorF("-background [none] create root window with no background\n"); -+ ErrorF("-nr (Ubuntu-specific) Synonym for -background none\n"); - ErrorF("-reset reset after last client exists\n"); - ErrorF("-p # screen-saver pattern duration (minutes)\n"); - ErrorF("-pn accept failure to listen on all ports\n"); -@@ -851,6 +852,8 @@ - UseMsg(); - } - } -+ else if ( strcmp( argv[i], "-nr") == 0) -+ bgNoneRoot = TRUE; - else if ( strcmp( argv[i], "-maxbigreqsize") == 0) { - if(++i < argc) { - long reqSizeArg = atol(argv[i]); diff --git a/debian/patches/214_glx_dri_searchdirs.patch b/debian/patches/214_glx_dri_searchdirs.patch deleted file mode 100644 index 3baa38f..0000000 --- a/debian/patches/214_glx_dri_searchdirs.patch +++ /dev/null @@ -1,240 +0,0 @@ -Index: xorg-server/glx/glxdricommon.h -=================================================================== ---- xorg-server.orig/glx/glxdricommon.h 2011-09-11 18:41:08.000000000 -0500 -+++ xorg-server/glx/glxdricommon.h 2011-09-11 18:41:43.381346390 -0500 -@@ -39,7 +39,7 @@ - extern const __DRIsystemTimeExtension systemTimeExtension; - - void * --glxProbeDriver(const char *name, -+glxProbeDriver(const char *name, void **cookie, - void **coreExt, const char *coreName, int coreVersion, - void **renderExt, const char *renderName, int renderVersion); - -Index: xorg-server/glx/glxdriswrast.c -=================================================================== ---- xorg-server.orig/glx/glxdriswrast.c 2011-09-11 18:41:08.000000000 -0500 -+++ xorg-server/glx/glxdriswrast.c 2011-09-11 18:41:43.381346390 -0500 -@@ -427,6 +427,7 @@ - const char *driverName = "swrast"; - __GLXDRIscreen *screen; - const __DRIconfig **driConfigs; -+ void *cookie = NULL; - - screen = calloc(1, sizeof *screen); - if (screen == NULL) -@@ -438,7 +439,7 @@ - screen->base.swapInterval = NULL; - screen->base.pScreen = pScreen; - -- screen->driver = glxProbeDriver(driverName, -+ screen->driver = glxProbeDriver(driverName, &cookie, - (void **)&screen->core, - __DRI_CORE, __DRI_CORE_VERSION, - (void **)&screen->swrast, -Index: xorg-server/configure.ac -=================================================================== ---- xorg-server.orig/configure.ac 2011-09-11 18:41:08.000000000 -0500 -+++ xorg-server/configure.ac 2011-09-11 18:41:43.381346390 -0500 -@@ -1260,7 +1260,12 @@ - AC_DEFINE_DIR(SERVER_MISC_CONFIG_PATH, SERVERCONFIG, [Server miscellaneous config path]) - AC_DEFINE_DIR(BASE_FONT_PATH, FONTROOTDIR, [Default base font path]) - dridriverdir=`$PKG_CONFIG --variable=dridriverdir dri` --AC_DEFINE_DIR(DRI_DRIVER_PATH, dridriverdir, [Default DRI driver path]) -+drisearchdirs=`$PKG_CONFIG --variable=drisearchdirs dri` -+if test -n "$drisearchdirs" ; then -+ AC_DEFINE_DIR(DRI_DRIVER_PATH, drisearchdirs, [Default DRI search dirs]) -+else -+ AC_DEFINE_DIR(DRI_DRIVER_PATH, dridriverdir, [Default DRI driver path]) -+fi - AC_DEFINE_UNQUOTED(XVENDORNAME, ["$VENDOR_NAME"], [Vendor name]) - AC_DEFINE_UNQUOTED(XVENDORNAMESHORT, ["$VENDOR_NAME_SHORT"], [Short vendor name]) - AC_DEFINE_UNQUOTED(XORG_DATE, ["$RELEASE_DATE"], [Vendor release]) -Index: xorg-server/glx/glxdricommon.c -=================================================================== ---- xorg-server.orig/glx/glxdricommon.c 2011-09-11 18:41:08.000000000 -0500 -+++ xorg-server/glx/glxdricommon.c 2011-09-11 18:46:45.296354364 -0500 -@@ -209,7 +209,7 @@ - static const char dri_driver_path[] = DRI_DRIVER_PATH; - - void * --glxProbeDriver(const char *driverName, -+glxProbeDriver(const char *driverName, void **cookie, - void **coreExt, const char *coreName, int coreVersion, - void **renderExt, const char *renderName, int renderVersion) - { -@@ -218,49 +218,60 @@ - char filename[PATH_MAX]; - const __DRIextension **extensions; - int from = X_ERROR; -- -- snprintf(filename, sizeof filename, "%s/%s_dri.so", -- dri_driver_path, driverName); -- -- driver = dlopen(filename, RTLD_LAZY | RTLD_LOCAL); -- if (driver == NULL) { -- LogMessage(X_ERROR, "AIGLX error: dlopen of %s failed (%s)\n", -- filename, dlerror()); -- goto cleanup_failure; -- } -- -- extensions = dlsym(driver, __DRI_DRIVER_EXTENSIONS); -- if (extensions == NULL) { -- LogMessage(X_ERROR, "AIGLX error: %s exports no extensions (%s)\n", -- driverName, dlerror()); -- goto cleanup_failure; -- } -- -- for (i = 0; extensions[i]; i++) { -- if (strcmp(extensions[i]->name, coreName) == 0 && -- extensions[i]->version >= coreVersion) { -- *coreExt = (void *)extensions[i]; -+ char *driDriverPath; -+ const char *pathStart = *cookie ? (const char*)*cookie : dri_driver_path; -+ const char *pathEnd = strchr(pathStart, ':'); -+ -+ for (; *pathStart; pathEnd = strchr(pathStart, ':')) { -+ driDriverPath = strndup(pathStart, -+ pathEnd ? pathEnd - pathStart : sizeof filename); -+ snprintf(filename, sizeof filename, "%s/%s_dri.so", -+ driDriverPath, driverName); -+ free(driDriverPath); -+ pathStart = pathEnd ? pathEnd + 1 : pathStart + strlen(pathStart); -+ *cookie = (void *)pathStart; -+ -+ LogMessage(X_INFO, "AIGLX: Trying DRI driver %s\n", filename); -+ -+ driver = dlopen(filename, RTLD_LAZY | RTLD_LOCAL); -+ if (driver == NULL) { -+ LogMessage(X_INFO, "AIGLX: dlopen of %s failed (%s)\n", -+ filename, dlerror()); -+ continue; - } - -- if (strcmp(extensions[i]->name, renderName) == 0 && -- extensions[i]->version >= renderVersion) { -- *renderExt = (void *)extensions[i]; -+ extensions = dlsym(driver, __DRI_DRIVER_EXTENSIONS); -+ if (extensions == NULL) { -+ LogMessage(X_INFO, "AIGLX: %s exports no extensions (%s)\n", -+ driverName, dlerror()); -+ dlclose(driver); -+ continue; -+ } -+ -+ for (i = 0; extensions[i]; i++) { -+ if (strcmp(extensions[i]->name, coreName) == 0 && -+ extensions[i]->version >= coreVersion) { -+ *coreExt = (void *)extensions[i]; -+ } -+ -+ if (strcmp(extensions[i]->name, renderName) == 0 && -+ extensions[i]->version >= renderVersion) { -+ *renderExt = (void *)extensions[i]; -+ } - } -- } - -- if (*coreExt == NULL || *renderExt == NULL) { -- if (!strcmp(driverName, "nouveau")) -- from = X_INFO; -- LogMessage(from, -- "AIGLX error: %s does not export required DRI extension\n", -- driverName); -- goto cleanup_failure; -+ if (*coreExt == NULL || *renderExt == NULL) { -+ if (!strcmp(driverName, "nouveau")) -+ from = X_INFO; -+ LogMessage(from, -+ "AIGLX: %s does not export required DRI extension\n", -+ driverName); -+ *coreExt = *renderExt = NULL; -+ dlclose(driver); -+ continue; -+ } -+ return driver; - } -- return driver; -- --cleanup_failure: -- if (driver) -- dlclose(driver); - *coreExt = *renderExt = NULL; - return NULL; - } -Index: xorg-server/glx/glxdri.c -=================================================================== ---- xorg-server.orig/glx/glxdri.c 2011-09-11 18:41:08.000000000 -0500 -+++ xorg-server/glx/glxdri.c 2011-09-11 18:41:43.381346390 -0500 -@@ -968,6 +968,7 @@ - size_t buffer_size; - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - const __DRIconfig **driConfigs; -+ void *cookie = NULL; - - if (!xf86LoaderCheckSymbol("DRIQueryDirectRenderingCapable") || - !DRIQueryDirectRenderingCapable(pScreen, &isCapable) || -@@ -1042,7 +1043,7 @@ - goto handle_error; - } - -- screen->driver = glxProbeDriver(driverName, -+ screen->driver = glxProbeDriver(driverName, &cookie, - (void **)&screen->core, - __DRI_CORE, __DRI_CORE_VERSION, - (void **)&screen->legacy, -Index: xorg-server/glx/glxdri2.c -=================================================================== ---- xorg-server.orig/glx/glxdri2.c 2011-09-11 18:41:08.000000000 -0500 -+++ xorg-server/glx/glxdri2.c 2011-09-11 18:41:43.381346390 -0500 -@@ -689,6 +689,7 @@ - size_t buffer_size; - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - const __DRIconfig **driConfigs; -+ void *cookie = NULL; - - screen = calloc(1, sizeof *screen); - if (screen == NULL) -@@ -710,24 +711,24 @@ - - __glXInitExtensionEnableBits(screen->glx_enable_bits); - -- screen->driver = glxProbeDriver(driverName, (void **)&screen->core, __DRI_CORE, 1, -- (void **)&screen->dri2, __DRI_DRI2, 1); -- if (screen->driver == NULL) { -- goto handle_error; -- } -- -- screen->driScreen = -- (*screen->dri2->createNewScreen)(pScreen->myNum, -- screen->fd, -- loader_extensions, -- &driConfigs, -- screen); -- -- if (screen->driScreen == NULL) { -- LogMessage(X_ERROR, -- "AIGLX error: Calling driver entry point failed\n"); -- goto handle_error; -- } -+ do { -+ screen->driver = glxProbeDriver(driverName, &cookie, -+ (void **)&screen->core, __DRI_CORE, 1, -+ (void **)&screen->dri2, __DRI_DRI2, 1); -+ if (screen->driver == NULL) -+ goto handle_error; -+ -+ screen->driScreen = -+ (*screen->dri2->createNewScreen)(pScreen->myNum, -+ screen->fd, -+ loader_extensions, -+ &driConfigs, -+ screen); -+ if (screen->driScreen == NULL) { -+ LogMessage(X_INFO, -+ "AIGLX: Calling driver entry point failed\n"); -+ } -+ } while (screen->driScreen == NULL); - - initializeExtensions(screen); - diff --git a/debian/patches/217_revert_bgnonevisitwindow.patch b/debian/patches/217_revert_bgnonevisitwindow.patch deleted file mode 100644 index 5388925..0000000 --- a/debian/patches/217_revert_bgnonevisitwindow.patch +++ /dev/null @@ -1,43 +0,0 @@ -From: Ian Pilcher -Subject: Backout commit 6dd775f57d2f94f0ddaee324aeec33b9b66ed5bc - -Index: xorg-server/composite/compalloc.c -=================================================================== ---- xorg-server.orig/composite/compalloc.c 2011-08-24 12:52:44.405647129 +0300 -+++ xorg-server/composite/compalloc.c 2011-08-24 12:56:49.805650625 +0300 -@@ -508,17 +508,6 @@ - return Success; - } - --static int --bgNoneVisitWindow(WindowPtr pWin, void *null) --{ -- if (pWin->backgroundState != BackgroundPixmap) -- return WT_WALKCHILDREN; -- if (pWin->background.pixmap != None) -- return WT_WALKCHILDREN; -- -- return WT_STOPWALKING; --} -- - static PixmapPtr - compNewPixmap (WindowPtr pWin, int x, int y, int w, int h, Bool map) - { -@@ -540,17 +529,6 @@ - return pPixmap; - - /* -- * If there's no bg=None in the tree, we're done. -- * -- * We could optimize this more by collection the regions of all the -- * bg=None subwindows and feeding that in as the clip for the -- * CopyArea below, but since window trees are shallow these days it -- * might not be worth the effort. -- */ -- if (TraverseTree(pWin, bgNoneVisitWindow, NULL) == WT_NOMATCH) -- return pPixmap; -- -- /* - * Copy bits from the parent into the new pixmap so that it will - * have "reasonable" contents in case for background None areas. - */ diff --git a/debian/patches/219_fedora-pointer-barriers.diff b/debian/patches/219_fedora-pointer-barriers.diff deleted file mode 100644 index 8ec5ab0..0000000 --- a/debian/patches/219_fedora-pointer-barriers.diff +++ /dev/null @@ -1,1020 +0,0 @@ -From 14f1112bec18ccece8e732fe6c200a56546230c7 Mon Sep 17 00:00:00 2001 -From: Adam Jackson -Date: Thu, 17 Mar 2011 13:56:17 -0400 -Subject: [PATCH] CRTC confine and pointer barriers - ---- - dix/events.c | 7 + - dix/getevents.c | 12 +- - include/dix.h | 1 + - include/protocol-versions.h | 2 +- - mi/mipointer.c | 16 ++- - mi/mipointer.h | 6 + - randr/randr.c | 2 + - randr/randrstr.h | 4 + - randr/rrcrtc.c | 155 ++++++++++++++++ - xfixes/cursor.c | 399 ++++++++++++++++++++++++++++++++++++++++++- - xfixes/xfixes.c | 24 ++- - xfixes/xfixes.h | 17 ++ - xfixes/xfixesint.h | 16 ++ - 14 files changed, 658 insertions(+), 16 deletions(-) - -Index: xorg-server/dix/events.c -=================================================================== ---- xorg-server.orig/dix/events.c 2011-08-24 12:52:44.325647127 +0300 -+++ xorg-server/dix/events.c 2011-08-24 12:57:24.685651121 +0300 -@@ -328,6 +328,13 @@ - return dev->type == MASTER_POINTER || dev->type == MASTER_KEYBOARD; - } - -+Bool -+IsFloating(DeviceIntPtr dev) -+{ -+ return GetMaster(dev, MASTER_KEYBOARD) == NULL; -+} -+ -+ - /** - * Max event opcode. - */ -Index: xorg-server/dix/getevents.c -=================================================================== ---- xorg-server.orig/dix/getevents.c 2011-08-24 12:52:44.315647128 +0300 -+++ xorg-server/dix/getevents.c 2011-08-24 12:57:20.625651063 +0300 -@@ -816,7 +816,11 @@ - * miPointerSetPosition() and then scale back into device coordinates (if - * needed). miPSP will change x/y if the screen was crossed. - * -+ * The coordinates provided are always absolute. The parameter mode whether -+ * it was relative or absolute movement that landed us at those coordinates. -+ * - * @param dev The device to be moved. -+ * @param mode Movement mode (Absolute or Relative) - * @param x Pointer to current x-axis value, may be modified. - * @param y Pointer to current y-axis value, may be modified. - * @param x_frac Fractional part of current x-axis value, may be modified. -@@ -828,7 +832,8 @@ - * @param screeny_frac Fractional part of screen y coordinate, as above. - */ - static void --positionSprite(DeviceIntPtr dev, int *x, int *y, float x_frac, float y_frac, -+positionSprite(DeviceIntPtr dev, int mode, -+ int *x, int *y, float x_frac, float y_frac, - ScreenPtr scr, int *screenx, int *screeny, float *screenx_frac, float *screeny_frac) - { - int old_screenx, old_screeny; -@@ -867,7 +872,7 @@ - old_screeny = *screeny; - /* This takes care of crossing screens for us, as well as clipping - * to the current screen. */ -- miPointerSetPosition(dev, screenx, screeny); -+ _miPointerSetPosition(dev, mode, screenx, screeny); - - if (dev->u.master) { - dev->u.master->last.valuators[0] = *screenx; -@@ -1202,7 +1207,8 @@ - if ((flags & POINTER_NORAW) == 0) - set_raw_valuators(raw, &mask, raw->valuators.data); - -- positionSprite(pDev, &x, &y, x_frac, y_frac, scr, &cx, &cy, &cx_frac, &cy_frac); -+ positionSprite(pDev, (flags & POINTER_ABSOLUTE) ? Absolute : Relative, -+ &x, &y, x_frac, y_frac, scr, &cx, &cy, &cx_frac, &cy_frac); - updateHistory(pDev, &mask, ms); - - /* Update the valuators with the true value sent to the client*/ -Index: xorg-server/include/dix.h -=================================================================== ---- xorg-server.orig/include/dix.h 2011-08-24 12:52:44.355647127 +0300 -+++ xorg-server/include/dix.h 2011-08-24 12:57:24.695651123 +0300 -@@ -570,6 +570,7 @@ - extern Bool _X_EXPORT IsKeyboardDevice(DeviceIntPtr dev); - extern Bool IsPointerEvent(InternalEvent *event); - extern _X_EXPORT Bool IsMaster(DeviceIntPtr dev); -+extern _X_EXPORT Bool IsFloating(DeviceIntPtr dev); - - extern _X_HIDDEN void CopyKeyClass(DeviceIntPtr device, DeviceIntPtr master); - extern _X_HIDDEN int CorePointerProc(DeviceIntPtr dev, int what); -Index: xorg-server/include/protocol-versions.h -=================================================================== ---- xorg-server.orig/include/protocol-versions.h 2011-08-24 12:52:44.365647129 +0300 -+++ xorg-server/include/protocol-versions.h 2011-08-24 12:57:20.735651065 +0300 -@@ -126,7 +126,7 @@ - #define SERVER_XF86VIDMODE_MINOR_VERSION 2 - - /* Fixes */ --#define SERVER_XFIXES_MAJOR_VERSION 4 -+#define SERVER_XFIXES_MAJOR_VERSION 5 - #define SERVER_XFIXES_MINOR_VERSION 0 - - /* X Input */ -Index: xorg-server/mi/mipointer.c -=================================================================== ---- xorg-server.orig/mi/mipointer.c 2011-08-24 12:56:49.645650622 +0300 -+++ xorg-server/mi/mipointer.c 2011-08-24 12:56:49.825650624 +0300 -@@ -229,6 +229,10 @@ - SetupScreen (pScreen); - - GenerateEvent = generateEvent; -+ -+ if (pScreen->ConstrainCursorHarder) -+ pScreen->ConstrainCursorHarder(pDev, pScreen, Absolute, &x, &y); -+ - /* device dependent - must pend signal and call miPointerWarpCursor */ - (*pScreenPriv->screenFuncs->WarpCursor) (pDev, pScreen, x, y); - if (!generateEvent) -@@ -488,7 +492,7 @@ - } - - void --miPointerSetPosition(DeviceIntPtr pDev, int *x, int *y) -+_miPointerSetPosition(DeviceIntPtr pDev, int mode, int *x, int *y) - { - miPointerScreenPtr pScreenPriv; - ScreenPtr pScreen; -@@ -532,6 +536,9 @@ - if (*y >= pPointer->limits.y2) - *y = pPointer->limits.y2 - 1; - -+ if (pScreen->ConstrainCursorHarder) -+ pScreen->ConstrainCursorHarder(pDev, pScreen, mode, x, y); -+ - if (pPointer->x == *x && pPointer->y == *y && - pPointer->pScreen == pScreen) - return; -@@ -539,6 +546,13 @@ - miPointerMoveNoEvent(pDev, pScreen, *x, *y); - } - -+/* ABI hack */ -+void -+miPointerSetPosition(DeviceIntPtr pDev, int *x, int *y) -+{ -+ _miPointerSetPosition(pDev, Absolute, x, y); -+} -+ - void - miPointerGetPosition(DeviceIntPtr pDev, int *x, int *y) - { -Index: xorg-server/mi/mipointer.h -=================================================================== ---- xorg-server.orig/mi/mipointer.h 2011-08-24 12:52:44.375647128 +0300 -+++ xorg-server/mi/mipointer.h 2011-08-24 12:56:49.825650624 +0300 -@@ -131,6 +131,12 @@ - - /* Moves the cursor to the specified position. May clip the co-ordinates: - * x and y are modified in-place. */ -+extern _X_EXPORT void _miPointerSetPosition( -+ DeviceIntPtr pDev, -+ int mode, -+ int *x, -+ int *y); -+ - extern _X_EXPORT void miPointerSetPosition( - DeviceIntPtr pDev, - int *x, -Index: xorg-server/randr/randr.c -=================================================================== ---- xorg-server.orig/randr/randr.c 2011-08-24 12:56:49.745650625 +0300 -+++ xorg-server/randr/randr.c 2011-08-24 12:56:49.825650624 +0300 -@@ -270,6 +270,8 @@ - - wrap (pScrPriv, pScreen, CloseScreen, RRCloseScreen); - -+ pScreen->ConstrainCursorHarder = RRConstrainCursorHarder; -+ - pScrPriv->numOutputs = 0; - pScrPriv->outputs = NULL; - pScrPriv->numCrtcs = 0; -Index: xorg-server/randr/randrstr.h -=================================================================== ---- xorg-server.orig/randr/randrstr.h 2011-08-24 12:52:44.305647126 +0300 -+++ xorg-server/randr/randrstr.h 2011-08-24 12:56:49.825650624 +0300 -@@ -297,6 +297,7 @@ - int rate; - int size; - #endif -+ Bool discontiguous; - } rrScrPrivRec, *rrScrPrivPtr; - - extern _X_EXPORT DevPrivateKeyRec rrPrivKeyRec; -@@ -700,6 +701,9 @@ - int - ProcRRSetPanning (ClientPtr client); - -+void -+RRConstrainCursorHarder (DeviceIntPtr, ScreenPtr, int, int *, int *); -+ - /* rrdispatch.c */ - extern _X_EXPORT Bool - RRClientKnowsRates (ClientPtr pClient); -Index: xorg-server/randr/rrcrtc.c -=================================================================== ---- xorg-server.orig/randr/rrcrtc.c 2011-08-24 12:52:44.285647124 +0300 -+++ xorg-server/randr/rrcrtc.c 2011-08-24 12:56:49.825650624 +0300 -@@ -1,5 +1,6 @@ - /* - * Copyright © 2006 Keith Packard -+ * Copyright 2010 Red Hat, Inc - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that -@@ -22,6 +23,7 @@ - - #include "randrstr.h" - #include "swaprep.h" -+#include "mipointer.h" - - RESTYPE RRCrtcType; - -@@ -292,6 +294,92 @@ - return FALSE; - } - -+static void -+crtc_bounds(RRCrtcPtr crtc, int *left, int *right, int *top, int *bottom) -+{ -+ *left = crtc->x; -+ *top = crtc->y; -+ -+ switch (crtc->rotation) { -+ case RR_Rotate_0: -+ case RR_Rotate_180: -+ default: -+ *right = crtc->x + crtc->mode->mode.width; -+ *bottom = crtc->y + crtc->mode->mode.height; -+ return; -+ case RR_Rotate_90: -+ case RR_Rotate_270: -+ *right = crtc->x + crtc->mode->mode.height; -+ *bottom = crtc->y + crtc->mode->mode.width; -+ return; -+ } -+} -+ -+/* overlapping counts as adjacent */ -+static Bool -+crtcs_adjacent(const RRCrtcPtr a, const RRCrtcPtr b) -+{ -+ /* left, right, top, bottom... */ -+ int al, ar, at, ab; -+ int bl, br, bt, bb; -+ int cl, cr, ct, cb; /* the overlap, if any */ -+ -+ crtc_bounds(a, &al, &ar, &at, &ab); -+ crtc_bounds(b, &bl, &br, &bt, &bb); -+ -+ cl = max(al, bl); -+ cr = min(ar, br); -+ ct = max(at, bt); -+ cb = min(ab, bb); -+ -+ return (cl <= cr) && (ct <= cb); -+} -+ -+/* Depth-first search and mark all CRTCs reachable from cur */ -+static void -+mark_crtcs (rrScrPrivPtr pScrPriv, int *reachable, int cur) -+{ -+ int i; -+ reachable[cur] = TRUE; -+ for (i = 0; i < pScrPriv->numCrtcs; ++i) { -+ if (reachable[i] || !pScrPriv->crtcs[i]->mode) -+ continue; -+ if (crtcs_adjacent(pScrPriv->crtcs[cur], pScrPriv->crtcs[i])) -+ mark_crtcs(pScrPriv, reachable, i); -+ } -+} -+ -+static void -+RRComputeContiguity (ScreenPtr pScreen) -+{ -+ rrScrPriv(pScreen); -+ Bool discontiguous = TRUE; -+ int i, n = pScrPriv->numCrtcs; -+ -+ int *reachable = calloc(n, sizeof(int)); -+ if (!reachable) -+ goto out; -+ -+ /* Find first enabled CRTC and start search for reachable CRTCs from it */ -+ for (i = 0; i < n; ++i) { -+ if (pScrPriv->crtcs[i]->mode) { -+ mark_crtcs(pScrPriv, reachable, i); -+ break; -+ } -+ } -+ -+ /* Check that all enabled CRTCs were marked as reachable */ -+ for (i = 0; i < n; ++i) -+ if (pScrPriv->crtcs[i]->mode && !reachable[i]) -+ goto out; -+ -+ discontiguous = FALSE; -+ -+out: -+ free(reachable); -+ pScrPriv->discontiguous = discontiguous; -+} -+ - /* - * Request that the Crtc be reconfigured - */ -@@ -306,6 +394,7 @@ - { - ScreenPtr pScreen = crtc->pScreen; - Bool ret = FALSE; -+ Bool recompute = TRUE; - rrScrPriv(pScreen); - - /* See if nothing changed */ -@@ -318,6 +407,7 @@ - !RRCrtcPendingProperties (crtc) && - !RRCrtcPendingTransform (crtc)) - { -+ recompute = FALSE; - ret = TRUE; - } - else -@@ -381,6 +471,10 @@ - RRPostPendingProperties (outputs[o]); - } - } -+ -+ if (recompute) -+ RRComputeContiguity(pScreen); -+ - return ret; - } - -@@ -1349,3 +1443,64 @@ - free(reply); - return Success; - } -+ -+void -+RRConstrainCursorHarder(DeviceIntPtr pDev, ScreenPtr pScreen, int mode, int *x, int *y) -+{ -+ rrScrPriv (pScreen); -+ int i; -+ -+ /* intentional dead space -> let it float */ -+ if (pScrPriv->discontiguous) -+ return; -+ -+ /* if we're moving inside a crtc, we're fine */ -+ for (i = 0; i < pScrPriv->numCrtcs; i++) { -+ RRCrtcPtr crtc = pScrPriv->crtcs[i]; -+ -+ int left, right, top, bottom; -+ -+ if (!crtc->mode) -+ continue; -+ -+ crtc_bounds(crtc, &left, &right, &top, &bottom); -+ -+ if ((*x >= left) && (*x <= right) && (*y >= top) && (*y <= bottom)) -+ return; -+ } -+ -+ /* if we're trying to escape, clamp to the CRTC we're coming from */ -+ for (i = 0; i < pScrPriv->numCrtcs; i++) { -+ RRCrtcPtr crtc = pScrPriv->crtcs[i]; -+ int nx, ny; -+ int left, right, top, bottom; -+ -+ if (!crtc->mode) -+ continue; -+ -+ crtc_bounds(crtc, &left, &right, &top, &bottom); -+ miPointerGetPosition(pDev, &nx, &ny); -+ -+ if ((nx >= left) && (nx <= right) && (ny >= top) && (ny <= bottom)) { -+ if ((*x <= left) || (*x >= right)) { -+ int dx = *x - nx; -+ -+ if (dx > 0) -+ *x = right; -+ else if (dx < 0) -+ *x = left; -+ } -+ -+ if ((*y <= top) || (*y >= bottom)) { -+ int dy = *y - ny; -+ -+ if (dy > 0) -+ *y = bottom; -+ else if (dy < 0) -+ *y = top; -+ } -+ -+ return; -+ } -+ } -+} -Index: xorg-server/xfixes/cursor.c -=================================================================== ---- xorg-server.orig/xfixes/cursor.c 2011-08-24 12:52:44.345647126 +0300 -+++ xorg-server/xfixes/cursor.c 2011-08-24 12:56:49.825650624 +0300 -@@ -1,5 +1,6 @@ - /* - * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved. -+ * Copyright 2010 Red Hat, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), -@@ -50,13 +51,16 @@ - #include "cursorstr.h" - #include "dixevents.h" - #include "servermd.h" -+#include "mipointer.h" - #include "inputstr.h" - #include "windowstr.h" - #include "xace.h" -+#include "list.h" - - static RESTYPE CursorClientType; - static RESTYPE CursorHideCountType; - static RESTYPE CursorWindowType; -+RESTYPE PointerBarrierType; - static CursorPtr CursorCurrent[MAXDEVICES]; - - static DevPrivateKeyRec CursorScreenPrivateKeyRec; -@@ -107,6 +111,14 @@ - XID resource; - } CursorHideCountRec; - -+typedef struct PointerBarrierClient *PointerBarrierClientPtr; -+ -+struct PointerBarrierClient { -+ ScreenPtr screen; -+ struct PointerBarrier barrier; -+ struct list entry; -+}; -+ - /* - * Wrap DisplayCursor to catch cursor change events - */ -@@ -114,7 +126,9 @@ - typedef struct _CursorScreen { - DisplayCursorProcPtr DisplayCursor; - CloseScreenProcPtr CloseScreen; -+ ConstrainCursorHarderProcPtr ConstrainCursorHarder; - CursorHideCountPtr pCursorHideCounts; -+ struct list barriers; - } CursorScreenRec, *CursorScreenPtr; - - #define GetCursorScreen(s) ((CursorScreenPtr)dixLookupPrivate(&(s)->devPrivates, CursorScreenPrivateKey)) -@@ -184,9 +198,11 @@ - Bool ret; - CloseScreenProcPtr close_proc; - DisplayCursorProcPtr display_proc; -+ ConstrainCursorHarderProcPtr constrain_proc; - - Unwrap (cs, pScreen, CloseScreen, close_proc); - Unwrap (cs, pScreen, DisplayCursor, display_proc); -+ Unwrap (cs, pScreen, ConstrainCursorHarder, constrain_proc); - deleteCursorHideCountsForScreen(pScreen); - ret = (*pScreen->CloseScreen) (index, pScreen); - free(cs); -@@ -1029,6 +1045,382 @@ - return 1; - } - -+static BOOL -+barrier_is_horizontal(const struct PointerBarrier *barrier) -+{ -+ return barrier->y1 == barrier->y2; -+} -+ -+static BOOL -+barrier_is_vertical(const struct PointerBarrier *barrier) -+{ -+ return barrier->x1 == barrier->x2; -+} -+ -+/** -+ * @return The set of barrier movement directions the movement vector -+ * x1/y1 → x2/y2 represents. -+ */ -+int -+barrier_get_direction(int x1, int y1, int x2, int y2) -+{ -+ int direction = 0; -+ -+ /* which way are we trying to go */ -+ if (x2 > x1) -+ direction |= BarrierPositiveX; -+ if (x2 < x1) -+ direction |= BarrierNegativeX; -+ if (y2 > y1) -+ direction |= BarrierPositiveY; -+ if (y2 < y1) -+ direction |= BarrierNegativeY; -+ -+ return direction; -+} -+ -+/** -+ * Test if the barrier may block movement in the direction defined by -+ * x1/y1 → x2/y2. This function only tests whether the directions could be -+ * blocked, it does not test if the barrier actually blocks the movement. -+ * -+ * @return TRUE if the barrier blocks the direction of movement or FALSE -+ * otherwise. -+ */ -+BOOL -+barrier_is_blocking_direction(const struct PointerBarrier *barrier, int direction) -+{ -+ /* Barriers define which way is ok, not which way is blocking */ -+ return (barrier->directions & direction) != direction; -+} -+ -+/** -+ * Test if the movement vector x1/y1 → x2/y2 is intersecting with the -+ * barrier. A movement vector with the startpoint or endpoint adjacent to -+ * the barrier itself counts as intersecting. -+ * -+ * @param x1 X start coordinate of movement vector -+ * @param y1 Y start coordinate of movement vector -+ * @param x2 X end coordinate of movement vector -+ * @param y2 Y end coordinate of movement vector -+ * @param[out] distance The distance between the start point and the -+ * intersection with the barrier (if applicable). -+ * @return TRUE if the barrier intersects with the given vector -+ */ -+BOOL -+barrier_is_blocking(const struct PointerBarrier *barrier, -+ int x1, int y1, int x2, int y2, -+ double *distance) -+{ -+ BOOL rc = FALSE; -+ float ua, ub, ud; -+ int dir = barrier_get_direction(x1, y1, x2, y2); -+ -+ /* Algorithm below doesn't handle edge cases well, hence the extra -+ * checks. */ -+ if (barrier_is_vertical(barrier)) { -+ /* handle immediate barrier adjacency, moving away */ -+ if (dir & BarrierPositiveX && x1 == barrier->x1) -+ return FALSE; -+ if (dir & BarrierNegativeX && x1 == (barrier->x1 - 1)) -+ return FALSE; -+ /* startpoint adjacent to barrier, moving towards -> block */ -+ if (x1 == barrier->x1 && y1 >= barrier->y1 && y1 <= barrier->y2) { -+ *distance = 0; -+ return TRUE; -+ } -+ } else { -+ /* handle immediate barrier adjacency, moving away */ -+ if (dir & BarrierPositiveY && y1 == barrier->y1) -+ return FALSE; -+ if (dir & BarrierNegativeY && y1 == (barrier->y1 - 1)) -+ return FALSE; -+ /* startpoint adjacent to barrier, moving towards -> block */ -+ if (y1 == barrier->y1 && x1 >= barrier->x1 && x1 <= barrier->x2) { -+ *distance = 0; -+ return TRUE; -+ } -+ } -+ -+ /* not an edge case, compute distance */ -+ ua = 0; -+ ud = (barrier->y2 - barrier->y1) * (x2 - x1) - (barrier->x2 - barrier->x1) * (y2 - y1); -+ if (ud != 0) { -+ ua = ((barrier->x2 - barrier->x1) * (y1 - barrier->y1) - -+ (barrier->y2 - barrier->y1) * (x1 - barrier->x1)) / ud; -+ ub = ((x2 - x1) * (y1 - barrier->y1) - -+ (y2 - y1) * (x1 - barrier->x1)) / ud; -+ if (ua < 0 || ua > 1 || ub < 0 || ub > 1) -+ ua = 0; -+ } -+ -+ if (ua > 0 && ua <= 1) -+ { -+ double ix = barrier->x1 + ua * (barrier->x2 - barrier->x1); -+ double iy = barrier->y1 + ua * (barrier->y2 - barrier->y1); -+ -+ *distance = sqrt(pow(x1 - ix, 2) + pow(y1 - iy, 2)); -+ rc = TRUE; -+ } -+ -+ return rc; -+} -+ -+/** -+ * Find the nearest barrier that is blocking movement from x1/y1 to x2/y2. -+ * -+ * @param dir Only barriers blocking movement in direction dir are checked -+ * @param x1 X start coordinate of movement vector -+ * @param y1 Y start coordinate of movement vector -+ * @param x2 X end coordinate of movement vector -+ * @param y2 Y end coordinate of movement vector -+ * @return The barrier nearest to the movement origin that blocks this movement. -+ */ -+static struct PointerBarrier* -+barrier_find_nearest(CursorScreenPtr cs, int dir, -+ int x1, int y1, int x2, int y2) -+{ -+ struct PointerBarrierClient *c; -+ struct PointerBarrier *nearest = NULL; -+ double min_distance = INT_MAX; /* can't get higher than that in X anyway */ -+ -+ list_for_each_entry(c, &cs->barriers, entry) { -+ struct PointerBarrier *b = &c->barrier; -+ double distance; -+ -+ if (!barrier_is_blocking_direction(b, dir)) -+ continue; -+ -+ if (barrier_is_blocking(b, x1, y1, x2, y2, &distance)) -+ { -+ if (min_distance > distance) -+ { -+ min_distance = distance; -+ nearest = b; -+ } -+ } -+ } -+ -+ return nearest; -+} -+ -+/** -+ * Clamp to the given barrier given the movement direction specified in dir. -+ * -+ * @param barrier The barrier to clamp to -+ * @param dir The movement direction -+ * @param[out] x The clamped x coordinate. -+ * @param[out] y The clamped x coordinate. -+ */ -+void -+barrier_clamp_to_barrier(struct PointerBarrier *barrier, int dir, int *x, int *y) -+{ -+ if (barrier_is_vertical(barrier)) -+ { -+ if ((dir & BarrierNegativeX) & ~barrier->directions) -+ *x = barrier->x1; -+ if ((dir & BarrierPositiveX) & ~barrier->directions) -+ *x = barrier->x1 - 1; -+ } -+ if (barrier_is_horizontal(barrier)) -+ { -+ if ((dir & BarrierNegativeY) & ~barrier->directions) -+ *y = barrier->y1; -+ if ((dir & BarrierPositiveY) & ~barrier->directions) -+ *y = barrier->y1 - 1; -+ } -+} -+ -+static void -+CursorConstrainCursorHarder(DeviceIntPtr dev, ScreenPtr screen, int mode, int *x, int *y) -+{ -+ CursorScreenPtr cs = GetCursorScreen(screen); -+ -+ if (!list_is_empty(&cs->barriers) && !IsFloating(dev) && mode == Relative) { -+ int ox, oy; -+ int dir; -+ struct PointerBarrier *nearest = NULL; -+ -+ /* where are we coming from */ -+ miPointerGetPosition(dev, &ox, &oy); -+ -+ /* How this works: -+ * Given the origin and the movement vector, get the nearest barrier -+ * to the origin that is blocking the movement. -+ * Clamp to that barrier. -+ * Then, check from the clamped intersection to the original -+ * destination, again finding the nearest barrier and clamping. -+ */ -+ dir = barrier_get_direction(ox, oy, *x, *y); -+ -+ nearest = barrier_find_nearest(cs, dir, ox, oy, *x, *y); -+ if (nearest) { -+ barrier_clamp_to_barrier(nearest, dir, x, y); -+ -+ if (barrier_is_vertical(nearest)) { -+ dir &= ~(BarrierNegativeX | BarrierPositiveX); -+ ox = *x; -+ } else if (barrier_is_horizontal(nearest)) { -+ dir &= ~(BarrierNegativeY | BarrierPositiveY); -+ oy = *y; -+ } -+ -+ nearest = barrier_find_nearest(cs, dir, ox, oy, *x, *y); -+ if (nearest) { -+ barrier_clamp_to_barrier(nearest, dir, x, y); -+ } -+ } -+ } -+ -+ if (cs->ConstrainCursorHarder) { -+ screen->ConstrainCursorHarder = cs->ConstrainCursorHarder; -+ screen->ConstrainCursorHarder(dev, screen, mode, x, y); -+ screen->ConstrainCursorHarder = CursorConstrainCursorHarder; -+ } -+} -+ -+static struct PointerBarrierClient * -+CreatePointerBarrierClient(ScreenPtr screen, ClientPtr client, -+ xXFixesCreatePointerBarrierReq *stuff) -+{ -+ CursorScreenPtr cs = GetCursorScreen(screen); -+ struct PointerBarrierClient *ret = malloc(sizeof(*ret)); -+ -+ if (ret) { -+ ret->screen = screen; -+ ret->barrier.x1 = min(stuff->x1, stuff->x2); -+ ret->barrier.x2 = max(stuff->x1, stuff->x2); -+ ret->barrier.y1 = min(stuff->y1, stuff->y2); -+ ret->barrier.y2 = max(stuff->y1, stuff->y2); -+ ret->barrier.directions = stuff->directions & 0x0f; -+ if (barrier_is_horizontal(&ret->barrier)) -+ ret->barrier.directions &= ~(BarrierPositiveX | BarrierNegativeX); -+ if (barrier_is_vertical(&ret->barrier)) -+ ret->barrier.directions &= ~(BarrierPositiveY | BarrierNegativeY); -+ list_add(&ret->entry, &cs->barriers); -+ } -+ -+ return ret; -+} -+ -+int -+ProcXFixesCreatePointerBarrier (ClientPtr client) -+{ -+ int err; -+ WindowPtr pWin; -+ struct PointerBarrierClient *barrier; -+ struct PointerBarrier b; -+ REQUEST (xXFixesCreatePointerBarrierReq); -+ -+ REQUEST_SIZE_MATCH(xXFixesCreatePointerBarrierReq); -+ LEGAL_NEW_RESOURCE(stuff->barrier, client); -+ -+ err = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess); -+ if (err != Success) { -+ client->errorValue = stuff->window; -+ return err; -+ } -+ -+ /* This sure does need fixing. */ -+ if (stuff->num_devices) -+ return BadImplementation; -+ -+ b.x1 = stuff->x1; -+ b.x2 = stuff->x2; -+ b.y1 = stuff->y1; -+ b.y2 = stuff->y2; -+ -+ if (!barrier_is_horizontal(&b) && !barrier_is_vertical(&b)) -+ return BadValue; -+ -+ /* no 0-sized barriers */ -+ if (barrier_is_horizontal(&b) && barrier_is_vertical(&b)) -+ return BadValue; -+ -+ if (!(barrier = CreatePointerBarrierClient(pWin->drawable.pScreen, -+ client, stuff))) -+ return BadAlloc; -+ -+ if (!AddResource(stuff->barrier, PointerBarrierType, &barrier->barrier)) -+ return BadAlloc; -+ -+ return Success; -+} -+ -+int -+SProcXFixesCreatePointerBarrier (ClientPtr client) -+{ -+ int n; -+ REQUEST(xXFixesCreatePointerBarrierReq); -+ -+ swaps(&stuff->length, n); -+ REQUEST_SIZE_MATCH(xXFixesCreatePointerBarrierReq); -+ swapl(&stuff->barrier, n); -+ swapl(&stuff->window, n); -+ swaps(&stuff->x1, n); -+ swaps(&stuff->y1, n); -+ swaps(&stuff->x2, n); -+ swaps(&stuff->y2, n); -+ swapl(&stuff->directions, n); -+ return ProcXFixesVector[stuff->xfixesReqType](client); -+} -+ -+static int -+CursorFreeBarrier(void *data, XID id) -+{ -+ struct PointerBarrierClient *b = NULL, *barrier; -+ ScreenPtr screen; -+ CursorScreenPtr cs; -+ -+ barrier = container_of(data, struct PointerBarrierClient, barrier); -+ screen = barrier->screen; -+ cs = GetCursorScreen(screen); -+ -+ /* find and unlink from the screen private */ -+ list_for_each_entry(b, &cs->barriers, entry) { -+ if (b == barrier) { -+ list_del(&b->entry); -+ break; -+ } -+ } -+ -+ free(barrier); -+ return Success; -+} -+ -+int -+ProcXFixesDestroyPointerBarrier (ClientPtr client) -+{ -+ int err; -+ void *barrier; -+ REQUEST (xXFixesDestroyPointerBarrierReq); -+ -+ REQUEST_SIZE_MATCH(xXFixesDestroyPointerBarrierReq); -+ -+ err = dixLookupResourceByType((void **)&barrier, stuff->barrier, -+ PointerBarrierType, client, -+ DixDestroyAccess); -+ if (err != Success) { -+ client->errorValue = stuff->barrier; -+ return err; -+ } -+ -+ FreeResource(stuff->barrier, RT_NONE); -+ return Success; -+} -+ -+int -+SProcXFixesDestroyPointerBarrier (ClientPtr client) -+{ -+ int n; -+ REQUEST(xXFixesDestroyPointerBarrierReq); -+ -+ swaps(&stuff->length, n); -+ REQUEST_SIZE_MATCH(xXFixesDestroyPointerBarrierReq); -+ swapl(&stuff->barrier, n); -+ return ProcXFixesVector[stuff->xfixesReqType](client); -+} -+ - Bool - XFixesCursorInit (void) - { -@@ -1048,8 +1440,10 @@ - cs = (CursorScreenPtr) calloc(1, sizeof (CursorScreenRec)); - if (!cs) - return FALSE; -+ list_init(&cs->barriers); - Wrap (cs, pScreen, CloseScreen, CursorCloseScreen); - Wrap (cs, pScreen, DisplayCursor, CursorDisplayCursor); -+ Wrap (cs, pScreen, ConstrainCursorHarder, CursorConstrainCursorHarder); - cs->pCursorHideCounts = NULL; - SetCursorScreen (pScreen, cs); - } -@@ -1059,7 +1453,10 @@ - "XFixesCursorHideCount"); - CursorWindowType = CreateNewResourceType(CursorFreeWindow, - "XFixesCursorWindow"); -+ PointerBarrierType = CreateNewResourceType(CursorFreeBarrier, -+ "XFixesPointerBarrier"); - -- return CursorClientType && CursorHideCountType && CursorWindowType; -+ return CursorClientType && CursorHideCountType && CursorWindowType && -+ PointerBarrierType; - } - -Index: xorg-server/xfixes/xfixes.c -=================================================================== ---- xorg-server.orig/xfixes/xfixes.c 2011-08-24 12:52:44.355647127 +0300 -+++ xorg-server/xfixes/xfixes.c 2011-08-24 12:56:49.825650624 +0300 -@@ -1,5 +1,6 @@ - /* - * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved. -+ * Copyright 2010 Red Hat, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), -@@ -47,10 +48,6 @@ - - #include "xfixesint.h" - #include "protocol-versions.h" --/* -- * Must use these instead of the constants from xfixeswire.h. They advertise -- * what we implement, not what the protocol headers define. -- */ - - static unsigned char XFixesReqCode; - int XFixesEventBase; -@@ -97,11 +94,12 @@ - - /* Major version controls available requests */ - static const int version_requests[] = { -- X_XFixesQueryVersion, /* before client sends QueryVersion */ -- X_XFixesGetCursorImage, /* Version 1 */ -- X_XFixesChangeCursorByName, /* Version 2 */ -- X_XFixesExpandRegion, /* Version 3 */ -- X_XFixesShowCursor, /* Version 4 */ -+ X_XFixesQueryVersion, /* before client sends QueryVersion */ -+ X_XFixesGetCursorImage, /* Version 1 */ -+ X_XFixesChangeCursorByName, /* Version 2 */ -+ X_XFixesExpandRegion, /* Version 3 */ -+ X_XFixesShowCursor, /* Version 4 */ -+ X_XFixesDestroyPointerBarrier, /* Version 5 */ - }; - - #define NUM_VERSION_REQUESTS (sizeof (version_requests) / sizeof (version_requests[0])) -@@ -142,6 +140,9 @@ - /*************** Version 4 ****************/ - ProcXFixesHideCursor, - ProcXFixesShowCursor, -+/*************** Version 5 ****************/ -+ ProcXFixesCreatePointerBarrier, -+ ProcXFixesDestroyPointerBarrier, - }; - - static int -@@ -205,6 +206,9 @@ - /*************** Version 4 ****************/ - SProcXFixesHideCursor, - SProcXFixesShowCursor, -+/*************** Version 5 ****************/ -+ SProcXFixesCreatePointerBarrier, -+ SProcXFixesDestroyPointerBarrier, - }; - - static int -@@ -260,6 +264,8 @@ - EventSwapVector[XFixesEventBase + XFixesCursorNotify] = - (EventSwapPtr) SXFixesCursorNotifyEvent; - SetResourceTypeErrorValue(RegionResType, XFixesErrorBase + BadRegion); -+ SetResourceTypeErrorValue(PointerBarrierType, -+ XFixesErrorBase + BadBarrier); - } - } - -Index: xorg-server/xfixes/xfixes.h -=================================================================== ---- xorg-server.orig/xfixes/xfixes.h 2011-08-24 12:52:44.335647125 +0300 -+++ xorg-server/xfixes/xfixes.h 2011-08-24 12:56:49.825650624 +0300 -@@ -30,6 +30,7 @@ - #include "resource.h" - - extern _X_EXPORT RESTYPE RegionResType; -+extern _X_EXPORT RESTYPE PointerBarrierType; - extern _X_EXPORT int XFixesErrorBase; - - #define VERIFY_REGION(pRegion, rid, client, mode) \ -@@ -51,5 +52,21 @@ - extern _X_EXPORT RegionPtr - XFixesRegionCopy (RegionPtr pRegion); - -+struct PointerBarrier { -+ CARD16 x1, x2, y1, y2; -+ CARD32 directions; -+}; -+ -+ -+extern int -+barrier_get_direction(int, int, int, int); -+extern BOOL -+barrier_is_blocking(const struct PointerBarrier*, int, int, int, int, double*); -+extern BOOL -+barrier_is_blocking_direction(const struct PointerBarrier*, int); -+extern void -+barrier_clamp_to_barrier(struct PointerBarrier *barrier, int dir, int *x, int *y); -+ -+ - - #endif /* _XFIXES_H_ */ -Index: xorg-server/xfixes/xfixesint.h -=================================================================== ---- xorg-server.orig/xfixes/xfixesint.h 2011-08-24 12:52:44.345647126 +0300 -+++ xorg-server/xfixes/xfixesint.h 2011-08-24 12:56:49.825650624 +0300 -@@ -1,5 +1,6 @@ - /* - * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved. -+ * Copyright 2010 Red Hat, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), -@@ -278,6 +279,21 @@ - int - SProcXFixesShowCursor (ClientPtr client); - -+/* Version 5 */ -+ -+int -+ProcXFixesCreatePointerBarrier (ClientPtr client); -+ -+int -+SProcXFixesCreatePointerBarrier (ClientPtr client); -+ -+int -+ProcXFixesDestroyPointerBarrier (ClientPtr client); -+ -+int -+SProcXFixesDestroyPointerBarrier (ClientPtr client); -+ -+/* Xinerama */ - extern int (*PanoramiXSaveXFixesVector[XFixesNumberRequests])(ClientPtr); - void PanoramiXFixesInit (void); - void PanoramiXFixesReset (void); diff --git a/debian/patches/224_return_BadWindow_not_BadMatch.diff b/debian/patches/224_return_BadWindow_not_BadMatch.diff deleted file mode 100644 index 12f59eb..0000000 --- a/debian/patches/224_return_BadWindow_not_BadMatch.diff +++ /dev/null @@ -1,47 +0,0 @@ -commit ef492e9797b6d4f6bbc25e86bedc24477819fde7 -Author: Chris Halse Rogers -Date: Thu Jan 5 01:22:39 2012 +0000 - - dix: Return BadWindow rather than BadMatch from dixLookupWindow - - dixLookupWindow uses dixLookupDrawable internally, which returns - BadMatch when the XID matches a non-Window drawable. Users - of dixLookupWindow don't care about this, just that it's not - a valid Window. - - This is a generalised version of the fix for X.Org Bug 23562, - where GetProperty was incorrectly returning BadMatch. Auditing other - window requests, all that I checked would incorrectly return BadMatch - in these circumstances. An incomplete list of calls that could - incorrectly return BadMatch is: ListProperties, SetSelectionOwner, - {Destroy,Map,Unmap}{,Sub}Window. - - None of the callers of dixLookupWindow, except for GetProperty, check - for BadMatch - - Signed-off-by: Christopher James Halse Rogers - Reviewed-by: Daniel Stone - Reviewed-by: Adam Jackson - Signed-off-by: Keith Packard - -diff --git a/dix/dixutils.c b/dix/dixutils.c -index 2b5391f..da26dc1 100644 ---- a/dix/dixutils.c -+++ b/dix/dixutils.c -@@ -224,7 +224,15 @@ dixLookupWindow(WindowPtr *pWin, XID id, ClientPtr client, Mask access) - { - int rc; - rc = dixLookupDrawable((DrawablePtr*)pWin, id, client, M_WINDOW, access); -- return (rc == BadDrawable) ? BadWindow : rc; -+ /* dixLookupDrawable returns BadMatch iff id is a valid Drawable -+ but is not a Window. Users of dixLookupWindow expect a BadWindow -+ error in this case; they don't care that it's a valid non-Window XID */ -+ if (rc == BadMatch) -+ rc = BadWindow; -+ /* Similarly, users of dixLookupWindow don't want BadDrawable. */ -+ if (rc == BadDrawable) -+ rc = BadWindow; -+ return rc; - } - - int diff --git a/debian/patches/225_non-root_config_paths.patch b/debian/patches/225_non-root_config_paths.patch deleted file mode 100644 index 82661ea..0000000 --- a/debian/patches/225_non-root_config_paths.patch +++ /dev/null @@ -1,247 +0,0 @@ -From ead968a4300c0adeff89b9886e888b6d284c75cc Mon Sep 17 00:00:00 2001 -From: Antoine Martin -Date: Sat, 17 Dec 2011 01:36:51 +0700 -Subject: [PATCH] xserver: check for elevated privileges not uid=0 - -This allows us to run the server as a normal user whilst still -being able to use the -modulepath, -logfile and -config switches -We define a xf86PrivsElevated which will do the checks and cache -the result in case it is called more than once. -Also renamed the paths #defines to match their new meaning. -Original discussion which led to this patch can be found here: -http://lists.freedesktop.org/archives/xorg-devel/2011-September/025853.html - -Signed-off-by: Antoine Martin -Tested-by: Michal Suchanek -Reviewed-by: Jamey Sharp -Reviewed-by: Adam Jackson ---- - configure.ac | 2 +- - hw/xfree86/common/xf86Config.c | 28 +++++++------- - hw/xfree86/common/xf86Init.c | 78 +++++++++++++++++++++++++++++++++++----- - hw/xfree86/common/xf86Priv.h | 1 + - include/xorg-config.h.in | 6 +++ - 5 files changed, 91 insertions(+), 24 deletions(-) - ---- a/configure.ac -+++ b/configure.ac -@@ -210,7 +210,8 @@ dnl Checks for library functions. - AC_FUNC_VPRINTF - AC_CHECK_FUNCS([geteuid getuid link memmove memset mkstemp strchr strrchr \ - strtol getopt getopt_long vsnprintf walkcontext backtrace \ -- getisax getzoneid shmctl64 strcasestr ffs vasprintf]) -+ getisax getzoneid shmctl64 strcasestr ffs vasprintf issetugid \ -+ getresuid]) - AC_FUNC_ALLOCA - dnl Old HAS_* names used in os/*.c. - AC_CHECK_FUNC([getdtablesize], ---- a/hw/xfree86/common/xf86Config.c -+++ b/hw/xfree86/common/xf86Config.c -@@ -72,8 +72,8 @@ - * These paths define the way the config file search is done. The escape - * sequences are documented in parser/scan.c. - */ --#ifndef ROOT_CONFIGPATH --#define ROOT_CONFIGPATH "%A," "%R," \ -+#ifndef ALL_CONFIGPATH -+#define ALL_CONFIGPATH "%A," "%R," \ - "/etc/X11/%R," "%P/etc/X11/%R," \ - "%E," "%F," \ - "/etc/X11/%F," "%P/etc/X11/%F," \ -@@ -83,8 +83,8 @@ - "%P/lib/X11/%X.%H," \ - "%P/lib/X11/%X" - #endif --#ifndef USER_CONFIGPATH --#define USER_CONFIGPATH "/etc/X11/%S," "%P/etc/X11/%S," \ -+#ifndef RESTRICTED_CONFIGPATH -+#define RESTRICTED_CONFIGPATH "/etc/X11/%S," "%P/etc/X11/%S," \ - "/etc/X11/%G," "%P/etc/X11/%G," \ - "/etc/X11/%X," "/etc/%X," \ - "%P/etc/X11/%X.%H," \ -@@ -92,14 +92,14 @@ - "%P/lib/X11/%X.%H," \ - "%P/lib/X11/%X" - #endif --#ifndef ROOT_CONFIGDIRPATH --#define ROOT_CONFIGDIRPATH "%A," "%R," \ -+#ifndef ALL_CONFIGDIRPATH -+#define ALL_CONFIGDIRPATH "%A," "%R," \ - "/etc/X11/%R," "%C/X11/%R," \ - "/etc/X11/%X," "%C/X11/%X" - #endif --#ifndef USER_CONFIGDIRPATH --#define USER_CONFIGDIRPATH "/etc/X11/%R," "%C/X11/%R," \ -- "/etc/X11/%X," "%C/X11/%X" -+#ifndef RESTRICTED_CONFIGDIRPATH -+#define RESTRICTED_CONFIGDIRPATH "/etc/X11/%R," "%C/X11/%R," \ -+ "/etc/X11/%X," "%C/X11/%X" - #endif - #ifndef SYS_CONFIGDIRPATH - #define SYS_CONFIGDIRPATH "/usr/share/X11/%X," "%D/X11/%X" -@@ -2361,12 +2361,12 @@ xf86HandleConfigFile(Bool autoconfig) - Bool implicit_layout = FALSE; - - if (!autoconfig) { -- if (getuid() == 0) { -- filesearch = ROOT_CONFIGPATH; -- dirsearch = ROOT_CONFIGDIRPATH; -+ if (!xf86PrivsElevated()) { -+ filesearch = ALL_CONFIGPATH; -+ dirsearch = ALL_CONFIGDIRPATH; - } else { -- filesearch = USER_CONFIGPATH; -- dirsearch = USER_CONFIGDIRPATH; -+ filesearch = RESTRICTED_CONFIGPATH; -+ dirsearch = RESTRICTED_CONFIGDIRPATH; - } - - if (xf86ConfigFile) ---- a/hw/xfree86/common/xf86Init.c -+++ b/hw/xfree86/common/xf86Init.c -@@ -236,6 +236,65 @@ xf86PrintMarkers(void) - LogPrintMarkers(); - } - -+Bool xf86PrivsElevated(void) -+{ -+ static Bool privsTested = FALSE; -+ static Bool privsElevated = TRUE; -+ -+ if (!privsTested) { -+#if defined(WIN32) -+ privsElevated = FALSE; -+#else -+ if ((getuid() != geteuid()) || (getgid() != getegid())) { -+ privsElevated = TRUE; -+ } else { -+#if defined(HAVE_ISSETUGID) -+ privsElevated = issetugid(); -+#elif defined(HAVE_GETRESUID) -+ uid_t ruid, euid, suid; -+ gid_t rgid, egid, sgid; -+ -+ if ((getresuid(&ruid, &euid, &suid) == 0) && -+ (getresgid(&rgid, &egid, &sgid) == 0)) { -+ privsElevated = (euid != suid) || (egid != sgid); -+ } -+ else { -+ printf("Failed getresuid or getresgid"); -+ /* Something went wrong, make defensive assumption */ -+ privsElevated = TRUE; -+ } -+#else -+ if (getuid()==0) { -+ /* running as root: uid==euid==0 */ -+ privsElevated = FALSE; -+ } -+ else { -+ /* -+ * If there are saved ID's the process might still be privileged -+ * even though the above test succeeded. If issetugid() and -+ * getresgid() aren't available, test this by trying to set -+ * euid to 0. -+ */ -+ unsigned int oldeuid; -+ oldeuid = geteuid(); -+ -+ if (seteuid(0) != 0) { -+ privsElevated = FALSE; -+ } else { -+ if (seteuid(oldeuid) != 0) { -+ FatalError("Failed to drop privileges. Exiting\n"); -+ } -+ privsElevated = TRUE; -+ } -+ } -+#endif -+ } -+#endif -+ privsTested = TRUE; -+ } -+ return privsElevated; -+} -+ - static Bool - xf86CreateRootWindow(WindowPtr pWin) - { -@@ -855,7 +914,7 @@ OsVendorInit(void) - - #ifdef O_NONBLOCK - if (!beenHere) { -- if (geteuid() == 0 && getuid() != geteuid()) -+ if (xf86PrivsElevated()) - { - int status; - -@@ -1064,10 +1123,11 @@ ddxProcessArgument(int argc, char **argv - FatalError("Required argument to %s not specified\n", argv[i]); \ - } - -- /* First the options that are only allowed for root */ -+ /* First the options that are not allowed with elevated privileges */ - if (!strcmp(argv[i], "-modulepath") || !strcmp(argv[i], "-logfile")) { -- if ( (geteuid() == 0) && (getuid() != 0) ) { -- FatalError("The '%s' option can only be used by root.\n", argv[i]); -+ if (xf86PrivsElevated()) { -+ FatalError("The '%s' option cannot be used with " -+ "elevated privileges.\n", argv[i]); - } - else if (!strcmp(argv[i], "-modulepath")) - { -@@ -1095,9 +1155,9 @@ ddxProcessArgument(int argc, char **argv - if (!strcmp(argv[i], "-config") || !strcmp(argv[i], "-xf86config")) - { - CHECK_FOR_REQUIRED_ARGUMENT(); -- if (getuid() != 0 && !xf86PathIsSafe(argv[i + 1])) { -+ if (xf86PrivsElevated() && !xf86PathIsSafe(argv[i + 1])) { - FatalError("\nInvalid argument for %s\n" -- "\tFor non-root users, the file specified with %s must be\n" -+ "\tWith elevated privileges, the file specified with %s must be\n" - "\ta relative path and must not contain any \"..\" elements.\n" - "\tUsing default "__XCONFIGFILE__" search path.\n\n", - argv[i], argv[i]); -@@ -1108,9 +1168,9 @@ ddxProcessArgument(int argc, char **argv - if (!strcmp(argv[i], "-configdir")) - { - CHECK_FOR_REQUIRED_ARGUMENT(); -- if (getuid() != 0 && !xf86PathIsSafe(argv[i + 1])) { -+ if (xf86PrivsElevated() && !xf86PathIsSafe(argv[i + 1])) { - FatalError("\nInvalid argument for %s\n" -- "\tFor non-root users, the file specified with %s must be\n" -+ "\tWith elevated privileges, the file specified with %s must be\n" - "\ta relative path and must not contain any \"..\" elements.\n" - "\tUsing default "__XCONFIGDIR__" search path.\n\n", - argv[i], argv[i]); -@@ -1384,7 +1444,7 @@ ddxUseMsg(void) - ErrorF("\n"); - ErrorF("\n"); - ErrorF("Device Dependent Usage\n"); -- if (getuid() == 0 || geteuid() != 0) -+ if (!xf86PrivsElevated()) - { - ErrorF("-modulepath paths specify the module search path\n"); - ErrorF("-logfile file specify a log file name\n"); ---- a/hw/xfree86/common/xf86Priv.h -+++ b/hw/xfree86/common/xf86Priv.h -@@ -148,6 +148,7 @@ extern _X_EXPORT Bool xf86LoadModules(ch - extern _X_EXPORT int xf86SetVerbosity(int verb); - extern _X_EXPORT int xf86SetLogVerbosity(int verb); - extern _X_EXPORT Bool xf86CallDriverProbe( struct _DriverRec * drv, Bool detect_only ); -+extern _X_EXPORT Bool xf86PrivsElevated(void); - - #endif /* _NO_XF86_PROTOTYPES */ - ---- a/include/xorg-config.h.in -+++ b/include/xorg-config.h.in -@@ -145,4 +145,10 @@ - /* Build with libdrm support */ - #undef WITH_LIBDRM - -+/* Have setugid */ -+#undef HAVE_ISSETUGID -+ -+/* Have getresuid */ -+#undef HAVE_GETRESUID -+ - #endif /* _XORG_CONFIG_H_ */ diff --git a/debian/patches/226_fall_back_to_autoconfiguration.patch b/debian/patches/226_fall_back_to_autoconfiguration.patch deleted file mode 100644 index 4a513fb..0000000 --- a/debian/patches/226_fall_back_to_autoconfiguration.patch +++ /dev/null @@ -1,105 +0,0 @@ -From 1d22d773f67f8c00ab8881d2cce00ef95abf24f7 Mon Sep 17 00:00:00 2001 -From: Alberto Milone -Date: Fri, 27 Jan 2012 19:31:55 +0100 -Subject: [PATCH 1/1] Try to fall back to autoconfiguration in some cases - despite having configuration files - -Fall back to autoconfiguration if either the graphics -driver module specified in configuration files can't be -found or if there's no device supported by the specified -driver. - -Signed-off-by: Alberto Milone ---- - hw/xfree86/common/xf86Globals.c | 1 + - hw/xfree86/common/xf86Init.c | 31 ++++++++++++++++++++++++++----- - hw/xfree86/common/xf86Priv.h | 1 + - 3 files changed, 28 insertions(+), 5 deletions(-) - -diff --git a/hw/xfree86/common/xf86Globals.c b/hw/xfree86/common/xf86Globals.c -index 16d5557..a1a06ad 100644 ---- a/hw/xfree86/common/xf86Globals.c -+++ b/hw/xfree86/common/xf86Globals.c -@@ -155,6 +155,7 @@ int xf86NumDrivers = 0; - InputDriverPtr *xf86InputDriverList = NULL; - int xf86NumInputDrivers = 0; - int xf86NumScreens = 0; -+Bool xf86AttemptedFallback = FALSE; - - const char *xf86VisualNames[] = { - "StaticGray", -diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c -index 0a47140..a0c7f51 100644 ---- a/hw/xfree86/common/xf86Init.c -+++ b/hw/xfree86/common/xf86Init.c -@@ -411,20 +411,34 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv) - free(optionlist); - } - -+Fallback: - /* Load all driver modules specified in the config file */ - /* If there aren't any specified in the config file, autoconfig them */ - /* FIXME: Does not handle multiple active screen sections, but I'm not - * sure if we really want to handle that case*/ - configured_device = xf86ConfigLayout.screens->screen->device; -- if ((!configured_device) || (!configured_device->driver)) { -+ if (xf86AttemptedFallback) { -+ configured_device->driver = NULL; -+ if (!autoConfigDevice(configured_device)) { -+ xf86Msg(X_ERROR, "Auto configuration on fallback failed\n"); -+ return; -+ } -+ } -+ else if ((!configured_device) || (!configured_device->driver)) { - if (!autoConfigDevice(configured_device)) { - xf86Msg(X_ERROR, "Automatic driver configuration failed\n"); - return ; - } - } - if ((modulelist = xf86DriverlistFromConfig())) { -- xf86LoadModules(modulelist, NULL); -- free(modulelist); -+ if (!xf86LoadModules(modulelist, NULL) && !xf86AttemptedFallback) { -+ free(modulelist); -+ xf86AttemptedFallback = TRUE; -+ goto Fallback; -+ } -+ else { -+ free(modulelist); -+ } - } - - /* Load all input driver modules specified in the config file. */ -@@ -483,8 +497,15 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv) - else - xf86Info.dontVTSwitch = TRUE; - -- if (xf86BusConfig() == FALSE) -- return; -+ if (xf86BusConfig() == FALSE) { -+ if (!xf86AttemptedFallback) { -+ xf86AttemptedFallback = TRUE; -+ goto Fallback; -+ } -+ else { -+ return; -+ } -+ } - - xf86PostProbe(); - -diff --git a/hw/xfree86/common/xf86Priv.h b/hw/xfree86/common/xf86Priv.h -index 1fe3d7e..c342424 100644 ---- a/hw/xfree86/common/xf86Priv.h -+++ b/hw/xfree86/common/xf86Priv.h -@@ -86,6 +86,7 @@ extern _X_EXPORT int xf86NumDrivers; - extern _X_EXPORT Bool xf86Resetting; - extern _X_EXPORT Bool xf86Initialising; - extern _X_EXPORT int xf86NumScreens; -+extern _X_EXPORT Bool xf86AttemptedFallback; - extern _X_EXPORT const char *xf86VisualNames[]; - extern _X_EXPORT int xf86Verbose; /* verbosity level */ - extern _X_EXPORT int xf86LogVerbose; /* log file verbosity level */ --- -1.7.5.4 - diff --git a/debian/patches/227_null_ptr_midispcur.patch b/debian/patches/227_null_ptr_midispcur.patch deleted file mode 100644 index 6d871ee..0000000 --- a/debian/patches/227_null_ptr_midispcur.patch +++ /dev/null @@ -1,14 +0,0 @@ -diff -u a/mi/midispcur.c b/mi/midispcur.c ---- a/mi/midispcur.c 2011-08-05 09:59:03.000000000 +0400 -+++ b/mi/midispcur.c 2012-02-16 10:07:52.524576132 +0400 -@@ -479,6 +479,10 @@ - GCPtr pGC; - - pBuffer = miGetDCDevice(pDev, pScreen); -+ -+ if (!pBuffer) -+ return FALSE; -+ - pSave = pBuffer->pSave; - - pWin = pScreen->root; diff --git a/debian/patches/228_log-format-fix.patch b/debian/patches/228_log-format-fix.patch deleted file mode 100644 index 61e7eae..0000000 --- a/debian/patches/228_log-format-fix.patch +++ /dev/null @@ -1,441 +0,0 @@ -Description: extreme backport of upstream log format fixes (CVE-2012-2118). -Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/xorg-server/+bug/996250 -Origin: http://patchwork.freedesktop.org/patch/10001/ - -Index: xorg-server-1.11.4/os/log.c -=================================================================== ---- xorg-server-1.11.4.orig/os/log.c 2012-05-06 11:03:17.621808123 -0700 -+++ xorg-server-1.11.4/os/log.c 2012-05-06 11:03:18.057814189 -0700 -@@ -167,6 +167,12 @@ - #ifndef X_NOT_IMPLEMENTED_STRING - #define X_NOT_IMPLEMENTED_STRING "(NI)" - #endif -+#ifndef X_DEBUG_STRING -+#define X_DEBUG_STRING "(DB)" -+#endif -+#ifndef X_NONE_STRING -+#define X_NONE_STRING "" -+#endif - - /* - * LogInit is called to start logging to a file. It is also called (with -@@ -223,7 +229,7 @@ - * needed. - */ - if (saveBuffer && bufferSize > 0) { -- free(saveBuffer); /* Must be free(), not free() */ -+ free(saveBuffer); - saveBuffer = NULL; - bufferSize = 0; - } -@@ -265,36 +271,19 @@ - } - - /* This function does the actual log message writes. */ -- --void --LogVWrite(int verb, const char *f, va_list args) -+static void -+LogSWrite(int verb, const char *buf, size_t len, Bool end_line) - { -- static char tmpBuffer[1024]; -- int len = 0; - static Bool newline = TRUE; - -- if (newline) { -- sprintf(tmpBuffer, "[%10.3f] ", GetTimeInMillis() / 1000.0); -- len = strlen(tmpBuffer); -- if (logFile) -- fwrite(tmpBuffer, len, 1, logFile); -- } -- -- /* -- * Since a va_list can only be processed once, write the string to a -- * buffer, and then write the buffer out to the appropriate output -- * stream(s). -- */ -- if (verb < 0 || logFileVerbosity >= verb || logVerbosity >= verb) { -- vsnprintf(tmpBuffer, sizeof(tmpBuffer), f, args); -- len = strlen(tmpBuffer); -- } -- newline = (tmpBuffer[len-1] == '\n'); -- if ((verb < 0 || logVerbosity >= verb) && len > 0) -- fwrite(tmpBuffer, len, 1, stderr); -- if ((verb < 0 || logFileVerbosity >= verb) && len > 0) { -+ if (verb < 0 || logVerbosity >= verb) -+ fwrite(buf, len, 1, stderr); -+ if (verb < 0 || logFileVerbosity >= verb) { - if (logFile) { -- fwrite(tmpBuffer, len, 1, logFile); -+ if (newline) -+ fprintf(logFile, "[%10.3f] ", GetTimeInMillis() / 1000.0); -+ newline = end_line; -+ fwrite(buf, len, 1, logFile); - if (logFlush) { - fflush(logFile); - #ifndef WIN32 -@@ -311,13 +300,19 @@ - FatalError("realloc() failed while saving log messages\n"); - } - bufferUnused -= len; -- memcpy(saveBuffer + bufferPos, tmpBuffer, len); -+ memcpy(saveBuffer + bufferPos, buf, len); - bufferPos += len; - } - } - } - - void -+LogVWrite(int verb, const char *f, va_list args) -+{ -+ return LogVMessageVerb(X_NONE, verb, f, args); -+} -+ -+void - LogWrite(int verb, const char *f, ...) - { - va_list args; -@@ -327,60 +322,75 @@ - va_end(args); - } - --void --LogVMessageVerb(MessageType type, int verb, const char *format, va_list args) -+/* Returns the Message Type string to prepend to a logging message, or NULL -+ * if the message will be dropped due to insufficient verbosity. */ -+static const char * -+LogMessageTypeVerbString(MessageType type, int verb) - { -- const char *s = X_UNKNOWN_STRING; -- char tmpBuf[1024]; -+ if (type == X_ERROR) -+ verb = 0; - -- /* Ignore verbosity for X_ERROR */ -- if (logVerbosity >= verb || logFileVerbosity >= verb || type == X_ERROR) { -- switch (type) { -- case X_PROBED: -- s = X_PROBE_STRING; -- break; -- case X_CONFIG: -- s = X_CONFIG_STRING; -- break; -- case X_DEFAULT: -- s = X_DEFAULT_STRING; -- break; -- case X_CMDLINE: -- s = X_CMDLINE_STRING; -- break; -- case X_NOTICE: -- s = X_NOTICE_STRING; -- break; -- case X_ERROR: -- s = X_ERROR_STRING; -- if (verb > 0) -- verb = 0; -- break; -- case X_WARNING: -- s = X_WARNING_STRING; -- break; -- case X_INFO: -- s = X_INFO_STRING; -- break; -- case X_NOT_IMPLEMENTED: -- s = X_NOT_IMPLEMENTED_STRING; -- break; -- case X_UNKNOWN: -- s = X_UNKNOWN_STRING; -- break; -- case X_NONE: -- s = NULL; -- break; -- } -+ if (logVerbosity < verb && logFileVerbosity < verb) -+ return NULL; - -- /* if s is not NULL we need a space before format */ -- snprintf(tmpBuf, sizeof(tmpBuf), "%s%s%s", s ? s : "", -- s ? " " : "", -- format); -- LogVWrite(verb, tmpBuf, args); -+ switch (type) { -+ case X_PROBED: -+ return X_PROBE_STRING; -+ case X_CONFIG: -+ return X_CONFIG_STRING; -+ case X_DEFAULT: -+ return X_DEFAULT_STRING; -+ case X_CMDLINE: -+ return X_CMDLINE_STRING; -+ case X_NOTICE: -+ return X_NOTICE_STRING; -+ case X_ERROR: -+ return X_ERROR_STRING; -+ case X_WARNING: -+ return X_WARNING_STRING; -+ case X_INFO: -+ return X_INFO_STRING; -+ case X_NOT_IMPLEMENTED: -+ return X_NOT_IMPLEMENTED_STRING; -+ case X_UNKNOWN: -+ return X_UNKNOWN_STRING; -+ case X_NONE: -+ return X_NONE_STRING; -+ case X_DEBUG: -+ return X_DEBUG_STRING; -+ default: -+ return X_UNKNOWN_STRING; - } - } - -+void -+LogVMessageVerb(MessageType type, int verb, const char *format, va_list args) -+{ -+ const char *type_str; -+ char buf[1024]; -+ const size_t size = sizeof(buf); -+ Bool newline; -+ size_t len = 0; -+ -+ type_str = LogMessageTypeVerbString(type, verb); -+ if (!type_str) -+ return; -+ -+ /* if type_str is not "", prepend it and ' ', to message */ -+ if (type_str[0] != '\0') -+ len += Xscnprintf(&buf[len], size - len, "%s ", type_str); -+ -+ if (size - len > 1) -+ len += Xvscnprintf(&buf[len], size - len, format, args); -+ -+ /* Force '\n' at end of truncated line */ -+ if (size - len == 1) -+ buf[len - 1] = '\n'; -+ -+ newline = (buf[len - 1] == '\n'); -+ LogSWrite(verb, buf, len, newline); -+} -+ - /* Log message with verbosity level specified. */ - void - LogMessageVerb(MessageType type, int verb, const char *format, ...) -@@ -404,6 +414,49 @@ - } - - void -+LogVHdrMessageVerb(MessageType type, int verb, const char *msg_format, -+ va_list msg_args, const char *hdr_format, va_list hdr_args) -+{ -+ const char *type_str; -+ char buf[1024]; -+ const size_t size = sizeof(buf); -+ Bool newline; -+ size_t len = 0; -+ -+ type_str = LogMessageTypeVerbString(type, verb); -+ if (!type_str) -+ return; -+ -+ /* if type_str is not "", prepend it and ' ', to message */ -+ if (type_str[0] != '\0') -+ len += Xscnprintf(&buf[len], size - len, "%s ", type_str); -+ -+ if (hdr_format && size - len > 1) -+ len += Xvscnprintf(&buf[len], size - len, hdr_format, hdr_args); -+ -+ if (msg_format && size - len > 1) -+ len += Xvscnprintf(&buf[len], size - len, msg_format, msg_args); -+ -+ /* Force '\n' at end of truncated line */ -+ if (size - len == 1) -+ buf[len - 1] = '\n'; -+ -+ newline = (buf[len - 1] == '\n'); -+ LogSWrite(verb, buf, len, newline); -+} -+ -+void -+LogHdrMessageVerb(MessageType type, int verb, const char *msg_format, -+ va_list msg_args, const char *hdr_format, ...) -+{ -+ va_list hdr_args; -+ -+ va_start(hdr_args, hdr_format); -+ LogVHdrMessageVerb(type, verb, msg_format, msg_args, hdr_format, hdr_args); -+ va_end(hdr_args); -+} -+ -+void - AbortServer(void) _X_NORETURN; - void - SigAbortServer(int signo) _X_NORETURN; -Index: xorg-server-1.11.4/include/Xprintf.h -=================================================================== ---- xorg-server-1.11.4.orig/include/Xprintf.h 2012-05-06 10:32:42.436348011 -0700 -+++ xorg-server-1.11.4/include/Xprintf.h 2012-05-06 11:03:18.057814189 -0700 -@@ -66,4 +66,16 @@ - # define vasprintf Xvasprintf - #endif - -+/* -+ * These functions provide a portable implementation of the linux kernel -+ * scnprintf & vscnprintf routines that return the number of bytes actually -+ * copied during a snprintf, (excluding the final '\0'). -+ */ -+extern _X_EXPORT int -+Xscnprintf(char *s, int n, const char * _X_RESTRICT_KYWD fmt, ...) -+_X_ATTRIBUTE_PRINTF(3,4); -+extern _X_EXPORT int -+Xvscnprintf(char *s, int n, const char * _X_RESTRICT_KYWD fmt, va_list va) -+_X_ATTRIBUTE_PRINTF(3,0); -+ - #endif /* XPRINTF_H */ -Index: xorg-server-1.11.4/os/xprintf.c -=================================================================== ---- xorg-server-1.11.4.orig/os/xprintf.c 2012-05-06 10:32:42.472348510 -0700 -+++ xorg-server-1.11.4/os/xprintf.c 2012-05-06 11:03:18.057814189 -0700 -@@ -182,6 +182,50 @@ - return size; - } - -+/** -+ * Varargs snprintf that returns the actual number of bytes (excluding final -+ * '\0') that were copied into the buffer. -+ * This is opposed to the normal sprintf() usually returns the number of bytes -+ * that would have been written. -+ * -+ * @param s buffer to copy into -+ * @param n size of buffer s -+ * @param format printf style format string -+ * @param va variable argument list -+ * @return number of bytes actually copied, excluding final '\0' -+ */ -+int -+Xvscnprintf(char *s, int n, const char *format, va_list args) -+{ -+ int x; -+ if (n == 0) -+ return 0; -+ x = vsnprintf(s, n , format, args); -+ return (x >= n) ? (n - 1) : x; -+} -+ -+/** -+ * snprintf that returns the actual number of bytes (excluding final '\0') that -+ * were copied into the buffer. -+ * This is opposed to the normal sprintf() usually returns the number of bytes -+ * that would have been written. -+ * -+ * @param s buffer to copy into -+ * @param n size of buffer s -+ * @param format printf style format string -+ * @param ... arguments for specified format -+ * @return number of bytes actually copied, excluding final '\0' -+ */ -+int Xscnprintf(char *s, int n, const char *format, ...) -+{ -+ int x; -+ va_list ap; -+ va_start(ap, format); -+ x = Xvscnprintf(s, n, format, ap); -+ va_end(ap); -+ return x; -+} -+ - /* Old api, now deprecated, may be removed in the future */ - char * - Xvprintf(const char *format, va_list va) -Index: xorg-server-1.11.4/hw/xfree86/common/xf86Helper.c -=================================================================== ---- xorg-server-1.11.4.orig/hw/xfree86/common/xf86Helper.c 2012-05-06 10:32:42.488348731 -0700 -+++ xorg-server-1.11.4/hw/xfree86/common/xf86Helper.c 2012-05-06 11:03:18.057814189 -0700 -@@ -1036,25 +1036,13 @@ - xf86VDrvMsgVerb(int scrnIndex, MessageType type, int verb, const char *format, - va_list args) - { -- char *tmpFormat; -- - /* Prefix the scrnIndex name to the format string. */ - if (scrnIndex >= 0 && scrnIndex < xf86NumScreens && -- xf86Screens[scrnIndex]->name) { -- tmpFormat = malloc(strlen(format) + -- strlen(xf86Screens[scrnIndex]->name) + -- PREFIX_SIZE + 1); -- if (!tmpFormat) -- return; -- -- snprintf(tmpFormat, PREFIX_SIZE + 1, "%s(%d): ", -- xf86Screens[scrnIndex]->name, scrnIndex); -- -- strcat(tmpFormat, format); -- LogVMessageVerb(type, verb, tmpFormat, args); -- free(tmpFormat); -- } else -- LogVMessageVerb(type, verb, format, args); -+ xf86Screens[scrnIndex]->name) -+ LogHdrMessageVerb(type, verb, format, args, "%s(%d): ", -+ xf86Screens[scrnIndex]->name, scrnIndex); -+ else -+ LogVMessageVerb(type, verb, format, args); - } - #undef PREFIX_SIZE - -@@ -1087,15 +1075,18 @@ - xf86VIDrvMsgVerb(InputInfoPtr dev, MessageType type, int verb, const char *format, - va_list args) - { -- char *msg; -+ const char *driverName = NULL; -+ const char *deviceName = NULL; - -- if (asprintf(&msg, "%s: %s: %s", dev->drv->driverName, dev->name, format) -- == -1) { -- LogVMessageVerb(type, verb, "%s", args); -- } else { -- LogVMessageVerb(type, verb, msg, args); -- free(msg); -+ /* Prefix driver and device names to formatted message. */ -+ if (dev) { -+ deviceName = dev->name; -+ if (dev->drv) -+ driverName = dev->drv->driverName; - } -+ -+ LogHdrMessageVerb(type, verb, format, args, "%s: %s: ", driverName, -+ deviceName); - } - - /* Print input driver message, with verbose level specified directly */ -Index: xorg-server-1.11.4/include/os.h -=================================================================== ---- xorg-server-1.11.4.orig/include/os.h 2012-05-06 11:03:17.621808123 -0700 -+++ xorg-server-1.11.4/include/os.h 2012-05-06 11:03:29.353971366 -0700 -@@ -514,6 +514,7 @@ - X_INFO, /* Informational message */ - X_NONE, /* No prefix */ - X_NOT_IMPLEMENTED, /* Not implemented */ -+ X_DEBUG, /* Debug message */ - X_UNKNOWN = -1 /* unknown -- this must always be last */ - } MessageType; - -@@ -528,6 +529,20 @@ - ...) _X_ATTRIBUTE_PRINTF(3,4); - extern _X_EXPORT void LogMessage(MessageType type, const char *format, ...) - _X_ATTRIBUTE_PRINTF(2,3); -+ -+extern _X_EXPORT void -+LogVHdrMessageVerb(MessageType type, int verb, -+ const char *msg_format, va_list msg_args, -+ const char *hdr_format, va_list hdr_args) -+_X_ATTRIBUTE_PRINTF(3, 0) -+_X_ATTRIBUTE_PRINTF(5, 0); -+extern _X_EXPORT void -+LogHdrMessageVerb(MessageType type, int verb, -+ const char *msg_format, va_list msg_args, -+ const char *hdr_format, ...) -+_X_ATTRIBUTE_PRINTF(3, 0) -+_X_ATTRIBUTE_PRINTF(5, 6); -+ - extern _X_EXPORT void FreeAuditTimer(void); - extern _X_EXPORT void AuditF(const char *f, ...) _X_ATTRIBUTE_PRINTF(1,2); - extern _X_EXPORT void VAuditF(const char *f, va_list args) _X_ATTRIBUTE_PRINTF(1,0); diff --git a/debian/patches/229_randr_first_check_pScrPriv_before_using_the_pointer.patch b/debian/patches/229_randr_first_check_pScrPriv_before_using_the_pointer.patch deleted file mode 100644 index 8c9cf71..0000000 --- a/debian/patches/229_randr_first_check_pScrPriv_before_using_the_pointer.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 32603f57ca03b6390b109960f8bb5ea53ac95ecb Mon Sep 17 00:00:00 2001 -From: Ricardo Salveti de Araujo -Date: Thu, 21 Jun 2012 00:55:53 -0300 -Subject: [PATCH] randr: first check pScrPriv before using the pointer at - RRFirstOutput - -Fix a seg fault in case pScrPriv is NULL at ProcRRGetScreenInfo, -which later calls RRFirstOutput. - -Signed-off-by: Ricardo Salveti de Araujo -Reviewed-by: Keith Packard -Signed-off-by: Keith Packard ---- - randr/randr.c | 3 +++ - 1 file changed, 3 insertions(+) - -Index: xorg-server-1.11.4/randr/randr.c -=================================================================== ---- xorg-server-1.11.4.orig/randr/randr.c 2012-07-17 18:46:06.000000000 -0300 -+++ xorg-server-1.11.4/randr/randr.c 2012-07-17 18:48:35.169824448 -0300 -@@ -454,6 +454,9 @@ - rrScrPriv(pScreen); - RROutputPtr output; - int i, j; -+ -+ if (!pScrPriv) -+ return NULL; - - if (pScrPriv->primaryOutput && pScrPriv->primaryOutput->crtc) - return pScrPriv->primaryOutput; diff --git a/debian/patches/230_randr_catch_two_more_potential_unset_rrScrPriv_uses.patch b/debian/patches/230_randr_catch_two_more_potential_unset_rrScrPriv_uses.patch deleted file mode 100644 index e37d073..0000000 --- a/debian/patches/230_randr_catch_two_more_potential_unset_rrScrPriv_uses.patch +++ /dev/null @@ -1,52 +0,0 @@ -From 855003c333a0ead1db912695bc9705ef2b3144b4 Mon Sep 17 00:00:00 2001 -From: Keith Packard -Date: Thu, 21 Jun 2012 18:45:18 -0700 -Subject: [PATCH] randr: Catch two more potential unset rrScrPriv uses - -Ricardo Salveti found one place where the -randr code could use the randr screen private data without checking -for null first. This happens when the X server is running with -multiple screens, some of which are randr enabled and some of which -are not. Applications making protocol requests to the non-randr -screens can cause segfaults where the server touches the unset private -structure. - -I audited the code and found two more possible problem spots; the -trick to auditing for this issue was to look for functions not taking -a RandR data structure and where there was no null screen private -check above them in the call graph. - -Signed-off-by: Keith Packard ---- - randr/rroutput.c | 3 ++- - randr/rrscreen.c | 3 +++ - 2 files changed, 5 insertions(+), 1 deletion(-) - -diff --git a/randr/rroutput.c b/randr/rroutput.c -index 091e06b..fbd0e32 100644 ---- a/randr/rroutput.c -+++ b/randr/rroutput.c -@@ -546,7 +546,8 @@ ProcRRSetOutputPrimary(ClientPtr client) - } - - pScrPriv = rrGetScrPriv(pWin->drawable.pScreen); -- RRSetPrimaryOutput(pWin->drawable.pScreen, pScrPriv, output); -+ if (pScrPriv) -+ RRSetPrimaryOutput(pWin->drawable.pScreen, pScrPriv, output); - - return Success; - } -diff --git a/randr/rrscreen.c b/randr/rrscreen.c -index f570afa..55110e0 100644 ---- a/randr/rrscreen.c -+++ b/randr/rrscreen.c -@@ -261,6 +261,9 @@ - - pScreen = pWin->drawable.pScreen; - pScrPriv = rrGetScrPriv(pScreen); -+ if (!pScrPriv) -+ return BadMatch; -+ - if (stuff->width < pScrPriv->minWidth || pScrPriv->maxWidth < stuff->width) - { - client->errorValue = stuff->width; diff --git a/debian/patches/233-xf86events-valgrind.patch b/debian/patches/233-xf86events-valgrind.patch deleted file mode 100644 index f2fbcfb..0000000 --- a/debian/patches/233-xf86events-valgrind.patch +++ /dev/null @@ -1,19 +0,0 @@ -diff --git a/hw/xfree86/common/xf86Events.c b/hw/xfree86/common/xf86Events.c -index 41ffabd..6082bee 100644 ---- a/hw/xfree86/common/xf86Events.c -+++ b/hw/xfree86/common/xf86Events.c -@@ -270,10 +270,10 @@ xf86Wakeup(pointer blockData, int err, pointer pReadmask) - } - } - -- if (err >= 0) { /* we don't want the handlers called if select() */ -- IHPtr ih; /* returned with an error condition, do we? */ -- -- for (ih = InputHandlers; ih; ih = ih->next) { -+ if (err >= 0) { /* we don't want the handlers called if select() */ -+ IHPtr ih, ih_tmp; /* returned with an error condition, do we? */ -+ -+ nt_list_for_each_entry_safe(ih, ih_tmp, InputHandlers, next) { - if (ih->enabled && ih->fd >= 0 && ih->ihproc && - (FD_ISSET(ih->fd, ((fd_set *)pReadmask)) != 0)) { - ih->ihproc(ih->fd, ih->data); diff --git a/debian/patches/235-composite-tracking.diff b/debian/patches/235-composite-tracking.diff deleted file mode 100644 index 20d2ce2..0000000 --- a/debian/patches/235-composite-tracking.diff +++ /dev/null @@ -1,63 +0,0 @@ -diff --git a/exa/exa_priv.h b/exa/exa_priv.h -index 70de4bd..60aa328 100644 ---- a/exa/exa_priv.h -+++ b/exa/exa_priv.h -@@ -206,6 +206,7 @@ typedef struct { - RegionRec srcReg; - RegionRec maskReg; - PixmapPtr srcPix; -+ PixmapPtr maskPix; - - } ExaScreenPrivRec, *ExaScreenPrivPtr; - -diff --git a/exa/exa_unaccel.c b/exa/exa_unaccel.c -index 219f903..7d83d15 100644 ---- a/exa/exa_unaccel.c -+++ b/exa/exa_unaccel.c -@@ -448,6 +448,13 @@ ExaSrcValidate(DrawablePtr pDrawable, - RegionPtr dst; - int xoff, yoff; - -+ if (pExaScr->srcPix == pPix) -+ dst = &pExaScr->srcReg; -+ else if (pExaScr->maskPix == pPix) -+ dst = &pExaScr->maskReg; -+ else -+ return; -+ - exaGetDrawableDeltas(pDrawable, pPix, &xoff, &yoff); - - box.x1 = x + xoff; -@@ -455,9 +462,6 @@ ExaSrcValidate(DrawablePtr pDrawable, - box.x2 = box.x1 + width; - box.y2 = box.y1 + height; - -- dst = (pExaScr->srcPix == pPix) ? &pExaScr->srcReg : -- &pExaScr->maskReg; -- - RegionInit(®, &box, 1); - RegionUnion(dst, dst, ®); - RegionUninit(®); -@@ -506,17 +510,20 @@ ExaPrepareCompositeReg(ScreenPtr pScreen, - RegionTranslate(pSrc->pCompositeClip, - -pSrc->pDrawable->x, - -pSrc->pDrawable->y); -- } -+ } else -+ pExaScr->srcPix = NULL; - - if (pMask && pMask->pDrawable) { - pMaskPix = exaGetDrawablePixmap(pMask->pDrawable); - RegionNull(&pExaScr->maskReg); - maskReg = &pExaScr->maskReg; -+ pExaScr->maskPix = pMaskPix; - if (pMask != pDst && pMask != pSrc) - RegionTranslate(pMask->pCompositeClip, - -pMask->pDrawable->x, - -pMask->pDrawable->y); -- } -+ } else -+ pExaScr->maskPix = NULL; - - RegionTranslate(pDst->pCompositeClip, - -pDst->pDrawable->x, diff --git a/debian/patches/238-xrandr-fix-panning.patch b/debian/patches/238-xrandr-fix-panning.patch deleted file mode 100644 index 2dcb326..0000000 --- a/debian/patches/238-xrandr-fix-panning.patch +++ /dev/null @@ -1,129 +0,0 @@ -Description: disable CRTC cursor confinement when panning is enabled -Origin: backport, http://cgit.freedesktop.org/xorg/xserver/commit/?id=1bf81af4a6be1113bcc3b940ab264d5c9e0f0c5d -Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/xorg-server/+bug/883319 -Bug: https://bugs.freedesktop.org/show_bug.cgi?id=39949 - -Index: xorg-server-1.11.4/hw/xfree86/modes/xf86RandR12.c -=================================================================== ---- xorg-server-1.11.4.orig/hw/xfree86/modes/xf86RandR12.c 2012-12-20 10:46:57.594909196 -0500 -+++ xorg-server-1.11.4/hw/xfree86/modes/xf86RandR12.c 2012-12-20 10:52:27.706917648 -0500 -@@ -60,6 +60,9 @@ - * See https://bugs.freedesktop.org/show_bug.cgi?id=21554 - */ - xf86EnterVTProc *orig_EnterVT; -+ -+ Bool panning; -+ ConstrainCursorHarderProcPtr orig_ConstrainCursorHarder; - } XF86RandRInfoRec, *XF86RandRInfoPtr; - - #ifdef RANDR_12_INTERFACE -@@ -678,6 +681,10 @@ - return TRUE; - } - -+#define PANNING_ENABLED(crtc) \ -+ ((crtc)->panningTotalArea.x2 > (crtc)->panningTotalArea.x1 || \ -+ (crtc)->panningTotalArea.y2 > (crtc)->panningTotalArea.y1) -+ - static Bool - xf86RandR12ScreenSetSize (ScreenPtr pScreen, - CARD16 width, -@@ -691,6 +698,7 @@ - WindowPtr pRoot = pScreen->root; - PixmapPtr pScrnPix; - Bool ret = FALSE; -+ Bool panning = FALSE; - int c; - - if (xf86RandR12Key) { -@@ -711,8 +719,7 @@ - /* Update panning information */ - for (c = 0; c < config->num_crtc; c++) { - xf86CrtcPtr crtc = config->crtc[c]; -- if (crtc->panningTotalArea.x2 > crtc->panningTotalArea.x1 || -- crtc->panningTotalArea.y2 > crtc->panningTotalArea.y1) { -+ if (PANNING_ENABLED (crtc)) { - if (crtc->panningTotalArea.x2 > crtc->panningTrackingArea.x1) - crtc->panningTotalArea.x2 += width - pScreen->width; - if (crtc->panningTotalArea.y2 > crtc->panningTrackingArea.y1) -@@ -723,6 +730,7 @@ - crtc->panningTrackingArea.y2 += height - pScreen->height; - xf86RandR13VerifyPanningArea (crtc, width, height); - xf86RandR13Pan (crtc, randrp->pointerX, randrp->pointerY); -+ panning = TRUE; - } - } - -@@ -930,6 +938,7 @@ - randrp = XF86RANDRINFO(pScreen); - #if RANDR_12_INTERFACE - xf86Screens[pScreen->myNum]->EnterVT = randrp->orig_EnterVT; -+ pScreen->ConstrainCursorHarder = randrp->orig_ConstrainCursorHarder; - #endif - - free(randrp); -@@ -1234,6 +1243,7 @@ - } - xf86RandR13VerifyPanningArea (crtc, pScreen->width, pScreen->height); - xf86RandR13Pan (crtc, randrp->pointerX, randrp->pointerY); -+ randrp->panning = PANNING_ENABLED (crtc); - /* - * Save the last successful setting for EnterVT - */ -@@ -1667,7 +1677,7 @@ - BoxRec oldTotalArea; - BoxRec oldTrackingArea; - INT16 oldBorder[4]; -- -+ Bool oldPanning = randrp->panning; - - if (crtc->version < 2) - return FALSE; -@@ -1685,12 +1695,14 @@ - - if (xf86RandR13VerifyPanningArea (crtc, pScreen->width, pScreen->height)) { - xf86RandR13Pan (crtc, randrp->pointerX, randrp->pointerY); -+ randrp->panning = PANNING_ENABLED (crtc); - return TRUE; - } else { - /* Restore old settings */ - memcpy (&crtc->panningTotalArea, &oldTotalArea, sizeof(BoxRec)); - memcpy (&crtc->panningTrackingArea, &oldTrackingArea, sizeof(BoxRec)); - memcpy (crtc->panningBorder, oldBorder, 4*sizeof(INT16)); -+ randrp->panning = oldPanning; - return FALSE; - } - } -@@ -1775,6 +1787,21 @@ - return RRGetInfo (pScreen, TRUE); /* force a re-probe of outputs and notify clients about changes */ - } - -+static void -+xf86RandR13ConstrainCursorHarder(DeviceIntPtr dev, ScreenPtr screen, int mode, int *x, int *y) -+{ -+ XF86RandRInfoPtr randrp = XF86RANDRINFO(screen); -+ -+ if (randrp->panning) -+ return; -+ -+ if (randrp->orig_ConstrainCursorHarder) { -+ screen->ConstrainCursorHarder = randrp->orig_ConstrainCursorHarder; -+ screen->ConstrainCursorHarder(dev, screen, mode, x, y); -+ screen->ConstrainCursorHarder = xf86RandR13ConstrainCursorHarder; -+ } -+} -+ - static Bool - xf86RandR12Init12 (ScreenPtr pScreen) - { -@@ -1803,6 +1830,10 @@ - randrp->orig_EnterVT = pScrn->EnterVT; - pScrn->EnterVT = xf86RandR12EnterVT; - -+ randrp->panning = FALSE; -+ randrp->orig_ConstrainCursorHarder = pScreen->ConstrainCursorHarder; -+ pScreen->ConstrainCursorHarder = xf86RandR13ConstrainCursorHarder; -+ - if (!xf86RandR12CreateObjects12 (pScreen)) - return FALSE; - diff --git a/debian/patches/500_pointer_barrier_thresholds.diff b/debian/patches/500_pointer_barrier_thresholds.diff deleted file mode 100644 index 9e255ad..0000000 --- a/debian/patches/500_pointer_barrier_thresholds.diff +++ /dev/null @@ -1,1694 +0,0 @@ -Index: xorg-server/include/protocol-versions.h -=================================================================== ---- xorg-server.orig/include/protocol-versions.h 2012-03-07 22:24:45.540697115 +1100 -+++ xorg-server/include/protocol-versions.h 2012-03-08 07:40:35.472111389 +1100 -@@ -122,7 +122,7 @@ - #define SERVER_XF86VIDMODE_MINOR_VERSION 2 - - /* Fixes */ --#define SERVER_XFIXES_MAJOR_VERSION 5 -+#define SERVER_XFIXES_MAJOR_VERSION 6 - #define SERVER_XFIXES_MINOR_VERSION 0 - - /* X Input */ -Index: xorg-server/xfixes/cursor.c -=================================================================== ---- xorg-server.orig/xfixes/cursor.c 2012-03-07 22:24:45.580697117 +1100 -+++ xorg-server/xfixes/cursor.c 2012-03-08 11:00:53.155469738 +1100 -@@ -61,6 +61,7 @@ - static RESTYPE CursorHideCountType; - static RESTYPE CursorWindowType; - RESTYPE PointerBarrierType; -+static RESTYPE PointerBarrierClientType; - static CursorPtr CursorCurrent[MAXDEVICES]; - - static DevPrivateKeyRec CursorScreenPrivateKeyRec; -@@ -119,6 +120,11 @@ - struct list entry; - }; - -+/** -+ * Pick up unclamped (x,y) coordinates from dix/getevents -+ */ -+extern int unclamped_prex, unclamped_prey; -+ - /* - * Wrap DisplayCursor to catch cursor change events - */ -@@ -129,6 +135,7 @@ - ConstrainCursorHarderProcPtr ConstrainCursorHarder; - CursorHideCountPtr pCursorHideCounts; - struct list barriers; -+ struct list barrierClients; - } CursorScreenRec, *CursorScreenPtr; - - #define GetCursorScreen(s) ((CursorScreenPtr)dixLookupPrivate(&(s)->devPrivates, CursorScreenPrivateKey)) -@@ -1118,7 +1125,8 @@ - - /* Algorithm below doesn't handle edge cases well, hence the extra - * checks. */ -- if (barrier_is_vertical(barrier)) { -+ if (barrier_is_vertical(barrier) && -+ (dir & (BarrierPositiveX | BarrierNegativeX))) { - /* handle immediate barrier adjacency, moving away */ - if (dir & BarrierPositiveX && x1 == barrier->x1) - return FALSE; -@@ -1129,7 +1137,8 @@ - *distance = 0; - return TRUE; - } -- } else { -+ } else if (barrier_is_horizontal(barrier) && -+ (dir & (BarrierPositiveY | BarrierNegativeY))){ - /* handle immediate barrier adjacency, moving away */ - if (dir & BarrierPositiveY && y1 == barrier->y1) - return FALSE; -@@ -1231,6 +1240,127 @@ - } - } - -+/* -+ * ConstrainCursorHarder is called from the SIGIO context. -+ * This means we cannot safely send a client event from anything in -+ * CursorConstrainCursorHarder's callgraph. -+ * -+ * Allocate a set of WorkQueue items to use. -+ */ -+ -+struct BarrierEventStore { -+ WorkQueueRec wq_item; -+ xXFixesBarrierNotifyEvent ev; -+ Bool in_use; -+}; -+ -+/* Let's guess that 100 events is enough of a buffer. */ -+#define BARRIER_EVENT_QUEUE_SIZE 100 -+struct BarrierEventStore barrierEventQueue[BARRIER_EVENT_QUEUE_SIZE]; -+ -+static void -+CursorWorkQueueDestroyProc (WorkQueuePtr this) -+{ -+ struct BarrierEventStore *store; -+ store = container_of (this, struct BarrierEventStore, wq_item); -+ -+ store->in_use = FALSE; -+} -+ -+static Bool -+CursorSendBarrierEvent (ClientPtr client, pointer eventStore) -+{ -+ struct BarrierEventStore *store = (struct BarrierEventStore *)eventStore; -+ WriteEventsToClient (client, 1, (xEvent *)&store->ev); -+ -+ return TRUE; -+} -+ -+static struct BarrierEventStore * -+CursorFindFreeEventStore (void) -+{ -+ for (int i = 0; i < BARRIER_EVENT_QUEUE_SIZE; ++i) { -+ if (!barrierEventQueue[i].in_use) { -+ return &barrierEventQueue[i]; -+ } -+ } -+ return NULL; -+} -+ -+static void -+QueueBarrierEvent(CursorScreenPtr cs, struct PointerBarrier *barrier, -+ int x, int y, int velocity, Bool threshold_exceeded) -+{ -+ PointerBarrierEventClientPtr client; -+ struct BarrierEventStore *store; -+ list_for_each_entry(client, &cs->barrierClients, entry) { -+ store = CursorFindFreeEventStore (); -+ if (store == NULL) { -+ ErrorF ("[xfixes] Barrier event queue full. Dropping further events\n"); -+ return; -+ } -+ -+ store->in_use = TRUE; -+ -+ store->ev.type = XFixesEventBase + XFixesBarrierNotify; -+ store->ev.subtype = threshold_exceeded ? XFixesBarrierThresholdExceededNotify : -+ XFixesBarrierHitNotify; -+ store->ev.event_id = barrier->barrierEventID; -+ store->ev.barrier = barrier->barrier; -+ store->ev.x = x; -+ store->ev.y = y; -+ store->ev.velocity = velocity; -+ store->ev.timestamp = currentTime.milliseconds; -+ -+ if (client->client->swapped) { -+ int n; -+ -+ swapl(&store->ev.event_id, n); -+ swapl(&store->ev.barrier, n); -+ swaps(&store->ev.x, n); -+ swaps(&store->ev.y, n); -+ swapl(&store->ev.velocity, n); -+ swapl(&store->ev.timestamp, n); -+ } -+ -+ store->wq_item.function = CursorSendBarrierEvent; -+ store->wq_item.client = client->client; -+ store->wq_item.closure = store; -+ store->wq_item.destroyProc = CursorWorkQueueDestroyProc; -+ -+ QueueWorkItem (&store->wq_item); -+ } -+} -+ -+static void -+barrier_calculate_velocity_components (int x1, int y1, int x2, int y2, -+ int *vel_x, int *vel_y) -+{ -+ static CARD32 last_timestamp = 0; -+ CARD32 timestamp = GetTimeInMillis(); -+ int dx, dy; -+ int dt = timestamp - last_timestamp; -+ -+ if (last_timestamp == 0) { -+ /* Not much we can do for the first event */ -+ *vel_x = 0; -+ *vel_y = 0; -+ last_timestamp = timestamp; -+ return; -+ } -+ -+ /* Lets not divide by zero if we can avoid it */ -+ dt = dt > 0 ? dt : 1; -+ -+ dx = x2 - x1; -+ dy = y2 - y1; -+ -+ *vel_x = abs(dx) * 1000.0 / dt; -+ *vel_y = abs(dy) * 1000.0 / dt; -+ -+ last_timestamp = timestamp; -+} -+ - static void - CursorConstrainCursorHarder(DeviceIntPtr dev, ScreenPtr screen, int mode, int *x, int *y) - { -@@ -1238,12 +1368,23 @@ - - if (!list_is_empty(&cs->barriers) && !IsFloating(dev) && mode == Relative) { - int ox, oy; -+ int vel_x, vel_y; - int dir; - struct PointerBarrier *nearest = NULL; -+ PointerBarrierClientPtr c; - - /* where are we coming from */ - miPointerGetPosition(dev, &ox, &oy); - -+ /* Use the unclamped values, if available. If not, *x, *y -+ * will have to do. -+ * NOTE: We should never get here with unclamped values unset. -+ */ -+ if (unclamped_prex == -1 || unclamped_prey == -1) { -+ unclamped_prex = *x; -+ unclamped_prey = *y; -+ } -+ - /* How this works: - * Given the origin and the movement vector, get the nearest barrier - * to the origin that is blocking the movement. -@@ -1251,11 +1392,27 @@ - * Then, check from the clamped intersection to the original - * destination, again finding the nearest barrier and clamping. - */ -- dir = barrier_get_direction(ox, oy, *x, *y); -+ dir = barrier_get_direction(ox, oy, unclamped_prex, unclamped_prey); -+ barrier_calculate_velocity_components(ox, oy, unclamped_prex, unclamped_prey, &vel_x, &vel_y); - -- nearest = barrier_find_nearest(cs, dir, ox, oy, *x, *y); -+ nearest = barrier_find_nearest(cs, dir, ox, oy, unclamped_prex, unclamped_prey); - if (nearest) { -- barrier_clamp_to_barrier(nearest, dir, x, y); -+ int velocity = barrier_is_vertical(nearest) ? vel_x : vel_y; -+ Bool threshold_exceeded = (nearest->velocity != 0) && -+ (velocity > nearest->velocity); -+ -+ if (!nearest->lastHit) { -+ /* This is the start of a new barrier event */ -+ nearest->barrierEventID++; -+ } -+ -+ if ((!threshold_exceeded || nearest->lastHit) && -+ (nearest->barrierEventID != nearest->releaseEventID)) { -+ barrier_clamp_to_barrier(nearest, dir, x, y); -+ nearest->hit = TRUE; -+ } -+ -+ QueueBarrierEvent(cs, nearest, *x, *y, velocity, threshold_exceeded); - - if (barrier_is_vertical(nearest)) { - dir &= ~(BarrierNegativeX | BarrierPositiveX); -@@ -1265,11 +1422,31 @@ - oy = *y; - } - -- nearest = barrier_find_nearest(cs, dir, ox, oy, *x, *y); -+ nearest = barrier_find_nearest(cs, dir, ox, oy, unclamped_prex, unclamped_prey); - if (nearest) { -- barrier_clamp_to_barrier(nearest, dir, x, y); -+ velocity = barrier_is_vertical(nearest) ? vel_x : vel_y; -+ threshold_exceeded = (nearest->velocity != 0) && -+ (velocity > nearest->velocity); -+ -+ if (!nearest->lastHit) { -+ /* This is the start of a new barrier event */ -+ nearest->barrierEventID++; -+ } -+ -+ if ((!threshold_exceeded || nearest->lastHit) && -+ (nearest->barrierEventID != nearest->releaseEventID)) { -+ barrier_clamp_to_barrier(nearest, dir, x, y); -+ nearest->hit = TRUE; -+ } -+ -+ QueueBarrierEvent(cs, nearest, *x, *y, velocity, threshold_exceeded); - } - } -+ -+ list_for_each_entry(c, &cs->barriers, entry) { -+ c->barrier.lastHit = c->barrier.hit; -+ c->barrier.hit = FALSE; -+ } - } - - if (cs->ConstrainCursorHarder) { -@@ -1284,15 +1461,45 @@ - xXFixesCreatePointerBarrierReq *stuff) - { - CursorScreenPtr cs = GetCursorScreen(screen); -- struct PointerBarrierClient *ret = malloc(sizeof(*ret)); -+ struct PointerBarrierClient *ret = calloc(sizeof(*ret), 1); - - if (ret) { - ret->screen = screen; -+ ret->barrier.barrier = stuff->barrier; - ret->barrier.x1 = min(stuff->x1, stuff->x2); - ret->barrier.x2 = max(stuff->x1, stuff->x2); - ret->barrier.y1 = min(stuff->y1, stuff->y2); - ret->barrier.y2 = max(stuff->y1, stuff->y2); - ret->barrier.directions = stuff->directions & 0x0f; -+ ret->barrier.velocity = 0; -+ ret->barrier.barrierEventID = 0; -+ if (barrier_is_horizontal(&ret->barrier)) -+ ret->barrier.directions &= ~(BarrierPositiveX | BarrierNegativeX); -+ if (barrier_is_vertical(&ret->barrier)) -+ ret->barrier.directions &= ~(BarrierPositiveY | BarrierNegativeY); -+ list_add(&ret->entry, &cs->barriers); -+ } -+ -+ return ret; -+} -+ -+static struct PointerBarrierClient * -+CreatePointerBarrierVelocityClient(ScreenPtr screen, ClientPtr client, -+ xXFixesCreatePointerBarrierVelocityReq *stuff) -+{ -+ CursorScreenPtr cs = GetCursorScreen(screen); -+ struct PointerBarrierClient *ret = calloc(sizeof(*ret), 1); -+ -+ if (ret) { -+ ret->screen = screen; -+ ret->barrier.barrier = stuff->barrier; -+ ret->barrier.x1 = min(stuff->x1, stuff->x2); -+ ret->barrier.x2 = max(stuff->x1, stuff->x2); -+ ret->barrier.y1 = min(stuff->y1, stuff->y2); -+ ret->barrier.y2 = max(stuff->y1, stuff->y2); -+ ret->barrier.directions = stuff->directions & 0x0f; -+ ret->barrier.velocity = stuff->velocity; -+ ret->barrier.barrierEventID = 0; - if (barrier_is_horizontal(&ret->barrier)) - ret->barrier.directions &= ~(BarrierPositiveX | BarrierNegativeX); - if (barrier_is_vertical(&ret->barrier)) -@@ -1365,6 +1572,69 @@ - return ProcXFixesVector[stuff->xfixesReqType](client); - } - -+int -+ProcXFixesCreatePointerBarrierVelocity (ClientPtr client) -+{ -+ int err; -+ WindowPtr pWin; -+ struct PointerBarrierClient *barrier; -+ struct PointerBarrier b; -+ REQUEST (xXFixesCreatePointerBarrierVelocityReq); -+ -+ REQUEST_SIZE_MATCH(xXFixesCreatePointerBarrierVelocityReq); -+ LEGAL_NEW_RESOURCE(stuff->barrier, client); -+ -+ err = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess); -+ if (err != Success) { -+ client->errorValue = stuff->window; -+ return err; -+ } -+ -+ /* This sure does need fixing. */ -+ if (stuff->num_devices) -+ return BadImplementation; -+ -+ b.x1 = stuff->x1; -+ b.x2 = stuff->x2; -+ b.y1 = stuff->y1; -+ b.y2 = stuff->y2; -+ -+ if (!barrier_is_horizontal(&b) && !barrier_is_vertical(&b)) -+ return BadValue; -+ -+ /* no 0-sized barriers */ -+ if (barrier_is_horizontal(&b) && barrier_is_vertical(&b)) -+ return BadValue; -+ -+ if (!(barrier = CreatePointerBarrierVelocityClient(pWin->drawable.pScreen, -+ client, stuff))) -+ return BadAlloc; -+ -+ if (!AddResource(stuff->barrier, PointerBarrierType, &barrier->barrier)) -+ return BadAlloc; -+ -+ return Success; -+} -+ -+int -+SProcXFixesCreatePointerBarrierVelocity (ClientPtr client) -+{ -+ int n; -+ REQUEST(xXFixesCreatePointerBarrierVelocityReq); -+ -+ swaps(&stuff->length, n); -+ REQUEST_SIZE_MATCH(xXFixesCreatePointerBarrierReq); -+ swapl(&stuff->barrier, n); -+ swapl(&stuff->window, n); -+ swaps(&stuff->x1, n); -+ swaps(&stuff->y1, n); -+ swaps(&stuff->x2, n); -+ swaps(&stuff->y2, n); -+ swapl(&stuff->directions, n); -+ swapl(&stuff->velocity, n); -+ return ProcXFixesVector[stuff->xfixesReqType](client); -+} -+ - static int - CursorFreeBarrier(void *data, XID id) - { -@@ -1421,6 +1691,118 @@ - return ProcXFixesVector[stuff->xfixesReqType](client); - } - -+static int -+CursorFreeBarrierClient(void *data, XID id) -+{ -+ PointerBarrierEventClientPtr client = data, c; -+ ScreenPtr screen = client->screen; -+ CursorScreenPtr cs = GetCursorScreen(screen); -+ -+ /* find and unlink from the screen private */ -+ list_for_each_entry(c, &cs->barrierClients, entry) { -+ if (c == client) { -+ list_del(&c->entry); -+ break; -+ } -+ } -+ -+ free(client); -+ return Success; -+} -+ -+static struct PointerBarrierEventClient * -+CreatePointerBarrierEventClient(ScreenPtr screen, ClientPtr client, -+ xXFixesSelectBarrierInputReq *stuff) -+{ -+ CursorScreenPtr cs = GetCursorScreen(screen); -+ struct PointerBarrierEventClient *ret = malloc(sizeof(*ret)); -+ -+ if (ret) { -+ ret->screen = screen; -+ ret->client = client; -+ ret->eventMask = stuff->eventMask; -+ ret->window = stuff->window; -+ ret->resource = FakeClientID (client->index); -+ list_add(&ret->entry, &cs->barrierClients); -+ } -+ -+ return ret; -+} -+ -+int -+ProcXFixesSelectBarrierInput (ClientPtr client) -+{ -+ int err; -+ WindowPtr pWin; -+ struct PointerBarrierEventClient *eventClient; -+ REQUEST (xXFixesSelectBarrierInputReq); -+ -+ REQUEST_SIZE_MATCH(xXFixesSelectBarrierInputReq); -+ -+ err = dixLookupWindow(&pWin , stuff->window, client, DixReadAccess); -+ if (err != Success) { -+ client->errorValue = stuff->window; -+ return err; -+ } -+ -+ if (!(eventClient = CreatePointerBarrierEventClient(pWin->drawable.pScreen, -+ client, -+ stuff))) -+ return BadAlloc; -+ -+ if (!AddResource (eventClient->resource, PointerBarrierClientType, eventClient)) -+ return BadAlloc; -+ -+ return Success; -+} -+ -+int -+SProcXFixesSelectBarrierInput (ClientPtr client) -+{ -+ int n; -+ REQUEST(xXFixesSelectBarrierInputReq); -+ -+ swaps(&stuff->length, n); -+ REQUEST_SIZE_MATCH(xXFixesSelectBarrierInputReq); -+ swapl(&stuff->window, n); -+ swapl(&stuff->eventMask, n); -+ return ProcXFixesVector[stuff->xfixesReqType](client); -+} -+ -+int -+ProcXFixesBarrierReleasePointer (ClientPtr client) -+{ -+ int err; -+ struct PointerBarrier *barrier; -+ REQUEST (xXFixesBarrierReleasePointerReq); -+ REQUEST_SIZE_MATCH(xXFixesBarrierReleasePointerReq); -+ -+ err = dixLookupResourceByType((void **)&barrier, stuff->barrier, -+ PointerBarrierType, client, -+ DixReadAccess); -+ if (err != Success) { -+ client->errorValue = stuff->barrier; -+ return err; -+ } -+ -+ barrier->releaseEventID = stuff->event_id; -+ -+ return Success; -+} -+ -+int -+SProcXFixesBarrierReleasePointer (ClientPtr client) -+{ -+ int n; -+ REQUEST(xXFixesBarrierReleasePointerReq); -+ -+ swaps(&stuff->length, n); -+ REQUEST_SIZE_MATCH(xXFixesBarrierReleasePointerReq); -+ swapl(&stuff->barrier, n); -+ swapl(&stuff->event_id, n); -+ return ProcXFixesVector[stuff->xfixesReqType](client); -+} -+ - Bool - XFixesCursorInit (void) - { -@@ -1441,6 +1823,7 @@ - if (!cs) - return FALSE; - list_init(&cs->barriers); -+ list_init(&cs->barrierClients); - Wrap (cs, pScreen, CloseScreen, CursorCloseScreen); - Wrap (cs, pScreen, DisplayCursor, CursorDisplayCursor); - Wrap (cs, pScreen, ConstrainCursorHarder, CursorConstrainCursorHarder); -@@ -1455,8 +1838,10 @@ - "XFixesCursorWindow"); - PointerBarrierType = CreateNewResourceType(CursorFreeBarrier, - "XFixesPointerBarrier"); -+ PointerBarrierClientType = CreateNewResourceType(CursorFreeBarrierClient, -+ "XFixesPointerBarrierClient"); - - return CursorClientType && CursorHideCountType && CursorWindowType && -- PointerBarrierType; -+ PointerBarrierType && PointerBarrierClientType; - } - -Index: xorg-server/xfixes/xfixes.c -=================================================================== ---- xorg-server.orig/xfixes/xfixes.c 2012-03-07 22:24:45.592697117 +1100 -+++ xorg-server/xfixes/xfixes.c 2012-03-08 07:40:35.480111388 +1100 -@@ -100,6 +100,7 @@ - X_XFixesExpandRegion, /* Version 3 */ - X_XFixesShowCursor, /* Version 4 */ - X_XFixesDestroyPointerBarrier, /* Version 5 */ -+ X_XFixesBarrierReleasePointer, /* Version 6 */ - }; - - #define NUM_VERSION_REQUESTS (sizeof (version_requests) / sizeof (version_requests[0])) -@@ -143,6 +144,10 @@ - /*************** Version 5 ****************/ - ProcXFixesCreatePointerBarrier, - ProcXFixesDestroyPointerBarrier, -+/*************** Version 6 ****************/ -+ ProcXFixesCreatePointerBarrierVelocity, -+ ProcXFixesSelectBarrierInput, -+ ProcXFixesBarrierReleasePointer, - }; - - static int -@@ -209,6 +214,10 @@ - /*************** Version 5 ****************/ - SProcXFixesCreatePointerBarrier, - SProcXFixesDestroyPointerBarrier, -+/*************** Version 6 ****************/ -+ SProcXFixesCreatePointerBarrierVelocity, -+ SProcXFixesSelectBarrierInput, -+ SProcXFixesBarrierReleasePointer, - }; - - static int -Index: xorg-server/xfixes/xfixes.h -=================================================================== ---- xorg-server.orig/xfixes/xfixes.h 2012-03-07 22:24:45.608697118 +1100 -+++ xorg-server/xfixes/xfixes.h 2012-03-08 07:40:35.480111388 +1100 -@@ -28,6 +28,7 @@ - #define _XFIXES_H_ - - #include "resource.h" -+#include "list.h" - - extern _X_EXPORT RESTYPE RegionResType; - extern _X_EXPORT RESTYPE PointerBarrierType; -@@ -52,9 +53,25 @@ - extern _X_EXPORT RegionPtr - XFixesRegionCopy (RegionPtr pRegion); - -+typedef struct PointerBarrierEventClient *PointerBarrierEventClientPtr; -+ -+struct PointerBarrierEventClient { -+ ScreenPtr screen; -+ ClientPtr client; -+ CARD32 eventMask; -+ XID window; -+ XID resource; -+ struct list entry; -+}; -+ - struct PointerBarrier { -+ XID barrier; - CARD16 x1, x2, y1, y2; - CARD32 directions; -+ CARD32 velocity; -+ CARD32 barrierEventID; -+ CARD32 releaseEventID; -+ Bool hit, lastHit; - }; - - -Index: xorg-server/xfixes/xfixesint.h -=================================================================== ---- xorg-server.orig/xfixes/xfixesint.h 2012-03-07 22:24:45.616697118 +1100 -+++ xorg-server/xfixes/xfixesint.h 2012-03-08 07:40:35.480111388 +1100 -@@ -59,6 +59,7 @@ - #include "windowstr.h" - #include "selection.h" - #include "xfixes.h" -+#include "list.h" - - extern int XFixesEventBase; - -@@ -293,6 +294,26 @@ - int - SProcXFixesDestroyPointerBarrier (ClientPtr client); - -+/* Version 6 */ -+ -+int -+ProcXFixesSelectBarrierInput (ClientPtr client); -+ -+int -+SProcXFixesSelectBarrierInput (ClientPtr client); -+ -+int -+ProcXFixesCreatePointerBarrierVelocity (ClientPtr client); -+ -+int -+SProcXFixesCreatePointerBarrierVelocity (ClientPtr client); -+ -+int -+ProcXFixesBarrierReleasePointer (ClientPtr client); -+ -+int -+SProcXFixesBarrierReleasePointer (ClientPtr client); -+ - /* Xinerama */ - extern int (*PanoramiXSaveXFixesVector[XFixesNumberRequests])(ClientPtr); - void PanoramiXFixesInit (void); -Index: xorg-server/dix/getevents.c -=================================================================== ---- xorg-server.orig/dix/getevents.c 2012-03-07 22:24:45.624697119 +1100 -+++ xorg-server/dix/getevents.c 2012-03-08 11:02:31.739464474 +1100 -@@ -79,6 +79,12 @@ - InternalEvent* InputEventList = NULL; - - /** -+ * xfixes/cursor.c wants the unclamped (x,y) values for velocity -+ * calculation. Export them here. -+ */ -+int unclamped_prex = -1, unclamped_prey = -1; -+ -+/** - * Pick some arbitrary size for Xi motion history. - */ - int -@@ -903,7 +909,15 @@ - /* miPointerSetPosition takes care of crossing screens for us, as well as - * clipping to the current screen. Coordinates returned are in desktop - * coord system */ -+ /** -+ * Hack to pass the unclipped values through to the pointer barrier code. -+ * Required (for now) to calculate the velocity. -+ */ -+ unclamped_prex = (int)floor(*screenx) - scr->x; -+ unclamped_prey = (int)floor(*screeny) - scr->y; - scr = miPointerSetPosition(dev, mode, screenx, screeny); -+ unclamped_prex = -1; -+ unclamped_prey = -1; - - /* If we were constrained, rescale x/y from the screen coordinates so - * the device valuators reflect the correct position. For screen -Index: xorg-server/test/gtest/xfixes_barriers.cpp -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ xorg-server/test/gtest/xfixes_barriers.cpp 2012-03-08 07:42:49.188104249 +1100 -@@ -0,0 +1,828 @@ -+/* -+ -+Copyright (c) 2012, Canonical Ltd -+ -+Permission is hereby granted, free of charge, to any person obtaining a -+copy of this software and associated documentation files (the "Software"), -+to deal in the Software without restriction, including without limitation -+the rights to use, copy, modify, merge, publish, distribute, sublicense, -+and/or sell copies of the Software, and to permit persons to whom the -+Software is furnished to do so, subject to the following conditions: -+ -+The above copyright notice and this permission notice (including the next -+paragraph) shall be included in all copies or substantial portions of the -+Software. -+ -+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -+THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -+DEALINGS IN THE SOFTWARE. -+*/ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+ -+int main (int argc, char **argv) -+{ -+ ::testing::InitGoogleTest (&argc, argv); -+ xorg::testing::Environment* environment = new xorg::testing::Environment (); -+ environment->set_conf_file (XORG_DUMMY_CONF); -+ environment->set_server (XORG_BINARY); -+ testing::AddGlobalTestEnvironment (environment); -+ return RUN_ALL_TESTS (); -+} -+ -+class BarrierTest : public xorg::testing::Test { -+ public: -+ ::Display *dpy; -+ static XErrorEvent *lastError; -+ int xtest_eventbase; -+ int xtest_errorbase; -+ int fixes_eventbase; -+ int fixes_errorbase; -+ -+ void AssertPointerPosition (int expected_x, int expected_y) -+ { -+ int x, y, unused_int; -+ unsigned int unused_uint; -+ Window unused_win; -+ -+ XQueryPointer (Display (), DefaultRootWindow (Display ()), -+ &unused_win, &unused_win, &x, &y, -+ &unused_int, &unused_int, &unused_uint); -+ -+ ASSERT_TRUE (x == expected_x && y == expected_y) << -+ "Incorrect pointer position: Expected ("<< -+ expected_x<< ", "<= 2); -+ -+ major = 6; -+ minor = 0; -+ XFixesQueryVersion (dpy, &major, &minor); -+ ASSERT_EQ (6, major); -+ ASSERT_TRUE (minor >= 0); -+ -+ ASSERT_TRUE (XFixesQueryExtension (dpy, -+ &fixes_eventbase, &fixes_errorbase)); -+ -+ lastError = new XErrorEvent; -+ XSetErrorHandler (ErrorHandler); -+ } -+ -+ private: -+ static int ErrorHandler (::Display *dpy, XErrorEvent *error) -+ { -+ memcpy (lastError, error, sizeof (*lastError)); -+ return 0; -+ } -+}; -+ -+XErrorEvent *BarrierTest::lastError = NULL; -+ -+TEST_F (BarrierTest, CreateVerticalBarrierSucceeds) -+{ -+ PointerBarrier barrier; -+ barrier = XFixesCreatePointerBarrier (dpy, DefaultRootWindow(dpy), -+ 100, 0, -+ 100, 100, -+ 0, -+ 0, NULL); -+ ASSERT_NE(None, barrier); -+} -+ -+TEST_F (BarrierTest, CreateHorizontalBarrierSucceds) -+{ -+ PointerBarrier barrier; -+ barrier = XFixesCreatePointerBarrier (dpy, DefaultRootWindow(dpy), -+ 100, 100, -+ 200, 100, -+ 0, -+ 0, NULL); -+ ASSERT_NE(None, barrier); -+} -+ -+TEST_F (BarrierTest, CreateNonAxisAlignedBarrierFails) -+{ -+ XFixesCreatePointerBarrier (dpy, DefaultRootWindow(dpy), -+ 0, 0, -+ 100, 100, -+ 0, -+ 0, NULL); -+ XSync (Display (), false); -+ ASSERT_EQ(BadValue, lastError->error_code); -+} -+ -+TEST_F (BarrierTest, VerticalBidirectionalBarrierBlocksRelativeMotion) -+{ -+ int barrier_x = 100; -+ XFixesCreatePointerBarrier (Display (), DefaultRootWindow (Display ()), -+ barrier_x, 0, -+ barrier_x, 300, -+ 0, 0, NULL); -+ -+ int x = 200, y = 100, dx = -200, dy = 0; -+ XTestFakeMotionEvent (Display (), DefaultScreen (Display ()), -+ x, y, 0); -+ -+ ASSERT_NO_FATAL_FAILURE (AssertPointerPosition (x, y)); -+ -+ // Relative motion should block on barrier -+ XTestFakeRelativeMotionEvent (Display (), dx, dy, 0); -+ -+ ASSERT_NO_FATAL_FAILURE (AssertPointerPosition (barrier_x, y)); -+} -+ -+TEST_F (BarrierTest, VerticalPositiveXBarrierBlocksMotion) -+{ -+ int barrier_x = 100; -+ XFixesCreatePointerBarrier (Display (), DefaultRootWindow (Display ()), -+ barrier_x, 0, -+ barrier_x, 300, -+ BarrierPositiveX, 0, NULL); -+ int x = 200, y = 100, dx = -200, dy = 0; -+ XTestFakeMotionEvent (Display (), DefaultScreen (Display ()), -+ x, y, 0); -+ -+ ASSERT_NO_FATAL_FAILURE (AssertPointerPosition (x, y)); -+ -+ // Relative motion in -ve X direction should block on barrier -+ XTestFakeRelativeMotionEvent (Display (), dx, dy, 0); -+ -+ ASSERT_NO_FATAL_FAILURE (AssertPointerPosition (barrier_x, y + dy)); -+ -+ x = 0, y = 100, dx = 200, dy = 0; -+ XTestFakeMotionEvent (Display (), DefaultScreen (Display ()), -+ x, y, 0); -+ -+ ASSERT_NO_FATAL_FAILURE (AssertPointerPosition (x, y)); -+ -+ // Relative motion in +ve X direction should ignore barrier -+ XTestFakeRelativeMotionEvent (Display (), dx, dy, 0); -+ -+ ASSERT_NO_FATAL_FAILURE (AssertPointerPosition (x + dx, y + dy)); -+} -+ -+TEST_F (BarrierTest, VerticalNegativeXBarrierBlocksMotion) -+{ -+ int barrier_x = 100; -+ XFixesCreatePointerBarrier (Display (), DefaultRootWindow (Display ()), -+ barrier_x, 0, -+ barrier_x, 300, -+ BarrierNegativeX, -+ 0, NULL); -+ -+ int x = 200, y = 100, dx = -200, dy = 0; -+ XTestFakeMotionEvent (Display (), DefaultScreen (Display ()), -+ x, y, 0); -+ -+ ASSERT_NO_FATAL_FAILURE (AssertPointerPosition (x, y)); -+ -+ // Relative motion in -ve X direction should ignore barrier -+ XTestFakeRelativeMotionEvent (Display (), dx, dy, 0); -+ -+ ASSERT_NO_FATAL_FAILURE (AssertPointerPosition (x + dx, y + dy)); -+ -+ x = 0, y = 100, dx = 200, dy = 0; -+ XTestFakeMotionEvent (Display (), DefaultScreen (Display ()), -+ x, y, 0); -+ -+ ASSERT_NO_FATAL_FAILURE (AssertPointerPosition (x, y)); -+ -+ // Relative motion in +ve X direction should block on barrier -+ XTestFakeRelativeMotionEvent (Display (), dx, dy, 0); -+ -+ ASSERT_NO_FATAL_FAILURE (AssertPointerPosition (barrier_x - 1, y + dy)); -+} -+ -+TEST_F (BarrierTest, HorizontalBidirectionalBarrierBlocksRelativeMotion) -+{ -+ int barrier_y = 100; -+ XFixesCreatePointerBarrier (Display (), DefaultRootWindow (Display ()), -+ 0, barrier_y, -+ 300, barrier_y, -+ 0, 0, NULL); -+ -+ int x = 200, y = 0; -+ XTestFakeMotionEvent (Display (), DefaultScreen (Display ()), -+ x, y, 0); -+ -+ ASSERT_NO_FATAL_FAILURE (AssertPointerPosition (x, y)); -+ -+ // Relative motion in +ve Y direction should block on barrier -+ int dx = 0, dy = 200; -+ XTestFakeRelativeMotionEvent (Display (), dx, dy, 0); -+ -+ ASSERT_NO_FATAL_FAILURE (AssertPointerPosition (x + dx, barrier_y - 1)); -+ -+ x = 100, y = 200; -+ XTestFakeMotionEvent (Display (), DefaultScreen (Display ()), -+ x, y, 0); -+ -+ ASSERT_NO_FATAL_FAILURE (AssertPointerPosition (x, y)); -+ -+ // Relative motion in -ve Y direction should block on barrier -+ dx = 0, dy = -200; -+ XTestFakeRelativeMotionEvent (Display (), dx, dy, 0); -+ -+ ASSERT_NO_FATAL_FAILURE (AssertPointerPosition (x + dx, barrier_y)); -+} -+ -+TEST_F (BarrierTest, HorizontalPositiveYBarrierBlocksMotion) -+{ -+ int barrier_y = 100; -+ XFixesCreatePointerBarrier (Display (), DefaultRootWindow (Display ()), -+ 0, barrier_y, -+ 300, barrier_y, -+ BarrierPositiveY, 0, NULL); -+ -+ int x = 200, y = 0; -+ XTestFakeMotionEvent (Display (), DefaultScreen (Display ()), -+ x, y, 0); -+ ASSERT_NO_FATAL_FAILURE (AssertPointerPosition (x, y)); -+ -+ // Relative motion in +ve Y direction should ignore barrier -+ int dx = 0, dy = 200; -+ XTestFakeRelativeMotionEvent (Display (), dx, dy, 0); -+ ASSERT_NO_FATAL_FAILURE (AssertPointerPosition (x + dx, y + dy)); -+ -+ x = 100, y = 200; -+ XTestFakeMotionEvent (Display (), DefaultScreen (Display ()), -+ x, y, 0); -+ -+ ASSERT_NO_FATAL_FAILURE (AssertPointerPosition (x, y)); -+ -+ // Relative motion in -ve Y direction should block on barrier -+ dx = 0, dy = -200; -+ XTestFakeRelativeMotionEvent (Display (), dx, dy, 0); -+ -+ ASSERT_NO_FATAL_FAILURE (AssertPointerPosition (x + dx, barrier_y)); -+} -+ -+TEST_F (BarrierTest, HorizontalNegativeYBarrierBlocksMotion) -+{ -+ int barrier_y = 100; -+ XFixesCreatePointerBarrier (Display (), DefaultRootWindow (Display ()), -+ 0, barrier_y, -+ 300, barrier_y, -+ BarrierNegativeY, 0, NULL); -+ -+ int x = 200, y = 0; -+ XTestFakeMotionEvent (Display (), DefaultScreen (Display ()), -+ x, y, 0); -+ ASSERT_NO_FATAL_FAILURE (AssertPointerPosition (x, y)); -+ -+ // Relative motion in +ve Y direction should block on barrier -+ int dx = 0, dy = 200; -+ XTestFakeRelativeMotionEvent (Display (), dx, dy, 0); -+ ASSERT_NO_FATAL_FAILURE (AssertPointerPosition (x + dx, barrier_y - 1)); -+ -+ x = 100, y = 200; -+ XTestFakeMotionEvent (Display (), DefaultScreen (Display ()), -+ x, y, 0); -+ -+ ASSERT_NO_FATAL_FAILURE (AssertPointerPosition (x, y)); -+ -+ // Relative motion in -ve Y direction should ignore barrier -+ dx = 0, dy = -200; -+ XTestFakeRelativeMotionEvent (Display (), dx, dy, 0); -+ -+ ASSERT_NO_FATAL_FAILURE (AssertPointerPosition (x + dx, y + dy)); -+} -+ -+TEST_F (BarrierTest, DestroyPointerBarrierSucceeds) -+{ -+ int barrier_x = 100; -+ PointerBarrier barrier; -+ barrier = XFixesCreatePointerBarrier (Display (), DefaultRootWindow (Display ()), -+ barrier_x, 0, -+ barrier_x, 300, -+ 0, 0, NULL); -+ -+ int x = 0, y = 200; -+ XTestFakeMotionEvent (Display (), DefaultScreen (Display ()), -+ x, y, 0); -+ ASSERT_NO_FATAL_FAILURE (AssertPointerPosition (x, y)); -+ -+ // Check that the barrier exists before we destroy it. -+ int dx = 200, dy = 0; -+ XTestFakeRelativeMotionEvent (Display (), dx, dy, 0); -+ ASSERT_NO_FATAL_FAILURE (AssertPointerPosition (barrier_x - 1, y + dy)); -+ -+ // Destroy the barrier... -+ XFixesDestroyPointerBarrier (Display (), barrier); -+ -+ XTestFakeMotionEvent (Display (), DefaultScreen (Display ()), -+ x, y, 0); -+ ASSERT_NO_FATAL_FAILURE (AssertPointerPosition (x, y)); -+ -+ // There should be no barrier to block this. -+ XTestFakeRelativeMotionEvent (Display (), dx, dy, 0); -+ ASSERT_NO_FATAL_FAILURE (AssertPointerPosition (x + dx, y + dy)); -+} -+ -+TEST_F (BarrierTest, BarrierIgnoresNonsensicalDirections) -+{ -+ int barrier_x = 100; -+ XFixesCreatePointerBarrier (Display (), DefaultRootWindow (Display ()), -+ barrier_x, 0, -+ barrier_x, 300, -+ BarrierPositiveY | BarrierNegativeY, -+ 0, NULL); -+ -+ int x = 200, y = 100; -+ XTestFakeMotionEvent (Display (), DefaultScreen (Display ()), -+ x, y, 0); -+ -+ ASSERT_NO_FATAL_FAILURE (AssertPointerPosition (x, y)); -+ -+ int dx = -200, dy = 0; -+ XTestFakeRelativeMotionEvent (Display (), dx, dy, 0); -+ -+ ASSERT_NO_FATAL_FAILURE (AssertPointerPosition (barrier_x, y + dy)); -+ -+ int barrier_y = 100; -+ XFixesCreatePointerBarrier (Display (), DefaultRootWindow (Display ()), -+ 0, barrier_y, -+ 400, barrier_y, -+ BarrierPositiveX | BarrierNegativeX, -+ 0, NULL); -+ -+ x = 100, y = 200; -+ XTestFakeMotionEvent (Display (), DefaultScreen (Display ()), -+ x, y, 0); -+ -+ ASSERT_NO_FATAL_FAILURE (AssertPointerPosition (x, y)); -+ -+ dx = 0, dy = -200; -+ XTestFakeRelativeMotionEvent (Display (), dx, dy, 0); -+ -+ ASSERT_NO_FATAL_FAILURE (AssertPointerPosition (x + dx, barrier_y)); -+} -+ -+TEST_F (BarrierTest, VerticalBarrierEdges) -+{ -+ int barrier_x = 300, barrier_y1 = 300 , barrier_y2 = 500; -+ XFixesCreatePointerBarrier (Display (), DefaultRootWindow (Display ()), -+ barrier_x, barrier_y1, -+ barrier_x, barrier_y2, -+ 0, 0, NULL); -+ -+ int x = barrier_x + 100, y = barrier_y1 - 1; -+ XTestFakeMotionEvent (Display (), DefaultScreen (Display ()), -+ x, y, 0); -+ ASSERT_NO_FATAL_FAILURE (AssertPointerPosition (x, y)); -+ -+ // Motion should take us past the top of the barrier... -+ int dx = -200, dy = 0; -+ XTestFakeRelativeMotionEvent (Display (), dx, dy, 0); -+ ASSERT_NO_FATAL_FAILURE (AssertPointerPosition (x + dx, y + dy)); -+ -+ x = barrier_x + 100, y = barrier_y1; -+ XTestFakeMotionEvent (Display (), DefaultScreen (Display ()), -+ x, y, 0); -+ ASSERT_NO_FATAL_FAILURE (AssertPointerPosition (x, y)); -+ -+ // Motion should hit the top of the barrier... -+ dx = -200, dy = 0; -+ XTestFakeRelativeMotionEvent (Display (), dx, dy, 0); -+ ASSERT_NO_FATAL_FAILURE (AssertPointerPosition (barrier_x, y + dy)); -+ -+ x = barrier_x + 100, y = barrier_y2; -+ XTestFakeMotionEvent (Display (), DefaultScreen (Display ()), -+ x, y, 0); -+ ASSERT_NO_FATAL_FAILURE (AssertPointerPosition (x, y)); -+ -+ // Motion should hit the bottom of the barrier... -+ dx = -200, dy = 0; -+ XTestFakeRelativeMotionEvent (Display (), dx, dy, 0); -+ ASSERT_NO_FATAL_FAILURE (AssertPointerPosition (barrier_x, y + dy)); -+ -+ x = barrier_x + 100, y = barrier_y2 + 1; -+ XTestFakeMotionEvent (Display (), DefaultScreen (Display ()), -+ x, y, 0); -+ ASSERT_NO_FATAL_FAILURE (AssertPointerPosition (x, y)); -+ -+ // Motion should take us past the bottom of the barrier... -+ dx = -200, dy = 0; -+ XTestFakeRelativeMotionEvent (Display (), dx, dy, 0); -+ ASSERT_NO_FATAL_FAILURE (AssertPointerPosition (x + dx, y + dy)); -+} -+ -+TEST_F (BarrierTest, HorizontalBarrierEdges) -+{ -+ int barrier_x1 = 200, barrier_x2 = 500, barrier_y = 300; -+ XFixesCreatePointerBarrier (Display (), DefaultRootWindow (Display ()), -+ barrier_x1, barrier_y, -+ barrier_x2, barrier_y, -+ 0, 0, NULL); -+ -+ int x = barrier_x1 - 1, y = barrier_y - 100; -+ XTestFakeMotionEvent (Display (), DefaultScreen (Display ()), -+ x, y, 0); -+ ASSERT_NO_FATAL_FAILURE (AssertPointerPosition (x, y)); -+ -+ // Motion should take us past the left edge of the barrier... -+ int dx = 0, dy = 200; -+ XTestFakeRelativeMotionEvent (Display (), dx, dy, 0); -+ ASSERT_NO_FATAL_FAILURE (AssertPointerPosition (x + dx, y + dy)); -+ -+ x = barrier_x1, y = barrier_y - 100; -+ XTestFakeMotionEvent (Display (), DefaultScreen (Display ()), -+ x, y, 0); -+ ASSERT_NO_FATAL_FAILURE (AssertPointerPosition (x, y)); -+ -+ // Motion should hit the top of the barrier... -+ dx = 0, dy = 200; -+ XTestFakeRelativeMotionEvent (Display (), dx, dy, 0); -+ ASSERT_NO_FATAL_FAILURE (AssertPointerPosition (x, barrier_y - 1)); -+ -+ x = barrier_x2, y = barrier_y - 100; -+ XTestFakeMotionEvent (Display (), DefaultScreen (Display ()), -+ x, y, 0); -+ ASSERT_NO_FATAL_FAILURE (AssertPointerPosition (x, y)); -+ -+ // Motion should hit the bottom of the barrier... -+ dx = 0, dy = 200; -+ XTestFakeRelativeMotionEvent (Display (), dx, dy, 0); -+ ASSERT_NO_FATAL_FAILURE (AssertPointerPosition (x + dx, barrier_y - 1)); -+ -+ x = barrier_x2 + 1, y = barrier_y - 100; -+ XTestFakeMotionEvent (Display (), DefaultScreen (Display ()), -+ x, y, 0); -+ ASSERT_NO_FATAL_FAILURE (AssertPointerPosition (x, y)); -+ -+ // Motion should take us past the bottom of the barrier... -+ dx = 0, dy = 200; -+ XTestFakeRelativeMotionEvent (Display (), dx, dy, 0); -+ ASSERT_NO_FATAL_FAILURE (AssertPointerPosition (x + dx, y + dy)); -+} -+ -+TEST_F (BarrierTest, CornerBlocksMotion) -+{ -+ int corner_x, corner_y; -+ XFixesCreatePointerBarrier (Display (), DefaultRootWindow (Display ()), -+ corner_x, corner_y, -+ corner_x, corner_y + 300, -+ 0, 0, NULL); -+ XFixesCreatePointerBarrier (Display (), DefaultRootWindow (Display ()), -+ corner_x, corner_y, -+ corner_x + 300, corner_y, -+ 0, 0, NULL); -+ -+ int x = corner_x + 100, y = corner_y + 100; -+ XTestFakeMotionEvent (Display (), DefaultScreen (Display ()), -+ x, y, 0); -+ ASSERT_NO_FATAL_FAILURE (AssertPointerPosition (x, y)); -+ -+ XTestFakeRelativeMotionEvent (Display (), -200, -200, 0); -+ ASSERT_NO_FATAL_FAILURE (AssertPointerPosition (corner_x, corner_y)); -+} -+ -+TEST_F (BarrierTest, VerticalBarrierWithAdjacentStart) -+{ -+ int barrier_x = 350; -+ XFixesCreatePointerBarrier (Display (), DefaultRootWindow (Display ()), -+ barrier_x, 100, -+ barrier_x, 300, -+ 0, 0, NULL); -+ -+ int x = barrier_x, y = 200; -+ XTestFakeMotionEvent (Display (), DefaultScreen (Display ()), -+ x, y, 0); -+ ASSERT_NO_FATAL_FAILURE (AssertPointerPosition (x, y)); -+ -+ int dx = -10, dy = 0; -+ XTestFakeRelativeMotionEvent (Display (), dx, dy, 0); -+ ASSERT_NO_FATAL_FAILURE (AssertPointerPosition (barrier_x, y + dy)); -+ -+ x = barrier_x, y = 200; -+ XTestFakeMotionEvent (Display (), DefaultScreen (Display ()), -+ x, y, 0); -+ ASSERT_NO_FATAL_FAILURE (AssertPointerPosition (x, y)); -+ -+ dx = 10, dy = 0; -+ XTestFakeRelativeMotionEvent (Display (), dx, dy, 0); -+ ASSERT_NO_FATAL_FAILURE (AssertPointerPosition (x + dx, y + dy)); -+ -+ x = barrier_x - 1, y = 200; -+ XTestFakeMotionEvent (Display (), DefaultScreen (Display ()), -+ x, y, 0); -+ ASSERT_NO_FATAL_FAILURE (AssertPointerPosition (x, y)); -+ -+ dx = 10, dy = 0; -+ XTestFakeRelativeMotionEvent (Display (), dx, dy, 0); -+ ASSERT_NO_FATAL_FAILURE (AssertPointerPosition (barrier_x - 1, y + dy)); -+ -+ x = barrier_x - 1, y = 200; -+ XTestFakeMotionEvent (Display (), DefaultScreen (Display ()), -+ x, y, 0); -+ ASSERT_NO_FATAL_FAILURE (AssertPointerPosition (x, y)); -+ -+ dx = -10, dy = 0; -+ XTestFakeRelativeMotionEvent (Display (), dx, dy, 0); -+ ASSERT_NO_FATAL_FAILURE (AssertPointerPosition (x + dx, y + dy)); -+} -+ -+TEST_F (BarrierTest, HorizontalBarrierWithAdjacentStart) -+{ -+ int barrier_y = 300; -+ XFixesCreatePointerBarrier (Display (), DefaultRootWindow (Display ()), -+ 100, barrier_y, -+ 400, barrier_y, -+ 0, 0, NULL); -+ -+ int x = 240, y = barrier_y; -+ XTestFakeMotionEvent (Display (), DefaultScreen (Display ()), -+ x, y, 0); -+ ASSERT_NO_FATAL_FAILURE (AssertPointerPosition (x, y)); -+ -+ int dx = 0, dy = -10; -+ XTestFakeRelativeMotionEvent (Display (), dx, dy, 0); -+ ASSERT_NO_FATAL_FAILURE (AssertPointerPosition (x + dx, barrier_y)); -+ -+ x = 240, y = barrier_y; -+ XTestFakeMotionEvent (Display (), DefaultScreen (Display ()), -+ x, y, 0); -+ ASSERT_NO_FATAL_FAILURE (AssertPointerPosition (x, y)); -+ -+ dx = 0, dy = 10; -+ XTestFakeRelativeMotionEvent (Display (), dx, dy, 0); -+ ASSERT_NO_FATAL_FAILURE (AssertPointerPosition (x + dx, y + dy)); -+ -+ x = 240, y = barrier_y - 1; -+ XTestFakeMotionEvent (Display (), DefaultScreen (Display ()), -+ x, y, 0); -+ ASSERT_NO_FATAL_FAILURE (AssertPointerPosition (x, y)); -+ -+ dx = 0, dy = 10; -+ XTestFakeRelativeMotionEvent (Display (), dx, dy, 0); -+ ASSERT_NO_FATAL_FAILURE (AssertPointerPosition (x + dx, barrier_y - 1)); -+ -+ x = 240, y = barrier_y - 1; -+ XTestFakeMotionEvent (Display (), DefaultScreen (Display ()), -+ x, y, 0); -+ ASSERT_NO_FATAL_FAILURE (AssertPointerPosition (x, y)); -+ -+ dx = 0, dy = -10; -+ XTestFakeRelativeMotionEvent (Display (), dx, dy, 0); -+ ASSERT_NO_FATAL_FAILURE (AssertPointerPosition (x + dx, y + dy)); -+} -+ -+TEST_F (BarrierTest, BarrierNotifyEventFires) -+{ -+ int barrier_y = 300; -+ XFixesCreatePointerBarrier (Display (), DefaultRootWindow (Display ()), -+ 100, barrier_y, -+ 400, barrier_y, -+ 0, 0, NULL); -+ -+ XFixesSelectBarrierInput (Display (), DefaultRootWindow (Display ()), -+ XFixesBarrierHitNotifyMask); -+ -+ int x = 240, y = barrier_y + 50; -+ XTestFakeMotionEvent (Display (), DefaultScreen (Display ()), -+ x, y, 0); -+ ASSERT_NO_FATAL_FAILURE (AssertPointerPosition (x, y)); -+ -+ XTestFakeRelativeMotionEvent (Display (), 0, -100, 0); -+ -+ XFlush (Display ()); -+ ASSERT_TRUE (WaitForXEvent ())<<"Timed out waiting to receive X event"; -+ while (XPending (Display ())) { -+ XEvent e; -+ XNextEvent (Display (), &e); -+ switch (e.xany.type - fixes_eventbase) { -+ case XFixesBarrierNotify: -+ return; -+ } -+ } -+ FAIL () << "Failed to recieve BarrierNotify event"; -+} -+ -+TEST_F (BarrierTest, RecieveOneNotifyEventPerHit) -+{ -+ int barrier_x = 100; -+ XFixesCreatePointerBarrier (Display (), DefaultRootWindow (Display ()), -+ barrier_x, 0, -+ barrier_x, 300, -+ 0, 0, NULL); -+ -+ XFixesSelectBarrierInput (Display (), DefaultRootWindow (Display ()), -+ XFixesBarrierHitNotifyMask); -+ -+ int x = 200, y = 100, dx = -200, dy = 0; -+ XTestFakeMotionEvent (Display (), DefaultScreen (Display ()), -+ x, y, 0); -+ ASSERT_NO_FATAL_FAILURE (AssertPointerPosition (x, y)); -+ -+ /* Generate 5 barrier events */ -+ for (int i = 0; i < 5; ++i) { -+ XTestFakeRelativeMotionEvent (Display (), dx, dy, 0); -+ } -+ -+ int barrierEventCount = 0; -+ XFlush (Display ()); -+ ASSERT_TRUE (WaitForXEvent ())<<"Timed out waiting to receive X event"; -+ while (XPending (Display ())) { -+ XEvent e; -+ XNextEvent (Display (), &e); -+ switch (e.xany.type - fixes_eventbase) { -+ case XFixesBarrierNotify: -+ barrierEventCount++; -+ break; -+ } -+ } -+ ASSERT_EQ (5, barrierEventCount); -+} -+ -+TEST_F (BarrierTest, BarrierEventHasNonZeroVelocity) -+{ -+ int barrier_x = 100; -+ XFixesCreatePointerBarrier (Display (), DefaultRootWindow (Display ()), -+ barrier_x, 0, -+ barrier_x, 300, -+ 0, 0, NULL); -+ -+ XFixesSelectBarrierInput (Display (), DefaultRootWindow (Display ()), -+ XFixesBarrierHitNotifyMask); -+ -+ int x = 200, y = 100, dx = -200, dy = 0; -+ XTestFakeMotionEvent (Display (), DefaultScreen (Display ()), -+ x, y, 0); -+ ASSERT_NO_FATAL_FAILURE (AssertPointerPosition (x, y)); -+ -+ /* One relative event to ensure the server has a non-zero -+ * last-event-time */ -+ XTestFakeRelativeMotionEvent (Display (), 10, 10, 0); -+ /* Run the pointer into the barrier */ -+ XTestFakeRelativeMotionEvent (Display (), dx, dy, 0); -+ -+ XFlush (Display ()); -+ ASSERT_TRUE (WaitForXEvent ())<<"Timed out waiting to receive X event"; -+ while (XPending (Display ())) { -+ XEvent e; -+ XNextEvent (Display (), &e); -+ switch (e.xany.type - fixes_eventbase) { -+ case XFixesBarrierNotify: -+ XFixesBarrierNotifyEvent *notify = (XFixesBarrierNotifyEvent *)&e; -+ ASSERT_LT (0, notify->velocity); -+ return; -+ } -+ } -+ FAIL () << "Failed to receive barrier event"; -+} -+ -+TEST_F (BarrierTest, ScreenEdgeVerticalBarrierEventHasNonZeroVelocity) -+{ -+ int barrier_x = 0; -+ XFixesCreatePointerBarrier (Display (), DefaultRootWindow (Display ()), -+ barrier_x, 0, -+ barrier_x, 300, -+ 0, 0, NULL); -+ -+ XFixesSelectBarrierInput (Display (), DefaultRootWindow (Display ()), -+ XFixesBarrierHitNotifyMask); -+ -+ int x = 100, y = 100, dx = -200, dy = 0; -+ XTestFakeMotionEvent (Display (), DefaultScreen (Display ()), -+ x, y, 0); -+ ASSERT_NO_FATAL_FAILURE (AssertPointerPosition (x, y)); -+ -+ /* One relative event to ensure the server has a non-zero -+ * last-event-time */ -+ XTestFakeRelativeMotionEvent (Display (), 10, 10, 0); -+ /* Run the pointer into the barrier */ -+ XTestFakeRelativeMotionEvent (Display (), dx, dy, 0); -+ -+ XFlush (Display ()); -+ ASSERT_TRUE (WaitForXEvent ())<<"Timed out waiting to receive X event"; -+ while (XPending (Display ())) { -+ XEvent e; -+ XNextEvent (Display (), &e); -+ switch (e.xany.type - fixes_eventbase) { -+ case XFixesBarrierNotify: -+ XFixesBarrierNotifyEvent *notify = (XFixesBarrierNotifyEvent *)&e; -+ ASSERT_LT (0, notify->velocity); -+ return; -+ } -+ } -+ FAIL () << "Failed to receive barrier event"; -+} -+ -+TEST_F (BarrierTest, ScreenEdgeHorizontalBarrierEventHasNonZeroVelocity) -+{ -+ int barrier_y = 0; -+ XFixesCreatePointerBarrier (Display (), DefaultRootWindow (Display ()), -+ 0, barrier_y, -+ 300, barrier_y, -+ 0, 0, NULL); -+ -+ XFixesSelectBarrierInput (Display (), DefaultRootWindow (Display ()), -+ XFixesBarrierHitNotifyMask); -+ -+ int x = 100, y = 100, dx = 0, dy = -200; -+ XTestFakeMotionEvent (Display (), DefaultScreen (Display ()), -+ x, y, 0); -+ ASSERT_NO_FATAL_FAILURE (AssertPointerPosition (x, y)); -+ -+ /* One relative event to ensure the server has a non-zero -+ * last-event-time */ -+ XTestFakeRelativeMotionEvent (Display (), 10, 10, 0); -+ /* Run the pointer into the barrier */ -+ XTestFakeRelativeMotionEvent (Display (), dx, dy, 0); -+ -+ XFlush (Display ()); -+ ASSERT_TRUE (WaitForXEvent ())<<"Timed out waiting to receive X event"; -+ while (XPending (Display ())) { -+ XEvent e; -+ XNextEvent (Display (), &e); -+ switch (e.xany.type - fixes_eventbase) { -+ case XFixesBarrierNotify: -+ XFixesBarrierNotifyEvent *notify = (XFixesBarrierNotifyEvent *)&e; -+ ASSERT_LT (0, notify->velocity); -+ return; -+ } -+ } -+ FAIL () << "Failed to receive barrier event"; -+} -+ -+TEST_F (BarrierTest, ReceiveOneBarrierEventPerHitOnScreenEdge) -+{ -+ int barrier_x = 0; -+ XFixesCreatePointerBarrier (Display (), DefaultRootWindow (Display ()), -+ barrier_x, 0, -+ barrier_x, 300, -+ 0, 0, NULL); -+ -+ XFixesSelectBarrierInput (Display (), DefaultRootWindow (Display ()), -+ XFixesBarrierHitNotifyMask); -+ -+ int x = 20, y = 100, dx = -40, dy = 0; -+ XTestFakeMotionEvent (Display (), DefaultScreen (Display ()), -+ x, y, 0); -+ ASSERT_NO_FATAL_FAILURE (AssertPointerPosition (x, y)); -+ -+ /* Generate 5 barrier events */ -+ for (int i = 0; i < 5; ++i) { -+ XTestFakeRelativeMotionEvent (Display (), dx, dy, 0); -+ } -+ -+ int barrierEventCount = 0; -+ XFlush (Display ()); -+ ASSERT_TRUE (WaitForXEvent ())<<"Timed out waiting to receive X event"; -+ while (XPending (Display ())) { -+ XEvent e; -+ XNextEvent (Display (), &e); -+ switch (e.xany.type - fixes_eventbase) { -+ case XFixesBarrierNotify: -+ barrierEventCount++; -+ break; -+ } -+ } -+ ASSERT_EQ (5, barrierEventCount); -+} -Index: xorg-server/configure.ac -=================================================================== ---- xorg-server.orig/configure.ac 2012-03-08 07:40:35.416111392 +1100 -+++ xorg-server/configure.ac 2012-03-08 11:02:31.783464472 +1100 -@@ -2155,6 +2155,25 @@ - - AC_CONFIG_COMMANDS([sdksyms], [touch hw/xfree86/sdksyms.dep]) - -+AC_PROG_CXX -+ -+PKG_CHECK_MODULES(XORG_GTEST, xorg-gtest, -+ [have_xorg_gtest="yes"], -+ [AC_MSG_WARN([xorg-gtest not installed, tests will not be built])]) -+AM_CONDITIONAL([HAVE_XORG_GTEST], [test "x$have_xorg_gtest" = xyes]) -+AC_SUBST([XORG_GTEST_CFLAGS]) -+AC_SUBST([XORG_GTEST_LIBS]) -+ -+PKG_CHECK_MODULES([XFIXES], xfixes, [have_xfixes="yes"], [have_xfixes="no"]) -+AM_CONDITIONAL([HAVE_XFIXES], [test "x$have_xfixes" = xyes]) -+AC_SUBST([XFIXES_CFLAGS]) -+AC_SUBST([XFIXES_LIBS]) -+ -+PKG_CHECK_MODULES([XTEST], xtst, [have_xtest="yes"], [have_xtest="no"]) -+AM_CONDITIONAL([HAVE_XTEST], [test "x$have_xtest" = xyes]) -+AC_SUBST([XTEST_CFLAGS]) -+AC_SUBST([XTEST_LIBS]) -+ - AC_OUTPUT([ - Makefile - glx/Makefile -@@ -2254,6 +2273,7 @@ - hw/kdrive/src/Makefile - test/Makefile - test/xi2/Makefile -+test/gtest/Makefile - xserver.ent - xorg-server.pc - ]) -Index: xorg-server/test/gtest/Makefile.am -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ xorg-server/test/gtest/Makefile.am 2012-03-08 07:40:35.488111388 +1100 -@@ -0,0 +1,27 @@ -+check_PROGRAMS = xfixes_barriers -+check_DATA = dummy.conf -+ -+TESTS=xfixes_barriers -+ -+GTEST_SRC_DIR = /usr/src/gtest -+GTEST_SOURCES = $(GTEST_SRC_DIR)/src/gtest-all.cc -+ -+xfixes_barriers_CXXFLAGS = $(AM_CXXFLAGS) \ -+ -I$(GTEST_SRC_DIR) \ -+ $(XORG_GTEST_CFLAGS) \ -+ $(XTEST_CFLAGS) \ -+ $(XFIXES_CFLAGS) \ -+ -DXORG_BINARY=\"$(top_builddir)/hw/xfree86/Xorg\" \ -+ -DXORG_DUMMY_CONF=\"$(abs_srcdir)/dummy.conf\" -+ -+xfixes_barriers_LDADD = \ -+ $(XFIXES_LIBS) \ -+ $(XTEST_LIBS) \ -+ $(XORG_GTEST_LIBS) \ -+ -lpthread -+ -+xfixes_barriers_SOURCES = \ -+ xfixes_barriers.cpp -+ -+nodist_xfixes_barriers_SOURCES = \ -+ $(GTEST_SOURCES) -Index: xorg-server/test/Makefile.am -=================================================================== ---- xorg-server.orig/test/Makefile.am 2012-03-07 22:24:45.684697122 +1100 -+++ xorg-server/test/Makefile.am 2012-03-08 07:40:35.488111388 +1100 -@@ -1,5 +1,10 @@ - if ENABLE_UNIT_TESTS - SUBDIRS= . xi2 -+ -+if HAVE_XORG_GTEST -+SUBDIRS+= gtest -+endif -+ - noinst_PROGRAMS = xkb input xtest list misc fixes xfree86 touch - check_LTLIBRARIES = libxservertest.la - -Index: xorg-server/test/gtest/dummy.conf -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ xorg-server/test/gtest/dummy.conf 2012-03-08 07:40:35.488111388 +1100 -@@ -0,0 +1,4 @@ -+Section "Device" -+ Identifier "Dummy video device" -+ Driver "dummy" -+EndSection -Index: xorg-server/dix/dixutils.c -=================================================================== ---- xorg-server.orig/dix/dixutils.c 2012-03-08 07:40:35.392111393 +1100 -+++ xorg-server/dix/dixutils.c 2012-03-08 07:40:35.488111388 +1100 -@@ -537,7 +537,7 @@ - { - /* remove q from the list */ - *p = q->next; /* don't fetch until after func called */ -- free(q); -+ (*q->destroyProc) (q); - } - else - { -@@ -560,7 +560,7 @@ - (void) (*q->function) (q->client, q->closure); - /* remove q from the list */ - *p = q->next; /* don't fetch until after func called */ -- free(q); -+ (*q->destroyProc) (q); - } - else - { -@@ -570,6 +570,12 @@ - workQueueLast = p; - } - -+static void -+FreeWorkQueueItem (WorkQueuePtr this) -+{ -+ free(this); -+} -+ - Bool - QueueWorkProc ( - Bool (*function)(ClientPtr /* pClient */, pointer /* closure */), -@@ -583,12 +589,22 @@ - q->function = function; - q->client = client; - q->closure = closure; -+ q->destroyProc = FreeWorkQueueItem; - q->next = NULL; - *workQueueLast = q; - workQueueLast = &q->next; - return TRUE; - } - -+Bool -+QueueWorkItem (WorkQueuePtr item) -+{ -+ item->next = NULL; -+ *workQueueLast = item; -+ workQueueLast = &item->next; -+ return TRUE; -+} -+ - /* - * Manage a queue of sleeping clients, awakening them - * when requested, by using the OS functions IgnoreClient -Index: xorg-server/include/dixstruct.h -=================================================================== ---- xorg-server.orig/include/dixstruct.h 2012-03-07 22:24:45.552697115 +1100 -+++ xorg-server/include/dixstruct.h 2012-03-08 07:40:35.492111388 +1100 -@@ -153,6 +153,9 @@ - ); - ClientPtr client; - pointer closure; -+ void (*destroyProc) ( -+ struct _WorkQueue * /* this */ -+); - } WorkQueueRec; - - extern _X_EXPORT TimeStamp currentTime; -Index: xorg-server/include/dix.h -=================================================================== ---- xorg-server.orig/include/dix.h 2012-03-07 22:24:45.568697116 +1100 -+++ xorg-server/include/dix.h 2012-03-08 07:40:35.492111388 +1100 -@@ -266,6 +266,8 @@ - pointer /*closure*/ - ); - -+extern _X_EXPORT Bool QueueWorkItem(WorkQueuePtr item); -+ - typedef Bool (* ClientSleepProcPtr)( - ClientPtr /*client*/, - pointer /*closure*/); diff --git a/debian/patches/505_query_pointer_touchscreen.patch b/debian/patches/505_query_pointer_touchscreen.patch deleted file mode 100644 index 0443acf..0000000 --- a/debian/patches/505_query_pointer_touchscreen.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 3d6bd9fd8bd565f4c0513b2649a678109f60bd27 Mon Sep 17 00:00:00 2001 -From: Chase Douglas -Date: Tue, 3 Apr 2012 17:18:43 -0700 -Subject: [PATCH] Use touch state when querying pointer through core protocol - -QueryPointer is part of the core protocol. As such, it knows nothing -about touch devices. Touches are converted to button 1 press, pointer -motion, and button 1 release for core clients, so we should ensure the -pointer state mask has button 1 set when XQueryPointer is used. - -Signed-off-by: Chase Douglas ---- - dix/events.c | 3 +-- - 1 files changed, 1 insertions(+), 2 deletions(-) - -diff --git a/dix/events.c b/dix/events.c -index 4470947..b9f9cfa 100644 ---- a/dix/events.c -+++ b/dix/events.c -@@ -5098,8 +5098,7 @@ ProcQueryPointer(ClientPtr client) - memset(&rep, 0, sizeof(xQueryPointerReply)); - rep.type = X_Reply; - rep.sequenceNumber = client->sequence; -- rep.mask = mouse->button ? (mouse->button->state) : 0; -- rep.mask |= XkbStateFieldFromRec(&keyboard->key->xkbInfo->state); -+ rep.mask = event_get_corestate(mouse, keyboard); - rep.length = 0; - rep.root = (GetCurrentRootWindow(mouse))->drawable.id; - rep.rootX = pSprite->hot.x; --- -1.7.9.1 - diff --git a/debian/patches/506_touchscreen_pointer_emulation_checks.patch b/debian/patches/506_touchscreen_pointer_emulation_checks.patch deleted file mode 100644 index c6fcac8..0000000 --- a/debian/patches/506_touchscreen_pointer_emulation_checks.patch +++ /dev/null @@ -1,159 +0,0 @@ -From ec9c4295830c3de610e65aca17f4da4a7af3c4c5 Mon Sep 17 00:00:00 2001 -From: Chase Douglas -Date: Wed, 18 Apr 2012 12:04:58 -0700 -Subject: [PATCH] Check other clients' core masks properly when adding touch - listener - -The current code checks the core event mask as though it were an XI -mask. This change fixes the checks so the proper client and event masks -are used. - -Signed-off-by: Chase Douglas -Reviewed-by: Peter Hutterer ---- - dix/touch.c | 8 ++++---- - 1 files changed, 4 insertions(+), 4 deletions(-) - -diff --git a/dix/touch.c b/dix/touch.c -index 572bdfb..f8f26c8 100644 ---- a/dix/touch.c -+++ b/dix/touch.c -@@ -811,6 +811,7 @@ TouchAddRegularListener(DeviceIntPtr dev, TouchPointInfoPtr ti, - if (mask & EVENT_CORE_MASK) { - int coretype = GetCoreType(TouchGetPointerEventType(ev)); - Mask core_filter = event_get_filter_from_type(dev, coretype); -+ OtherClients *oclients; - - /* window owner */ - if (IsMaster(dev) && (win->eventMask & core_filter)) { -@@ -822,13 +823,12 @@ TouchAddRegularListener(DeviceIntPtr dev, TouchPointInfoPtr ti, - } - - /* all others */ -- nt_list_for_each_entry(iclients, (InputClients*)wOtherClients(win), next) -- { -- if (!(iclients->mask[XIAllDevices] & core_filter)) -+ nt_list_for_each_entry(oclients, wOtherClients(win), next) { -+ if (!(oclients->mask & core_filter)) - continue; - - TouchEventHistoryAllocate(ti); -- TouchAddListener(ti, iclients->resource, CORE, -+ TouchAddListener(ti, oclients->resource, CORE, - type, LISTENER_AWAITING_BEGIN, win); - return TRUE; - } --- -1.7.9.1 - -From 01091806f762f6f8fc83dc1051b5f3cfb38e88b1 Mon Sep 17 00:00:00 2001 -From: Chase Douglas -Date: Wed, 4 Apr 2012 12:57:40 -0700 -Subject: [PATCH 2/3] Check core event mask properly for pointer emulated - touch events - -The current code checks the core event mask as though it were an XI2 -mask. This change fixes the checks so the proper client and event masks -are used. - -Signed-off-by: Chase Douglas - -Conflicts: - - Xi/exevents.c ---- - Xi/exevents.c | 13 +++++++++---- - 1 files changed, 9 insertions(+), 4 deletions(-) - -diff --git a/Xi/exevents.c b/Xi/exevents.c -index f390f67..72e6d91 100644 ---- a/Xi/exevents.c -+++ b/Xi/exevents.c -@@ -1342,6 +1342,8 @@ RetrieveTouchDeliveryData(DeviceIntPtr dev, TouchPointInfoPtr ti, - BUG_WARN(!iclients); - if (!iclients) - return FALSE; -+ -+ *client = rClient(iclients); - } else if (listener->level == XI) - { - int xi_type = GetXIType(TouchGetPointerEventType(ev)); -@@ -1352,19 +1354,22 @@ RetrieveTouchDeliveryData(DeviceIntPtr dev, TouchPointInfoPtr ti, - BUG_WARN(!iclients); - if (!iclients) - return FALSE; -+ -+ *client = rClient(iclients); - } else - { - int coretype = GetCoreType(TouchGetPointerEventType(ev)); - Mask core_filter = event_get_filter_from_type(dev, coretype); -+ OtherClients *oclients; - - /* all others */ -- nt_list_for_each_entry(iclients, (InputClients*)wOtherClients(*win), next) -- if (iclients->mask[XIAllDevices] & core_filter) -+ nt_list_for_each_entry(oclients, (InputClients*)wOtherClients(*win), next) -+ if (oclients->mask & core_filter) - break; -- /* if owner selected, iclients is NULL */ -+ /* if owner selected, oclients is NULL */ -+ *client = oclients ? rClient(oclients) : wClient(*win); - } - -- *client = iclients ? rClient(iclients) : wClient(*win); - *mask = iclients ? iclients->xi2mask : NULL; - *grab = NULL; - } --- -1.7.9.1 - -From 4b4c88b247c6435578c983d74a90f35472849f3a Mon Sep 17 00:00:00 2001 -From: Chase Douglas -Date: Wed, 4 Apr 2012 12:59:55 -0700 -Subject: [PATCH 3/3] Only set XI2 mask if pointer emulation is for XI2 client - -The current code returns a reference to memory that may not actually be -an XI2 mask. Instead, only return a value when an XI2 client has -selected for events. - -Signed-off-by: Chase Douglas - -Conflicts: - - Xi/exevents.c ---- - Xi/exevents.c | 3 ++- - 1 files changed, 2 insertions(+), 1 deletions(-) - -diff --git a/Xi/exevents.c b/Xi/exevents.c -index 72e6d91..fe06efa 100644 ---- a/Xi/exevents.c -+++ b/Xi/exevents.c -@@ -1293,6 +1293,7 @@ RetrieveTouchDeliveryData(DeviceIntPtr dev, TouchPointInfoPtr ti, - { - int rc; - InputClients *iclients = NULL; -+ *mask = NULL; - - if (listener->type == LISTENER_GRAB || - listener->type == LISTENER_POINTER_GRAB) -@@ -1343,6 +1344,7 @@ RetrieveTouchDeliveryData(DeviceIntPtr dev, TouchPointInfoPtr ti, - if (!iclients) - return FALSE; - -+ *mask = iclients->xi2mask; - *client = rClient(iclients); - } else if (listener->level == XI) - { -@@ -1370,7 +1372,6 @@ RetrieveTouchDeliveryData(DeviceIntPtr dev, TouchPointInfoPtr ti, - *client = oclients ? rClient(oclients) : wClient(*win); - } - -- *mask = iclients ? iclients->xi2mask : NULL; - *grab = NULL; - } - --- -1.7.9.1 - diff --git a/debian/patches/507_touchscreen_fixes.patch b/debian/patches/507_touchscreen_fixes.patch deleted file mode 100644 index 2209bac..0000000 --- a/debian/patches/507_touchscreen_fixes.patch +++ /dev/null @@ -1,540 +0,0 @@ ---- a/Xi/exevents.c -+++ b/Xi/exevents.c -@@ -1148,6 +1148,48 @@ EmitTouchEnd(DeviceIntPtr dev, TouchPoin - } - - /** -+ * Find the oldest touch that still has a pointer emulation client. -+ * -+ * Pointer emulation can only be performed for the oldest touch. Otherwise, the -+ * order of events seen by the client will be wrong. This function helps us find -+ * the next touch to be emulated. -+ * -+ * @param dev The device to find touches for. -+ */ -+static TouchPointInfoPtr -+FindOldestPointerEmulatedTouch(DeviceIntPtr dev) -+{ -+ TouchPointInfoPtr oldest = NULL; -+ int i; -+ -+ for (i = 0; i < dev->touch->num_touches; i++) { -+ TouchPointInfoPtr ti = dev->touch->touches + i; -+ int j; -+ -+ if (!ti->active || !ti->emulate_pointer) -+ continue; -+ -+ for (j = 0; j < ti->num_listeners; j++) { -+ if (ti->listeners[j].type == LISTENER_POINTER_GRAB || -+ ti->listeners[j].type == LISTENER_POINTER_REGULAR) -+ break; -+ } -+ if (j == ti->num_listeners) -+ continue; -+ -+ if (!oldest) { -+ oldest = ti; -+ continue; -+ } -+ -+ if (oldest->client_id - ti->client_id < UINT_MAX / 2) -+ oldest = ti; -+ } -+ -+ return oldest; -+} -+ -+/** - * If the current owner has rejected the event, deliver the - * TouchOwnership/TouchBegin to the next item in the sprite stack. - */ -@@ -1159,8 +1201,16 @@ TouchPuntToNextOwner(DeviceIntPtr dev, T - if (ti->listeners[0].state == LISTENER_AWAITING_OWNER || - ti->listeners[0].state == LISTENER_EARLY_ACCEPT) - DeliverTouchEvents(dev, ti, (InternalEvent*)ev, ti->listeners[0].listener); -- else if (ti->listeners[0].state == LISTENER_AWAITING_BEGIN) -+ else if (ti->listeners[0].state == LISTENER_AWAITING_BEGIN) { -+ /* We can't punt to a pointer listener unless all older pointer -+ * emulated touches have been seen already. */ -+ if ((ti->listeners[0].type == LISTENER_POINTER_GRAB || -+ ti->listeners[0].type == LISTENER_POINTER_REGULAR) && -+ ti != FindOldestPointerEmulatedTouch(dev)) -+ return; -+ - TouchEventHistoryReplay(ti, dev, ti->listeners[0].listener); -+ } - - /* If we've just removed the last grab and the touch has physically - * ended, send a TouchEnd event too and finalise the touch. */ -@@ -1177,6 +1227,25 @@ TouchPuntToNextOwner(DeviceIntPtr dev, T - } - - /** -+ * Check the oldest touch to see if it needs to be replayed to its pointer -+ * owner. -+ * -+ * Touch event propagation is paused if it hits a pointer listener while an -+ * older touch with a pointer listener is waiting on accept or reject. This -+ * function will restart propagation of a paused touch if needed. -+ * -+ * @param dev The device to check touches for. -+ */ -+static void -+CheckOldestTouch(DeviceIntPtr dev) -+{ -+ TouchPointInfoPtr oldest = FindOldestPointerEmulatedTouch(dev); -+ -+ if (oldest && oldest->listeners[0].state == LISTENER_AWAITING_BEGIN) -+ TouchPuntToNextOwner(dev, oldest, NULL); -+} -+ -+/** - * Process a touch rejection. - * - * @param sourcedev The source device of the touch sequence. -@@ -1205,14 +1274,6 @@ TouchRejected(DeviceIntPtr sourcedev, To - } - } - -- /* If there are no other listeners left, and the touchpoint is pending -- * finish, then we can just kill it now. */ -- if (ti->num_listeners == 1 && ti->pending_finish) -- { -- TouchEndTouch(sourcedev, ti); -- return; -- } -- - /* Remove the resource from the listener list, updating - * ti->num_listeners, as well as ti->num_grabs if it was a grab. */ - if (TouchRemoveListener(ti, resource)) -@@ -1226,6 +1287,10 @@ TouchRejected(DeviceIntPtr sourcedev, To - * the TouchOwnership or TouchBegin event to the new owner. */ - if (ev && ti->num_listeners > 0 && was_owner) - TouchPuntToNextOwner(sourcedev, ti, ev); -+ else if (ti->num_listeners == 0) -+ TouchEndTouch(sourcedev, ti); -+ -+ CheckOldestTouch(sourcedev); - } - - /** -@@ -1243,9 +1308,18 @@ ProcessTouchOwnershipEvent(DeviceIntPtr - if (ev->reason == XIRejectTouch) - TouchRejected(dev, ti, ev->resource, ev); - else if (ev->reason == XIAcceptTouch) { -+ int i; -+ -+ /* Go through the motions of ending the touch if the listener has -+ * already seen the end. This ensures that the touch record is ended in -+ * the server. */ -+ if (ti->listeners[0].state == LISTENER_HAS_END) -+ EmitTouchEnd(dev, ti, TOUCH_ACCEPT, ti->listeners[0].listener); -+ - /* The touch owner has accepted the touch. Send TouchEnd events to - * everyone else, and truncate the list of listeners. */ -- EmitTouchEnd(dev, ti, TOUCH_ACCEPT, 0); -+ for (i = 1; i < ti->num_listeners; i++) -+ EmitTouchEnd(dev, ti, TOUCH_ACCEPT, ti->listeners[i].listener); - - while (ti->num_listeners > 1) - TouchRemoveListener(ti, ti->listeners[1].listener); -@@ -1428,11 +1502,21 @@ DeliverTouchEmulatedEvent(DeviceIntPtr d - if (!deliveries) - DeliverOneGrabbedEvent(ptrev, dev, grab->grabtype); - -+ /* We must accept the touch sequence once a pointer listener has -+ * received one event past ButtonPress. */ -+ if (deliveries && ev->any.type != ET_TouchBegin && -+ !(ev->device_event.flags & TOUCH_CLIENT_ID)) -+ TouchListenerAcceptReject(dev, ti, 0, XIAcceptTouch); -+ - if (ev->any.type == ET_TouchEnd && -+ !(ev->device_event.flags & TOUCH_CLIENT_ID) && - !dev->button->buttonsDown && - dev->deviceGrab.fromPassiveGrab && -- GrabIsPointerGrab(grab)) -+ GrabIsPointerGrab(grab)) { - (*dev->deviceGrab.DeactivateGrab)(dev); -+ CheckOldestTouch(dev); -+ return Success; -+ } - } - } else - { -@@ -1552,12 +1636,43 @@ ProcessTouchEvent(InternalEvent *ev, Dev - else - touchid = ev->device_event.touchid; - -+ if (emulate_pointer) -+ UpdateDeviceState(dev, &ev->device_event); -+ - if (type == ET_TouchBegin) { - ti = TouchBeginTouch(dev, ev->device_event.sourceid, touchid, - emulate_pointer); - } else - ti = TouchFindByClientID(dev, touchid); - -+ /* Under the following circumstances we create a new touch record for an -+ * existing touch: -+ * -+ * - The touch may be pointer emulated -+ * - An explicit grab is active on the device -+ * - The grab is a pointer grab -+ * -+ * This allows for an explicit grab to receive pointer events for an already -+ * active touch. -+ */ -+ if (!ti && type != ET_TouchBegin && emulate_pointer && -+ dev->deviceGrab.grab && !dev->deviceGrab.fromPassiveGrab && -+ (dev->deviceGrab.grab->grabtype == CORE || -+ dev->deviceGrab.grab->grabtype == XI || -+ !xi2mask_isset(dev->deviceGrab.grab->xi2mask, dev, XI_TouchBegin))) { -+ ti = TouchBeginTouch(dev, ev->device_event.sourceid, touchid, -+ emulate_pointer); -+ if (!ti) { -+ DebugF("[Xi] %s: Failed to create new dix record for explicitly " -+ "grabbed touchpoint %d\n", -+ dev->name, type, touchid); -+ return; -+ } -+ -+ TouchBuildSprite(dev, ti, ev); -+ TouchSetupListeners(dev, ti, ev); -+ } -+ - if (!ti) - { - DebugF("[Xi] %s: Failed to get event %d for touchpoint %d\n", -@@ -1575,9 +1690,11 @@ ProcessTouchEvent(InternalEvent *ev, Dev - CheckMotion(&ev->device_event, dev); - - /* Make sure we have a valid window trace for event delivery; must be -- * called after event type mutation. */ -+ * called after event type mutation. Touch end events are always processed -+ * in order to end touch records. */ - /* FIXME: check this */ -- if (!TouchEnsureSprite(dev, ti, ev)) -+ if ((type == ET_TouchBegin && !TouchBuildSprite(dev, ti, ev)) || -+ (type != ET_TouchEnd && ti->sprite.spriteTraceGood == 0)) - return; - - /* TouchOwnership events are handled separately from the rest, as they -@@ -1813,6 +1930,14 @@ DeliverTouchEndEvent(DeviceIntPtr dev, T - { - rc = DeliverTouchEmulatedEvent(dev, ti, ev, listener, client, win, - grab, xi2mask); -+ -+ if (ti->num_listeners > 1) { -+ ev->any.type = ET_TouchUpdate; -+ ev->device_event.flags |= TOUCH_PENDING_END; -+ if (!(ev->device_event.flags & TOUCH_CLIENT_ID)) -+ ti->pending_finish = TRUE; -+ } -+ - goto out; - } - -@@ -1923,9 +2048,6 @@ DeliverTouchEvents(DeviceIntPtr dev, Tou - - DeliverTouchEvent(dev, ti, ev, listener, client, win, grab, mask); - } -- -- if (ti->emulate_pointer) -- UpdateDeviceState(dev, &ev->device_event); - } - - int ---- a/dix/dispatch.c -+++ b/dix/dispatch.c -@@ -215,7 +215,7 @@ UpdateCurrentTimeIf(void) - systime.milliseconds = GetTimeInMillis(); - if (systime.milliseconds < currentTime.milliseconds) - systime.months++; -- if (*checkForInput[0] == *checkForInput[1]) -+ if (CompareTimeStamps(systime, currentTime) == LATER) - currentTime = systime; - } - -@@ -408,6 +408,9 @@ Dispatch(void) - } - /* now, finally, deal with client requests */ - -+ /* Update currentTime so request time checks, such as for input -+ * device grabs, are calculated correctly */ -+ UpdateCurrentTimeIf(); - result = ReadRequestFromClient(client); - if (result <= 0) - { ---- a/dix/events.c -+++ b/dix/events.c -@@ -1312,14 +1312,10 @@ ComputeFreezes(void) - { - if (IsTouchEvent((InternalEvent*)event)) - { -- InternalEvent *events = InitEventList(GetMaximumEventsNum()); -- int i, nev; - TouchPointInfoPtr ti = TouchFindByClientID(replayDev, event->touchid); - BUG_WARN(!ti); -- nev = GetTouchOwnershipEvents(events, replayDev, ti, XIRejectTouch, ti->listeners[0].listener, 0); -- for (i = 0; i < nev; i++) -- mieqProcessDeviceEvent(replayDev, events + i, NULL); -- ProcessInputEvents(); -+ -+ TouchListenerAcceptReject(replayDev, ti, 0, XIRejectTouch); - } else if (replayDev->focus && !IsPointerEvent((InternalEvent*)event)) - DeliverFocusedEvent(replayDev, (InternalEvent*)event, w); - else -@@ -1459,6 +1455,38 @@ ReattachToOldMaster(DeviceIntPtr dev) - } - - /** -+ * Update touch records when an explicit grab is activated. Any touches owned by -+ * the grabbing client are updated so the listener state reflects the new grab. -+ */ -+static void -+UpdateTouchesForGrab(DeviceIntPtr mouse) -+{ -+ int i; -+ -+ if (!mouse->touch || mouse->deviceGrab.fromPassiveGrab) -+ return; -+ -+ for (i = 0; i < mouse->touch->num_touches; i++) { -+ TouchPointInfoPtr ti = mouse->touch->touches + i; -+ GrabPtr grab = mouse->deviceGrab.grab; -+ -+ if (ti->active && -+ CLIENT_BITS(ti->listeners[0].listener) == grab->resource) { -+ ti->listeners[0].listener = grab->resource; -+ ti->listeners[0].level = grab->grabtype; -+ ti->listeners[0].state = LISTENER_IS_OWNER; -+ ti->listeners[0].window = grab->window; -+ -+ if (grab->grabtype == CORE || grab->grabtype == XI || -+ !xi2mask_isset(grab->xi2mask, mouse, XI_TouchBegin)) -+ ti->listeners[0].type = LISTENER_POINTER_GRAB; -+ else -+ ti->listeners[0].type = LISTENER_GRAB; -+ } -+ } -+} -+ -+/** - * Activate a pointer grab on the given device. A pointer grab will cause all - * core pointer events of this device to be delivered to the grabbing client only. - * No other device will send core events to the grab client while the grab is -@@ -1509,6 +1537,7 @@ ActivatePointerGrab(DeviceIntPtr mouse, - grabinfo->fromPassiveGrab = isPassive; - grabinfo->implicitGrab = autoGrab & ImplicitGrabMask; - PostNewCursor(mouse); -+ UpdateTouchesForGrab(mouse); - CheckGrabForSyncs(mouse,(Bool)grab->pointerMode, (Bool)grab->keyboardMode); - } - -@@ -1524,6 +1553,8 @@ DeactivatePointerGrab(DeviceIntPtr mouse - DeviceIntPtr dev; - Bool wasImplicit = (mouse->deviceGrab.fromPassiveGrab && - mouse->deviceGrab.implicitGrab); -+ XID grab_resource = grab->resource; -+ int i; - - TouchRemovePointerGrab(mouse); - -@@ -1549,6 +1580,15 @@ DeactivatePointerGrab(DeviceIntPtr mouse - ReattachToOldMaster(mouse); - - ComputeFreezes(); -+ -+ /* If an explicit grab was deactivated, we must remove it from the head of -+ * all the touches' listener lists. */ -+ for (i = 0; mouse->touch && i < mouse->touch->num_touches; i++) { -+ TouchPointInfoPtr ti = mouse->touch->touches + i; -+ -+ if (ti->active && TouchResourceIsOwner(ti, grab_resource)) -+ TouchListenerAcceptReject(mouse, ti, 0, XIRejectTouch); -+ } - } - - /** ---- a/dix/touch.c -+++ b/dix/touch.c -@@ -375,13 +375,6 @@ TouchEndTouch(DeviceIntPtr dev, TouchPoi - if (ti->emulate_pointer) - { - GrabPtr grab; -- DeviceEvent ev; -- memset(&ev, 0, sizeof(ev)); -- ev.type = ET_TouchEnd; -- ev.detail.button = 1; -- ev.touchid = ti->client_id; -- ev.flags = TOUCH_POINTER_EMULATED|TOUCH_END; -- UpdateDeviceState(dev, &ev); - - if ((grab = dev->deviceGrab.grab)) - { -@@ -496,10 +489,22 @@ TouchEventHistoryReplay(TouchPointInfoPt - flags = TOUCH_CLIENT_ID|TOUCH_REPLAYING; - if (ti->emulate_pointer) - flags |= TOUCH_POINTER_EMULATED; -- /* send fake begin event to next owner */ -+ /* Generate events based on a fake touch begin event to get DCCE events if -+ * needed */ -+ /* FIXME: This needs to be cleaned up */ - nev = GetTouchEvents(tel, dev, ti->client_id, XI_TouchBegin, flags, mask); -- for (i = 0; i < nev; i++) -- DeliverTouchEvents(dev, ti, tel + i, resource); -+ for (i = 0; i < nev; i++) { -+ /* Send saved touch begin event */ -+ if (tel[i].any.type == ET_TouchBegin) { -+ DeviceEvent *ev = &ti->history[0]; -+ ev->flags |= TOUCH_REPLAYING; -+ DeliverTouchEvents(dev, ti, (InternalEvent*)ev, resource); -+ } -+ else {/* Send DCCE event */ -+ tel[i].any.time = ti->history[0].time; -+ DeliverTouchEvents(dev, ti, tel + i, resource); -+ } -+ } - - valuator_mask_free(&mask); - FreeEventList(tel, GetMaximumEventsNum()); -@@ -558,22 +563,12 @@ TouchBuildDependentSpriteTrace(DeviceInt - * TouchBegin events. - */ - Bool --TouchEnsureSprite(DeviceIntPtr sourcedev, TouchPointInfoPtr ti, -- InternalEvent *ev) -+TouchBuildSprite(DeviceIntPtr sourcedev, TouchPointInfoPtr ti, -+ InternalEvent *ev) - { - TouchClassPtr t = sourcedev->touch; - SpritePtr sprite = &ti->sprite; - -- /* We may not have a sprite if there are no applicable grabs or -- * event selections, or if they've disappeared, or if all the grab -- * owners have rejected the touch. Don't bother delivering motion -- * events if not, but TouchEnd events still need to be processed so -- * we can call FinishTouchPoint and release it for later use. */ -- if (ev->any.type == ET_TouchEnd) -- return TRUE; -- else if (ev->any.type != ET_TouchBegin) -- return (sprite->spriteTraceGood > 0); -- - if (t->mode == XIDirectTouch) - { - /* Focus immediately under the touchpoint in direct touch mode. -@@ -897,6 +892,11 @@ TouchSetupListeners(DeviceIntPtr dev, To - if (dev->deviceGrab.grab) - TouchAddActiveGrabListener(dev, ti, ev, dev->deviceGrab.grab); - -+ /* We set up an active touch listener for existing touches, but not any -+ * passive grab or regular listeners. */ -+ if (ev->any.type != ET_TouchBegin) -+ return; -+ - /* First, find all grabbing clients from the root window down - * to the deepest child window. */ - for (i = 0; i < sprite->spriteTraceGood; i++) -@@ -988,15 +988,48 @@ TouchListenerGone(XID resource) - } - - int -+TouchListenerAcceptReject(DeviceIntPtr dev, TouchPointInfoPtr ti, int listener, -+ int mode) -+{ -+ InternalEvent *events; -+ int nev; -+ int i; -+ -+ if (listener > 0) { -+ if (mode == XIRejectTouch) -+ TouchRejected(dev, ti, ti->listeners[listener].listener, NULL); -+ else -+ ti->listeners[listener].state = LISTENER_EARLY_ACCEPT; -+ -+ return Success; -+ } -+ -+ events = InitEventList(GetMaximumEventsNum()); -+ if (!events) { -+ BUG_WARN_MSG(TRUE, "Failed to allocate touch ownership events\n"); -+ return BadAlloc; -+ } -+ -+ nev = GetTouchOwnershipEvents(events, dev, ti, mode, -+ ti->listeners[0].listener, 0); -+ BUG_WARN_MSG(nev == 0, "Failed to get touch ownership events\n"); -+ -+ for (i = 0; i < nev; i++) -+ mieqProcessDeviceEvent(dev, events + i, NULL); -+ -+ ProcessInputEvents(); -+ -+ FreeEventList(events, GetMaximumEventsNum()); -+ -+ return nev ? Success : BadMatch; -+} -+ -+int - TouchAcceptReject(ClientPtr client, DeviceIntPtr dev, int mode, - uint32_t touchid, Window grab_window, XID *error) - { - TouchPointInfoPtr ti; -- int nev, i; -- InternalEvent *events = InitEventList(GetMaximumEventsNum()); -- -- if (!events) -- return BadAlloc; -+ int i; - - if (!dev->touch) - { -@@ -1020,25 +1053,5 @@ TouchAcceptReject(ClientPtr client, Devi - if (i == ti->num_listeners) - return BadAccess; - -- if (i > 0) -- { -- if (mode == XIRejectTouch) -- TouchRejected(dev, ti, ti->listeners[i].listener, NULL); -- else -- ti->listeners[i].state = LISTENER_EARLY_ACCEPT; -- -- return Success; -- } -- -- nev = GetTouchOwnershipEvents(events, dev, ti, mode, -- ti->listeners[0].listener, 0); -- if (nev == 0) -- return BadAlloc; -- for (i = 0; i < nev; i++) -- mieqProcessDeviceEvent(dev, events + i, NULL); -- -- ProcessInputEvents(); -- -- FreeEventList(events, GetMaximumEventsNum()); -- return Success; -+ return TouchListenerAcceptReject(dev, ti, i, mode); - } ---- a/include/input.h -+++ b/include/input.h -@@ -624,14 +624,16 @@ extern void TouchAddListener(TouchPointI - WindowPtr window); - extern Bool TouchRemoveListener(TouchPointInfoPtr ti, XID resource); - extern void TouchSetupListeners(DeviceIntPtr dev, TouchPointInfoPtr ti, InternalEvent *ev); --extern Bool TouchEnsureSprite(DeviceIntPtr sourcedev, TouchPointInfoPtr ti, -- InternalEvent *ev); -+extern Bool TouchBuildSprite(DeviceIntPtr sourcedev, TouchPointInfoPtr ti, -+ InternalEvent *ev); - extern Bool TouchBuildDependentSpriteTrace(DeviceIntPtr dev, SpritePtr sprite); - extern int TouchConvertToPointerEvent(const InternalEvent *ev, - InternalEvent *motion, InternalEvent *button); - extern int TouchGetPointerEventType(const InternalEvent *ev); - extern void TouchRemovePointerGrab(DeviceIntPtr dev); - extern void TouchListenerGone(XID resource); -+extern int TouchListenerAcceptReject(DeviceIntPtr dev, TouchPointInfoPtr ti, -+ int listener, int mode); - extern int TouchAcceptReject(ClientPtr client, DeviceIntPtr dev, int mode, - uint32_t touchid, Window grab_window, XID *error); - diff --git a/debian/patches/508_device_off_release_buttons.patch b/debian/patches/508_device_off_release_buttons.patch deleted file mode 100644 index 91d2249..0000000 --- a/debian/patches/508_device_off_release_buttons.patch +++ /dev/null @@ -1,37 +0,0 @@ -From adaf1adecf5697455e9f3fb0234939113873f959 Mon Sep 17 00:00:00 2001 -From: Peter Hutterer -Date: Mon, 30 Apr 2012 10:01:48 +1000 -Subject: [PATCH] dix: when disabling a device, release all buttons and keys - -A suspend-induced device disable may happen before the device gets to see -the button release event. On resume, the server's internal state still has -some buttons pressed, causing inconsistent behaviour. - -Force the release and the matching events to be sent to the client. - -Signed-off-by: Peter Hutterer -Reviewed-by: Chase Douglas - -Conflicts: - - dix/devices.c ---- - dix/devices.c | 2 ++ - 1 files changed, 2 insertions(+), 0 deletions(-) - -diff --git a/dix/devices.c b/dix/devices.c -index 9624424..b325d17 100644 ---- a/dix/devices.c -+++ b/dix/devices.c -@@ -447,6 +447,8 @@ DisableDevice(DeviceIntPtr dev, BOOL sendevent) - if (*prev != dev) - return FALSE; - -+ ReleaseButtonsAndKeys(dev); -+ - /* float attached devices */ - if (IsMaster(dev)) - { --- -1.7.9.1 - diff --git a/debian/patches/510-dix-return-early-from-DisableDevice-if-the-device-is.patch b/debian/patches/510-dix-return-early-from-DisableDevice-if-the-device-is.patch deleted file mode 100644 index 87ae244..0000000 --- a/debian/patches/510-dix-return-early-from-DisableDevice-if-the-device-is.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 46adcefb0e08515195d8e49985a4e210395700b3 Mon Sep 17 00:00:00 2001 -From: Peter Hutterer -Date: Thu, 10 May 2012 12:10:12 +1000 -Subject: [PATCH 07/12] dix: return early from DisableDevice if the device is - already disabled - -Signed-off-by: Peter Hutterer -Reviewed-by: Chase Douglas ---- - dix/devices.c | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/dix/devices.c b/dix/devices.c -index df46497..6acff4f 100644 ---- a/dix/devices.c -+++ b/dix/devices.c -@@ -428,6 +428,9 @@ DisableDevice(DeviceIntPtr dev, BOOL sendevent) - BOOL enabled; - int flags[MAXDEVICES] = { 0 }; - -+ if (!dev->enabled) -+ return TRUE; -+ - for (prev = &inputInfo.devices; - *prev && (*prev != dev); prev = &(*prev)->next); - if (*prev != dev) --- -1.7.9.5 - diff --git a/debian/patches/511-dix-move-freeing-the-sprite-into-a-function.patch b/debian/patches/511-dix-move-freeing-the-sprite-into-a-function.patch deleted file mode 100644 index d48b876..0000000 --- a/debian/patches/511-dix-move-freeing-the-sprite-into-a-function.patch +++ /dev/null @@ -1,62 +0,0 @@ -From e57d6a89027c55fef987cdc259668c48a8b4ea1b Mon Sep 17 00:00:00 2001 -From: Peter Hutterer -Date: Thu, 10 May 2012 15:32:20 +1000 -Subject: [PATCH 08/12] dix: move freeing the sprite into a function - -Signed-off-by: Peter Hutterer -Reviewed-by: Chase Douglas ---- - dix/devices.c | 7 +------ - dix/events.c | 12 ++++++++++++ - include/dix.h | 2 ++ - 3 files changed, 15 insertions(+), 6 deletions(-) - ---- a/dix/devices.c -+++ b/dix/devices.c -@@ -949,12 +949,7 @@ - free(classes); - } - -- if (DevHasCursor(dev) && dev->spriteInfo->sprite) { -- if (dev->spriteInfo->sprite->current) -- FreeCursor(dev->spriteInfo->sprite->current, None); -- free(dev->spriteInfo->sprite->spriteTrace); -- free(dev->spriteInfo->sprite); -- } -+ FreeSprite(dev); - - /* a client may have the device set as client pointer */ - for (j = 0; j < currentMaxClients; j++) ---- a/dix/events.c -+++ b/dix/events.c -@@ -3323,6 +3323,18 @@ - #endif - } - -+void FreeSprite(DeviceIntPtr dev) -+{ -+ if (DevHasCursor(dev) && dev->spriteInfo->sprite) { -+ if (dev->spriteInfo->sprite->current) -+ FreeCursor(dev->spriteInfo->sprite->current, None); -+ free(dev->spriteInfo->sprite->spriteTrace); -+ free(dev->spriteInfo->sprite); -+ } -+ dev->spriteInfo->sprite = NULL; -+} -+ -+ - /** - * Update the mouse sprite info when the server switches from a pScreen to another. - * Otherwise, the pScreen of the mouse sprite is never updated when we switch ---- a/include/dix.h -+++ b/include/dix.h -@@ -417,6 +417,9 @@ - DeviceIntPtr /* pDev */, - WindowPtr /* pWin */); - -+extern void FreeSprite( -+ DeviceIntPtr /* pDev */); -+ - extern void UpdateSpriteForScreen( - DeviceIntPtr /* pDev */, - ScreenPtr /* pScreen */); diff --git a/debian/patches/512-dix-free-the-sprite-when-disabling-the-device.patch b/debian/patches/512-dix-free-the-sprite-when-disabling-the-device.patch deleted file mode 100644 index 0ba5be4..0000000 --- a/debian/patches/512-dix-free-the-sprite-when-disabling-the-device.patch +++ /dev/null @@ -1,31 +0,0 @@ -From df1704365e700d3cf1d36a241bdfc479159a8df7 Mon Sep 17 00:00:00 2001 -From: Peter Hutterer -Date: Thu, 10 May 2012 15:33:15 +1000 -Subject: [PATCH 09/12] dix: free the sprite when disabling the device - -Disabled devices don't need sprites (they can't send events anyway) and the -device init process is currently geared to check for whether sprite is -present to check if the device should be paired/attached. - -Signed-off-by: Peter Hutterer -Reviewed-by: Chase Douglas ---- - dix/devices.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/dix/devices.c b/dix/devices.c -index a280dee..f134f31 100644 ---- a/dix/devices.c -+++ b/dix/devices.c -@@ -465,6 +465,8 @@ DisableDevice(DeviceIntPtr dev, BOOL sendevent) - (void) (*dev->deviceProc) (dev, DEVICE_OFF); - dev->enabled = FALSE; - -+ FreeSprite(dev); -+ - /* now that the device is disabled, we can reset the signal handler's - * last.slave */ - OsBlockSignals(); --- -1.7.9.5 - diff --git a/debian/patches/513-dix-disable-non-sprite-owners-first-when-disabling-p.patch b/debian/patches/513-dix-disable-non-sprite-owners-first-when-disabling-p.patch deleted file mode 100644 index f8e05ee..0000000 --- a/debian/patches/513-dix-disable-non-sprite-owners-first-when-disabling-p.patch +++ /dev/null @@ -1,41 +0,0 @@ -From e433d1046c222f9d969c2c28a4651ff9097614f4 Mon Sep 17 00:00:00 2001 -From: Peter Hutterer -Date: Thu, 10 May 2012 12:42:59 +1000 -Subject: [PATCH 10/12] dix: disable non-sprite-owners first when disabling - paired devices - -If a sprite-owner is to be disabled but still paired, disable the paired -device first. i.e. disabling a master pointer will disable the master -keyboard first. - -Signed-off-by: Peter Hutterer -Reviewed-by: Chase Douglas ---- -Altered to apply to stable - - dix/devices.c | 7 +++++-- - 1 file changed, 5 insertions(+), 2 deletions(-) - ---- a/dix/devices.c -+++ b/dix/devices.c -@@ -477,15 +477,14 @@ - { - for (other = inputInfo.devices; other; other = other->next) - { -- if (other->spriteInfo->paired == dev) -- { -- ErrorF("[dix] cannot disable device, still paired. " -- "This is a bug. \n"); -- return FALSE; -- } -+ if (other->spriteInfo->paired == dev && !other->spriteInfo->spriteOwner) -+ DisableDevice(other, sendevent); - } - } - -+ if (dev->spriteInfo->paired) -+ dev->spriteInfo->paired = NULL; -+ - (void)(*dev->deviceProc)(dev, DEVICE_OFF); - dev->enabled = FALSE; - diff --git a/debian/patches/514-Xi-drop-forced-unpairing-when-changing-the-hierarchy.patch b/debian/patches/514-Xi-drop-forced-unpairing-when-changing-the-hierarchy.patch deleted file mode 100644 index 19e3d8a..0000000 --- a/debian/patches/514-Xi-drop-forced-unpairing-when-changing-the-hierarchy.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 9c0e820216cd1631f75b037b7908d55ac091692c Mon Sep 17 00:00:00 2001 -From: Peter Hutterer -Date: Thu, 10 May 2012 12:55:44 +1000 -Subject: [PATCH 11/12] Xi: drop forced unpairing when changing the hierarchy - -Devices are unpaired as needed on DisableDevice now. - -Signed-off-by: Peter Hutterer -Reviewed-by: Chase Douglas ---- - Xi/xichangehierarchy.c | 6 ------ - 1 file changed, 6 deletions(-) - -diff --git a/Xi/xichangehierarchy.c b/Xi/xichangehierarchy.c -index 756aaac..89f16d8 100644 ---- a/Xi/xichangehierarchy.c -+++ b/Xi/xichangehierarchy.c -@@ -293,12 +293,6 @@ remove_master(ClientPtr client, xXIRemoveMasterInfo * r, int flags[MAXDEVICES]) - } - } - -- /* can't disable until we removed pairing */ -- keybd->spriteInfo->paired = NULL; -- ptr->spriteInfo->paired = NULL; -- XTestptr->spriteInfo->paired = NULL; -- XTestkeybd->spriteInfo->paired = NULL; -- - /* disable the remove the devices, XTest devices must be done first - else the sprites they rely on will be destroyed */ - DisableDevice(XTestptr, FALSE); --- -1.7.9.5 - diff --git a/debian/patches/515-dix-disable-all-devices-before-shutdown.patch b/debian/patches/515-dix-disable-all-devices-before-shutdown.patch deleted file mode 100644 index 4853e50..0000000 --- a/debian/patches/515-dix-disable-all-devices-before-shutdown.patch +++ /dev/null @@ -1,85 +0,0 @@ -From 4c68f5d395c66f28b56e488cb3cd12f36820357b Mon Sep 17 00:00:00 2001 -From: Peter Hutterer -Date: Wed, 9 May 2012 09:21:28 +1000 -Subject: [PATCH 12/12] dix: disable all devices before shutdown - -f3410b97cf9b48a47bee3d15d232f8a88e75f4ef introduced a regression on server -shutdown. If any button or key was held on shutdown (ctrl, alt, backspace -are usually still down) sending a raw event will segfault the server. The -the root windows are set to NULL before calling CloseDownDevices(). - -Avoid this by disabling all devices first when shutting down. Disabled -devices won't send events anymore. - -Master keyboards must be disabled first, otherwise disabling the pointer -will trigger DisableDevice(keyboard) and the keyboard is removed from the -inputInfo.devices list and moved to inputInfo.off_devices. A regular loop -through inputInfo.devices would thus jump to off_devices and not recover. - -Signed-off-by: Peter Hutterer -Acked-by: Chase Douglas -Reviewed-by: Chase Douglas ---- - dix/devices.c | 20 ++++++++++++++++++++ - dix/main.c | 4 ++++ - include/input.h | 2 +- - 3 files changed, 25 insertions(+), 1 deletion(-) - ---- a/dix/devices.c -+++ b/dix/devices.c -@@ -524,6 +524,26 @@ - return TRUE; - } - -+void -+DisableAllDevices(void) -+{ -+ DeviceIntPtr dev, tmp; -+ -+ nt_list_for_each_entry_safe(dev, tmp, inputInfo.devices, next) { -+ if (!IsMaster(dev)) -+ DisableDevice(dev, FALSE); -+ } -+ /* master keyboards need to be disabled first */ -+ nt_list_for_each_entry_safe(dev, tmp, inputInfo.devices, next) { -+ if (dev->enabled && IsMaster(dev) && IsKeyboardDevice(dev)) -+ DisableDevice(dev, FALSE); -+ } -+ nt_list_for_each_entry_safe(dev, tmp, inputInfo.devices, next) { -+ if (dev->enabled) -+ DisableDevice(dev, FALSE); -+ } -+} -+ - /** - * Initialise a new device through the driver and tell all clients about the - * new device. ---- a/dix/main.c -+++ b/dix/main.c -@@ -105,6 +105,7 @@ - #include "privates.h" - #include "registry.h" - #include "client.h" -+#include "exevents.h" - #ifdef PANORAMIX - #include "panoramiXsrv.h" - #else -@@ -294,6 +295,7 @@ - #endif - - UndisplayDevices(); -+ DisableAllDevices(); - - /* Now free up whatever must be freed */ - if (screenIsSaved == SCREEN_SAVER_ON) ---- a/include/input.h -+++ b/include/input.h -@@ -280,7 +280,7 @@ - extern _X_EXPORT Bool DisableDevice( - DeviceIntPtr /*device*/, - BOOL /* sendevent */); -- -+extern void DisableAllDevices(void); - extern int InitAndStartDevices(void); - - extern void CloseDownDevices(void); diff --git a/debian/patches/516-dix-dont-emulate-scroll-events-for-non-existing-axes.patch b/debian/patches/516-dix-dont-emulate-scroll-events-for-non-existing-axes.patch deleted file mode 100644 index 7d022e1..0000000 --- a/debian/patches/516-dix-dont-emulate-scroll-events-for-non-existing-axes.patch +++ /dev/null @@ -1,39 +0,0 @@ -commit b53cdf4c53f0787ed41281278877e0405fcb2674 -Author: Peter Hutterer -Date: Fri Apr 27 16:31:17 2012 +1000 - - dix: don't emulate scroll events for non-existing axes (#47281) - - Test case: - - create a device with REL_HWHEEL and ABS_X and ABS_Y. evdev 2.7.0 will set - that up as device with 1 relative axis - - move pointer to VGA1 - - xrandr --output VGA1 --off - - Warps the pointer to the new spot and calls GPE with the x/y mask bits set. - When running through the loop to check for scroll event, this overruns the - axes and may try to emulate scroll events based on random garbage in the - memory. If that memory contained non-zero for the scroll type but near-zero - for the increment field, the server would hang in an infinite loop. - - This was the trigger for this suggested, never-merged, patch here: - http://patchwork.freedesktop.org/patch/9543/ - - X.Org Bug 47281 - - Signed-off-by: Peter Hutterer - Reviewed-by: Chase Douglas - (cherry picked from commit af88b43f9e604157b74270d609c08bdfa256a792) - ---- a/dix/getevents.c -+++ b/dix/getevents.c -@@ -1593,6 +1593,9 @@ - /* Now turn the smooth-scrolling axes back into emulated button presses - * for legacy clients, based on the integer delta between before and now */ - for (i = 0; i < valuator_mask_size(&mask); i++) { -+ if (i >= pDev->valuator->numAxes) -+ break; -+ - if (!valuator_mask_isset(&mask, i)) - continue; - diff --git a/debian/patches/516-randr-first-check-pScrPriv-before-using-the-pointer.patch b/debian/patches/516-randr-first-check-pScrPriv-before-using-the-pointer.patch deleted file mode 100644 index 8c9cf71..0000000 --- a/debian/patches/516-randr-first-check-pScrPriv-before-using-the-pointer.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 32603f57ca03b6390b109960f8bb5ea53ac95ecb Mon Sep 17 00:00:00 2001 -From: Ricardo Salveti de Araujo -Date: Thu, 21 Jun 2012 00:55:53 -0300 -Subject: [PATCH] randr: first check pScrPriv before using the pointer at - RRFirstOutput - -Fix a seg fault in case pScrPriv is NULL at ProcRRGetScreenInfo, -which later calls RRFirstOutput. - -Signed-off-by: Ricardo Salveti de Araujo -Reviewed-by: Keith Packard -Signed-off-by: Keith Packard ---- - randr/randr.c | 3 +++ - 1 file changed, 3 insertions(+) - -Index: xorg-server-1.11.4/randr/randr.c -=================================================================== ---- xorg-server-1.11.4.orig/randr/randr.c 2012-07-17 18:46:06.000000000 -0300 -+++ xorg-server-1.11.4/randr/randr.c 2012-07-17 18:48:35.169824448 -0300 -@@ -454,6 +454,9 @@ - rrScrPriv(pScreen); - RROutputPtr output; - int i, j; -+ -+ if (!pScrPriv) -+ return NULL; - - if (pScrPriv->primaryOutput && pScrPriv->primaryOutput->crtc) - return pScrPriv->primaryOutput; diff --git a/debian/patches/517-randr-Catch-two-more-potential-unset-rrScrPriv-uses.patch b/debian/patches/517-randr-Catch-two-more-potential-unset-rrScrPriv-uses.patch deleted file mode 100644 index e37d073..0000000 --- a/debian/patches/517-randr-Catch-two-more-potential-unset-rrScrPriv-uses.patch +++ /dev/null @@ -1,52 +0,0 @@ -From 855003c333a0ead1db912695bc9705ef2b3144b4 Mon Sep 17 00:00:00 2001 -From: Keith Packard -Date: Thu, 21 Jun 2012 18:45:18 -0700 -Subject: [PATCH] randr: Catch two more potential unset rrScrPriv uses - -Ricardo Salveti found one place where the -randr code could use the randr screen private data without checking -for null first. This happens when the X server is running with -multiple screens, some of which are randr enabled and some of which -are not. Applications making protocol requests to the non-randr -screens can cause segfaults where the server touches the unset private -structure. - -I audited the code and found two more possible problem spots; the -trick to auditing for this issue was to look for functions not taking -a RandR data structure and where there was no null screen private -check above them in the call graph. - -Signed-off-by: Keith Packard ---- - randr/rroutput.c | 3 ++- - randr/rrscreen.c | 3 +++ - 2 files changed, 5 insertions(+), 1 deletion(-) - -diff --git a/randr/rroutput.c b/randr/rroutput.c -index 091e06b..fbd0e32 100644 ---- a/randr/rroutput.c -+++ b/randr/rroutput.c -@@ -546,7 +546,8 @@ ProcRRSetOutputPrimary(ClientPtr client) - } - - pScrPriv = rrGetScrPriv(pWin->drawable.pScreen); -- RRSetPrimaryOutput(pWin->drawable.pScreen, pScrPriv, output); -+ if (pScrPriv) -+ RRSetPrimaryOutput(pWin->drawable.pScreen, pScrPriv, output); - - return Success; - } -diff --git a/randr/rrscreen.c b/randr/rrscreen.c -index f570afa..55110e0 100644 ---- a/randr/rrscreen.c -+++ b/randr/rrscreen.c -@@ -261,6 +261,9 @@ - - pScreen = pWin->drawable.pScreen; - pScrPriv = rrGetScrPriv(pScreen); -+ if (!pScrPriv) -+ return BadMatch; -+ - if (stuff->width < pScrPriv->minWidth || pScrPriv->maxWidth < stuff->width) - { - client->errorValue = stuff->width; diff --git a/debian/patches/series b/debian/patches/series deleted file mode 100644 index 8688706..0000000 --- a/debian/patches/series +++ /dev/null @@ -1,62 +0,0 @@ -## Patches with a number < 100 are applied in debian. -## Ubuntu patches start with 100. -0001-add-dri2video.patch -001_fedora_extramodes.patch -02_Add-libnettle-as-option-for-sha1.diff -07-xfree86-fix-build-with-xv-disabled.diff -#13_debian_add_xkbpath_env_variable.diff -15-nouveau.diff - -# Ubuntu patches -100_rethrow_signals.patch -105_nvidia_fglrx_autodetect.patch -111_armel-drv-fallbacks.patch -122_xext_fix_card32_overflow_in_xauth.patch -157_check_null_modes.patch -162_null_crtc_in_rotation.patch -165_man_xorg_conf_no_device_ident.patch -166_nullptr_xinerama_keyrepeat.patch -167_nullptr_xisbread.patch -168_glibc_trace_to_stderr.patch -172_cwgetbackingpicture_nullptr_check.patch -188_default_primary_to_first_busid.patch -190_cache-xkbcomp_output_for_fast_start_up.patch -191-Xorg-add-an-extra-module-path.patch -198_nohwaccess.patch -200_randr-null.patch -#201_report-real-dpi.patch -208_switch_on_release.diff -209_add_legacy_bgnone_option.patch -224_return_BadWindow_not_BadMatch.diff -225_non-root_config_paths.patch -226_fall_back_to_autoconfiguration.patch -227_null_ptr_midispcur.patch -228_log-format-fix.patch -229_randr_first_check_pScrPriv_before_using_the_pointer.patch -230_randr_catch_two_more_potential_unset_rrScrPriv_uses.patch -233-xf86events-valgrind.patch -235-composite-tracking.diff -238-xrandr-fix-panning.patch - -## Input Stack Patches (from xserver 1.12) ## -500_pointer_barrier_thresholds.diff -505_query_pointer_touchscreen.patch -506_touchscreen_pointer_emulation_checks.patch -507_touchscreen_fixes.patch -# Patch 508 attempted to fix LP: #968845, but caused regression -# crash bug #1009629. Patches 510-515 attempted to fix that -# regression, but this led to the severe crash bug #1021517. -# So, disabling the patch set until this can be studied better. -#508_device_off_release_buttons.patch -#510-dix-return-early-from-DisableDevice-if-the-device-is.patch -#511-dix-move-freeing-the-sprite-into-a-function.patch -#512-dix-free-the-sprite-when-disabling-the-device.patch -#513-dix-disable-non-sprite-owners-first-when-disabling-p.patch -#514-Xi-drop-forced-unpairing-when-changing-the-hierarchy.patch -#515-dix-disable-all-devices-before-shutdown.patch -516-dix-dont-emulate-scroll-events-for-non-existing-axes.patch - -# Rotation patches -1001-xfree86-modes-Let-the-driver-handle-the-transform.patch -1002-xfree86-modes-Make-cursor-position-transform-a-helpe.patch - -- 2.39.2