From 763a115cabaf1f961229d06380185ac3a5fb1b2f Mon Sep 17 00:00:00 2001
From: root <root@localhost.(none)>
Date: Mon, 5 Jul 2010 17:34:45 +0200
Subject: [PATCH] Revert "Disable acceleration if we detect a hardware error."

This reverts commit cd38b705be84901a38380dc2a1b90889b553d565.
---
 src/i830.h             |    1 -
 src/i830_batchbuffer.c |    8 --------
 src/i830_uxa.c         |    4 +---
 uxa/uxa-accel.c        |   20 +++++++++-----------
 uxa/uxa-glyphs.c       |    1 -
 uxa/uxa-priv.h         |    1 -
 uxa/uxa-render.c       |    8 +++-----
 uxa/uxa.c              |    9 ---------
 uxa/uxa.h              |    1 -
 9 files changed, 13 insertions(+), 40 deletions(-)

diff --git a/src/i830.h b/src/i830.h
index 64acda3..eef6610 100644
--- a/src/i830.h
+++ b/src/i830.h
@@ -417,7 +417,6 @@ typedef struct intel_screen_private {
 	char *deviceName;
 
 	Bool use_pageflipping;
-	Bool force_fallback;
 
 	/* Broken-out options. */
 	OptionInfoPtr Options;
diff --git a/src/i830_batchbuffer.c b/src/i830_batchbuffer.c
index 5719d08..2348275 100644
--- a/src/i830_batchbuffer.c
+++ b/src/i830_batchbuffer.c
@@ -32,7 +32,6 @@
 
 #include <assert.h>
 #include <stdlib.h>
-#include <errno.h>
 
 #include "xf86.h"
 #include "i830.h"
@@ -202,13 +201,6 @@ void intel_batch_submit(ScrnInfoPtr scrn, int flush)
 				   strerror(-ret));
 			once = 1;
 		}
