From ce8d2b96c1be30113328801685a2f345cf5fec61 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Mon, 8 Nov 2021 14:43:41 -0500 Subject: [PATCH] pan/bi: Add bi_dual_tex_as_u32 helper Type safe cast, making dual texture descriptors easier to manipulate. Signed-off-by: Alyssa Rosenzweig Part-of: --- src/panfrost/bifrost/bifrost.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/panfrost/bifrost/bifrost.h b/src/panfrost/bifrost/bifrost.h index d9b5e1d5e0b..0a951ea175c 100644 --- a/src/panfrost/bifrost/bifrost.h +++ b/src/panfrost/bifrost/bifrost.h @@ -28,6 +28,7 @@ #include #include +#include #include #ifdef __cplusplus @@ -572,6 +573,15 @@ struct bifrost_dual_texture_operation { unsigned primary_mask : 4; } __attribute__((packed)); +static inline uint32_t +bi_dual_tex_as_u32(struct bifrost_dual_texture_operation desc) +{ + uint32_t desc_u; + memcpy(&desc_u, &desc, sizeof(desc)); + + return desc_u; +} + #define BIFROST_MEGA_SAMPLE 128 #define BIFROST_ALL_SAMPLES 255 #define BIFROST_CURRENT_PIXEL 255