freedreno: Use explicit *_NONE enum for undefined formats
authorKristian H. Kristensen <hoegsberg@google.com>
Fri, 22 May 2020 20:36:38 +0000 (13:36 -0700)
committerMarge Bot <eric+marge@anholt.net>
Tue, 26 May 2020 18:35:03 +0000 (18:35 +0000)
This adds RB, VFMT and TFMT NONE values for a3xx-a5xx and FMT6_NONE
for a6xx.  Use those values instead of open coded (enum xxx) ~0 or
sometimes even ~0, which triggers out-of-enum range warnings.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5173>

20 files changed:
src/freedreno/registers/a3xx.xml
src/freedreno/registers/a4xx.xml
src/freedreno/registers/a5xx.xml
src/freedreno/registers/a6xx.xml
src/freedreno/vulkan/tu_formats.c
src/gallium/drivers/freedreno/a2xx/fd2_util.h
src/gallium/drivers/freedreno/a3xx/fd3_emit.c
src/gallium/drivers/freedreno/a3xx/fd3_format.c
src/gallium/drivers/freedreno/a3xx/fd3_resource.c
src/gallium/drivers/freedreno/a3xx/fd3_screen.c
src/gallium/drivers/freedreno/a4xx/fd4_emit.c
src/gallium/drivers/freedreno/a4xx/fd4_format.c
src/gallium/drivers/freedreno/a5xx/fd5_blitter.c
src/gallium/drivers/freedreno/a5xx/fd5_emit.c
src/gallium/drivers/freedreno/a5xx/fd5_format.c
src/gallium/drivers/freedreno/a5xx/fd5_screen.c
src/gallium/drivers/freedreno/a6xx/fd6_blitter.c
src/gallium/drivers/freedreno/a6xx/fd6_emit.c
src/gallium/drivers/freedreno/a6xx/fd6_format.c
src/gallium/drivers/freedreno/a6xx/fd6_screen.c

index 6c92d442dad46078df40384627bb9f706df187ed..5cfa1fe9ea924324d8005f85bca8701efcc09795 100644 (file)
@@ -91,6 +91,8 @@ xsi:schemaLocation="http://nouveau.freedesktop.org/ rules-ng.xsd">
        <value name="VFMT_2_10_10_10_UNORM" value="0x3d"/>
        <value name="VFMT_2_10_10_10_SINT" value="0x3e"/>
        <value name="VFMT_2_10_10_10_SNORM" value="0x3f"/>
+
+       <value name="VFMT_NONE" value="0xff"/>
 </enum>
 
 <enum name="a3xx_tex_fmt">
@@ -210,6 +212,8 @@ xsi:schemaLocation="http://nouveau.freedesktop.org/ rules-ng.xsd">
        <value name="TFMT_ETC2_RGBA8" value="0x74"/>
        <value name="TFMT_ETC2_RGB8A1" value="0x75"/>
        <value name="TFMT_ETC2_RGB8" value="0x76"/>
+
+       <value name="TFMT_NONE" value="0xff"/>
 </enum>
 
 <enum name="a3xx_tex_fetchsize">
@@ -278,6 +282,8 @@ xsi:schemaLocation="http://nouveau.freedesktop.org/ rules-ng.xsd">
        <value name="RB_R32_UINT"           value="0x38"/>
        <value name="RB_R32G32_UINT"        value="0x39"/>
        <value name="RB_R32G32B32A32_UINT"  value="0x3b"/>
+
+       <value name="RB_NONE"               value="0xff"/>
 </enum>
 
 <enum name="a3xx_cp_perfcounter_select">
index 1c2c48c5e50a9c5e4b6b791396845c47a52a52a2..284e491c886a5443696217c7b3cbb480f807d9b7 100644 (file)
@@ -56,6 +56,8 @@ xsi:schemaLocation="http://nouveau.freedesktop.org/ rules-ng.xsd">
        <value name="RB4_R32G32B32A32_FLOAT" value="0x3c"/>
        <value name="RB4_R32G32B32A32_UINT" value="0x3d"/>
        <value name="RB4_R32G32B32A32_SINT" value="0x3e"/>
