freedreno/a4xx: fix *_NONE enum conversion
authorShawn Guo <shawn.guo@linaro.org>
Tue, 30 Jun 2020 12:40:53 +0000 (20:40 +0800)
committerMarge Bot <eric+marge@anholt.net>
Tue, 30 Jun 2020 14:23:29 +0000 (14:23 +0000)
Commit e369b8931c67 ("freedreno: Use explicit *_NONE enum for undefined
formats") only partially converts ~0 to *_NONE enum.  It breaks texture
support, and glmark2 texture scene gives a black screen.

Adding the missing conversion of ~0 to *_NONE enum fixes the issue.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5693>

src/gallium/drivers/freedreno/a4xx/fd4_format.c
src/gallium/drivers/freedreno/a4xx/fd4_screen.c

index c41015857d63402cdee7f31947f55908f2f2b341..3e7fff51743102f47f9d04957302cd53da403437 100644 (file)
@@ -339,7 +339,7 @@ enum a4xx_vtx_fmt
 fd4_pipe2vtx(enum pipe_format format)
 {
        if (!formats[format].present)
-               return ~0;
+               return VFMT4_NONE;
        return formats[format].vtx;
 }
 
@@ -348,7 +348,7 @@ enum a4xx_tex_fmt
 fd4_pipe2tex(enum pipe_format format)
 {
        if (!formats[format].present)
-               return ~0;
+               return TFMT4_NONE;
        return formats[format].tex;
 }
 
@@ -357,7 +357,7 @@ enum a4xx_color_fmt
 fd4_pipe2color(enum pipe_format format)
 {
        if (!formats[format].present)
-               return ~0;
+               return RB4_NONE;
        return formats[format].rb;
 }
 
index 8f60b51bf8f25f0a63fa5a57cea67e7be3e33327..ee6403f9c5d9b1d6b0b8a39f49f6cdab99652667 100644 (file)
@@ -56,12 +56,12 @@ fd4_screen_is_format_supported(struct pipe_screen *pscreen,
                return false;
 
        if ((usage & PIPE_BIND_VERTEX_BUFFER) &&
-                       (fd4_pipe2vtx(format) != (enum a4xx_vtx_fmt)~0)) {
+                       (fd4_pipe2vtx(format) != VFMT4_NONE)) {
                retval |= PIPE_BIND_VERTEX_BUFFER;
        }
 
        if ((usage & PIPE_BIND_SAMPLER_VIEW) &&
-                       (fd4_pipe2tex(format) != (enum a4xx_tex_fmt)~0) &&
+                       (fd4_pipe2tex(format) != TFMT4_NONE) &&
                        (target == PIPE_BUFFER ||
                         util_format_get_blocksize(format) != 12)) {
                retval |= PIPE_BIND_SAMPLER_VIEW;
@@ -71,8 +71,8 @@ fd4_screen_is_format_supported(struct pipe_screen *pscreen,
                                PIPE_BIND_DISPLAY_TARGET |
                                PIPE_BIND_SCANOUT |
                                PIPE_BIND_SHARED)) &&
-                       (fd4_pipe2color(format) != (enum a4xx_color_fmt)~0) &&
-                       (fd4_pipe2tex(format) != (enum a4xx_tex_fmt)~0)) {
+                       (fd4_pipe2color(format) != RB4_NONE) &&
+                       (fd4_pipe2tex(format) != TFMT4_NONE)) {
                retval |= usage & (PIPE_BIND_RENDER_TARGET |
                                PIPE_BIND_DISPLAY_TARGET |
                                PIPE_BIND_SCANOUT |
@@ -86,7 +86,7 @@ fd4_screen_is_format_supported(struct pipe_screen *pscreen,
 
        if ((usage & PIPE_BIND_DEPTH_STENCIL) &&
                        (fd4_pipe2depth(format) != (enum a4xx_depth_format)~0) &&
-                       (fd4_pipe2tex(format) != (enum a4xx_tex_fmt)~0)) {
+                       (fd4_pipe2tex(format) != TFMT4_NONE)) {
                retval |= PIPE_BIND_DEPTH_STENCIL;
        }