st/xorg: Explicitly check whether the driver supports the pixmap formats.
authorMichel Dänzer <daenzer@vmware.com>
Tue, 15 Sep 2009 16:30:58 +0000 (18:30 +0200)
committerMichel Dänzer <daenzer@vmware.com>
Tue, 15 Sep 2009 16:30:58 +0000 (18:30 +0200)
Rather than arbitrarily checking for pixmap depth < 15.

src/gallium/state_trackers/xorg/xorg_exa.c

index d6241aa19ea6d69336e7d3b395be6f2fdaecf19f..88149b9d5c1c74a7c375c22c776dcde5ef949a02 100644 (file)
@@ -284,15 +284,17 @@ ExaPrepareSolid(PixmapPtr pPixmap, int alu, Pixel planeMask, Pixel fg)
 #if 0
     debug_printf("ExaPrepareSolid - test\n");
 #endif
-    if (pPixmap->drawable.depth < 15)
-       return FALSE;
-
     if (!EXA_PM_IS_SOLID(&pPixmap->drawable, planeMask))
        return FALSE;
 
     if (!priv || !priv->tex)
        return FALSE;
 
+    if (!exa->scrn->is_format_supported(exa->scrn, priv->tex->format,
+                                        priv->tex->target,
+                                        PIPE_TEXTURE_USAGE_RENDER_TARGET, 0))
+       return FALSE;
+
     if (alu != GXcopy)
        return FALSE;
 
@@ -358,15 +360,20 @@ ExaPrepareCopy(PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap, int xdir,
     if (alu != GXcopy)
        return FALSE;
 
-    if (pSrcPixmap->drawable.depth < 15 || pDstPixmap->drawable.depth < 15)
-       return FALSE;
-
     if (!EXA_PM_IS_SOLID(&pSrcPixmap->drawable, planeMask))
        return FALSE;
 
     if (!priv || !src_priv)
        return FALSE;
 
+    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,
+                                        src_priv->tex->target,
+                                        PIPE_TEXTURE_USAGE_SAMPLER, 0))
+       return FALSE;
+
     if (!priv->tex || !src_priv->tex)
        return FALSE;