st/xorg: Add debug for fallbacks
authorJakob Bornecrantz <wallbraker@gmail.com>
Mon, 28 Sep 2009 18:19:26 +0000 (11:19 -0700)
committerJakob Bornecrantz <wallbraker@gmail.com>
Tue, 29 Sep 2009 04:34:45 +0000 (21:34 -0700)
src/gallium/state_trackers/xorg/xorg_driver.c
src/gallium/state_trackers/xorg/xorg_exa.c
src/gallium/state_trackers/xorg/xorg_exa.h
src/gallium/state_trackers/xorg/xorg_tracker.h

index 643b6b3b9e4cc20969a109e0fff09a090e58ca3e..3dff8d859ee18cbc5cf40ae281ecebc8b894b12d 100644 (file)
@@ -558,6 +558,7 @@ ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
     xf86SetBlackWhitePixels(pScreen);
 
     ms->exa = xorg_exa_init(pScrn);
+    ms->debug_fallback = debug_get_option_bool("XORG_DEBUG_FALLBACK", TRUE);
 
     miInitializeBackingStore(pScreen);
     xf86SetBackingStore(pScreen);
index f3d7d6eddd556b770ec548867fcd5fbfbcdd4530..b54e31a70190e04c6654b4f6bce12b5d2ee158f5 100644 (file)
@@ -286,23 +286,23 @@ ExaPrepareSolid(PixmapPtr pPixmap, int alu, Pixel planeMask, Pixel fg)
 #if DEBUG_PRINT
     debug_printf("ExaPrepareSolid(0x%x)\n", fg);
 #endif
-    if (!EXA_PM_IS_SOLID(&pPixmap->drawable, planeMask))
-       return FALSE;
+    if (!exa->pipe)
+       XORG_FALLBACK("solid accle not enabled");
 
     if (!priv || !priv->tex)
-       return FALSE;
+       XORG_FALLBACK("solid !priv || !priv->tex");
 
-    if (!exa->scrn->is_format_supported(exa->scrn, priv->tex->format,
-                                        priv->tex->target,
-                                        PIPE_TEXTURE_USAGE_RENDER_TARGET, 0))
-       return FALSE;
+    if (!EXA_PM_IS_SOLID(&pPixmap->drawable, planeMask))
+       XORG_FALLBACK("solid planeMask is not solid");
 
     if (alu != GXcopy)
-       return FALSE;
-
-    if (!exa->pipe)
-       return FALSE;
+       XORG_FALLBACK("solid not GXcopy");
 
+    if (!exa->scrn->is_format_supported(exa->scrn, priv->tex->format,
+                                        priv->tex->target,
+                                        PIPE_TEXTURE_USAGE_RENDER_TARGET, 0)) {
+       XORG_FALLBACK("solid bad format %s", pf_name(priv->tex->format));
+    }
 
 #if DEBUG_SOLID
     fg = 0xffff0000;