+
+       <value name="RB4_NONE" value="0xff"/>
 </enum>
 
 <enum name="a4xx_tile_mode">
@@ -135,6 +137,8 @@ xsi:schemaLocation="http://nouveau.freedesktop.org/ rules-ng.xsd">
        <value name="VFMT4_2_10_10_10_UNORM" value="0x3d"/>
        <value name="VFMT4_2_10_10_10_SINT" value="0x3e"/>
        <value name="VFMT4_2_10_10_10_SNORM" value="0x3f"/>
+
+       <value name="VFMT4_NONE" value="0xff"/>
 </enum>
 
 <enum name="a4xx_tex_fmt">
@@ -260,6 +264,8 @@ xsi:schemaLocation="http://nouveau.freedesktop.org/ rules-ng.xsd">
        <value name="TFMT4_ASTC_12x10"            value="0x7b"/>
        <value name="TFMT4_ASTC_12x12"            value="0x7c"/>
        <!-- 0x7d .. 0x7f -->
+
+       <value name="TFMT4_NONE"                  value="0xff"/>
 </enum>
 
 <enum name="a4xx_tex_fetchsize">
index c5fdb662b8bc5a943c61778e89b058e26d5d3d46..f954a7bd8adecb07fb350026c4348ea0a4691ca0 100644 (file)
@@ -51,6 +51,8 @@ xsi:schemaLocation="http://nouveau.freedesktop.org/ rules-ng.xsd">
        <value value="0x82" name="RB5_R32G32B32A32_FLOAT"/>
        <value value="0x83" name="RB5_R32G32B32A32_UINT"/>
        <value value="0x84" name="RB5_R32G32B32A32_SINT"/>
+
+       <value value="0xff" name="RB5_NONE"/>
 </enum>
 
 <enum name="a5xx_tile_mode">
@@ -138,6 +140,8 @@ xsi:schemaLocation="http://nouveau.freedesktop.org/ rules-ng.xsd">
        <value value="0x83" name="VFMT5_32_32_32_32_UINT"/>
        <value value="0x84" name="VFMT5_32_32_32_32_SINT"/>
        <value value="0x85" name="VFMT5_32_32_32_32_FIXED"/>
+
+       <value value="0xff" name="VFMT5_NONE"/>
 </enum>
 
 <enum name="a5xx_tex_fmt">
@@ -224,6 +228,8 @@ xsi:schemaLocation="http://nouveau.freedesktop.org/ rules-ng.xsd">
        <value value="0xcc" name="TFMT5_ASTC_10x10"/>
        <value value="0xcd" name="TFMT5_ASTC_12x10"/>
        <value value="0xce" name="TFMT5_ASTC_12x12"/>
+
+       <value value="0xff" name="TFMT5_NONE"/>
 </enum>
 
 <enum name="a5xx_tex_fetchsize">
index 92cabb15c2563b6243c9ded09419811e2d9ee982..a718b24149f4c64ae810596d8728c19910943bb1 100644 (file)
@@ -152,6 +152,10 @@ xsi:schemaLocation="http://nouveau.freedesktop.org/ rules-ng.xsd">
 
        <!-- same as X8Z24_UNORM but for sampling stencil (integer, 2nd channel) -->
        <value value="0xea" name="FMT6_S8Z24_UINT"/>
+
+       <!-- Not a hw enum, used internally in driver -->
+       <value value="0xff" name="FMT6_NONE"/>
+
 </enum>
 
 <enum name="a6xx_tex_fetchsize">
index a7d2d31bd6df197d319e6627a7e99acce24c11f0..11c9d05ca306321fa8161c611e8aa6f8c4a3add7 100644 (file)
@@ -32,8 +32,6 @@
 #include "vk_util.h"
 #include "drm-uapi/drm_fourcc.h"
 
