[Mesa-dev] [PATCH 42/42] panfrost: Update supported formats

Alyssa Rosenzweig alyssa.rosenzweig at collabora.com
Mon Jul 8 14:08:55 UTC 2019


Much of the format selection code was inherited from softpipe (!) of all
places, and a lot of it is accordingly cruft. Later if-elses were added
in random places to workaround missing formats at various points in
history. Clean up some of this.

Theoretically, any format we can texture from we can also render to. In
practice, there are a few corner cases that we need to disable
explicitly.

For one, we do have to restrict SCANOUT formats to workaround
buggy apps (in particular, dEQP which with --deqp-surface-type=window
under Weston will end up with RGB10_A2 and complain about low alpha
precision). Just be clearer about how/why.

Also, RGB5_A1 support is still broken; let's not worry about that quite
yet.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
---
 src/gallium/drivers/panfrost/pan_screen.c | 50 +++++------------------
 1 file changed, 10 insertions(+), 40 deletions(-)

diff --git a/src/gallium/drivers/panfrost/pan_screen.c b/src/gallium/drivers/panfrost/pan_screen.c
index d53a906838e..b044ae99399 100644
--- a/src/gallium/drivers/panfrost/pan_screen.c
+++ b/src/gallium/drivers/panfrost/pan_screen.c
@@ -460,48 +460,18 @@ panfrost_is_format_supported( struct pipe_screen *screen,
         if (format == PIPE_FORMAT_A1B5G5R5_UNORM || format == PIPE_FORMAT_X1B5G5R5_UNORM)
                 return FALSE;
 
-        /* Allow through special formats */
-
-        switch (format) {
-                case PIPE_FORMAT_R11G11B10_FLOAT:
-                case PIPE_FORMAT_B5G6R5_UNORM:
-                        return TRUE;
-                default:
-                        break;
-        }
-
-        if (bind & PIPE_BIND_RENDER_TARGET) {
-                if (format_desc->colorspace == UTIL_FORMAT_COLORSPACE_ZS)
-                        return FALSE;
-
-                /* Check for vaguely 8UNORM formats. Looser than
-                 * util_format_is_rgba8_variant, since it permits R8 (for
-                 * instance) */
-
-                for (unsigned chan = 0; chan < 4; ++chan) {
-                        enum util_format_type t = format_desc->channel[chan].type;
-                        if (t == UTIL_FORMAT_TYPE_VOID) continue;
-                        if (t != UTIL_FORMAT_TYPE_UNSIGNED) return FALSE;
-                        if (!format_desc->channel[chan].normalized) return FALSE;
-                        if (format_desc->channel[chan].size != 8) return FALSE;
-                }
-
-                /*
-                 * Although possible, it is unnatural to render into compressed or YUV
-                 * surfaces. So disable these here to avoid going into weird paths
-                 * inside the state trackers.
-                 */
-                if (format_desc->block.width != 1 ||
-                                format_desc->block.height != 1)
-                        return FALSE;
-        }
+        /* TODO */
+        if (format == PIPE_FORMAT_B5G5R5A1_UNORM)
+                return FALSE;
 
-        if (bind & PIPE_BIND_DEPTH_STENCIL) {
-                if (format_desc->colorspace != UTIL_FORMAT_COLORSPACE_ZS)
-                        return FALSE;
-        }
+        /* Don't confuse poorly written apps (workaround dEQP bug) that expect
+         * more alpha than they ask for */
+        bool scanout = bind & (PIPE_BIND_SCANOUT | PIPE_BIND_SHARED | PIPE_BIND_DISPLAY_TARGET);
+        if (scanout && !util_format_is_rgba8_variant(format_desc))
+                return FALSE;
 
-        if (format_desc->layout != UTIL_FORMAT_LAYOUT_PLAIN) {
+        if (format_desc->layout != UTIL_FORMAT_LAYOUT_PLAIN &&
+                        format_desc->layout != UTIL_FORMAT_LAYOUT_OTHER) {
                 /* Compressed formats not yet hooked up. */
                 return FALSE;
         }
-- 
2.20.1



More information about the mesa-dev mailing list