@@ -382,29 +382,30 @@ ExaPrepareCopy(PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap, int xdir,
 #if DEBUG_PRINT
     debug_printf("ExaPrepareCopy\n");
 #endif
+    if (!exa->pipe)
+       XORG_FALLBACK("copy accle not enabled");
 
-    if (alu != GXcopy)
-       return FALSE;
+    if (!priv || !src_priv)
+       XORG_FALLBACK("copy !priv || !src_priv");
+
+    if (!priv->tex || !src_priv->tex)
+       XORG_FALLBACK("copy !priv->tex || !src_priv->tex");
 
     if (!EXA_PM_IS_SOLID(&pSrcPixmap->drawable, planeMask))
-       return FALSE;
+       XORG_FALLBACK("copy planeMask is not solid");
 
-    if (!priv || !src_priv)
-       return FALSE;
+    if (alu != GXcopy)
+       XORG_FALLBACK("copy alu not GXcopy");
 
     if (!exa->scrn->is_format_supported(exa->scrn, priv->tex->format,
                                         priv->tex->target,
-                                        PIPE_TEXTURE_USAGE_RENDER_TARGET, 0) ||
-        !exa->scrn->is_format_supported(exa->scrn, src_priv->tex->format,
+                                        PIPE_TEXTURE_USAGE_RENDER_TARGET, 0))
+       XORG_FALLBACK("copy pDst format %s", pf_name(priv->tex->format));
+
+    if (!exa->scrn->is_format_supported(exa->scrn, src_priv->tex->format,
                                         src_priv->tex->target,
                                         PIPE_TEXTURE_USAGE_SAMPLER, 0))
-       return FALSE;
-
-    if (!priv->tex || !src_priv->tex)
-       return FALSE;
-
-    if (!exa->pipe)
-       return FALSE;
+       XORG_FALLBACK("copy pSrc format %s", pf_name(src_priv->tex->format));
 
     exa->copy.src = src_priv;
     exa->copy.dst = priv;
@@ -450,30 +451,38 @@ ExaPrepareComposite(int op, PicturePtr pSrcPicture,
 #if DEBUG_PRINT
    debug_printf("ExaPrepareComposite\n");
 #endif
+   if (!exa->pipe)
+      XORG_FALLBACK("comp accle not enabled");
 
    priv = exaGetPixmapDriverPrivate(pDst);
-   if (!priv || !priv->tex ||
-       !exa->scrn->is_format_supported(exa->scrn, priv->tex->format,
+   if (!priv || !priv->tex)
+      XORG_FALLBACK("comp pDst %s", !priv ? "!priv" : "!priv->tex");
+
+   if (!exa->scrn->is_format_supported(exa->scrn, priv->tex->format,
                                        priv->tex->target,
                                        PIPE_TEXTURE_USAGE_RENDER_TARGET, 0))
-      return FALSE;
+      XORG_FALLBACK("copy pDst format: %s", pf_name(priv->tex->format));
 
    if (pSrc) {
       priv = exaGetPixmapDriverPrivate(pSrc);
-      if (!priv || !priv->tex ||
-          !exa->scrn->is_format_supported(exa->scrn, priv->tex->format,
+      if (!priv || !priv->tex)
+         XORG_FALLBACK("comp pSrc %s", !priv ? "!priv" : "!priv->tex");
+
+      if (!exa->scrn->is_format_supported(exa->scrn, priv->tex->format,
                                           priv->tex->target,
                                           PIPE_TEXTURE_USAGE_SAMPLER, 0))
-         return FALSE;
+         XORG_FALLBACK("copy pSrc format: %s", pf_name(priv->tex->format));
    }
 
    if (pMask) {
       priv = exaGetPixmapDriverPrivate(pMask);
-      if (!priv || !priv->tex ||
-          !exa->scrn->is_format_supported(exa->scrn, priv->tex->format,
+      if (!priv || !priv->tex)
+         XORG_FALLBACK("comp pMask %s", !priv ? "!priv" : "!priv->tex");
+
+      if (!exa->scrn->is_format_supported(exa->scrn, priv->tex->format,
                                           priv->tex->target,
                                           PIPE_TEXTURE_USAGE_SAMPLER, 0))
-         return FALSE;
+         XORG_FALLBACK("copy pMask format: %s", pf_name(priv->tex->format));
    }
 
 #if DISABLE_ACCEL
index fe1f1cd103c4260f872e080b781511092aa644a1..d3f25ca844bfd8f93acac54f888c1eb3038aae2f 100644 (file)
@@ -50,6 +50,15 @@ struct exa_pixmap_priv
    unsigned map_count;
 };
 
+#define XORG_FALLBACK(s, arg...)              \
+do {                                          \
+   if (ms->debug_fallback) {                  \
+      xf86DrvMsg(pScrn->scrnIndex, X_INFO,    \
+                 "fallback: " s "\n", ##arg); \
+   }                                          \
+   return FALSE;                              \
+} while(0)
+
 struct pipe_surface *
 exa_gpu_surface(struct exa_context *exa, struct exa_pixmap_priv *priv);
 
index 2f7050bcb742f9014bb4b689d672723a67646f2f..db2f16f63ea24eac8bc59c24bddc34a79cd95328 100644 (file)
@@ -94,6 +94,7 @@ typedef struct _modesettingRec
     /* exa */
     void *exa;
     Bool noEvict;
+    Bool debug_fallback;
 
 #ifdef DRM_MODE_FEATURE_DIRTYFB
     DamagePtr damage;