1
0
xorg-x11-server/b_0001-Prevent-XSync-Alarms-from-senslessly-calling-CheckTr.patch
Egbert Eich 7286d85738 - Dropped:
* N_0001-Check-harder-for-primary-PCI-device.patch
    Whith libpciaccess code path irrelevant for Linux. 
  * N_0001-Fix-segfault-when-killing-X-with-ctrl-alt-backspace.patch
    Solved differently upstream
  * N_bug-197858_dpms.diff
    This one is upstream already - apparently nobody check this when
    it no longer applied...
  * N_bug534768-prefer_local_symbols.patch
    Upstream has a better suggestion how to solve this. However this
    patch is no longer needed     
  * N_dpms_screensaver.diff
    This topic was solved slightly differently upstream - still patch
    got ported without checking it's context.
  * N_randr1_1-sig11.diff
    No longer needed. Problem was fixed differently upstream.
  * u_vgaHW-no-legacy.patch
    Problem solved in the nv driver.
- Renamed:
  Those patches will go upstream, thus they are prefixed by a u_:
  * n__confine_to_shape.diff ->  u_confine_to_shape.diff
  * N_fbdevhw.diff -> u_fbdevhw.diff
  * n_x86emu-include-order.patch -> u_x86emu-include-order.patch
  * N_xorg-server-xdmcp.patchA -> u_xorg-server-xdmcp.patch
  Those patches no longer apply but are kept for reference thus prefixed by b_:
  * N_0001-Prevent-XSync-Alarms-from-senslessly-calling-CheckTr.patch ->
    b_0001-Prevent-XSync-Alarms-from-senslessly-calling-CheckTr.patch
  * N_cache-xkbcomp-output-for-fast-start-up.patch ->
    b_cache-xkbcomp-output-for-fast-start-up.patch
  * N_sync-fix.patch -> b_sync-fix.patch

OBS-URL: https://build.opensuse.org/package/show/X11:XOrg/xorg-x11-server?expand=0&rev=478
2013-12-11 15:46:05 +00:00

93 lines
3.3 KiB
Diff

From d1d9d4e5f8f9ac1d22e1258759d6ee9e49c7fe90 Mon Sep 17 00:00:00 2001
From: Egbert Eich <eich@freedesktop.org>
Date: Fri, 9 Apr 2010 15:10:32 +0200
Subject: [PATCH] Prevent XSync Alarms from senslessly calling CheckTrigger() when inactive.
If an XSync Alarm is set to inactive there is no need to check if a trigger
needs to fire. Doing so if the counter is the IdleCounter will put the
server on 100 percent CPU load since the select timeout is set to 0.
---
xorg-server-1.8.0/Xext/sync.c | 11 +++++++++--
xorg-server-1.8.0/Xext/syncsrv.h | 1 +
2 files changed, 10 insertions(+), 2 deletions(-)
Index: xorg-server-1.8.0/Xext/sync.c
===================================================================
--- xorg-server-1.8.0.orig/Xext/sync.c
+++ xorg-server-1.8.0/Xext/sync.c
@@ -518,6 +518,10 @@ SyncAlarmTriggerFired(SyncTrigger *pTrig
pAlarm->state = XSyncAlarmInactive;
}
}
+ /* Stop server from looping! */
+ if (pAlarm->state == XSyncAlarmInactive)
+ SyncDeleteTriggerFromCounter(&pAlarm->trigger);
+
/* The AlarmNotify event has to have the "new state of the alarm"
* which we can't be sure of until this point. However, it has
* to have the "old" trigger test value. That's the reason for
@@ -730,7 +734,7 @@ SyncChangeAlarmAttributes(ClientPtr clie
XSyncCounter counter;
Mask origmask = mask;
- counter = pAlarm->trigger.pCounter ? pAlarm->trigger.pCounter->id : None;
+ counter = pAlarm->counter_id;
while (mask)
{
@@ -741,7 +745,7 @@ SyncChangeAlarmAttributes(ClientPtr clie
case XSyncCACounter:
mask &= ~XSyncCACounter;
/* sanity check in SyncInitTrigger */
- counter = *values++;
+ counter = pAlarm->counter_id = *values++;
break;
case XSyncCAValueType:
@@ -808,6 +812,14 @@ SyncChangeAlarmAttributes(ClientPtr clie
return BadMatch;
}
}
+ if (pAlarm->state == XSyncAlarmInactive) {
+ /*
+ * If we are inactive the trigger has been deleted from the counter.
+ * Persuade SyncInitTrigger() to readd it.
+ */
+ origmask |= XSyncCACounter;
+ pAlarm->trigger.pCounter = NULL;
+ }
/* postpone this until now, when we're sure nothing else can go wrong */
if ((status = SyncInitTrigger(client, &pAlarm->trigger, counter,
@@ -815,6 +827,7 @@ SyncChangeAlarmAttributes(ClientPtr clie
return status;
/* XXX spec does not really say to do this - needs clarification */
+ /* It's the only place where it is set to XSyncAlarmActive! */
pAlarm->state = XSyncAlarmActive;
return Success;
}
@@ -1617,8 +1630,10 @@ ProcSyncCreateAlarm(ClientPtr client)
pAlarm->client = client;
pAlarm->alarm_id = stuff->id;
+ pAlarm->counter_id = None;
XSyncIntToValue(&pAlarm->delta, 1L);
pAlarm->events = TRUE;
+ /* SyncChangeAlarmAttributes() changes this - no need to set this here! */
pAlarm->state = XSyncAlarmInactive;
pAlarm->pEventClients = NULL;
status = SyncChangeAlarmAttributes(client, pAlarm, vmask,
Index: xorg-server-1.8.0/Xext/syncsrv.h
===================================================================
--- xorg-server-1.8.0.orig/Xext/syncsrv.h
+++ xorg-server-1.8.0/Xext/syncsrv.h
@@ -129,6 +129,7 @@ typedef struct _SyncAlarm {
int events;
int state;
SyncAlarmClientList *pEventClients;
+ XSyncCounter counter_id;
} SyncAlarm;
typedef struct {