Commit e0925148 authored by Dmitry Baryshkov's avatar Dmitry Baryshkov
Browse files

drm/msm: convert msm_format::unpack_tight to the flag



Instead of having a u8 or bool field unpack_tight, convert it to the
flag, this save space in the tables and allows us to handle all booleans
in the same way.

Reviewed-by: default avatarAbhinav Kumar <quic_abhinavk@quicinc.com>
Signed-off-by: default avatarDmitry Baryshkov <dmitry.baryshkov@linaro.org>
Patchwork: https://patchwork.freedesktop.org/patch/590428/
Link: https://lore.kernel.org/r/20240420-dpu-format-v2-6-9e93226cbffd@linaro.org
parent 0e67f514
Loading
Loading
Loading
Loading
+7 −15
Original line number Diff line number Diff line
@@ -44,11 +44,10 @@ bp, flg, fm, np) \
	.bpc_a = a,                                                       \
	.chroma_sample = CHROMA_FULL,                                     \
	.unpack_align_msb = 0,                                            \
	.unpack_tight = 1,                                                \
	.unpack_count = uc,                                               \
	.bpp = bp,                                                        \
	.fetch_mode = fm,                                                 \
	.flags = flg,                                                     \
	.flags = MSM_FORMAT_FLAG_UNPACK_TIGHT | flg,                      \
	.num_planes = np,                                                 \
	.tile_height = DPU_TILE_HEIGHT_DEFAULT                            \
}
@@ -66,11 +65,10 @@ alpha, bp, flg, fm, np, th) \
	.bpc_a = a,                                                       \
	.chroma_sample = CHROMA_FULL,                                     \
	.unpack_align_msb = 0,                                            \
	.unpack_tight = 1,                                                \
	.unpack_count = uc,                                               \
	.bpp = bp,                                                        \
	.fetch_mode = fm,                                                 \
	.flags = flg,                                                     \
	.flags = MSM_FORMAT_FLAG_UNPACK_TIGHT | flg,                      \
	.num_planes = np,                                                 \
	.tile_height = th                                                 \
}
@@ -89,11 +87,10 @@ alpha, chroma, count, bp, flg, fm, np) \
	.bpc_a = a,                                                       \
	.chroma_sample = chroma,                                          \
	.unpack_align_msb = 0,                                            \
	.unpack_tight = 1,                                                \
	.unpack_count = count,                                            \
	.bpp = bp,                                                        \
	.fetch_mode = fm,                                                 \
	.flags = flg,                                                     \
	.flags = MSM_FORMAT_FLAG_UNPACK_TIGHT | flg,                      \
	.num_planes = np,                                                 \
	.tile_height = DPU_TILE_HEIGHT_DEFAULT                            \
}
@@ -110,11 +107,10 @@ alpha, chroma, count, bp, flg, fm, np) \
	.bpc_a = a,                                                       \
	.chroma_sample = chroma,                                          \
	.unpack_align_msb = 0,                                            \
	.unpack_tight = 1,                                                \
	.unpack_count = 2,                                                \
	.bpp = 2,                                                         \
	.fetch_mode = fm,                                                 \
	.flags = flg,                                                     \
	.flags = MSM_FORMAT_FLAG_UNPACK_TIGHT | flg,                      \
	.num_planes = np,                                                 \
	.tile_height = DPU_TILE_HEIGHT_DEFAULT                            \
}
@@ -132,11 +128,10 @@ flg, fm, np, th) \
	.bpc_a = a,                                                       \
	.chroma_sample = chroma,                                          \
	.unpack_align_msb = 0,                                            \
	.unpack_tight = 1,                                                \
	.unpack_count = 2,                                                \
	.bpp = 2,                                                         \
	.fetch_mode = fm,                                                 \
	.flags = flg,                                                     \
	.flags = MSM_FORMAT_FLAG_UNPACK_TIGHT | flg,                      \
	.num_planes = np,                                                 \
	.tile_height = th                                                 \
}
@@ -153,7 +148,6 @@ flg, fm, np, th) \
	.bpc_a = a,                                                       \
	.chroma_sample = chroma,                                          \
	.unpack_align_msb = 1,                                            \
	.unpack_tight = 0,                                                \
	.unpack_count = 2,                                                \
	.bpp = 2,                                                         \
	.fetch_mode = fm,                                                 \
@@ -175,7 +169,6 @@ flg, fm, np, th) \
	.bpc_a = a,                                                       \
	.chroma_sample = chroma,                                          \
	.unpack_align_msb = 1,                                            \
	.unpack_tight = 0,                                                \
	.unpack_count = 2,                                                \
	.bpp = 2,                                                         \
	.fetch_mode = fm,                                                 \
