[Mesa-dev] [PATCH 1/2] i965: Expose the surface format table
Alejandro Piñeiro
apinheiro at igalia.com
Fri Apr 15 06:24:33 UTC 2016
On 14/04/16 20:37, Jason Ekstrand wrote:
> ---
> src/mesa/drivers/dri/i965/Makefile.sources | 1 +
> src/mesa/drivers/dri/i965/brw_surface_formats.c | 22 +++----------
> src/mesa/drivers/dri/i965/brw_surface_formats.h | 43 +++++++++++++++++++++++++
> 3 files changed, 48 insertions(+), 18 deletions(-)
> create mode 100644 src/mesa/drivers/dri/i965/brw_surface_formats.h
>
> diff --git a/src/mesa/drivers/dri/i965/Makefile.sources b/src/mesa/drivers/dri/i965/Makefile.sources
> index 2619e43..c314d74 100644
> --- a/src/mesa/drivers/dri/i965/Makefile.sources
> +++ b/src/mesa/drivers/dri/i965/Makefile.sources
> @@ -54,6 +54,7 @@ i965_compiler_FILES = \
> brw_shader.cpp \
> brw_shader.h \
> brw_surface_formats.c \
> + brw_surface_formats.h \
> brw_util.c \
> brw_util.h \
> brw_vec4_builder.h \
> diff --git a/src/mesa/drivers/dri/i965/brw_surface_formats.c b/src/mesa/drivers/dri/i965/brw_surface_formats.c
> index ba9b5b9..118b18d 100644
> --- a/src/mesa/drivers/dri/i965/brw_surface_formats.c
> +++ b/src/mesa/drivers/dri/i965/brw_surface_formats.c
> @@ -25,21 +25,7 @@
> #include "brw_context.h"
> #include "brw_state.h"
> #include "brw_defines.h"
> -
> -struct surface_format_info {
> - bool exists;
> - int sampling;
> - int filtering;
> - int shadow_compare;
> - int chroma_key;
> - int render_target;
> - int alpha_blend;
> - int input_vb;
> - int streamed_output_vb;
> - int color_processing;
> - int lossless_compression;
> - const char *name;
> -};
> +#include "brw_surface_formats.h"
>
> /* This macro allows us to write the table almost as it appears in the PRM,
> * while restructuring it to turn it into the C code we want.
> @@ -86,7 +72,7 @@ struct surface_format_info {
> * - VOL4_Part1 section 3.9.11 Render Target Write.
> * - Render Target Surface Types [SKL+]
> */
> -const struct surface_format_info surface_formats[] = {
> +const struct brw_surface_format_info surface_formats[] = {
> /* smpl filt shad CK RT AB VB SO color ccs_e */
> SF( Y, 50, x, x, Y, Y, Y, Y, x, 90, R32G32B32A32_FLOAT)
> SF( Y, x, x, x, Y, x, Y, Y, x, 90, R32G32B32A32_SINT)
> @@ -618,7 +604,7 @@ brw_init_surface_formats(struct brw_context *brw)
>
> for (format = MESA_FORMAT_NONE + 1; format < MESA_FORMAT_COUNT; format++) {
> uint32_t texture, render;
> - const struct surface_format_info *rinfo, *tinfo;
> + const struct brw_surface_format_info *rinfo, *tinfo;
> bool is_integer = _mesa_is_format_integer_color(format);
>
> render = texture = brw_format_for_mesa_format(format);
> @@ -828,7 +814,7 @@ bool
> brw_losslessly_compressible_format(const struct brw_context *brw,
> uint32_t brw_format)
> {
> - const struct surface_format_info * const sinfo =
> + const struct brw_surface_format_info * const sinfo =
> &surface_formats[brw_format];
> const int gen = brw->gen * 10;
>
> diff --git a/src/mesa/drivers/dri/i965/brw_surface_formats.h b/src/mesa/drivers/dri/i965/brw_surface_formats.h
> new file mode 100644
> index 0000000..8e4d35e
> --- /dev/null
> +++ b/src/mesa/drivers/dri/i965/brw_surface_formats.h
> @@ -0,0 +1,43 @@
> +/*
> + * Copyright © 2011 Intel Corporation
nitpick: 2016 now.
> + *
> + * 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.
> + */
> +
> +#pragma once
> +
> +#include <stdbool.h>
> +
> +struct brw_surface_format_info {
> + bool exists;
> + int sampling;
> + int filtering;
> + int shadow_compare;
> + int chroma_key;
> + int render_target;
> + int alpha_blend;
> + int input_vb;
> + int streamed_output_vb;
> + int color_processing;
> + int lossless_compression;
> + const char *name;
> +};
> +
> +extern const struct brw_surface_format_info surface_formats[];
More information about the mesa-dev
mailing list