From cdc3276317de5da31b7336a6aba0525bbc752191 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Wed, 12 Aug 2020 16:46:07 -0400 Subject: [PATCH] panfrost: XMLify mali_channel Signed-off-by: Alyssa Rosenzweig Reviewed-by: Tomeu Vizoso Part-of: --- src/panfrost/include/panfrost-job.h | 12 ------------ src/panfrost/lib/decode.c | 14 +++++++------- src/panfrost/lib/midgard.xml | 9 +++++++++ src/panfrost/lib/pan_blit.c | 4 ++-- src/panfrost/lib/pan_texture.c | 16 ++++++++-------- src/panfrost/lib/pan_texture.h | 16 ++++++++-------- 6 files changed, 34 insertions(+), 37 deletions(-) diff --git a/src/panfrost/include/panfrost-job.h b/src/panfrost/include/panfrost-job.h index 34d3e98f5c4..c0d986f77ef 100644 --- a/src/panfrost/include/panfrost-job.h +++ b/src/panfrost/include/panfrost-job.h @@ -147,18 +147,6 @@ struct mali_blend_equation { unsigned color_mask : 4; } __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, -}; - /* 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 diff --git a/src/panfrost/lib/decode.c b/src/panfrost/lib/decode.c index 06b381626dc..be18f2d0d95 100644 --- a/src/panfrost/lib/decode.c +++ b/src/panfrost/lib/decode.c @@ -756,12 +756,12 @@ static unsigned pandecode_access_mask_from_channel_swizzle(unsigned swizzle) { unsigned mask = 0; - assert(MALI_CHANNEL_RED == 0); + assert(MALI_CHANNEL_R == 0); for (unsigned c = 0; c < 4; ++c) { enum mali_channel chan = (swizzle >> (3*c)) & 0x7; - if (chan <= MALI_CHANNEL_ALPHA) + if (chan <= MALI_CHANNEL_A) mask |= (1 << chan); } @@ -790,10 +790,10 @@ pandecode_validate_format_swizzle(enum mali_format fmt, unsigned swizzle) * useless printing for the defaults */ unsigned default_swizzles[4] = { - MALI_CHANNEL_RED | (MALI_CHANNEL_ZERO << 3) | (MALI_CHANNEL_ZERO << 6) | (MALI_CHANNEL_ONE << 9), - MALI_CHANNEL_RED | (MALI_CHANNEL_GREEN << 3) | (MALI_CHANNEL_ZERO << 6) | (MALI_CHANNEL_ONE << 9), - MALI_CHANNEL_RED | (MALI_CHANNEL_GREEN << 3) | (MALI_CHANNEL_BLUE << 6) | (MALI_CHANNEL_ONE << 9), - MALI_CHANNEL_RED | (MALI_CHANNEL_GREEN << 3) | (MALI_CHANNEL_BLUE << 6) | (MALI_CHANNEL_ALPHA << 9) + MALI_CHANNEL_R | (MALI_CHANNEL_0 << 3) | (MALI_CHANNEL_0 << 6) | (MALI_CHANNEL_1 << 9), + MALI_CHANNEL_R | (MALI_CHANNEL_G << 3) | (MALI_CHANNEL_0 << 6) | (MALI_CHANNEL_1 << 9), + MALI_CHANNEL_R | (MALI_CHANNEL_G << 3) | (MALI_CHANNEL_B << 6) | (MALI_CHANNEL_1 << 9), + MALI_CHANNEL_R | (MALI_CHANNEL_G << 3) | (MALI_CHANNEL_B << 6) | (MALI_CHANNEL_A << 9) }; return (swizzle == default_swizzles[nr_comp - 1]); @@ -817,7 +817,7 @@ pandecode_swizzle(unsigned swizzle, enum mali_format format) for (unsigned c = 0; c < 4; ++c) { enum mali_channel chan = (swizzle >> (3 * c)) & 0x7; - if (chan >= MALI_CHANNEL_RESERVED_0) { + if (chan > MALI_CHANNEL_1) { pandecode_log("XXX: invalid swizzle channel %d\n", chan); continue; } diff --git a/src/panfrost/lib/midgard.xml b/src/panfrost/lib/midgard.xml index cf5eb8e429e..8a6692f02ce 100644 --- a/src/panfrost/lib/midgard.xml +++ b/src/panfrost/lib/midgard.xml @@ -1,5 +1,14 @@ + + + + + + + + + diff --git a/src/panfrost/lib/pan_blit.c b/src/panfrost/lib/pan_blit.c index fbc34600390..9aee7d81910 100644 --- a/src/panfrost/lib/pan_blit.c +++ b/src/panfrost/lib/pan_blit.c @@ -203,7 +203,7 @@ panfrost_load_midg( struct mali_attr_meta varying_meta = { .index = 0, .unknown1 = 2, - .format = (MALI_CHANNEL_RED << 0) | (MALI_CHANNEL_GREEN << 3) | (MALI_RGBA32F << 12) + .format = (MALI_CHANNEL_R << 0) | (MALI_CHANNEL_G << 3) | (MALI_RGBA32F << 12) }; struct mali_stencil_packed stencil; @@ -299,7 +299,7 @@ panfrost_load_midg( 0, 0, image->nr_samples, 0, - (MALI_CHANNEL_RED << 0) | (MALI_CHANNEL_GREEN << 3) | (MALI_CHANNEL_BLUE << 6) | (MALI_CHANNEL_ALPHA << 9), + (MALI_CHANNEL_R << 0) | (MALI_CHANNEL_G << 3) | (MALI_CHANNEL_B << 6) | (MALI_CHANNEL_A << 9), image->bo->gpu + image->first_layer * panfrost_get_layer_stride(image->slices, image->dim == MALI_TEXTURE_DIMENSION_3D, diff --git a/src/panfrost/lib/pan_texture.c b/src/panfrost/lib/pan_texture.c index fce120803ac..5a54fd563b2 100644 --- a/src/panfrost/lib/pan_texture.c +++ b/src/panfrost/lib/pan_texture.c @@ -273,16 +273,16 @@ panfrost_emit_texture_payload( } #define MALI_SWIZZLE_R001 \ - (MALI_CHANNEL_RED << 0) | \ - (MALI_CHANNEL_ZERO << 3) | \ - (MALI_CHANNEL_ZERO << 6) | \ - (MALI_CHANNEL_ONE << 9) + (MALI_CHANNEL_R << 0) | \ + (MALI_CHANNEL_0 << 3) | \ + (MALI_CHANNEL_0 << 6) | \ + (MALI_CHANNEL_1 << 9) #define MALI_SWIZZLE_A001 \ - (MALI_CHANNEL_ALPHA << 0) | \ - (MALI_CHANNEL_ZERO << 3) | \ - (MALI_CHANNEL_ZERO << 6) | \ - (MALI_CHANNEL_ONE << 9) + (MALI_CHANNEL_A << 0) | \ + (MALI_CHANNEL_0 << 3) | \ + (MALI_CHANNEL_0 << 6) | \ + (MALI_CHANNEL_1 << 9) void diff --git a/src/panfrost/lib/pan_texture.h b/src/panfrost/lib/pan_texture.h index 4d2d5478baa..3765836385d 100644 --- a/src/panfrost/lib/pan_texture.h +++ b/src/panfrost/lib/pan_texture.h @@ -158,17 +158,17 @@ panfrost_get_default_swizzle(unsigned components) { switch (components) { case 1: - return (MALI_CHANNEL_RED << 0) | (MALI_CHANNEL_ZERO << 3) | - (MALI_CHANNEL_ZERO << 6) | (MALI_CHANNEL_ONE << 9); + return (MALI_CHANNEL_R << 0) | (MALI_CHANNEL_0 << 3) | + (MALI_CHANNEL_0 << 6) | (MALI_CHANNEL_1 << 9); case 2: - return (MALI_CHANNEL_RED << 0) | (MALI_CHANNEL_GREEN << 3) | - (MALI_CHANNEL_ZERO << 6) | (MALI_CHANNEL_ONE << 9); + return (MALI_CHANNEL_R << 0) | (MALI_CHANNEL_G << 3) | + (MALI_CHANNEL_0 << 6) | (MALI_CHANNEL_1 << 9); case 3: - return (MALI_CHANNEL_RED << 0) | (MALI_CHANNEL_GREEN << 3) | - (MALI_CHANNEL_BLUE << 6) | (MALI_CHANNEL_ONE << 9); + return (MALI_CHANNEL_R << 0) | (MALI_CHANNEL_G << 3) | + (MALI_CHANNEL_B << 6) | (MALI_CHANNEL_1 << 9); case 4: - return (MALI_CHANNEL_RED << 0) | (MALI_CHANNEL_GREEN << 3) | - (MALI_CHANNEL_BLUE << 6) | (MALI_CHANNEL_ALPHA << 9); + return (MALI_CHANNEL_R << 0) | (MALI_CHANNEL_G << 3) | + (MALI_CHANNEL_B << 6) | (MALI_CHANNEL_A << 9); default: unreachable("Invalid number of components"); } -- 2.30.2