summaryrefslogtreecommitdiff
path: root/uxa
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2010-05-31 17:23:36 +0100
committerOwain G. Ainsworth <oga@openbsd.org>2010-09-11 21:01:26 +0100
commit63fc953d1000490a923e126196fabcfa914129fc (patch)
tree2208d2853cdfd383b50852962ab9d5d697683b9e /uxa
parentea6b977774fa23044d675aac2a89393f846b87f0 (diff)
Disable acceleration if we detect a hardware error.
This is wildly optimistic, but it should work in a surprising number of error situations and some output in those cases will be hopefully be better than none... If we submit a batchbuffer and the kernel reports the GPU is hung (which will be caused by an earlier execbuffer, and so the kernel should have had enough time to determine whether or not it could reset the GPU) then disable any further attempt to accelerate gfx and force fallbacks to map the buffers and use the CPU. We cannot normally map any more buffers if the GPU is hung, so only those already mapped prior to the hang can be written to, or those allocated in system memory. However, we can expect that the framebuffer is already mapped, and so have a reasonable expectation to continue to see the display update. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> (Cheery picked from commit cd38b705be84901a38380dc2a1b90889b553d565) Signed-off-by: Owain G. Ainsworth <oga@openbsd.org>
Diffstat (limited to 'uxa')
-rw-r--r--uxa/uxa-accel.c20
-rw-r--r--uxa/uxa-glyphs.c1
-rw-r--r--uxa/uxa-priv.h1
-rw-r--r--uxa/uxa-render.c8
-rw-r--r--uxa/uxa.c9
-rw-r--r--uxa/uxa.h1
6 files changed, 28 insertions, 12 deletions
diff --git a/uxa/uxa-accel.c b/uxa/uxa-accel.c
index ce2013e1..2b4c16c7 100644
--- a/uxa/uxa-accel.c
+++ b/uxa/uxa-accel.c
@@ -71,7 +71,7 @@ uxa_fill_spans(DrawablePtr pDrawable, GCPtr pGC, int n,
PicturePtr dst, src;
int error;
- if (uxa_screen->swappedOut)
+ if (uxa_screen->swappedOut || uxa_screen->force_fallback)
goto fallback;
if (pGC->fillStyle != FillSolid)
@@ -288,16 +288,18 @@ uxa_do_put_image(DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y,
if (format != ZPixmap || bpp < 8)
return FALSE;
- /* Only accelerate copies: no rop or planemask. */
- if (!UXA_PM_IS_SOLID(pDrawable, pGC->planemask) || pGC->alu != GXcopy)
+ if (uxa_screen->swappedOut || uxa_screen->force_fallback)
return FALSE;
- if (uxa_screen->swappedOut)
+ if (!uxa_screen->info->put_image)
return FALSE;
- pPix = uxa_get_offscreen_pixmap(pDrawable, &xoff, &yoff);
+ /* Only accelerate copies: no rop or planemask. */
+ if (!UXA_PM_IS_SOLID(pDrawable, pGC->planemask) || pGC->alu != GXcopy)
+ return FALSE;
- if (!pPix || !uxa_screen->info->put_image)
+ pPix = uxa_get_offscreen_pixmap(pDrawable, &xoff, &yoff);
+ if (!pPix)
return FALSE;
x += pDrawable->x;
@@ -652,7 +654,7 @@ uxa_copy_area(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC,
{
uxa_screen_t *uxa_screen = uxa_get_screen(pDstDrawable->pScreen);
- if (uxa_screen->swappedOut) {
+ if (uxa_screen->swappedOut || uxa_screen->force_fallback) {
return uxa_check_copy_area(pSrcDrawable, pDstDrawable, pGC,
srcx, srcy, width, height, dstx,
dsty);
@@ -842,7 +844,7 @@ uxa_poly_fill_rect(DrawablePtr pDrawable,
if (!REGION_NUM_RECTS(pReg))
goto out;
- if (uxa_screen->swappedOut)
+ if (uxa_screen->swappedOut || uxa_screen->force_fallback)
goto fallback;
pPixmap = uxa_get_offscreen_pixmap (pDrawable, &xoff, &yoff);
@@ -1255,7 +1257,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)
+ if (uxa_screen->swappedOut || uxa_screen->force_fallback)
goto fallback;
pPix = uxa_get_offscreen_pixmap(pDrawable, &xoff, &yoff);
diff --git a/uxa/uxa-glyphs.c b/uxa/uxa-glyphs.c
index 823cf82f..68d1c228 100644
--- a/uxa/uxa-glyphs.c
+++ b/uxa/uxa-glyphs.c
@@ -1040,6 +1040,7 @@ 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 9b76d12b..92536cc0 100644
--- a/uxa/uxa-priv.h
+++ b/uxa/uxa-priv.h
@@ -132,6 +132,7 @@ 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 4e301516..6189fe24 100644
--- a/uxa/uxa-render.c
+++ b/uxa/uxa-render.c
@@ -167,6 +167,10 @@ 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);
@@ -1508,17 +1512,15 @@ uxa_composite(CARD8 op,
RegionRec region;
int tx, ty;
- if (uxa_screen->swappedOut)
+ if (uxa_screen->swappedOut || uxa_screen->force_fallback)
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 8b6b5f27..4a5907e8 100644
--- a/uxa/uxa.c
+++ b/uxa/uxa.c
@@ -354,6 +354,13 @@ 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,6 +495,8 @@ 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 efadfdaa..e001c53d 100644
--- a/uxa/uxa.h
+++ b/uxa/uxa.h
@@ -571,6 +571,7 @@ 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