-#define FMT6_x -1
-
 #define TU6_FMT(vkfmt, hwfmt, swapfmt, valid) \
    [VK_FORMAT_##vkfmt] = {                   \
       .fmt = FMT6_##hwfmt,                     \
@@ -45,7 +43,7 @@
 #define TU6_xTC(vk, fmt, swap) TU6_FMT(vk, fmt, swap, FMT_TEXTURE | FMT_COLOR)
 #define TU6_Vxx(vk, fmt, swap) TU6_FMT(vk, fmt, swap, FMT_VERTEX)
 #define TU6_xTx(vk, fmt, swap) TU6_FMT(vk, fmt, swap, FMT_TEXTURE)
-#define TU6_xxx(vk, fmt, swap) TU6_FMT(vk, x, WZYX, false)
+#define TU6_xxx(vk, fmt, swap) TU6_FMT(vk, NONE, WZYX, 0)
 
 static const struct tu_native_format tu6_format_table[] = {
    TU6_xxx(UNDEFINED,                  x,                 x),    /* 0 */
index cf945b14475e9a43af387f804818c0c49950edab..b87ef412c4aa9f9f83dd97738585ea8e7a089393 100644 (file)
@@ -32,7 +32,8 @@
 #include "a2xx.xml.h"
 
 struct surface_format {
-#define FMT_INVALID 0x7f
+/* If enum is a signed type, 0x7f is out of range. Cast it to avoid warnings. */
+#define FMT_INVALID ((enum a2xx_sq_surfaceformat) 0x7f)
        enum a2xx_sq_surfaceformat format : 7;
        enum sq_tex_sign sign : 2;
        enum sq_tex_num_format num_format : 1;
index 2761358a48f3b069a514c57245d62e48f4216a9b..f86d4712c9a1b813e0fd1aca2aac2e9fa9dd2986 100644 (file)
@@ -441,7 +441,7 @@ fd3_emit_vertex_bufs(struct fd_ringbuffer *ring, struct fd3_emit *emit)
                                continue;
 #endif
 
-                       debug_assert(fmt != ~0);
+                       debug_assert(fmt != VFMT_NONE);
 
                        OUT_PKT0(ring, REG_A3XX_VFD_FETCH(j), 2);
                        OUT_RING(ring, A3XX_VFD_FETCH_INSTR_0_FETCHSIZE(fs - 1) |
index b5a5bb1bffce26119ee347ae5f65f9064a5787a6..58df9714f0a8ffe42bc59eca56059815b6666e01 100644 (file)
@@ -39,8 +39,6 @@ struct fd3_format {
        boolean present;
 };
 
-#define RB_NONE ~0
-
 /* vertex + texture */
 #define VT(pipe, fmt, rbfmt, swapfmt) \
        [PIPE_FORMAT_ ## pipe] = { \
@@ -55,7 +53,7 @@ struct fd3_format {
 #define _T(pipe, fmt, rbfmt, swapfmt) \
        [PIPE_FORMAT_ ## pipe] = { \
                .present = 1, \
-               .vtx = ~0, \
+               .vtx = VFMT_NONE, \
                .tex = TFMT_ ## fmt, \
                .rb = RB_ ## rbfmt, \
                .swap = swapfmt \
@@ -66,7 +64,7 @@ struct fd3_format {
        [PIPE_FORMAT_ ## pipe] = { \
                .present = 1, \
                .vtx = VFMT_ ## fmt, \
-               .tex = ~0, \
+               .tex = TFMT_NONE, \
                .rb = RB_ ## rbfmt, \
                .swap = swapfmt \
        }
@@ -295,7 +293,7 @@ enum a3xx_vtx_fmt
 fd3_pipe2vtx(enum pipe_format format)
 {
        if (!formats[format].present)
-               return ~0;
+               return VFMT_NONE;
        return formats[format].vtx;
 }
 
@@ -303,7 +301,7 @@ enum a3xx_tex_fmt
 fd3_pipe2tex(enum pipe_format format)
 {
        if (!formats[format].present)
-               return ~0;
+               return TFMT_NONE;
        return formats[format].tex;
 }
 
@@ -311,7 +309,7 @@ enum a3xx_color_fmt
 fd3_pipe2color(enum pipe_format format)
 {
        if (!formats[format].present)
-               return ~0;
+               return RB_NONE;
        return formats[format].rb;
 }
 
index 0a58c16abc6d04d676253d3ca53cf71b37e89025..49a7e0babec06f93c54876a1772294ea5abf35c8 100644 (file)
@@ -116,7 +116,7 @@ ok_format(enum pipe_format pfmt)
 {
        enum a3xx_color_fmt fmt = fd3_pipe2color(pfmt);
 
-       if (fmt == ~0)
+       if (fmt == RB_NONE)
                return false;
 
        switch (pfmt) {
index bdf8eaa06984a679aedba8ce30dca0e24723132e..772426c82f32c59ff9a80f4541ffa3a7b44ac555 100644 (file)
@@ -56,12 +56,12 @@ fd3_screen_is_format_supported(struct pipe_screen *pscreen,
                return false;
 
        if ((usage & PIPE_BIND_VERTEX_BUFFER) &&
-                       (fd3_pipe2vtx(format) != (enum a3xx_vtx_fmt)~0)) {
+                       (fd3_pipe2vtx(format) != VFMT_NONE)) {
                retval |= PIPE_BIND_VERTEX_BUFFER;
        }
 
        if ((usage & PIPE_BIND_SAMPLER_VIEW) &&
-                       (fd3_pipe2tex(format) != (enum a3xx_tex_fmt)~0)) {
+                       (fd3_pipe2tex(format) != TFMT_NONE)) {
                retval |= PIPE_BIND_SAMPLER_VIEW;
        }
 
@@ -70,8 +70,8 @@ fd3_screen_is_format_supported(struct pipe_screen *pscreen,
                                PIPE_BIND_SCANOUT |
                                PIPE_BIND_SHARED |
                                PIPE_BIND_BLENDABLE)) &&
-                       (fd3_pipe2color(format) != (enum a3xx_color_fmt)~0) &&
-                       (fd3_pipe2tex(format) != (enum a3xx_tex_fmt)~0)) {
+                       (fd3_pipe2color(format) != RB_NONE) &&
+                       (fd3_pipe2tex(format) != TFMT_NONE)) {
                retval |= usage & (PIPE_BIND_RENDER_TARGET |
                                PIPE_BIND_DISPLAY_TARGET |
                                PIPE_BIND_SCANOUT |
@@ -82,7 +82,7 @@ fd3_screen_is_format_supported(struct pipe_screen *pscreen,
 
        if ((usage & PIPE_BIND_DEPTH_STENCIL) &&
                        (fd_pipe2depth(format) != (enum adreno_rb_depth_format)~0) &&
-                       (fd3_pipe2tex(format) != (enum a3xx_tex_fmt)~0)) {
+                       (fd3_pipe2tex(format) != TFMT_NONE)) {
                retval |= PIPE_BIND_DEPTH_STENCIL;
        }
 
index 0aff8fe3e2f19f48507467b99042dbbc886f972e..6f94733e9adbe749776989c784a05b5d0505e175 100644 (file)
@@ -437,7 +437,7 @@ fd4_emit_vertex_bufs(struct fd_ringbuffer *ring, struct fd4_emit *emit)
                        uint32_t fs = util_format_get_blocksize(pfmt);
                        uint32_t off = vb->buffer_offset + elem->src_offset;
                        uint32_t size = fd_bo_size(rsc->bo) - off;
-                       debug_assert(fmt != ~0);
+                       debug_assert(fmt != VFMT4_NONE);
 
 #ifdef DEBUG
                        /* see dEQP-GLES31.stress.vertex_attribute_binding.buffer_bounds.bind_vertex_buffer_offset_near_wrap_10
index a9768acb07b7485b0e5917af5f6aa98d858fa192..c41015857d63402cdee7f31947f55908f2f2b341 100644 (file)
@@ -42,8 +42,6 @@ struct fd4_format {
        boolean present;
 };
 
-#define RB4_NONE ~0
-
 /* vertex + texture */
 #define VT(pipe, fmt, rbfmt, swapfmt) \
        [PIPE_FORMAT_ ## pipe] = { \
@@ -58,7 +56,7 @@ struct fd4_format {
 #define _T(pipe, fmt, rbfmt, swapfmt) \
        [PIPE_FORMAT_ ## pipe] = { \
                .present = 1, \
-               .vtx = ~0, \
+               .vtx = VFMT4_NONE, \
                .tex = TFMT4_ ## fmt, \
                .rb = RB4_ ## rbfmt, \
                .swap = swapfmt \
@@ -69,7 +67,7 @@ struct fd4_format {
        [PIPE_FORMAT_ ## pipe] = { \
                .present = 1, \
                .vtx = VFMT4_ ## fmt, \
-               .tex = ~0, \
+               .tex = TFMT4_NONE, \
                .rb = RB4_ ## rbfmt, \
                .swap = swapfmt \
        }
index 7c00c3edb42c57f3e4a1af6f129f5899415b2c7b..a1d846c68c5606214062398c20389eb635719537 100644 (file)
@@ -72,7 +72,7 @@ ok_format(enum pipe_format fmt)
                break;
        }
 
-       if (fd5_pipe2color(fmt) == ~0)
+       if (fd5_pipe2color(fmt) == RB5_NONE)
                return false;
 
        return true;
index ac8a5f59df0f46255bb369d929483075cd101043..3670cba0aaeb475a282ca51b47b256bba0789905 100644 (file)
@@ -492,7 +492,7 @@ fd5_emit_vertex_bufs(struct fd_ringbuffer *ring, struct fd5_emit *emit)
                        bool isint = util_format_is_pure_integer(pfmt);
                        uint32_t off = vb->buffer_offset + elem->src_offset;
                        uint32_t size = fd_bo_size(rsc->bo) - off;
-                       debug_assert(fmt != ~0);
+                       debug_assert(fmt != VFMT5_NONE);
 
 #ifdef DEBUG
                        /* see dEQP-GLES31.stress.vertex_attribute_binding.buffer_bounds.bind_vertex_buffer_offset_near_wrap_10
index 3686f1633f1348218efacdb8235776209788d02e..a201b64402f063bf5a03a551d45381e72ffeba47 100644 (file)
@@ -42,8 +42,6 @@ struct fd5_format {
        boolean present;
 };
 
-#define RB5_NONE ~0
-
 /* vertex + texture */
 #define VT(pipe, fmt, rbfmt, swapfmt) \
        [PIPE_FORMAT_ ## pipe] = { \
@@ -58,7 +56,7 @@ struct fd5_format {
 #define _T(pipe, fmt, rbfmt, swapfmt) \
        [PIPE_FORMAT_ ## pipe] = { \
                .present = 1, \
-               .vtx = ~0, \
+               .vtx = VFMT5_NONE, \
                .tex = TFMT5_ ## fmt, \
                .rb = RB5_ ## rbfmt, \
                .swap = swapfmt \
@@ -69,7 +67,7 @@ struct fd5_format {
        [PIPE_FORMAT_ ## pipe] = { \
                .present = 1, \
                .vtx = VFMT5_ ## fmt, \
-               .tex = ~0, \
+               .tex = TFMT5_NONE, \
                .rb = RB5_ ## rbfmt, \
                .swap = swapfmt \
        }
@@ -344,7 +342,7 @@ enum a5xx_vtx_fmt
 fd5_pipe2vtx(enum pipe_format format)
 {
        if (!formats[format].present)
-               return ~0;
+               return VFMT5_NONE;
        return formats[format].vtx;
 }
 
@@ -353,7 +351,7 @@ enum a5xx_tex_fmt
 fd5_pipe2tex(enum pipe_format format)
 {
        if (!formats[format].present)
-               return ~0;
+               return TFMT5_NONE;
        return formats[format].tex;
 }
 
@@ -362,7 +360,7 @@ enum a5xx_color_fmt
 fd5_pipe2color(enum pipe_format format)
 {
        if (!formats[format].present)
-               return ~0;
+               return RB5_NONE;
        return formats[format].rb;
 }
 
index 12dcb8a6e8014bec63bcf425e8f6099ed2d1d1bb..9a4df4d26fbc5bcbfb4d12043b0ce81b2ebf39cc 100644 (file)
@@ -71,12 +71,12 @@ fd5_screen_is_format_supported(struct pipe_screen *pscreen,
                return false;
 
        if ((usage & PIPE_BIND_VERTEX_BUFFER) &&
-                       (fd5_pipe2vtx(format) != (enum a5xx_vtx_fmt)~0)) {
+                       (fd5_pipe2vtx(format) != VFMT5_NONE)) {
                retval |= PIPE_BIND_VERTEX_BUFFER;
        }
 
        if ((usage & (PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_SHADER_IMAGE)) &&
-                       (fd5_pipe2tex(format) != (enum a5xx_tex_fmt)~0) &&
+                       (fd5_pipe2tex(format) != TFMT5_NONE) &&
                        (target == PIPE_BUFFER ||
                         util_format_get_blocksize(format) != 12)) {
                retval |= usage & (PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_SHADER_IMAGE);
@@ -87,8 +87,8 @@ fd5_screen_is_format_supported(struct pipe_screen *pscreen,
                                PIPE_BIND_SCANOUT |
                                PIPE_BIND_SHARED |
                                PIPE_BIND_COMPUTE_RESOURCE)) &&
-                       (fd5_pipe2color(format) != (enum a5xx_color_fmt)~0) &&
-                       (fd5_pipe2tex(format) != (enum a5xx_tex_fmt)~0)) {
+                       (fd5_pipe2color(format) != RB5_NONE) &&
+                       (fd5_pipe2tex(format) != TFMT5_NONE)) {
                retval |= usage & (PIPE_BIND_RENDER_TARGET |
                                PIPE_BIND_DISPLAY_TARGET |
                                PIPE_BIND_SCANOUT |
@@ -103,7 +103,7 @@ fd5_screen_is_format_supported(struct pipe_screen *pscreen,
 
        if ((usage & PIPE_BIND_DEPTH_STENCIL) &&
                        (fd5_pipe2depth(format) != (enum a5xx_depth_format)~0) &&
-                       (fd5_pipe2tex(format) != (enum a5xx_tex_fmt)~0)) {
+                       (fd5_pipe2tex(format) != TFMT5_NONE)) {
                retval |= PIPE_BIND_DEPTH_STENCIL;
        }
 
index 9b5231d55e3d76e8f35875da8eb2305cdc8047cb..7bf9679e93dc5a88bd97815fb7ba301fd178978d 100644 (file)
@@ -77,7 +77,7 @@ ok_format(enum pipe_format pfmt)
                break;
        }
 
-       if (fmt == ~0)
+       if (fmt == FMT6_NONE)
                return false;
 
        if (fd6_ifmt(fmt) == 0)
index 52a44c67535605c83453e5a00e28fb1c7d906a1a..23941873edb3a76dffa3ebb5472e7188c10a3b85 100644 (file)
@@ -608,7 +608,7 @@ build_vbo_state(struct fd6_emit *emit, const struct ir3_shader_variant *vp)
                enum pipe_format pfmt = elem->src_format;
                enum a6xx_format fmt = fd6_pipe2vtx(pfmt);
                bool isint = util_format_is_pure_integer(pfmt);
-               debug_assert(fmt != ~0);
+               debug_assert(fmt != FMT6_NONE);
 
                OUT_RING(ring, A6XX_VFD_DECODE_INSTR_IDX(j) |
                                A6XX_VFD_DECODE_INSTR_FORMAT(fmt) |
index fbb1fb960a8a225ff20d8f0c47a598bb12bcde67..0cd7b397a34416c5d8bc4121b01ebba022ecfe2c 100644 (file)
@@ -44,8 +44,6 @@ struct fd6_format {
        boolean present;
 };
 
-#define FMT6_NONE ~0
-
 #define FMT(pipe, vtxfmt, texfmt, rbfmt, swapfmt) \
        [PIPE_FORMAT_ ## pipe] = { \
                .present = 1, \
@@ -341,7 +339,7 @@ enum a6xx_format
 fd6_pipe2vtx(enum pipe_format format)
 {
        if (!formats[format].present)
-               return ~0;
+               return FMT6_NONE;
        return formats[format].vtx;
 }
 
@@ -350,7 +348,7 @@ enum a6xx_format
 fd6_pipe2tex(enum pipe_format format)
 {
        if (!formats[format].present)
-               return ~0;
+               return FMT6_NONE;
        return formats[format].tex;
 }
 
@@ -359,7 +357,7 @@ enum a6xx_format
 fd6_pipe2color(enum pipe_format format)
 {
        if (!formats[format].present)
-               return ~0;
+               return FMT6_NONE;
        return formats[format].rb;
 }
 
index 20383d4ff48ea8b2dafb7a99cb96b2f754585ab1..bb467112ed02dfe52f98f57e628a982b755c99e1 100644 (file)
@@ -77,12 +77,12 @@ fd6_screen_is_format_supported(struct pipe_screen *pscreen,
                return false;
 
        if ((usage & PIPE_BIND_VERTEX_BUFFER) &&
-                       (fd6_pipe2vtx(format) != (enum a6xx_format)~0)) {
+                       (fd6_pipe2vtx(format) != FMT6_NONE)) {
                retval |= PIPE_BIND_VERTEX_BUFFER;
        }
 
        if ((usage & (PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_SHADER_IMAGE)) &&
-                       (fd6_pipe2tex(format) != (enum a6xx_format)~0) &&
+                       (fd6_pipe2tex(format) != FMT6_NONE) &&
                        (target == PIPE_BUFFER ||
                         util_format_get_blocksize(format) != 12)) {
                retval |= usage & (PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_SHADER_IMAGE);
@@ -93,8 +93,8 @@ fd6_screen_is_format_supported(struct pipe_screen *pscreen,
                                PIPE_BIND_SCANOUT |
                                PIPE_BIND_SHARED |
                                PIPE_BIND_COMPUTE_RESOURCE)) &&
-                       (fd6_pipe2color(format) != (enum a6xx_format)~0) &&
-                       (fd6_pipe2tex(format) != (enum a6xx_format)~0)) {
+                       (fd6_pipe2color(format) != FMT6_NONE) &&
+                       (fd6_pipe2tex(format) != FMT6_NONE)) {
                retval |= usage & (PIPE_BIND_RENDER_TARGET |
                                PIPE_BIND_DISPLAY_TARGET |
                                PIPE_BIND_SCANOUT |
@@ -109,7 +109,7 @@ fd6_screen_is_format_supported(struct pipe_screen *pscreen,
 
        if ((usage & PIPE_BIND_DEPTH_STENCIL) &&
                        (fd6_pipe2depth(format) != (enum a6xx_depth_format)~0) &&
-                       (fd6_pipe2tex(format) != (enum a6xx_format)~0)) {
+                       (fd6_pipe2tex(format) != FMT6_NONE)) {
                retval |= PIPE_BIND_DEPTH_STENCIL;
        }