diff options
author | Thierry Reding <treding@nvidia.com> | 2017-10-11 14:28:24 +0200 |
---|---|---|
committer | Thierry Reding <treding@nvidia.com> | 2019-08-23 18:07:23 +0200 |
commit | 574f91b08e576e8eca6879ca58ddd9242de362a0 (patch) | |
tree | 2cf76cffd66310d292b88394c4e693e0586108a8 | |
parent | 6b5860698c4d3823e9ee08efe814c8a9a4647cfb (diff) |
gallium: Add support for dumping framebuffer modifiers
Adds a simple helper that can be used to dump the name of a framebuffer
modifier for debug purposes.
Signed-off-by: Thierry Reding <treding@nvidia.com>
-rw-r--r-- | src/gallium/auxiliary/Makefile.sources | 2 | ||||
-rw-r--r-- | src/gallium/auxiliary/meson.build | 2 | ||||
-rw-r--r-- | src/gallium/auxiliary/util/u_modifier.c | 70 | ||||
-rw-r--r-- | src/gallium/auxiliary/util/u_modifier.h | 66 |
4 files changed, 140 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/Makefile.sources b/src/gallium/auxiliary/Makefile.sources index e9ef327fdcc9..0ced1c7b58e2 100644 --- a/src/gallium/auxiliary/Makefile.sources +++ b/src/gallium/auxiliary/Makefile.sources @@ -286,6 +286,8 @@ C_SOURCES := \ util/u_log.h \ util/u_mm.c \ util/u_mm.h \ + util/u_modifier.c \ + util/u_modifier.h \ util/u_network.c \ util/u_network.h \ util/u_pack_color.h \ diff --git a/src/gallium/auxiliary/meson.build b/src/gallium/auxiliary/meson.build index 4a0f69845e9d..30e95e7c1875 100644 --- a/src/gallium/auxiliary/meson.build +++ b/src/gallium/auxiliary/meson.build @@ -306,6 +306,8 @@ files_libgallium = files( 'util/u_log.h', 'util/u_mm.c', 'util/u_mm.h', + 'util/u_modifier.c', + 'util/u_modifier.h', 'util/u_network.c', 'util/u_network.h', 'util/u_pack_color.h', diff --git a/src/gallium/auxiliary/util/u_modifier.c b/src/gallium/auxiliary/util/u_modifier.c new file mode 100644 index 000000000000..2fd7f96d298c --- /dev/null +++ b/src/gallium/auxiliary/util/u_modifier.c @@ -0,0 +1,70 @@ +/************************************************************************** + * + * Copyright 2017 NVIDIA Corporation. All right reserved. + * + * 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, sub license, 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 NON-INFRINGEMENT. + * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS 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. + * + **************************************************************************/ + +#include <drm_fourcc.h> + +#include "util/u_modifier.h" + +#define UTIL_MODIFIER_DESCRIPTION(_modifier) \ + { .modifier = DRM_FORMAT_MOD_ ## _modifier, .name = "DRM_FORMAT_MOD_" # _modifier } + +#define I915_MODIFIER_DESCRIPTION(_modifier) \ + { .modifier = I915_FORMAT_MOD_ ## _modifier, .name = "I915_FORMAT_MOD_" # _modifier } + +const struct util_modifier_description util_modifier_description_table[] = { + UTIL_MODIFIER_DESCRIPTION(INVALID), + UTIL_MODIFIER_DESCRIPTION(LINEAR), + I915_MODIFIER_DESCRIPTION(X_TILED), + I915_MODIFIER_DESCRIPTION(Y_TILED), + I915_MODIFIER_DESCRIPTION(Yf_TILED), + I915_MODIFIER_DESCRIPTION(Y_TILED_CCS), + I915_MODIFIER_DESCRIPTION(Yf_TILED_CCS), + UTIL_MODIFIER_DESCRIPTION(SAMSUNG_64_32_TILE), + UTIL_MODIFIER_DESCRIPTION(VIVANTE_TILED), + UTIL_MODIFIER_DESCRIPTION(VIVANTE_SUPER_TILED), + UTIL_MODIFIER_DESCRIPTION(VIVANTE_SPLIT_TILED), + UTIL_MODIFIER_DESCRIPTION(VIVANTE_SPLIT_SUPER_TILED), + UTIL_MODIFIER_DESCRIPTION(NVIDIA_TEGRA_TILED), + UTIL_MODIFIER_DESCRIPTION(NVIDIA_16BX2_BLOCK_ONE_GOB), + UTIL_MODIFIER_DESCRIPTION(NVIDIA_16BX2_BLOCK_TWO_GOB), + UTIL_MODIFIER_DESCRIPTION(NVIDIA_16BX2_BLOCK_FOUR_GOB), + UTIL_MODIFIER_DESCRIPTION(NVIDIA_16BX2_BLOCK_EIGHT_GOB), + UTIL_MODIFIER_DESCRIPTION(NVIDIA_16BX2_BLOCK_SIXTEEN_GOB), + UTIL_MODIFIER_DESCRIPTION(NVIDIA_16BX2_BLOCK_THIRTYTWO_GOB), + UTIL_MODIFIER_DESCRIPTION(BROADCOM_VC4_T_TILED), +}; + +const struct util_modifier_description * +util_modifier_description(uint64_t modifier) +{ + unsigned int i; + + for (i = 0; i < ARRAY_SIZE(util_modifier_description_table); i++) + if (util_modifier_description_table[i].modifier == modifier) + return &util_modifier_description_table[i]; + + return NULL; +} diff --git a/src/gallium/auxiliary/util/u_modifier.h b/src/gallium/auxiliary/util/u_modifier.h new file mode 100644 index 000000000000..9882f61f07db --- /dev/null +++ b/src/gallium/auxiliary/util/u_modifier.h @@ -0,0 +1,66 @@ +/************************************************************************** + * + * Copyright 2017 NVIDIA Corporation. All right reserved. + * + * 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, sub license, 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 NON-INFRINGEMENT. + * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS 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. + * + **************************************************************************/ + +#ifndef U_MODIFIERS_H +#define U_MODIFIERS_H + +#include "util/u_debug.h" + +#ifdef __cplusplus +extern "C" { +#endif + +struct util_modifier_description +{ + uint64_t modifier; + const char *name; +}; + +extern const struct util_modifier_description +util_modifier_description_table[]; + +const struct util_modifier_description * +util_modifier_description(uint64_t modifier); + +static inline const char * +util_modifier_name(uint64_t modifier) +{ + const struct util_modifier_description *desc; + + desc = util_modifier_description(modifier); + assert(desc); + + if (!desc) + return "DRM_FORMAT_MOD_???"; + + return desc->name; +} + +#ifdef __cplusplus +} // extern "C" { +#endif + +#endif /* !U_MODIFIERS_H */ |