"depth" for a picture format is the sum of bits of a/r/g/b, and not x.
The default format list was creating an x8r8g8b8 format at depth 32,
which is wrong. Likewise, servers supporting depth 30 would get an
x8r8g8b8 format at depth 30, which is nonsense.

Signed-off-by: Adam Jackson <a...@redhat.com>
---
 render/picture.c | 49 +++++++++++++++++++++----------------------------
 1 file changed, 21 insertions(+), 28 deletions(-)

diff --git a/render/picture.c b/render/picture.c
index f0638a39f..86d61e401 100644
--- a/render/picture.c
+++ b/render/picture.c
@@ -196,13 +196,13 @@ PictureCreateDefaultFormats(ScreenPtr pScreen, int 
*nformatp)
     formats[nformats].depth = 32;
     nformats++;
     formats[nformats].format = PICT_x8r8g8b8;
-    formats[nformats].depth = 32;
+    formats[nformats].depth = 24;
     nformats++;
     formats[nformats].format = PICT_b8g8r8a8;
     formats[nformats].depth = 32;
     nformats++;
     formats[nformats].format = PICT_b8g8r8x8;
-    formats[nformats].depth = 32;
+    formats[nformats].depth = 24;
     nformats++;
 
     /* now look through the depths and visuals adding other formats */
@@ -264,36 +264,29 @@ PictureCreateDefaultFormats(ScreenPtr pScreen, int 
*nformatp)
         switch (bpp) {
         case 16:
             /* depth 12 formats */
-            if (pDepth->depth >= 12) {
-                addFormat(formats, &nformats, PICT_x4r4g4b4, pDepth->depth);
-                addFormat(formats, &nformats, PICT_x4b4g4r4, pDepth->depth);
-            }
+            addFormat(formats, &nformats, PICT_x4r4g4b4, 12);
+            addFormat(formats, &nformats, PICT_x4b4g4r4, 12);
             /* depth 15 formats */
-            if (pDepth->depth >= 15) {
-                addFormat(formats, &nformats, PICT_x1r5g5b5, pDepth->depth);
-                addFormat(formats, &nformats, PICT_x1b5g5r5, pDepth->depth);
-            }
+            addFormat(formats, &nformats, PICT_x1r5g5b5, 15);
+            addFormat(formats, &nformats, PICT_x1b5g5r5, 15);
             /* depth 16 formats */
-            if (pDepth->depth >= 16) {
-                addFormat(formats, &nformats, PICT_a1r5g5b5, pDepth->depth);
-                addFormat(formats, &nformats, PICT_a1b5g5r5, pDepth->depth);
-                addFormat(formats, &nformats, PICT_r5g6b5, pDepth->depth);
-                addFormat(formats, &nformats, PICT_b5g6r5, pDepth->depth);
-                addFormat(formats, &nformats, PICT_a4r4g4b4, pDepth->depth);
-                addFormat(formats, &nformats, PICT_a4b4g4r4, pDepth->depth);
-            }
+            addFormat(formats, &nformats, PICT_a1r5g5b5, 16);
+            addFormat(formats, &nformats, PICT_a1b5g5r5, 16);
+            addFormat(formats, &nformats, PICT_r5g6b5, 16);
+            addFormat(formats, &nformats, PICT_b5g6r5, 16);
+            addFormat(formats, &nformats, PICT_a4r4g4b4, 16);
+            addFormat(formats, &nformats, PICT_a4b4g4r4, 16);
             break;
         case 32:
-            if (pDepth->depth >= 24) {
-                addFormat(formats, &nformats, PICT_x8r8g8b8, pDepth->depth);
-                addFormat(formats, &nformats, PICT_x8b8g8r8, pDepth->depth);
-            }
-            if (pDepth->depth >= 30) {
-                addFormat(formats, &nformats, PICT_a2r10g10b10, pDepth->depth);
-                addFormat(formats, &nformats, PICT_x2r10g10b10, pDepth->depth);
-                addFormat(formats, &nformats, PICT_a2b10g10r10, pDepth->depth);
-                addFormat(formats, &nformats, PICT_x2b10g10r10, pDepth->depth);
-            }
+            /* depth 24 formats */
+            addFormat(formats, &nformats, PICT_x8r8g8b8, 24);
+            addFormat(formats, &nformats, PICT_x8b8g8r8, 24);
+            /* depth 30 formats */
+            addFormat(formats, &nformats, PICT_x2r10g10b10, 30);
+            addFormat(formats, &nformats, PICT_x2b10g10r10, 30);
+            /* depth 32 formats */
+            addFormat(formats, &nformats, PICT_a2r10g10b10, 32);
+            addFormat(formats, &nformats, PICT_a2b10g10r10, 32);
             break;
         }
     }
-- 
2.14.3

_______________________________________________
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to