-
-		if (ret == -EIO) {
-			/* The GPU is hung and unlikely to recover by this point. */
-			xf86DrvMsg(scrn->scrnIndex, X_ERROR, "Disabling acceleration.\n");
-			uxa_set_force_fallback(screenInfo.screens[scrn->scrnIndex], TRUE);
-			intel->force_fallback = TRUE;
-		}
 	}
 
 	while (!list_is_empty(&intel->batch_pixmaps)) {
diff --git a/src/i830_uxa.c b/src/i830_uxa.c
index 61e857f..5aa962a 100644
--- a/src/i830_uxa.c
+++ b/src/i830_uxa.c
@@ -953,7 +953,7 @@ i830_uxa_create_pixmap(ScreenPtr screen, int w, int h, int depth,
 	if (w > 32767 || h > 32767)
 		return NullPixmap;
 
-	if (depth == 1 || intel->force_fallback)
+	if (depth == 1)
 		return fbCreatePixmap(screen, w, h, depth, usage);
 
 	if (usage == CREATE_PIXMAP_USAGE_GLYPH_PICTURE && w <= 32 && h <= 32)
@@ -1107,8 +1107,6 @@ Bool i830_uxa_init(ScreenPtr screen)
 
 	memset(intel->uxa_driver, 0, sizeof(*intel->uxa_driver));
 
-	intel->force_fallback = FALSE;
-
 	intel->bufferOffset = 0;
 	intel->uxa_driver->uxa_major = 1;
 	intel->uxa_driver->uxa_minor = 0;
diff --git a/uxa/uxa-accel.c b/uxa/uxa-accel.c
index 29a329f..786e5f0 100644
--- a/uxa/uxa-accel.c
+++ b/uxa/uxa-accel.c
@@ -70,7 +70,7 @@ uxa_fill_spans(DrawablePtr pDrawable, GCPtr pGC, int n,
 	PicturePtr dst, src;
 	int error;
 
-	if (uxa_screen->swappedOut || uxa_screen->force_fallback)
+	if (uxa_screen->swappedOut)
 		goto fallback;
 
 	if (pGC->fillStyle != FillSolid)
@@ -287,18 +287,16 @@ uxa_do_put_image(DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y,
 	if (format != ZPixmap || bpp < 8)
 		return FALSE;
 
-	if (uxa_screen->swappedOut || uxa_screen->force_fallback)
-		return FALSE;
-
-	if (!uxa_screen->info->put_image)
-		return FALSE;
-
 	/* Only accelerate copies: no rop or planemask. */
 	if (!UXA_PM_IS_SOLID(pDrawable, pGC->planemask) || pGC->alu != GXcopy)
 		return FALSE;
 
+	if (uxa_screen->swappedOut)
+		return FALSE;
+
 	pPix = uxa_get_offscreen_pixmap(pDrawable, &xoff, &yoff);
-	if (!pPix)
+
+	if (!pPix || !uxa_screen->info->put_image)
 		return FALSE;
 
 	x += pDrawable->x;
@@ -658,7 +656,7 @@ uxa_copy_area(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC,
 {
 	uxa_screen_t *uxa_screen = uxa_get_screen(pDstDrawable->pScreen);
 
-	if (uxa_screen->swappedOut || uxa_screen->force_fallback) {
+	if (uxa_screen->swappedOut) {
 		return uxa_check_copy_area(pSrcDrawable, pDstDrawable, pGC,
 					   srcx, srcy, width, height, dstx,
 					   dsty);
@@ -848,7 +846,7 @@ uxa_poly_fill_rect(DrawablePtr pDrawable,
 	if (!REGION_NUM_RECTS(pReg))
 		goto out;
 
-	if (uxa_screen->swappedOut || uxa_screen->force_fallback)
+	if (uxa_screen->swappedOut)
 		goto fallback;
 
 	pPixmap = uxa_get_offscreen_pixmap (pDrawable, &xoff, &yoff);
@@ -1261,7 +1259,7 @@ uxa_get_image(DrawablePtr pDrawable, int x, int y, int w, int h,
 	Box.x2 = Box.x1 + w;
 	Box.y2 = Box.y1 + h;
 
-	if (uxa_screen->swappedOut || uxa_screen->force_fallback)
+	if (uxa_screen->swappedOut)
 		goto fallback;
 
 	pPix = uxa_get_offscreen_pixmap(pDrawable, &xoff, &yoff);
diff --git a/uxa/uxa-glyphs.c b/uxa/uxa-glyphs.c
index 68d1c22..823cf82 100644
--- a/uxa/uxa-glyphs.c
+++ b/uxa/uxa-glyphs.c
@@ -1040,7 +1040,6 @@ uxa_glyphs(CARD8 op,
 
 	if (!uxa_screen->info->prepare_composite ||
 	    uxa_screen->swappedOut ||
-	    uxa_screen->force_fallback ||
 	    !uxa_drawable_is_offscreen(pDst->pDrawable) ||
 	    pDst->alphaMap || pSrc->alphaMap) {
 fallback:
diff --git a/uxa/uxa-priv.h b/uxa/uxa-priv.h
index b107928..4b988f4 100644
--- a/uxa/uxa-priv.h
+++ b/uxa/uxa-priv.h
@@ -133,7 +133,6 @@ typedef struct {
 #endif
 	EnableDisableFBAccessProcPtr SavedEnableDisableFBAccess;
 
-	Bool force_fallback;
 	Bool fallback_debug;
 	Bool swappedOut;
 	unsigned disableFbCount;
diff --git a/uxa/uxa-render.c b/uxa/uxa-render.c
index 9709a14..8c75bdb 100644
--- a/uxa/uxa-render.c
+++ b/uxa/uxa-render.c
@@ -167,10 +167,6 @@ uxa_print_composite_fallback(const char *func, CARD8 op,
 	if (! uxa_screen->fallback_debug)
 		return;
 
-	/* Limit the noise if fallbacks are expected. */
-	if (uxa_screen->force_fallback)
-		return;
-
 	uxa_composite_fallback_pict_desc(pSrc, srcdesc, 40);
 	uxa_composite_fallback_pict_desc(pMask, maskdesc, 40);
 	uxa_composite_fallback_pict_desc(pDst, dstdesc, 40);
@@ -1510,15 +1506,17 @@ uxa_composite(CARD8 op,
 	RegionRec region;
 	int tx, ty;
 
-	if (uxa_screen->swappedOut || uxa_screen->force_fallback)
+	if (uxa_screen->swappedOut)
 		goto fallback;
 
 	if (!uxa_drawable_is_offscreen(pDst->pDrawable))
 		goto fallback;
 
+
 	if (pDst->alphaMap || pSrc->alphaMap || (pMask && pMask->alphaMap))
 		goto fallback;
 
+
 	/* Remove repeat in source if useless */
 	if (pSrc->pDrawable && pSrc->repeat && pSrc->filter != PictFilterConvolution &&
 	    transform_is_integer_translation(pSrc->transform, &tx, &ty) &&
diff --git a/uxa/uxa.c b/uxa/uxa.c
index 2321a7f..37546dc 100644
--- a/uxa/uxa.c
+++ b/uxa/uxa.c
@@ -354,13 +354,6 @@ void uxa_set_fallback_debug(ScreenPtr screen, Bool enable)
 	uxa_screen->fallback_debug = enable;
 }
 
-void uxa_set_force_fallback(ScreenPtr screen, Bool value)
-{
-	uxa_screen_t *uxa_screen = uxa_get_screen(screen);
-
-	uxa_screen->force_fallback = value;
-}
-
 /**
  * uxa_close_screen() unwraps its wrapped screen functions and tears down UXA's
  * screen private, before calling down to the next CloseSccreen.
@@ -488,8 +481,6 @@ Bool uxa_driver_init(ScreenPtr screen, uxa_driver_t * uxa_driver)
 
 	dixSetPrivate(&screen->devPrivates, &uxa_screen_index, uxa_screen);
 
-	uxa_screen->force_fallback = FALSE;
-
 	uxa_screen->solid_cache_size = 0;
 	uxa_screen->solid_clear = 0;
 	uxa_screen->solid_black = 0;
diff --git a/uxa/uxa.h b/uxa/uxa.h
index e001c53..efadfda 100644
--- a/uxa/uxa.h
+++ b/uxa/uxa.h
@@ -571,7 +571,6 @@ uxa_get_color_for_pixmap (PixmapPtr	 pixmap,
 			  CARD32	*pixel);
 
 void uxa_set_fallback_debug(ScreenPtr screen, Bool enable);
-void uxa_set_force_fallback(ScreenPtr screen, Bool enable);
 
 /**
  * Returns TRUE if the given planemask covers all the significant bits in the
-- 
1.6.0.2

