st/xorg Fail early if we don't intend to accelerate.
authorThomas Hellstrom <thellstrom@vmware.com>
Tue, 8 Dec 2009 11:48:56 +0000 (12:48 +0100)
committerThomas Hellstrom <thellstrom@vmware.com>
Tue, 8 Dec 2009 11:50:27 +0000 (12:50 +0100)
Saves a number of unneeded computations and log noise.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
src/gallium/state_trackers/xorg/xorg_exa.c

index 32485add94e4e6dd0eaf419a60fa9912e67e3b0a..17a032ee87e6778c6e15348d2006ea1e0966326e 100644 (file)
@@ -343,6 +343,9 @@ ExaPrepareSolid(PixmapPtr pPixmap, int alu, Pixel planeMask, Pixel fg)
 #if DEBUG_PRINT
     debug_printf("ExaPrepareSolid(0x%x)\n", fg);
 #endif
+    if (!exa->accel)
+       return FALSE;
+
     if (!exa->pipe)
        XORG_FALLBACK("accle not enabled");
 
@@ -361,7 +364,7 @@ ExaPrepareSolid(PixmapPtr pPixmap, int alu, Pixel planeMask, Pixel fg)
        XORG_FALLBACK("format %s", pf_name(priv->tex->format));
     }
 
-    return exa->accel && xorg_solid_bind_state(exa, priv, fg);
+    return xorg_solid_bind_state(exa, priv, fg);
 }
 
 static void
@@ -417,6 +420,10 @@ ExaPrepareCopy(PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap, int xdir,
 #if DEBUG_PRINT
     debug_printf("ExaPrepareCopy\n");
 #endif
+
+    if (!exa->accel)
+       return FALSE;
+
     if (!exa->pipe)
        XORG_FALLBACK("accle not enabled");
 
@@ -490,7 +497,7 @@ ExaPrepareCopy(PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap, int xdir,
     }
 
 
-    return exa->accel;
+    return TRUE;
 }
 
 static void
@@ -598,15 +605,19 @@ ExaCheckComposite(int op,
    ScrnInfoPtr pScrn = xf86Screens[pDstPicture->pDrawable->pScreen->myNum];
    modesettingPtr ms = modesettingPTR(pScrn);
    struct exa_context *exa = ms->exa;
-   boolean accelerated = xorg_composite_accelerated(op,
-                                                    pSrcPicture,
-                                                    pMaskPicture,
-                                                    pDstPicture);
+
 #if DEBUG_PRINT
    debug_printf("ExaCheckComposite(%d, %p, %p, %p) = %d\n",
                 op, pSrcPicture, pMaskPicture, pDstPicture, accelerated);
 #endif
-   return exa->accel && accelerated;
+
+   if (!exa->accel)
+       return FALSE;
+
+   return xorg_composite_accelerated(op,
+                                    pSrcPicture,
+                                    pMaskPicture,
+                                    pDstPicture);
 }
 
 
@@ -620,6 +631,9 @@ ExaPrepareComposite(int op, PicturePtr pSrcPicture,
    struct exa_context *exa = ms->exa;
    struct exa_pixmap_priv *priv;
 
+   if (!exa->accel)
+       return FALSE;
+
 #if DEBUG_PRINT
    debug_printf("ExaPrepareComposite(%d, src=0x%p, mask=0x%p, dst=0x%p)\n",
                 op, pSrcPicture, pMaskPicture, pDstPicture);
@@ -678,8 +692,7 @@ ExaPrepareComposite(int op, PicturePtr pSrcPicture,
                        render_format_name(pMaskPicture->format));
    }
 
-   return exa->accel &&
-          xorg_composite_bind_state(exa, op, pSrcPicture, pMaskPicture,
+   return xorg_composite_bind_state(exa, op, pSrcPicture, pMaskPicture,
                                     pDstPicture,
                                     pSrc ? exaGetPixmapDriverPrivate(pSrc) : NULL,
                                     pMask ? exaGetPixmapDriverPrivate(pMask) : NULL,