diff --git a/src/freedreno/fdl/fd6_format_table.h b/src/freedreno/fdl/fd6_format_table.h index dc88f186494..de5de8aea92 100644 --- a/src/freedreno/fdl/fd6_format_table.h +++ b/src/freedreno/fdl/fd6_format_table.h @@ -35,6 +35,18 @@ #include "adreno_common.xml.h" #include "a6xx.xml.h" +static inline enum a6xx_tex_swiz +fdl6_swiz(unsigned char swiz) +{ + STATIC_ASSERT((unsigned) A6XX_TEX_X == (unsigned) PIPE_SWIZZLE_X); + STATIC_ASSERT((unsigned) A6XX_TEX_Y == (unsigned) PIPE_SWIZZLE_Y); + STATIC_ASSERT((unsigned) A6XX_TEX_Z == (unsigned) PIPE_SWIZZLE_Z); + STATIC_ASSERT((unsigned) A6XX_TEX_W == (unsigned) PIPE_SWIZZLE_W); + STATIC_ASSERT((unsigned) A6XX_TEX_ZERO == (unsigned) PIPE_SWIZZLE_0); + STATIC_ASSERT((unsigned) A6XX_TEX_ONE == (unsigned) PIPE_SWIZZLE_1); + return (enum a6xx_tex_swiz) swiz; +} + enum a6xx_depth_format fd6_pipe2depth(enum pipe_format format); enum a6xx_format fd6_vertex_format(enum pipe_format format) ATTRIBUTE_CONST; diff --git a/src/freedreno/fdl/fd6_view.c b/src/freedreno/fdl/fd6_view.c index 00b35ea280d..59e9e913d96 100644 --- a/src/freedreno/fdl/fd6_view.c +++ b/src/freedreno/fdl/fd6_view.c @@ -29,18 +29,6 @@ #include "freedreno_layout.h" #include "fd6_format_table.h" -static enum a6xx_tex_swiz -fdl6_swiz(unsigned char swiz) -{ - STATIC_ASSERT((unsigned) A6XX_TEX_X == (unsigned) PIPE_SWIZZLE_X); - STATIC_ASSERT((unsigned) A6XX_TEX_Y == (unsigned) PIPE_SWIZZLE_Y); - STATIC_ASSERT((unsigned) A6XX_TEX_Z == (unsigned) PIPE_SWIZZLE_Z); - STATIC_ASSERT((unsigned) A6XX_TEX_W == (unsigned) PIPE_SWIZZLE_W); - STATIC_ASSERT((unsigned) A6XX_TEX_ZERO == (unsigned) PIPE_SWIZZLE_0); - STATIC_ASSERT((unsigned) A6XX_TEX_ONE == (unsigned) PIPE_SWIZZLE_1); - return (enum a6xx_tex_swiz) swiz; -} - static enum a6xx_tex_type fdl6_tex_type(enum fdl_view_type type, bool storage) { diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_blend.c b/src/gallium/drivers/freedreno/a6xx/fd6_blend.c index 7c2f2193d76..e62d1a863e5 100644 --- a/src/gallium/drivers/freedreno/a6xx/fd6_blend.c +++ b/src/gallium/drivers/freedreno/a6xx/fd6_blend.c @@ -33,7 +33,6 @@ #include "fd6_blend.h" #include "fd6_context.h" -#include "fd6_format.h" #include "fd6_pack.h" // XXX move somewhere common.. same across a3xx/a4xx/a5xx.. diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_blitter.c b/src/gallium/drivers/freedreno/a6xx/fd6_blitter.c index 542eb36688b..9d381967674 100644 --- a/src/gallium/drivers/freedreno/a6xx/fd6_blitter.c +++ b/src/gallium/drivers/freedreno/a6xx/fd6_blitter.c @@ -37,7 +37,6 @@ #include "fd6_blitter.h" #include "fd6_emit.h" -#include "fd6_format.h" #include "fd6_resource.h" static inline enum a6xx_2d_ifmt diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_draw.c b/src/gallium/drivers/freedreno/a6xx/fd6_draw.c index c3ebcc051c1..87e3b43047f 100644 --- a/src/gallium/drivers/freedreno/a6xx/fd6_draw.c +++ b/src/gallium/drivers/freedreno/a6xx/fd6_draw.c @@ -36,7 +36,6 @@ #include "fd6_context.h" #include "fd6_draw.h" #include "fd6_emit.h" -#include "fd6_format.h" #include "fd6_program.h" #include "fd6_vsc.h" #include "fd6_zsa.h" diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_emit.c b/src/gallium/drivers/freedreno/a6xx/fd6_emit.c index 0a88e62232b..97556541cb8 100644 --- a/src/gallium/drivers/freedreno/a6xx/fd6_emit.c +++ b/src/gallium/drivers/freedreno/a6xx/fd6_emit.c @@ -42,7 +42,6 @@ #include "fd6_const.h" #include "fd6_context.h" #include "fd6_emit.h" -#include "fd6_format.h" #include "fd6_image.h" #include "fd6_pack.h" #include "fd6_program.h" diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_emit.h b/src/gallium/drivers/freedreno/a6xx/fd6_emit.h index 6a4d170504f..27b4b4f70fa 100644 --- a/src/gallium/drivers/freedreno/a6xx/fd6_emit.h +++ b/src/gallium/drivers/freedreno/a6xx/fd6_emit.h @@ -31,8 +31,8 @@ #include "pipe/p_context.h" #include "fd6_context.h" -#include "fd6_format.h" #include "fd6_program.h" +#include "fdl/fd6_format_table.h" #include "freedreno_context.h" #include "ir3_gallium.h" diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_format.c b/src/gallium/drivers/freedreno/a6xx/fd6_format.c deleted file mode 100644 index 021d5f5281c..00000000000 --- a/src/gallium/drivers/freedreno/a6xx/fd6_format.c +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (C) 2016 Rob Clark - * Copyright © 2018 Google, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * Authors: - * Rob Clark - */ - -#include "pipe/p_defines.h" -#include "util/format/u_format.h" - -#include "fd6_format.h" -#include "freedreno_resource.h" - -enum a6xx_tex_swiz -fd6_pipe2swiz(unsigned swiz) -{ - switch (swiz) { - default: - case PIPE_SWIZZLE_X: - return A6XX_TEX_X; - case PIPE_SWIZZLE_Y: - return A6XX_TEX_Y; - case PIPE_SWIZZLE_Z: - return A6XX_TEX_Z; - case PIPE_SWIZZLE_W: - return A6XX_TEX_W; - case PIPE_SWIZZLE_0: - return A6XX_TEX_ZERO; - case PIPE_SWIZZLE_1: - return A6XX_TEX_ONE; - } -} - diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_format.h b/src/gallium/drivers/freedreno/a6xx/fd6_format.h deleted file mode 100644 index cde24f1845d..00000000000 --- a/src/gallium/drivers/freedreno/a6xx/fd6_format.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (C) 2016 Rob Clark - * Copyright © 2018 Google, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * Authors: - * Rob Clark - */ - -#ifndef FD6_UTIL_H_ -#define FD6_UTIL_H_ - -#include "fdl/fd6_format_table.h" -#include "freedreno_resource.h" -#include "freedreno_util.h" - -#include "a6xx.xml.h" - -enum a6xx_tex_swiz fd6_pipe2swiz(unsigned swiz); - -#endif /* FD6_UTIL_H_ */ diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_gmem.c b/src/gallium/drivers/freedreno/a6xx/fd6_gmem.c index a8d9ab84e28..74b7dbdebb4 100644 --- a/src/gallium/drivers/freedreno/a6xx/fd6_gmem.c +++ b/src/gallium/drivers/freedreno/a6xx/fd6_gmem.c @@ -42,7 +42,6 @@ #include "fd6_context.h" #include "fd6_draw.h" #include "fd6_emit.h" -#include "fd6_format.h" #include "fd6_gmem.h" #include "fd6_pack.h" #include "fd6_program.h" @@ -278,10 +277,10 @@ patch_fb_read_gmem(struct fd_batch *batch) A6XX_TEX_CONST_0_SWAP(WZYX) | A6XX_TEX_CONST_0_TILE_MODE(TILE6_2) | COND(util_format_is_srgb(format), A6XX_TEX_CONST_0_SRGB) | - A6XX_TEX_CONST_0_SWIZ_X(fd6_pipe2swiz(swiz[0])) | - A6XX_TEX_CONST_0_SWIZ_Y(fd6_pipe2swiz(swiz[1])) | - A6XX_TEX_CONST_0_SWIZ_Z(fd6_pipe2swiz(swiz[2])) | - A6XX_TEX_CONST_0_SWIZ_W(fd6_pipe2swiz(swiz[3])); + A6XX_TEX_CONST_0_SWIZ_X(fdl6_swiz(swiz[0])) | + A6XX_TEX_CONST_0_SWIZ_Y(fdl6_swiz(swiz[1])) | + A6XX_TEX_CONST_0_SWIZ_Z(fdl6_swiz(swiz[2])) | + A6XX_TEX_CONST_0_SWIZ_W(fdl6_swiz(swiz[3])); for (unsigned i = 0; i < num_patches; i++) { struct fd_cs_patch *patch = fd_patch_element(&batch->fb_read_patches, i); diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_image.c b/src/gallium/drivers/freedreno/a6xx/fd6_image.c index 23c39a3424f..64a2ca2e650 100644 --- a/src/gallium/drivers/freedreno/a6xx/fd6_image.c +++ b/src/gallium/drivers/freedreno/a6xx/fd6_image.c @@ -30,7 +30,6 @@ #include "freedreno_resource.h" #include "freedreno_state.h" -#include "fd6_format.h" #include "fd6_image.h" #include "fd6_resource.h" #include "fd6_texture.h" diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_program.c b/src/gallium/drivers/freedreno/a6xx/fd6_program.c index 202a47d3662..5ddc48152f5 100644 --- a/src/gallium/drivers/freedreno/a6xx/fd6_program.c +++ b/src/gallium/drivers/freedreno/a6xx/fd6_program.c @@ -36,7 +36,6 @@ #include "fd6_const.h" #include "fd6_emit.h" -#include "fd6_format.h" #include "fd6_pack.h" #include "fd6_program.h" #include "fd6_texture.h" diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_query.c b/src/gallium/drivers/freedreno/a6xx/fd6_query.c index d95b4023a1f..4171ac4cec5 100644 --- a/src/gallium/drivers/freedreno/a6xx/fd6_query.c +++ b/src/gallium/drivers/freedreno/a6xx/fd6_query.c @@ -32,7 +32,6 @@ #include "fd6_context.h" #include "fd6_emit.h" -#include "fd6_format.h" #include "fd6_query.h" struct PACKED fd6_query_sample { diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_rasterizer.c b/src/gallium/drivers/freedreno/a6xx/fd6_rasterizer.c index d72fb46d9d0..6f42dad6558 100644 --- a/src/gallium/drivers/freedreno/a6xx/fd6_rasterizer.c +++ b/src/gallium/drivers/freedreno/a6xx/fd6_rasterizer.c @@ -30,7 +30,6 @@ #include "util/u_string.h" #include "fd6_context.h" -#include "fd6_format.h" #include "fd6_pack.h" #include "fd6_rasterizer.h" diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_resource.c b/src/gallium/drivers/freedreno/a6xx/fd6_resource.c index 190d3322e72..f13ef134f81 100644 --- a/src/gallium/drivers/freedreno/a6xx/fd6_resource.c +++ b/src/gallium/drivers/freedreno/a6xx/fd6_resource.c @@ -27,8 +27,8 @@ #include "drm-uapi/drm_fourcc.h" -#include "fd6_format.h" #include "fd6_resource.h" +#include "fdl/fd6_format_table.h" #include "a6xx.xml.h" diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_screen.c b/src/gallium/drivers/freedreno/a6xx/fd6_screen.c index d2d73da900e..2a339da931c 100644 --- a/src/gallium/drivers/freedreno/a6xx/fd6_screen.c +++ b/src/gallium/drivers/freedreno/a6xx/fd6_screen.c @@ -32,7 +32,6 @@ #include "fd6_blitter.h" #include "fd6_context.h" #include "fd6_emit.h" -#include "fd6_format.h" #include "fd6_resource.h" #include "fd6_screen.h" diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_texture.c b/src/gallium/drivers/freedreno/a6xx/fd6_texture.c index f60cc3473c8..72551513738 100644 --- a/src/gallium/drivers/freedreno/a6xx/fd6_texture.c +++ b/src/gallium/drivers/freedreno/a6xx/fd6_texture.c @@ -34,7 +34,6 @@ #include "freedreno_dev_info.h" #include "fd6_emit.h" -#include "fd6_format.h" #include "fd6_resource.h" #include "fd6_texture.h" diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_texture.h b/src/gallium/drivers/freedreno/a6xx/fd6_texture.h index 6882aaa639f..6962e533bf2 100644 --- a/src/gallium/drivers/freedreno/a6xx/fd6_texture.h +++ b/src/gallium/drivers/freedreno/a6xx/fd6_texture.h @@ -34,7 +34,7 @@ #include "freedreno_texture.h" #include "fd6_context.h" -#include "fd6_format.h" +#include "fdl/fd6_format_table.h" struct fd6_sampler_stateobj { struct pipe_sampler_state base; diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_zsa.c b/src/gallium/drivers/freedreno/a6xx/fd6_zsa.c index cc06b344e65..a00ad61c403 100644 --- a/src/gallium/drivers/freedreno/a6xx/fd6_zsa.c +++ b/src/gallium/drivers/freedreno/a6xx/fd6_zsa.c @@ -30,7 +30,6 @@ #include "util/u_string.h" #include "fd6_context.h" -#include "fd6_format.h" #include "fd6_zsa.h" /* update lza state based on stencil-test func: diff --git a/src/gallium/drivers/freedreno/meson.build b/src/gallium/drivers/freedreno/meson.build index 07ccd10825a..baddc0ae09f 100644 --- a/src/gallium/drivers/freedreno/meson.build +++ b/src/gallium/drivers/freedreno/meson.build @@ -192,8 +192,6 @@ files_libfreedreno = files( 'a6xx/fd6_draw.h', 'a6xx/fd6_emit.c', 'a6xx/fd6_emit.h', - 'a6xx/fd6_format.c', - 'a6xx/fd6_format.h', 'a6xx/fd6_gmem.c', 'a6xx/fd6_gmem.h', 'a6xx/fd6_image.c',