From: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
To: Rob Clark <robdclark@gmail.com>,
Abhinav Kumar <quic_abhinavk@quicinc.com>,
Dmitry Baryshkov <dmitry.baryshkov@linaro.org>,
Sean Paul <sean@poorly.run>,
Marijn Suijten <marijn.suijten@somainline.org>,
David Airlie <airlied@gmail.com>,
Daniel Vetter <daniel@ffwll.ch>
Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org,
freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: [PATCH v2 7/9] drm/msm: convert msm_format::unpack_align_msb to the flag
Date: Sat, 20 Apr 2024 07:01:04 +0300 [thread overview]
Message-ID: <20240420-dpu-format-v2-7-9e93226cbffd@linaro.org> (raw)
In-Reply-To: <20240420-dpu-format-v2-0-9e93226cbffd@linaro.org>
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 <quic_abhinavk@quicinc.com>
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c | 12 ++----------
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c | 2 +-
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_wb.c | 2 +-
drivers/gpu/drm/msm/disp/mdp_format.h | 4 ++--
4 files changed, 6 insertions(+), 14 deletions(-)
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c
index 705b91582b0f..2bb1584920c6 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c
@@ -43,7 +43,6 @@ bp, flg, fm, np) \
.bpc_r_cr = r, \
.bpc_a = a, \
.chroma_sample = CHROMA_FULL, \
- .unpack_align_msb = 0, \
.unpack_count = uc, \
.bpp = bp, \
.fetch_mode = fm, \
@@ -64,7 +63,6 @@ alpha, bp, flg, fm, np, th) \
.bpc_r_cr = r, \
.bpc_a = a, \
.chroma_sample = CHROMA_FULL, \
- .unpack_align_msb = 0, \
.unpack_count = uc, \
.bpp = bp, \
.fetch_mode = fm, \
@@ -86,7 +84,6 @@ alpha, chroma, count, bp, flg, fm, np) \
.bpc_r_cr = r, \
.bpc_a = a, \
.chroma_sample = chroma, \
- .unpack_align_msb = 0, \
.unpack_count = count, \
.bpp = bp, \
.fetch_mode = fm, \
@@ -106,7 +103,6 @@ alpha, chroma, count, bp, flg, fm, np) \
.bpc_r_cr = r, \
.bpc_a = a, \
.chroma_sample = chroma, \
- .unpack_align_msb = 0, \
.unpack_count = 2, \
.bpp = 2, \
.fetch_mode = fm, \
@@ -127,7 +123,6 @@ flg, fm, np, th) \
.bpc_r_cr = r, \
.bpc_a = a, \
.chroma_sample = chroma, \
- .unpack_align_msb = 0, \
.unpack_count = 2, \
.bpp = 2, \
.fetch_mode = fm, \
@@ -147,11 +142,10 @@ flg, fm, np, th) \
.bpc_r_cr = r, \
.bpc_a = a, \
.chroma_sample = chroma, \
- .unpack_align_msb = 1, \
.unpack_count = 2, \
.bpp = 2, \
.fetch_mode = fm, \
- .flags = flg, \
+ .flags = MSM_FORMAT_FLAG_UNPACK_ALIGN_MSB | flg, \
.num_planes = np, \
.tile_height = DPU_TILE_HEIGHT_DEFAULT \
}
@@ -168,11 +162,10 @@ flg, fm, np, th) \
.bpc_r_cr = r, \
.bpc_a = a, \
.chroma_sample = chroma, \
- .unpack_align_msb = 1, \
.unpack_count = 2, \
.bpp = 2, \
.fetch_mode = fm, \
- .flags = flg, \
+ .flags = MSM_FORMAT_FLAG_UNPACK_ALIGN_MSB | flg, \
.num_planes = np, \
.tile_height = th \
}
@@ -190,7 +183,6 @@ flg, fm, np) \
.bpc_r_cr = r, \
.bpc_a = a, \
.chroma_sample = chroma, \
- .unpack_align_msb = 0, \
.unpack_count = 1, \
.bpp = bp, \
.fetch_mode = fm, \
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c
index d411d70b8cd8..f4b4cd084282 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c
@@ -264,7 +264,7 @@ static void dpu_hw_sspp_setup_format(struct dpu_sw_pipe *pipe,
(fmt->element[1] << 8) | (fmt->element[0] << 0);
src_format |= ((fmt->unpack_count - 1) << 12) |
((fmt->flags & MSM_FORMAT_FLAG_UNPACK_TIGHT ? 1 : 0) << 17) |
- (fmt->unpack_align_msb << 18) |
+ ((fmt->flags & MSM_FORMAT_FLAG_UNPACK_ALIGN_MSB ? 1 : 0) << 18) |
((fmt->bpp - 1) << 9);
if (fmt->fetch_mode != MDP_FETCH_LINEAR) {
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_wb.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_wb.c
index 19163634855f..93ff01c889b5 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_wb.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_wb.c
@@ -97,7 +97,7 @@ static void dpu_hw_wb_setup_format(struct dpu_hw_wb *ctx,
(fmt->element[1] << 8) |
(fmt->element[0] << 0);
- dst_format |= (fmt->unpack_align_msb << 18) |
+ dst_format |= ((fmt->flags & MSM_FORMAT_FLAG_UNPACK_ALIGN_MSB ? 1 : 0) << 18) |
((fmt->flags & MSM_FORMAT_FLAG_UNPACK_TIGHT ? 1 : 0) << 17) |
((fmt->unpack_count - 1) << 12) |
((fmt->bpp - 1) << 9);
diff --git a/drivers/gpu/drm/msm/disp/mdp_format.h b/drivers/gpu/drm/msm/disp/mdp_format.h
index 18b2822dd552..d17f63c045a7 100644
--- a/drivers/gpu/drm/msm/disp/mdp_format.h
+++ b/drivers/gpu/drm/msm/disp/mdp_format.h
@@ -15,12 +15,14 @@ enum msm_format_flags {
MSM_FORMAT_FLAG_DX_BIT,
MSM_FORMAT_FLAG_COMPRESSED_BIT,
MSM_FORMAT_FLAG_UNPACK_TIGHT_BIT,
+ MSM_FORMAT_FLAG_UNPACK_ALIGN_MSB_BIT,
};
#define MSM_FORMAT_FLAG_YUV BIT(MSM_FORMAT_FLAG_YUV_BIT)
#define MSM_FORMAT_FLAG_DX BIT(MSM_FORMAT_FLAG_DX_BIT)
#define MSM_FORMAT_FLAG_COMPRESSED BIT(MSM_FORMAT_FLAG_COMPRESSED_BIT)
#define MSM_FORMAT_FLAG_UNPACK_TIGHT BIT(MSM_FORMAT_FLAG_UNPACK_TIGHT_BIT)
+#define MSM_FORMAT_FLAG_UNPACK_ALIGN_MSB BIT(MSM_FORMAT_FLAG_UNPACK_ALIGN_MSB_BIT)
/**
* struct msm_format: defines the format configuration
@@ -29,7 +31,6 @@ enum msm_format_flags {
* @fetch_type: how the color components are packed in pixel format
* @chroma_sample: chroma sub-samplng type
* @alpha_enable: whether the format has an alpha channel
- * @unpack_align_msb: unpack aligned to LSB or MSB
* @unpack_count: number of the components to unpack
* @bpp: bytes per pixel
* @flags: usage bit flags
@@ -45,7 +46,6 @@ struct msm_format {
enum mdp_fetch_type fetch_type;
enum mdp_chroma_samp_type chroma_sample;
bool alpha_enable;
- u8 unpack_align_msb;
u8 unpack_count;
u8 bpp;
unsigned long flags;
--
2.39.2
next prev parent reply other threads:[~2024-04-20 4:01 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-20 4:00 [PATCH v2 0/9] drm/msm: fold dpu_format into mdp_formats database Dmitry Baryshkov
2024-04-20 4:00 ` [PATCH v2 1/9] drm/msm/dpu: use format-related definitions from mdp_common.xml.h Dmitry Baryshkov
2024-04-20 4:00 ` [PATCH v2 2/9] drm/msm: add arrays listing formats supported by MDP4/MDP5 hardware Dmitry Baryshkov
2024-04-20 4:01 ` [PATCH v2 3/9] drm/msm/dpu: in dpu_format replace bitmap with unsigned long field Dmitry Baryshkov
2024-04-20 4:01 ` [PATCH v2 4/9] drm/msm/dpu: pull format flag definitions to mdp_format.h Dmitry Baryshkov
2024-04-20 22:47 ` Abhinav Kumar
2024-04-20 4:01 ` [PATCH v2 5/9] drm/msm: merge dpu_format and mdp_format in struct msm_format Dmitry Baryshkov
2024-04-20 4:01 ` [PATCH v2 6/9] drm/msm: convert msm_format::unpack_tight to the flag Dmitry Baryshkov
2024-04-20 4:01 ` Dmitry Baryshkov [this message]
2024-04-20 4:01 ` [PATCH v2 8/9] drm/msm: merge dpu format database to MDP formats Dmitry Baryshkov
2024-04-20 22:50 ` Abhinav Kumar
2024-04-20 4:01 ` [PATCH v2 9/9] drm/msm: drop msm_kms_funcs::get_format() callback Dmitry Baryshkov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240420-dpu-format-v2-7-9e93226cbffd@linaro.org \
--to=dmitry.baryshkov@linaro.org \
--cc=airlied@gmail.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=freedreno@lists.freedesktop.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marijn.suijten@somainline.org \
--cc=quic_abhinavk@quicinc.com \
--cc=robdclark@gmail.com \
--cc=sean@poorly.run \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox