Skip to content

Commit f4f3920

Browse files
committed
drm/msm: convert msm_format::unpack_align_msb to the flag
Instead of having a u8 or bool field unpack_align_msb, convert it to the flag, this save space in the tables and allows us to handle all booleans in the same way. Reviewed-by: Abhinav Kumar <[email protected]> Signed-off-by: Dmitry Baryshkov <[email protected]> Patchwork: https://patchwork.freedesktop.org/patch/590427/ Link: https://lore.kernel.org/r/[email protected]
1 parent e092514 commit f4f3920

File tree

4 files changed

+6
-14
lines changed

4 files changed

+6
-14
lines changed

drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ bp, flg, fm, np) \
4343
.bpc_r_cr = r, \
4444
.bpc_a = a, \
4545
.chroma_sample = CHROMA_FULL, \
46-
.unpack_align_msb = 0, \
4746
.unpack_count = uc, \
4847
.bpp = bp, \
4948
.fetch_mode = fm, \
@@ -64,7 +63,6 @@ alpha, bp, flg, fm, np, th) \
6463
.bpc_r_cr = r, \
6564
.bpc_a = a, \
6665
.chroma_sample = CHROMA_FULL, \
67-
.unpack_align_msb = 0, \
6866
.unpack_count = uc, \
6967
.bpp = bp, \
7068
.fetch_mode = fm, \
@@ -86,7 +84,6 @@ alpha, chroma, count, bp, flg, fm, np) \
8684
.bpc_r_cr = r, \
8785
.bpc_a = a, \
8886
.chroma_sample = chroma, \
89-
.unpack_align_msb = 0, \
9087
.unpack_count = count, \
9188
.bpp = bp, \
9289
.fetch_mode = fm, \
@@ -106,7 +103,6 @@ alpha, chroma, count, bp, flg, fm, np) \
106103
.bpc_r_cr = r, \
107104
.bpc_a = a, \
108105
.chroma_sample = chroma, \
109-
.unpack_align_msb = 0, \
110106
.unpack_count = 2, \
111107
.bpp = 2, \
112108
.fetch_mode = fm, \
@@ -127,7 +123,6 @@ flg, fm, np, th) \
127123
.bpc_r_cr = r, \
128124
.bpc_a = a, \
129125
.chroma_sample = chroma, \
130-
.unpack_align_msb = 0, \
131126
.unpack_count = 2, \
132127
.bpp = 2, \
133128
.fetch_mode = fm, \
@@ -147,11 +142,10 @@ flg, fm, np, th) \
147142
.bpc_r_cr = r, \
148143
.bpc_a = a, \
149144
.chroma_sample = chroma, \
150-
.unpack_align_msb = 1, \
151145
.unpack_count = 2, \
152146
.bpp = 2, \
153147
.fetch_mode = fm, \
154-
.flags = flg, \
148+
.flags = MSM_FORMAT_FLAG_UNPACK_ALIGN_MSB | flg, \
155149
.num_planes = np, \
156150
.tile_height = DPU_TILE_HEIGHT_DEFAULT \
157151
}
@@ -168,11 +162,10 @@ flg, fm, np, th) \
168162
.bpc_r_cr = r, \
169163
.bpc_a = a, \
170164
.chroma_sample = chroma, \
171-
.unpack_align_msb = 1, \
172165
.unpack_count = 2, \
173166
.bpp = 2, \
174167
.fetch_mode = fm, \
175-
.flags = flg, \
168+
.flags = MSM_FORMAT_FLAG_UNPACK_ALIGN_MSB | flg, \
176169
.num_planes = np, \
177170
.tile_height = th \
178171
}
@@ -190,7 +183,6 @@ flg, fm, np) \
190183
.bpc_r_cr = r, \
191184
.bpc_a = a, \
192185
.chroma_sample = chroma, \
193-
.unpack_align_msb = 0, \
194186
.unpack_count = 1, \
195187
.bpp = bp, \
196188
.fetch_mode = fm, \

drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ static void dpu_hw_sspp_setup_format(struct dpu_sw_pipe *pipe,
264264
(fmt->element[1] << 8) | (fmt->element[0] << 0);
265265
src_format |= ((fmt->unpack_count - 1) << 12) |
266266
((fmt->flags & MSM_FORMAT_FLAG_UNPACK_TIGHT ? 1 : 0) << 17) |
267-
(fmt->unpack_align_msb << 18) |
267+
((fmt->flags & MSM_FORMAT_FLAG_UNPACK_ALIGN_MSB ? 1 : 0) << 18) |
268268
((fmt->bpp - 1) << 9);
269269

270270
if (fmt->fetch_mode != MDP_FETCH_LINEAR) {

drivers/gpu/drm/msm/disp/dpu1/dpu_hw_wb.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ static void dpu_hw_wb_setup_format(struct dpu_hw_wb *ctx,
9797
(fmt->element[1] << 8) |
9898
(fmt->element[0] << 0);
9999

100-
dst_format |= (fmt->unpack_align_msb << 18) |
100+
dst_format |= ((fmt->flags & MSM_FORMAT_FLAG_UNPACK_ALIGN_MSB ? 1 : 0) << 18) |
101101
((fmt->flags & MSM_FORMAT_FLAG_UNPACK_TIGHT ? 1 : 0) << 17) |
102102
((fmt->unpack_count - 1) << 12) |
103103
((fmt->bpp - 1) << 9);

drivers/gpu/drm/msm/disp/mdp_format.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,14 @@ enum msm_format_flags {
1515
MSM_FORMAT_FLAG_DX_BIT,
1616
MSM_FORMAT_FLAG_COMPRESSED_BIT,
1717
MSM_FORMAT_FLAG_UNPACK_TIGHT_BIT,
18+
MSM_FORMAT_FLAG_UNPACK_ALIGN_MSB_BIT,
1819
};
1920

2021
#define MSM_FORMAT_FLAG_YUV BIT(MSM_FORMAT_FLAG_YUV_BIT)
2122
#define MSM_FORMAT_FLAG_DX BIT(MSM_FORMAT_FLAG_DX_BIT)
2223
#define MSM_FORMAT_FLAG_COMPRESSED BIT(MSM_FORMAT_FLAG_COMPRESSED_BIT)
2324
#define MSM_FORMAT_FLAG_UNPACK_TIGHT BIT(MSM_FORMAT_FLAG_UNPACK_TIGHT_BIT)
25+
#define MSM_FORMAT_FLAG_UNPACK_ALIGN_MSB BIT(MSM_FORMAT_FLAG_UNPACK_ALIGN_MSB_BIT)
2426

2527
/**
2628
* struct msm_format: defines the format configuration
@@ -29,7 +31,6 @@ enum msm_format_flags {
2931
* @fetch_type: how the color components are packed in pixel format
3032
* @chroma_sample: chroma sub-samplng type
3133
* @alpha_enable: whether the format has an alpha channel
32-
* @unpack_align_msb: unpack aligned to LSB or MSB
3334
* @unpack_count: number of the components to unpack
3435
* @bpp: bytes per pixel
3536
* @flags: usage bit flags
@@ -45,7 +46,6 @@ struct msm_format {
4546
enum mdp_fetch_type fetch_type;
4647
enum mdp_chroma_samp_type chroma_sample;
4748
bool alpha_enable;
48-
u8 unpack_align_msb;
4949
u8 unpack_count;
5050
u8 bpp;
5151
unsigned long flags;

0 commit comments

Comments
 (0)