[Mesa-dev] [PATCH 1/2] panfrost: Initial stub for Panfrost driver
Rob Clark
robdclark at gmail.com
Thu Jan 31 18:40:24 UTC 2019
On Wed, Jan 30, 2019 at 12:43 AM Alyssa Rosenzweig <alyssa at rosenzweig.io> wrote:
>
> This patch adds an initial stub for the Gallium driver, containing
> simple screen functions and the majority of the driver headers but no
> actual functionality. It further adds the winsys glue for linking in
> this stub driver via kmsro on Rockchip/Amlogic boards.
>
> Signed-off-by: Alyssa Rosenzweig <alyssa at rosenzweig.io>
> ---
> meson.build | 7 +-
> meson_options.txt | 2 +-
> .../auxiliary/pipe-loader/pipe_loader_drm.c | 5 +
> .../auxiliary/target-helpers/drm_helper.h | 23 +
> .../target-helpers/drm_helper_public.h | 3 +
> src/gallium/drivers/panfrost/.editorconfig | 3 +
> .../drivers/panfrost/include/meson.build | 0
> .../drivers/panfrost/include/panfrost-job.h | 1481 +++++++++++++++++
> .../drivers/panfrost/include/panfrost-misc.h | 47 +
> src/gallium/drivers/panfrost/meson.build | 52 +
> src/gallium/drivers/panfrost/pan_allocate.h | 123 ++
> src/gallium/drivers/panfrost/pan_context.h | 362 ++++
> src/gallium/drivers/panfrost/pan_public.h | 41 +
> src/gallium/drivers/panfrost/pan_resource.h | 85 +
> src/gallium/drivers/panfrost/pan_screen.c | 702 ++++++++
> src/gallium/drivers/panfrost/pan_screen.h | 88 +
> src/gallium/meson.build | 6 +
> src/gallium/targets/dri/meson.build | 5 +-
> src/gallium/targets/dri/target.c | 10 +
> .../winsys/kmsro/drm/kmsro_drm_winsys.c | 25 +
> src/gallium/winsys/kmsro/drm/meson.build | 3 +
> src/gallium/winsys/panfrost/drm/Android.mk | 33 +
> src/gallium/winsys/panfrost/drm/Makefile.am | 33 +
> .../winsys/panfrost/drm/Makefile.sources | 3 +
> src/gallium/winsys/panfrost/drm/meson.build | 29 +
> .../winsys/panfrost/drm/panfrost_drm_public.h | 36 +
> .../winsys/panfrost/drm/panfrost_drm_winsys.c | 42 +
> 27 files changed, 3244 insertions(+), 5 deletions(-)
> create mode 100644 src/gallium/drivers/panfrost/.editorconfig
> create mode 100644 src/gallium/drivers/panfrost/include/meson.build
> create mode 100644 src/gallium/drivers/panfrost/include/panfrost-job.h
> create mode 100644 src/gallium/drivers/panfrost/include/panfrost-misc.h
> create mode 100644 src/gallium/drivers/panfrost/meson.build
> create mode 100644 src/gallium/drivers/panfrost/pan_allocate.h
> create mode 100644 src/gallium/drivers/panfrost/pan_context.h
> create mode 100644 src/gallium/drivers/panfrost/pan_public.h
> create mode 100644 src/gallium/drivers/panfrost/pan_resource.h
> create mode 100644 src/gallium/drivers/panfrost/pan_screen.c
> create mode 100644 src/gallium/drivers/panfrost/pan_screen.h
> create mode 100644 src/gallium/winsys/panfrost/drm/Android.mk
> create mode 100644 src/gallium/winsys/panfrost/drm/Makefile.am
> create mode 100644 src/gallium/winsys/panfrost/drm/Makefile.sources
> create mode 100644 src/gallium/winsys/panfrost/drm/meson.build
> create mode 100644 src/gallium/winsys/panfrost/drm/panfrost_drm_public.h
> create mode 100644 src/gallium/winsys/panfrost/drm/panfrost_drm_winsys.c
>
[snip]
> diff --git a/src/gallium/drivers/panfrost/include/panfrost-job.h b/src/gallium/drivers/panfrost/include/panfrost-job.h
> new file mode 100644
> index 0000000000..dbb5486bfa
> --- /dev/null
> +++ b/src/gallium/drivers/panfrost/include/panfrost-job.h
> @@ -0,0 +1,1481 @@
> +/*
> + * © Copyright 2017-2018 Alyssa Rosenzweig
> + * © Copyright 2017-2018 Connor Abbott
> + * © Copyright 2017-2018 Lyude Paul
> + *
> + * 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.
> + *
> + */
> +
> +#ifndef __PANFROST_JOB_H__
> +#define __PANFROST_JOB_H__
> +
> +#include <stdint.h>
> +#include <panfrost-misc.h>
> +
> +#define T8XX
> +
> +#define MALI_SHORT_PTR_BITS (sizeof(uintptr_t)*8)
> +
> +#define MALI_FBD_HIERARCHY_WEIGHTS 8
> +
> +#define MALI_PAYLOAD_SIZE 256
> +
> +typedef u32 mali_jd_core_req;
> +
> +enum mali_job_type {
> + JOB_NOT_STARTED = 0,
> + JOB_TYPE_NULL = 1,
> + JOB_TYPE_SET_VALUE = 2,
> + JOB_TYPE_CACHE_FLUSH = 3,
> + JOB_TYPE_COMPUTE = 4,
> + JOB_TYPE_VERTEX = 5,
> + JOB_TYPE_GEOMETRY = 6,
> + JOB_TYPE_TILER = 7,
> + JOB_TYPE_FUSED = 8,
> + JOB_TYPE_FRAGMENT = 9,
> +};
> +
> +enum mali_draw_mode {
> + MALI_DRAW_NONE = 0x0,
> + MALI_POINTS = 0x1,
> + MALI_LINES = 0x2,
> + MALI_LINE_STRIP = 0x4,
> + MALI_LINE_LOOP = 0x6,
> + MALI_TRIANGLES = 0x8,
> + MALI_TRIANGLE_STRIP = 0xA,
> + MALI_TRIANGLE_FAN = 0xC,
> + MALI_POLYGON = 0xD,
> + MALI_QUADS = 0xE,
> + MALI_QUAD_STRIP = 0xF,
> +
> + /* All other modes invalid */
> +};
> +
> +/* Applies to tiler_gl_enables */
> +
> +#define MALI_CULL_FACE_BACK 0x80
> +#define MALI_CULL_FACE_FRONT 0x40
> +
> +#define MALI_FRONT_FACE(v) (v << 5)
> +#define MALI_CCW (0)
> +#define MALI_CW (1)
> +
> +#define MALI_OCCLUSION_BOOLEAN 0x8
> +
> +/* TODO: Might this actually be a finer bitfield? */
> +#define MALI_DEPTH_STENCIL_ENABLE 0x6400
> +
> +#define DS_ENABLE(field) \
> + (field == MALI_DEPTH_STENCIL_ENABLE) \
> + ? "MALI_DEPTH_STENCIL_ENABLE" \
> + : (field == 0) ? "0" \
> + : "0 /* XXX: Unknown, check hexdump */"
> +
> +/* Used in stencil and depth tests */
> +
> +enum mali_func {
> + MALI_FUNC_NEVER = 0,
> + MALI_FUNC_LESS = 1,
> + MALI_FUNC_EQUAL = 2,
> + MALI_FUNC_LEQUAL = 3,
> + MALI_FUNC_GREATER = 4,
> + MALI_FUNC_NOTEQUAL = 5,
> + MALI_FUNC_GEQUAL = 6,
> + MALI_FUNC_ALWAYS = 7
> +};
> +
> +/* Same OpenGL, but mixed up. Why? Because forget me, that's why! */
> +
> +enum mali_alt_func {
> + MALI_ALT_FUNC_NEVER = 0,
> + MALI_ALT_FUNC_GREATER = 1,
> + MALI_ALT_FUNC_EQUAL = 2,
> + MALI_ALT_FUNC_GEQUAL = 3,
> + MALI_ALT_FUNC_LESS = 4,
> + MALI_ALT_FUNC_NOTEQUAL = 5,
> + MALI_ALT_FUNC_LEQUAL = 6,
> + MALI_ALT_FUNC_ALWAYS = 7
> +};
> +
> +/* Flags apply to unknown2_3? */
> +
> +#define MALI_HAS_MSAA (1 << 0)
> +#define MALI_CAN_DISCARD (1 << 5)
> +
> +/* Applies on T6XX, specifying that programmable blending is in use */
> +#define MALI_HAS_BLEND_SHADER (1 << 6)
> +
> +/* func is mali_func */
> +#define MALI_DEPTH_FUNC(func) (func << 8)
> +#define MALI_GET_DEPTH_FUNC(flags) ((flags >> 8) & 0x7)
> +#define MALI_DEPTH_FUNC_MASK MALI_DEPTH_FUNC(0x7)
> +
> +#define MALI_DEPTH_TEST (1 << 11)
> +
> +/* Next flags to unknown2_4 */
> +#define MALI_STENCIL_TEST (1 << 0)
> +
> +/* What?! */
> +#define MALI_SAMPLE_ALPHA_TO_COVERAGE_NO_BLEND_SHADER (1 << 1)
> +
> +#define MALI_NO_DITHER (1 << 9)
> +#define MALI_DEPTH_RANGE_A (1 << 12)
> +#define MALI_DEPTH_RANGE_B (1 << 13)
> +#define MALI_NO_MSAA (1 << 14)
> +
> +/* Stencil test state is all encoded in a single u32, just with a lot of
> + * enums... */
> +
> +enum mali_stencil_op {
> + MALI_STENCIL_KEEP = 0,
> + MALI_STENCIL_REPLACE = 1,
> + MALI_STENCIL_ZERO = 2,
> + MALI_STENCIL_INVERT = 3,
> + MALI_STENCIL_INCR_WRAP = 4,
> + MALI_STENCIL_DECR_WRAP = 5,
> + MALI_STENCIL_INCR = 6,
> + MALI_STENCIL_DECR = 7
> +};
> +
> +struct mali_stencil_test {
> + unsigned ref : 8;
> + unsigned mask : 8;
> + enum mali_func func : 3;
> + enum mali_stencil_op sfail : 3;
> + enum mali_stencil_op dpfail : 3;
> + enum mali_stencil_op dppass : 3;
> + unsigned zero : 4;
> +} __attribute__((packed));
> +
> +/* Blending is a mess, since anything fancy triggers a blend shader, and
> + * -those- are not understood whatsover yet */
> +
> +#define MALI_MASK_R (1 << 0)
> +#define MALI_MASK_G (1 << 1)
> +#define MALI_MASK_B (1 << 2)
> +#define MALI_MASK_A (1 << 3)
> +
> +enum mali_nondominant_mode {
> + MALI_BLEND_NON_MIRROR = 0,
> + MALI_BLEND_NON_ZERO = 1
> +};
> +
> +enum mali_dominant_blend {
> + MALI_BLEND_DOM_SOURCE = 0,
> + MALI_BLEND_DOM_DESTINATION = 1
> +};
> +
> +enum mali_dominant_factor {
> + MALI_DOMINANT_UNK0 = 0,
> + MALI_DOMINANT_ZERO = 1,
> + MALI_DOMINANT_SRC_COLOR = 2,
> + MALI_DOMINANT_DST_COLOR = 3,
> + MALI_DOMINANT_UNK4 = 4,
> + MALI_DOMINANT_SRC_ALPHA = 5,
> + MALI_DOMINANT_DST_ALPHA = 6,
> + MALI_DOMINANT_CONSTANT = 7,
> +};
> +
> +enum mali_blend_modifier {
> + MALI_BLEND_MOD_UNK0 = 0,
> + MALI_BLEND_MOD_NORMAL = 1,
> + MALI_BLEND_MOD_SOURCE_ONE = 2,
> + MALI_BLEND_MOD_DEST_ONE = 3,
> +};
> +
> +struct mali_blend_mode {
> + enum mali_blend_modifier clip_modifier : 2;
> + unsigned unused_0 : 1;
> + unsigned negate_source : 1;
> +
> + enum mali_dominant_blend dominant : 1;
> +
> + enum mali_nondominant_mode nondominant_mode : 1;
> +
> + unsigned unused_1 : 1;
> +
> + unsigned negate_dest : 1;
> +
> + enum mali_dominant_factor dominant_factor : 3;
> + unsigned complement_dominant : 1;
> +} __attribute__((packed));
> +
> +struct mali_blend_equation {
> + /* Of type mali_blend_mode */
> + unsigned rgb_mode : 12;
> + unsigned alpha_mode : 12;
> +
> + unsigned zero1 : 4;
> +
> + /* Corresponds to MALI_MASK_* above and glColorMask arguments */
> +
> + unsigned color_mask : 4;
> +
> + /* Attached constant for CONSTANT_ALPHA, etc */
> +
> +#ifndef BIFROST
> + float constant;
> +#endif
> +} __attribute__((packed));
> +
> +/* Used with channel swizzling */
> +enum mali_channel {
> + MALI_CHANNEL_RED = 0,
> + MALI_CHANNEL_GREEN = 1,
> + MALI_CHANNEL_BLUE = 2,
> + MALI_CHANNEL_ALPHA = 3,
> + MALI_CHANNEL_ZERO = 4,
> + MALI_CHANNEL_ONE = 5,
> + MALI_CHANNEL_RESERVED_0 = 6,
> + MALI_CHANNEL_RESERVED_1 = 7,
> +};
> +
> +struct mali_channel_swizzle {
> + enum mali_channel r : 3;
> + enum mali_channel g : 3;
> + enum mali_channel b : 3;
> + enum mali_channel a : 3;
> +} __attribute__((packed));
> +
> +/* Compressed per-pixel formats. Each of these formats expands to one to four
> + * floating-point or integer numbers, as defined by the OpenGL specification.
> + * There are various places in OpenGL where the user can specify a compressed
> + * format in memory, which all use the same 8-bit enum in the various
> + * descriptors, although different hardware units support different formats.
> + */
> +
> +/* The top 3 bits specify how the bits of each component are interpreted. */
> +
> +/* e.g. R11F_G11F_B10F */
> +#define MALI_FORMAT_SPECIAL (2 << 5)
> +
> +/* signed normalized, e.g. RGBA8_SNORM */
> +#define MALI_FORMAT_SNORM (3 << 5)
> +
> +/* e.g. RGBA8UI */
> +#define MALI_FORMAT_UINT (4 << 5)
> +
> +/* e.g. RGBA8 and RGBA32F */
> +#define MALI_FORMAT_UNORM (5 << 5)
> +
> +/* e.g. RGBA8I and RGBA16F */
> +#define MALI_FORMAT_SINT (6 << 5)
> +
> +/* These formats seem to largely duplicate the others. They're used at least
> + * for Bifrost framebuffer output.
> + */
> +#define MALI_FORMAT_SPECIAL2 (7 << 5)
> +
> +/* If the high 3 bits are 3 to 6 these two bits say how many components
> + * there are.
> + */
> +#define MALI_NR_CHANNELS(n) ((n - 1) << 3)
> +
> +/* If the high 3 bits are 3 to 6, then the low 3 bits say how big each
> + * component is, except the special MALI_CHANNEL_FLOAT which overrides what the
> + * bits mean.
> + */
> +
> +#define MALI_CHANNEL_8 3
> +
> +#define MALI_CHANNEL_16 4
> +
> +#define MALI_CHANNEL_32 5
> +
> +/* For MALI_FORMAT_SINT it means a half-float (e.g. RG16F). For
> + * MALI_FORMAT_UNORM, it means a 32-bit float.
> + */
> +#define MALI_CHANNEL_FLOAT 7
> +
> +enum mali_format {
> + MALI_RGB10_A2_UNORM = MALI_FORMAT_SPECIAL | 0x3,
> + MALI_RGB10_A2_SNORM = MALI_FORMAT_SPECIAL | 0x5,
> + MALI_RGB10_A2UI = MALI_FORMAT_SPECIAL | 0x7,
> + MALI_RGB10_A2I = MALI_FORMAT_SPECIAL | 0x9,
> +
> + /* YUV formats */
> + MALI_NV12 = MALI_FORMAT_SPECIAL | 0xc,
> +
> + MALI_Z32_UNORM = MALI_FORMAT_SPECIAL | 0xD,
> + MALI_R32_FIXED = MALI_FORMAT_SPECIAL | 0x11,
> + MALI_RG32_FIXED = MALI_FORMAT_SPECIAL | 0x12,
> + MALI_RGB32_FIXED = MALI_FORMAT_SPECIAL | 0x13,
> + MALI_RGBA32_FIXED = MALI_FORMAT_SPECIAL | 0x14,
> + MALI_R11F_G11F_B10F = MALI_FORMAT_SPECIAL | 0x19,
> + /* Only used for varyings, to indicate the transformed gl_Position */
> + MALI_VARYING_POS = MALI_FORMAT_SPECIAL | 0x1e,
> + /* Only used for varyings, to indicate that the write should be
> + * discarded.
> + */
> + MALI_VARYING_DISCARD = MALI_FORMAT_SPECIAL | 0x1f,
> +
> + MALI_R8_SNORM = MALI_FORMAT_SNORM | MALI_NR_CHANNELS(1) | MALI_CHANNEL_8,
> + MALI_R16_SNORM = MALI_FORMAT_SNORM | MALI_NR_CHANNELS(1) | MALI_CHANNEL_16,
> + MALI_R32_SNORM = MALI_FORMAT_SNORM | MALI_NR_CHANNELS(1) | MALI_CHANNEL_32,
> + MALI_RG8_SNORM = MALI_FORMAT_SNORM | MALI_NR_CHANNELS(2) | MALI_CHANNEL_8,
> + MALI_RG16_SNORM = MALI_FORMAT_SNORM | MALI_NR_CHANNELS(2) | MALI_CHANNEL_16,
> + MALI_RG32_SNORM = MALI_FORMAT_SNORM | MALI_NR_CHANNELS(2) | MALI_CHANNEL_32,
> + MALI_RGB8_SNORM = MALI_FORMAT_SNORM | MALI_NR_CHANNELS(3) | MALI_CHANNEL_8,
> + MALI_RGB16_SNORM = MALI_FORMAT_SNORM | MALI_NR_CHANNELS(3) | MALI_CHANNEL_16,
> + MALI_RGB32_SNORM = MALI_FORMAT_SNORM | MALI_NR_CHANNELS(3) | MALI_CHANNEL_32,
> + MALI_RGBA8_SNORM = MALI_FORMAT_SNORM | MALI_NR_CHANNELS(4) | MALI_CHANNEL_8,
> + MALI_RGBA16_SNORM = MALI_FORMAT_SNORM | MALI_NR_CHANNELS(4) | MALI_CHANNEL_16,
> + MALI_RGBA32_SNORM = MALI_FORMAT_SNORM | MALI_NR_CHANNELS(4) | MALI_CHANNEL_32,
> +
> + MALI_R8UI = MALI_FORMAT_UINT | MALI_NR_CHANNELS(1) | MALI_CHANNEL_8,
> + MALI_R16UI = MALI_FORMAT_UINT | MALI_NR_CHANNELS(1) | MALI_CHANNEL_16,
> + MALI_R32UI = MALI_FORMAT_UINT | MALI_NR_CHANNELS(1) | MALI_CHANNEL_32,
> + MALI_RG8UI = MALI_FORMAT_UINT | MALI_NR_CHANNELS(2) | MALI_CHANNEL_8,
> + MALI_RG16UI = MALI_FORMAT_UINT | MALI_NR_CHANNELS(2) | MALI_CHANNEL_16,
> + MALI_RG32UI = MALI_FORMAT_UINT | MALI_NR_CHANNELS(2) | MALI_CHANNEL_32,
> + MALI_RGB8UI = MALI_FORMAT_UINT | MALI_NR_CHANNELS(3) | MALI_CHANNEL_8,
> + MALI_RGB16UI = MALI_FORMAT_UINT | MALI_NR_CHANNELS(3) | MALI_CHANNEL_16,
> + MALI_RGB32UI = MALI_FORMAT_UINT | MALI_NR_CHANNELS(3) | MALI_CHANNEL_32,
> + MALI_RGBA8UI = MALI_FORMAT_UINT | MALI_NR_CHANNELS(4) | MALI_CHANNEL_8,
> + MALI_RGBA16UI = MALI_FORMAT_UINT | MALI_NR_CHANNELS(4) | MALI_CHANNEL_16,
> + MALI_RGBA32UI = MALI_FORMAT_UINT | MALI_NR_CHANNELS(4) | MALI_CHANNEL_32,
> +
> + MALI_R8_UNORM = MALI_FORMAT_UNORM | MALI_NR_CHANNELS(1) | MALI_CHANNEL_8,
> + MALI_R16_UNORM = MALI_FORMAT_UNORM | MALI_NR_CHANNELS(1) | MALI_CHANNEL_16,
> + MALI_R32_UNORM = MALI_FORMAT_UNORM | MALI_NR_CHANNELS(1) | MALI_CHANNEL_32,
> + MALI_R32F = MALI_FORMAT_UNORM | MALI_NR_CHANNELS(1) | MALI_CHANNEL_FLOAT,
> + MALI_RG8_UNORM = MALI_FORMAT_UNORM | MALI_NR_CHANNELS(2) | MALI_CHANNEL_8,
> + MALI_RG16_UNORM = MALI_FORMAT_UNORM | MALI_NR_CHANNELS(2) | MALI_CHANNEL_16,
> + MALI_RG32_UNORM = MALI_FORMAT_UNORM | MALI_NR_CHANNELS(2) | MALI_CHANNEL_32,
> + MALI_RG32F = MALI_FORMAT_UNORM | MALI_NR_CHANNELS(2) | MALI_CHANNEL_FLOAT,
> + MALI_RGB8_UNORM = MALI_FORMAT_UNORM | MALI_NR_CHANNELS(3) | MALI_CHANNEL_8,
> + MALI_RGB16_UNORM = MALI_FORMAT_UNORM | MALI_NR_CHANNELS(3) | MALI_CHANNEL_16,
> + MALI_RGB32_UNORM = MALI_FORMAT_UNORM | MALI_NR_CHANNELS(3) | MALI_CHANNEL_32,
> + MALI_RGB32F = MALI_FORMAT_UNORM | MALI_NR_CHANNELS(3) | MALI_CHANNEL_FLOAT,
> + MALI_RGBA8_UNORM = MALI_FORMAT_UNORM | MALI_NR_CHANNELS(4) | MALI_CHANNEL_8,
> + MALI_RGBA16_UNORM = MALI_FORMAT_UNORM | MALI_NR_CHANNELS(4) | MALI_CHANNEL_16,
> + MALI_RGBA32_UNORM = MALI_FORMAT_UNORM | MALI_NR_CHANNELS(4) | MALI_CHANNEL_32,
> + MALI_RGBA32F = MALI_FORMAT_UNORM | MALI_NR_CHANNELS(4) | MALI_CHANNEL_FLOAT,
> +
> + MALI_R8I = MALI_FORMAT_SINT | MALI_NR_CHANNELS(1) | MALI_CHANNEL_8,
> + MALI_R16I = MALI_FORMAT_SINT | MALI_NR_CHANNELS(1) | MALI_CHANNEL_16,
> + MALI_R32I = MALI_FORMAT_SINT | MALI_NR_CHANNELS(1) | MALI_CHANNEL_32,
> + MALI_R16F = MALI_FORMAT_SINT | MALI_NR_CHANNELS(1) | MALI_CHANNEL_FLOAT,
> + MALI_RG8I = MALI_FORMAT_SINT | MALI_NR_CHANNELS(2) | MALI_CHANNEL_8,
> + MALI_RG16I = MALI_FORMAT_SINT | MALI_NR_CHANNELS(2) | MALI_CHANNEL_16,
> + MALI_RG32I = MALI_FORMAT_SINT | MALI_NR_CHANNELS(2) | MALI_CHANNEL_32,
> + MALI_RG16F = MALI_FORMAT_SINT | MALI_NR_CHANNELS(2) | MALI_CHANNEL_FLOAT,
> + MALI_RGB8I = MALI_FORMAT_SINT | MALI_NR_CHANNELS(3) | MALI_CHANNEL_8,
> + MALI_RGB16I = MALI_FORMAT_SINT | MALI_NR_CHANNELS(3) | MALI_CHANNEL_16,
> + MALI_RGB32I = MALI_FORMAT_SINT | MALI_NR_CHANNELS(3) | MALI_CHANNEL_32,
> + MALI_RGB16F = MALI_FORMAT_SINT | MALI_NR_CHANNELS(3) | MALI_CHANNEL_FLOAT,
> + MALI_RGBA8I = MALI_FORMAT_SINT | MALI_NR_CHANNELS(4) | MALI_CHANNEL_8,
> + MALI_RGBA16I = MALI_FORMAT_SINT | MALI_NR_CHANNELS(4) | MALI_CHANNEL_16,
> + MALI_RGBA32I = MALI_FORMAT_SINT | MALI_NR_CHANNELS(4) | MALI_CHANNEL_32,
> + MALI_RGBA16F = MALI_FORMAT_SINT | MALI_NR_CHANNELS(4) | MALI_CHANNEL_FLOAT,
> +
> + MALI_RGBA4 = MALI_FORMAT_SPECIAL2 | 0x8,
> + MALI_RGBA8_2 = MALI_FORMAT_SPECIAL2 | 0xd,
> + MALI_RGB10_A2_2 = MALI_FORMAT_SPECIAL2 | 0xe,
> +};
> +
> +
> +/* Alpha coverage is encoded as 4-bits (from a clampf), with inversion
> + * literally performing a bitwise invert. This function produces slightly wrong
> + * results and I'm not sure why; some rounding issue I suppose... */
> +
> +#define MALI_ALPHA_COVERAGE(clampf) ((uint16_t) (int) (clampf * 15.0f))
> +#define MALI_GET_ALPHA_COVERAGE(nibble) ((float) nibble / 15.0f)
> +
> +/* Applies to unknown1 */
> +#define MALI_NO_ALPHA_TO_COVERAGE (1 << 10)
> +
> +struct mali_blend_meta {
> +#ifdef T8XX
Small comment, you should plan on single build for all supported
generations.. I'm not entirely sure if this same header is eventually
planned to be #include'd from different C code w/ different defines
for gpu gen (afaict you just currently hard-code it at the top of this
header).. But distro's will be unhappy if it comes to different mesa
builds for 8xx vs 6xx ;-)
Also, I guess for your sanity at some point you'll want to autogen
cmdstream encoding and decoding from a single source. I get the
impression that envytools isn't the right thing for the bitpacked
format for mali cmdstream. Maybe the intel thing is better? But I
didn't get very far w/ a2xx r/e before I realized that keeping hand
coded decoding and encoding in sync sucked.
Anyways, totally fine w/ those details getting worked out in-tree,
after merging.
Acked-by: Rob Clark <robdclark at gmail.com>
More information about the mesa-dev
mailing list