1 From e8c946cb56a9789ce707888a8198a8dd092cca85 Mon Sep 17 00:00:00 2001
2 From: Carl Worth <cworth@cworth.org>
3 Date: Tue, 10 Jul 2007 00:45:55 -0700
4 Subject: [PATCH] Elminate gettimeofday as a hotspot in I830WaitLpRing
7 src/i830_accel.c | 47 ++++++++++++++++++++++++-----------------------
8 1 files changed, 24 insertions(+), 23 deletions(-)
10 diff --git a/src/i830_accel.c b/src/i830_accel.c
11 index 5cbad44..714af5a 100644
12 --- a/src/i830_accel.c
13 +++ b/src/i830_accel.c
14 @@ -120,36 +120,37 @@ I830WaitLpRing(ScrnInfoPtr pScrn, int n, int timeout_millis)
15 ring->space += ring->mem->size;
18 - now = GetTimeInMillis();
19 - if (start == 0 || now < start || ring->head != last_head) {
20 - if (I810_DEBUG & DEBUG_VERBOSE_ACCEL)
22 - ErrorF("space: %d wanted %d\n", ring->space, n);
24 - last_head = ring->head;
25 - } else if (now - start > timeout_millis) {
26 - ErrorF("Error in I830WaitLpRing(), timeout for %d seconds\n",
27 - timeout_millis/1000);
28 - if (IS_I965G(pI830))
29 - i965_dump_error_state(pScrn);
31 - i830_dump_error_state(pScrn);
32 - ErrorF("space: %d wanted %d\n", ring->space, n);
33 + if ((iters & 0xfff) == 0) {
34 + now = GetTimeInMillis();
35 + if (start == 0 || now < start || ring->head != last_head) {
36 + if (I810_DEBUG & DEBUG_VERBOSE_ACCEL)
38 + ErrorF("space: %d wanted %d\n", ring->space, n);
40 + last_head = ring->head;
41 + } else if (now - start > timeout_millis) {
42 + ErrorF("Error in I830WaitLpRing(), timeout for %d seconds\n",
43 + timeout_millis/1000);
44 + if (IS_I965G(pI830))
45 + i965_dump_error_state(pScrn);
47 + i830_dump_error_state(pScrn);
48 + ErrorF("space: %d wanted %d\n", ring->space, n);
50 - if (pI830->directRenderingEnabled) {
51 - DRIUnlock(screenInfo.screens[pScrn->scrnIndex]);
52 - DRICloseScreen(screenInfo.screens[pScrn->scrnIndex]);
54 + if (pI830->directRenderingEnabled) {
55 + DRIUnlock(screenInfo.screens[pScrn->scrnIndex]);
56 + DRICloseScreen(screenInfo.screens[pScrn->scrnIndex]);
60 - pI830->AccelInfoRec = NULL; /* Stops recursive behavior */
61 + pI830->AccelInfoRec = NULL; /* Stops recursive behavior */
64 - pI830->EXADriverPtr = NULL;
65 + pI830->EXADriverPtr = NULL;
67 - FatalError("lockup\n");
68 + FatalError("lockup\n");