Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/msm/dpu: in dpu_format replace bitmap with unsigned long field

Using bitmap for the flags results in a clumsy syntax on test_bit,
replace it with unsigned long type and simple binary ops.

Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Patchwork: https://patchwork.freedesktop.org/patch/590422/
Link: https://lore.kernel.org/r/20240420-dpu-format-v2-3-9e93226cbffd@linaro.org

+16 -18
+9 -9
drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c
··· 45 45 .unpack_count = uc, \ 46 46 .bpp = bp, \ 47 47 .fetch_mode = fm, \ 48 - .flag = {(flg)}, \ 48 + .flags = flg, \ 49 49 .num_planes = np, \ 50 50 .tile_height = DPU_TILE_HEIGHT_DEFAULT \ 51 51 } ··· 64 64 .unpack_count = uc, \ 65 65 .bpp = bp, \ 66 66 .fetch_mode = fm, \ 67 - .flag = {(flg)}, \ 67 + .flags = flg, \ 68 68 .num_planes = np, \ 69 69 .tile_height = th \ 70 70 } ··· 84 84 .unpack_count = count, \ 85 85 .bpp = bp, \ 86 86 .fetch_mode = fm, \ 87 - .flag = {(flg)}, \ 87 + .flags = flg, \ 88 88 .num_planes = np, \ 89 89 .tile_height = DPU_TILE_HEIGHT_DEFAULT \ 90 90 } ··· 102 102 .unpack_count = 2, \ 103 103 .bpp = 2, \ 104 104 .fetch_mode = fm, \ 105 - .flag = {(flg)}, \ 105 + .flags = flg, \ 106 106 .num_planes = np, \ 107 107 .tile_height = DPU_TILE_HEIGHT_DEFAULT \ 108 108 } ··· 121 121 .unpack_count = 2, \ 122 122 .bpp = 2, \ 123 123 .fetch_mode = fm, \ 124 - .flag = {(flg)}, \ 124 + .flags = flg, \ 125 125 .num_planes = np, \ 126 126 .tile_height = th \ 127 127 } ··· 139 139 .unpack_count = 2, \ 140 140 .bpp = 2, \ 141 141 .fetch_mode = fm, \ 142 - .flag = {(flg)}, \ 142 + .flags = flg, \ 143 143 .num_planes = np, \ 144 144 .tile_height = DPU_TILE_HEIGHT_DEFAULT \ 145 145 } ··· 158 158 .unpack_count = 2, \ 159 159 .bpp = 2, \ 160 160 .fetch_mode = fm, \ 161 - .flag = {(flg)}, \ 161 + .flags = flg, \ 162 162 .num_planes = np, \ 163 163 .tile_height = th \ 164 164 } ··· 178 178 .unpack_count = 1, \ 179 179 .bpp = bp, \ 180 180 .fetch_mode = fm, \ 181 - .flag = {(flg)}, \ 181 + .flags = flg, \ 182 182 .num_planes = np, \ 183 183 .tile_height = DPU_TILE_HEIGHT_DEFAULT \ 184 184 } ··· 1047 1047 DPU_ERROR("unsupported fmt: %4.4s modifier 0x%llX\n", 1048 1048 (char *)&format, modifier); 1049 1049 else 1050 - DRM_DEBUG_ATOMIC("fmt %4.4s mod 0x%llX ubwc %d yuv %d\n", 1050 + DRM_DEBUG_ATOMIC("fmt %4.4s mod 0x%llX ubwc %d yuv %ld\n", 1051 1051 (char *)&format, modifier, 1052 1052 DPU_FORMAT_IS_UBWC(fmt), 1053 1053 DPU_FORMAT_IS_YUV(fmt));
+7 -9
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_mdss.h
··· 40 40 DPU_FORMAT_FLAG_YUV_BIT, 41 41 DPU_FORMAT_FLAG_DX_BIT, 42 42 DPU_FORMAT_FLAG_COMPRESSED_BIT, 43 - DPU_FORMAT_FLAG_BIT_MAX, 44 43 }; 45 44 46 45 #define DPU_FORMAT_FLAG_YUV BIT(DPU_FORMAT_FLAG_YUV_BIT) 47 46 #define DPU_FORMAT_FLAG_DX BIT(DPU_FORMAT_FLAG_DX_BIT) 48 47 #define DPU_FORMAT_FLAG_COMPRESSED BIT(DPU_FORMAT_FLAG_COMPRESSED_BIT) 49 - #define DPU_FORMAT_IS_YUV(X) \ 50 - (test_bit(DPU_FORMAT_FLAG_YUV_BIT, (X)->flag)) 51 - #define DPU_FORMAT_IS_DX(X) \ 52 - (test_bit(DPU_FORMAT_FLAG_DX_BIT, (X)->flag)) 48 + 49 + #define DPU_FORMAT_IS_YUV(X) ((X)->flags & DPU_FORMAT_FLAG_YUV) 50 + #define DPU_FORMAT_IS_DX(X) ((X)->flags & DPU_FORMAT_FLAG_DX) 53 51 #define DPU_FORMAT_IS_LINEAR(X) ((X)->fetch_mode == MDP_FETCH_LINEAR) 54 52 #define DPU_FORMAT_IS_TILE(X) \ 55 53 (((X)->fetch_mode == MDP_FETCH_UBWC) && \ 56 - !test_bit(DPU_FORMAT_FLAG_COMPRESSED_BIT, (X)->flag)) 54 + !((X)->flags & DPU_FORMAT_FLAG_COMPRESSED)) 57 55 #define DPU_FORMAT_IS_UBWC(X) \ 58 56 (((X)->fetch_mode == MDP_FETCH_UBWC) && \ 59 - test_bit(DPU_FORMAT_FLAG_COMPRESSED_BIT, (X)->flag)) 57 + ((X)->flags & DPU_FORMAT_FLAG_COMPRESSED)) 60 58 61 59 #define DPU_BLEND_FG_ALPHA_FG_CONST (0 << 0) 62 60 #define DPU_BLEND_FG_ALPHA_BG_CONST (1 << 0) ··· 332 334 * @alpha_enable: whether the format has an alpha channel 333 335 * @num_planes: number of planes (including meta data planes) 334 336 * @fetch_mode: linear, tiled, or ubwc hw fetch behavior 335 - * @flag: usage bit flags 337 + * @flags: usage bit flags 336 338 * @tile_width: format tile width 337 339 * @tile_height: format tile height 338 340 */ ··· 349 351 u8 alpha_enable; 350 352 u8 num_planes; 351 353 enum mdp_fetch_mode fetch_mode; 352 - DECLARE_BITMAP(flag, DPU_FORMAT_FLAG_BIT_MAX); 354 + unsigned long flags; 353 355 u16 tile_width; 354 356 u16 tile_height; 355 357 };