From: Alain Volmat <avolmat@me.com>
To: Alain Volmat <alain.volmat@foss.st.com>,
David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch>
Cc: Alain Volmat <avolmat@me.com>,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: [PATCH 08/14] drm/sti: add more planes supports in sti_mixer
Date: Thu, 27 Jul 2023 21:51:32 +0000 [thread overview]
Message-ID: <20230727215141.53910-9-avolmat@me.com> (raw)
In-Reply-To: <20230727215141.53910-1-avolmat@me.com>
On STiH418, the mixer is able to driver more layers of
planes. For this purpose, add those new possible entries
and allow it to work in either STiH407 or STiH418 mode.
Signed-off-by: Alain Volmat <avolmat@me.com>
---
drivers/gpu/drm/sti/sti_mixer.c | 66 ++++++++++++++++++++++++++++-----
drivers/gpu/drm/sti/sti_mixer.h | 3 +-
2 files changed, 58 insertions(+), 11 deletions(-)
diff --git a/drivers/gpu/drm/sti/sti_mixer.c b/drivers/gpu/drm/sti/sti_mixer.c
index 9cd780403d7b..d30e31e62268 100644
--- a/drivers/gpu/drm/sti/sti_mixer.c
+++ b/drivers/gpu/drm/sti/sti_mixer.c
@@ -42,7 +42,9 @@ module_param_named(bkgcolor, bkg_color, int, 0644);
#define GAM_DEPTH_GDP1_ID 4
#define GAM_DEPTH_GDP2_ID 5
#define GAM_DEPTH_GDP3_ID 6
-#define GAM_DEPTH_MASK_ID 7
+#define GAM_DEPTH_GDP4_ID 7
+#define GAM_DEPTH_GDP5_ID 8
+#define GAM_DEPTH_VID2_ID 9
/* mask in CTL reg */
#define GAM_CTL_BACK_MASK BIT(0)
@@ -52,6 +54,10 @@ module_param_named(bkgcolor, bkg_color, int, 0644);
#define GAM_CTL_GDP1_MASK BIT(4)
#define GAM_CTL_GDP2_MASK BIT(5)
#define GAM_CTL_GDP3_MASK BIT(6)
+#define GAM_CTL_GDP4_MASK BIT(7)
+#define GAM_CTL_GDP5_MASK BIT(8)
+/* CURSOR doesn't exist on STiH418 where VID2 exist */
+#define GAM_CTL_VID2_MASK BIT(9)
#define GAM_CTL_CURSOR_MASK BIT(9)
const char *sti_mixer_to_str(struct sti_mixer *mixer)
@@ -80,15 +86,16 @@ static inline void sti_mixer_reg_write(struct sti_mixer *mixer,
#define DBGFS_DUMP(reg) seq_printf(s, "\n %-25s 0x%08X", #reg, \
sti_mixer_reg_read(mixer, reg))
-static void mixer_dbg_ctl(struct seq_file *s, int val)
+static void mixer_dbg_ctl(struct seq_file *s, int val, int depth)
{
unsigned int i;
int count = 0;
char *const disp_layer[] = {"BKG", "VID0", "VID1", "GDP0",
- "GDP1", "GDP2", "GDP3"};
+ "GDP1", "GDP2", "GDP3", "GDP4",
+ "GDP5", "VID2"};
seq_puts(s, "\tEnabled: ");
- for (i = 0; i < 7; i++) {
+ for (i = 0; i < depth; i++) {
if (val & 1) {
seq_printf(s, "%s ", disp_layer[i]);
count++;
@@ -108,18 +115,20 @@ static void mixer_dbg_ctl(struct seq_file *s, int val)
static void mixer_dbg_crb(struct seq_file *s, struct sti_mixer *mixer, u64 val)
{
int i;
- u32 shift, mask_id;
+ u32 shift, mask_id, mixer_depth;
if (of_device_is_compatible(mixer->dev->of_node, "st,stih418-compositor")) {
shift = 4;
mask_id = 0x0f;
+ mixer_depth = GAM_MIXER_NB_DEPTH_LEVEL_STIH418;
} else {
shift = 3;
mask_id = 0x07;
+ mixer_depth = GAM_MIXER_NB_DEPTH_LEVEL_STIH407;
}
seq_puts(s, "\tDepth: ");
- for (i = 0; i < GAM_MIXER_NB_DEPTH_LEVEL; i++) {
+ for (i = 0; i < mixer_depth; i++) {
switch (val & mask_id) {
case GAM_DEPTH_VID0_ID:
seq_puts(s, "VID0");
@@ -139,11 +148,20 @@ static void mixer_dbg_crb(struct seq_file *s, struct sti_mixer *mixer, u64 val)
case GAM_DEPTH_GDP3_ID:
seq_puts(s, "GDP3");
break;
+ case GAM_DEPTH_GDP4_ID:
+ seq_puts(s, "GDP4");
+ break;
+ case GAM_DEPTH_GDP5_ID:
+ seq_puts(s, "GDP5");
+ break;
+ case GAM_DEPTH_VID2_ID:
+ seq_puts(s, "VID2");
+ break;
default:
seq_puts(s, "---");
}
- if (i < GAM_MIXER_NB_DEPTH_LEVEL - 1)
+ if (i < mixer_depth - 1)
seq_puts(s, " < ");
val = val >> shift;
}
@@ -161,13 +179,19 @@ static int mixer_dbg_show(struct seq_file *s, void *arg)
{
struct drm_info_node *node = s->private;
struct sti_mixer *mixer = (struct sti_mixer *)node->info_ent->data;
+ int depth;
u64 val;
+ if (of_device_is_compatible(mixer->dev->of_node, "st,stih418-compositor"))
+ depth = GAM_MIXER_NB_DEPTH_LEVEL_STIH418 + 1;
+ else
+ depth = GAM_MIXER_NB_DEPTH_LEVEL_STIH407 + 1;
+
seq_printf(s, "%s: (vaddr = 0x%p)",
sti_mixer_to_str(mixer), mixer->regs);
DBGFS_DUMP(GAM_MIXER_CTL);
- mixer_dbg_ctl(s, sti_mixer_reg_read(mixer, GAM_MIXER_CTL));
+ mixer_dbg_ctl(s, sti_mixer_reg_read(mixer, GAM_MIXER_CTL), depth);
DBGFS_DUMP(GAM_MIXER_BKC);
DBGFS_DUMP(GAM_MIXER_BCO);
DBGFS_DUMP(GAM_MIXER_BCS);
@@ -259,14 +283,16 @@ int sti_mixer_set_plane_depth(struct sti_mixer *mixer, struct sti_plane *plane)
int plane_id, depth = plane->drm_plane.state->normalized_zpos;
unsigned int i;
u64 mask, val;
- u32 shift, mask_id;
+ u32 shift, mask_id, mixer_depth;
if (of_device_is_compatible(mixer->dev->of_node, "st,stih418-compositor")) {
shift = 4;
mask_id = 0x0f;
+ mixer_depth = GAM_MIXER_NB_DEPTH_LEVEL_STIH418;
} else {
shift = 3;
mask_id = 0x07;
+ mixer_depth = GAM_MIXER_NB_DEPTH_LEVEL_STIH407;
}
switch (plane->desc) {
@@ -285,6 +311,18 @@ int sti_mixer_set_plane_depth(struct sti_mixer *mixer, struct sti_plane *plane)
case STI_HQVDP_0:
plane_id = GAM_DEPTH_VID0_ID;
break;
+ case STI_HQVDP_1:
+ plane_id = GAM_DEPTH_VID1_ID;
+ break;
+ case STI_GDP_4:
+ plane_id = GAM_DEPTH_GDP4_ID;
+ break;
+ case STI_GDP_5:
+ plane_id = GAM_DEPTH_GDP5_ID;
+ break;
+ case STI_HQVDP_2:
+ plane_id = GAM_DEPTH_VID2_ID;
+ break;
case STI_CURSOR:
/* no need to set depth for cursor */
return 0;
@@ -297,7 +335,7 @@ int sti_mixer_set_plane_depth(struct sti_mixer *mixer, struct sti_plane *plane)
val = sti_mixer_reg_read(mixer, GAM_MIXER_CRB);
if (of_device_is_compatible(mixer->dev->of_node, "st,stih418-compositor"))
val |= ((u64)sti_mixer_reg_read(mixer, GAM_MIXER_CRB2) << 32);
- for (i = 0; i < GAM_MIXER_NB_DEPTH_LEVEL; i++) {
+ for (i = 0; i < mixer_depth; i++) {
mask = mask_id << (shift * i);
if ((val & mask) == plane_id << (shift * i))
break;
@@ -366,6 +404,14 @@ static u32 sti_mixer_get_plane_mask(struct sti_plane *plane)
return GAM_CTL_GDP3_MASK;
case STI_HQVDP_0:
return GAM_CTL_VID0_MASK;
+ case STI_HQVDP_1:
+ return GAM_CTL_VID1_MASK;
+ case STI_GDP_4:
+ return GAM_CTL_GDP4_MASK;
+ case STI_GDP_5:
+ return GAM_CTL_GDP5_MASK;
+ case STI_HQVDP_2:
+ return GAM_CTL_VID2_MASK;
case STI_CURSOR:
return GAM_CTL_CURSOR_MASK;
default:
diff --git a/drivers/gpu/drm/sti/sti_mixer.h b/drivers/gpu/drm/sti/sti_mixer.h
index ab06beb7b258..1ce7c6b4b4f3 100644
--- a/drivers/gpu/drm/sti/sti_mixer.h
+++ b/drivers/gpu/drm/sti/sti_mixer.h
@@ -61,7 +61,8 @@ void sti_mixer_set_background_status(struct sti_mixer *mixer, bool enable);
void sti_mixer_debugfs_init(struct sti_mixer *mixer, struct drm_minor *minor);
/* depth in Cross-bar control = z order */
-#define GAM_MIXER_NB_DEPTH_LEVEL 6
+#define GAM_MIXER_NB_DEPTH_LEVEL_STIH407 6
+#define GAM_MIXER_NB_DEPTH_LEVEL_STIH418 9
#define STI_MIXER_MAIN 0
#define STI_MIXER_AUX 1
--
2.34.1
next prev parent reply other threads:[~2023-07-27 21:53 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-27 21:51 [PATCH 00/14] drm/sti: add display support on stih418 family Alain Volmat
2023-07-27 21:51 ` [PATCH 01/14] drm/sti: add hdmi tx6g0c28 phy for STi platform Alain Volmat
2023-07-27 21:51 ` [PATCH 02/14] dt-bindings: display: add st,stih418-vtg compatible for sti vtg Alain Volmat
2023-07-28 7:22 ` Krzysztof Kozlowski
2023-07-27 21:51 ` [PATCH 03/14] drm/sti: add support for VTG on the stih418 platform Alain Volmat
2023-07-27 21:51 ` [PATCH 04/14] drm/sti: add STih418 platform support in sti mixer Alain Volmat
2023-07-27 21:51 ` [PATCH 05/14] drm/sti: add support for stih418 in tvout Alain Volmat
2023-07-27 21:51 ` [PATCH 06/14] drm/sti: remove VTG_SYNC_ID_HDMI from sti_vtg.h Alain Volmat
2023-07-27 21:51 ` [PATCH 07/14] drm/sti: add more possible GDP / VID planes entries in sti_plane Alain Volmat
2023-07-27 21:51 ` Alain Volmat [this message]
2023-07-27 21:51 ` [PATCH 09/14] drm/sti: add support for GDPPLUS / stih418 GDPs Alain Volmat
2023-07-27 21:51 ` [PATCH 10/14] drm/sti: add compositor support for stih418 platform Alain Volmat
2023-07-27 21:51 ` [PATCH 11/14] ARM: dts: sti: move vtg_main / vtg_aux into stih407/stih410 dtsi Alain Volmat
2023-07-27 21:51 ` [PATCH 12/14] ARM: dts: sti: addition of display nodes for stih418 platform Alain Volmat
2023-07-28 7:24 ` Krzysztof Kozlowski
2023-07-27 21:51 ` [PATCH 13/14] ARM: dts: sti: add the gpu node for the MALI-400 on stih418.dtsi Alain Volmat
2023-07-27 21:51 ` [PATCH 14/14] ARM: dts: sti: enable basic display on stih418-b2264 board Alain Volmat
2023-07-28 7:24 ` Krzysztof Kozlowski
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=20230727215141.53910-9-avolmat@me.com \
--to=avolmat@me.com \
--cc=airlied@gmail.com \
--cc=alain.volmat@foss.st.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
/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
all inboxes | Powered by JetHome®