@@ -198,11 +191,10 @@ flg, fm, np) \
	.bpc_a = a,                                                       \
	.chroma_sample = chroma,                                          \
	.unpack_align_msb = 0,                                            \
	.unpack_tight = 1,                                                \
	.unpack_count = 1,                                                \
	.bpp = bp,                                                        \
	.fetch_mode = fm,                                                 \
	.flags = flg,                                                     \
	.flags = MSM_FORMAT_FLAG_UNPACK_TIGHT | flg,                      \
	.num_planes = np,                                                 \
	.tile_height = DPU_TILE_HEIGHT_DEFAULT                            \
}
@@ -636,7 +628,7 @@ static int _dpu_format_get_media_color_ubwc(const struct msm_format *fmt)
	if (fmt->pixel_format == DRM_FORMAT_NV12 ||
	    fmt->pixel_format == DRM_FORMAT_P010) {
		if (MSM_FORMAT_IS_DX(fmt)) {
			if (fmt->unpack_tight)
			if (fmt->flags & MSM_FORMAT_FLAG_UNPACK_TIGHT)
				color_fmt = COLOR_FMT_NV12_BPP10_UBWC;
			else
				color_fmt = COLOR_FMT_P010_UBWC;
+1 −1
Original line number Diff line number Diff line
@@ -263,7 +263,7 @@ static void dpu_hw_sspp_setup_format(struct dpu_sw_pipe *pipe,
	unpack = (fmt->element[3] << 24) | (fmt->element[2] << 16) |
		(fmt->element[1] << 8) | (fmt->element[0] << 0);
	src_format |= ((fmt->unpack_count - 1) << 12) |
		(fmt->unpack_tight << 17) |
		((fmt->flags & MSM_FORMAT_FLAG_UNPACK_TIGHT ? 1 : 0) << 17) |
		(fmt->unpack_align_msb << 18) |
		((fmt->bpp - 1) << 9);

+1 −1
Original line number Diff line number Diff line
@@ -98,7 +98,7 @@ static void dpu_hw_wb_setup_format(struct dpu_hw_wb *ctx,
		(fmt->element[0] << 0);

	dst_format |= (fmt->unpack_align_msb << 18) |
		(fmt->unpack_tight << 17) |
		((fmt->flags & MSM_FORMAT_FLAG_UNPACK_TIGHT ? 1 : 0) << 17) |
		((fmt->unpack_count - 1) << 12) |
		((fmt->bpp - 1) << 9);

+2 −1
Original line number Diff line number Diff line
@@ -325,7 +325,8 @@ static int mdp4_plane_mode_set(struct drm_plane *plane,
			MDP4_PIPE_SRC_FORMAT_FETCH_PLANES(format->fetch_type) |
			MDP4_PIPE_SRC_FORMAT_CHROMA_SAMP(format->chroma_sample) |
			MDP4_PIPE_SRC_FORMAT_FRAME_FORMAT(frame_type) |
			COND(format->unpack_tight, MDP4_PIPE_SRC_FORMAT_UNPACK_TIGHT));
			COND(format->flags & MSM_FORMAT_FLAG_UNPACK_TIGHT,
			     MDP4_PIPE_SRC_FORMAT_UNPACK_TIGHT));

	mdp4_write(mdp4_kms, REG_MDP4_PIPE_SRC_UNPACK(pipe),
			MDP4_PIPE_SRC_UNPACK_ELEM0(format->element[0]) |
+2 −1
Original line number Diff line number Diff line
@@ -801,7 +801,8 @@ static void mdp5_hwpipe_mode_set(struct mdp5_kms *mdp5_kms,
			COND(format->alpha_enable, MDP5_PIPE_SRC_FORMAT_ALPHA_ENABLE) |
			MDP5_PIPE_SRC_FORMAT_CPP(format->bpp - 1) |
			MDP5_PIPE_SRC_FORMAT_UNPACK_COUNT(format->unpack_count - 1) |
			COND(format->unpack_tight, MDP5_PIPE_SRC_FORMAT_UNPACK_TIGHT) |
			COND(format->flags & MSM_FORMAT_FLAG_UNPACK_TIGHT,
			     MDP5_PIPE_SRC_FORMAT_UNPACK_TIGHT) |
			MDP5_PIPE_SRC_FORMAT_FETCH_TYPE(format->fetch_type) |
			MDP5_PIPE_SRC_FORMAT_CHROMA_SAMP(format->chroma_sample));

Loading