* [PATCH 00/13] Fix the errors of MediaTek display driver found by IGT
@ 2024-06-16 8:29 Hsiao Chien Sung via B4 Relay
2024-06-16 8:29 ` [PATCH 01/13] soc: mediatek: Disable 9-bit alpha in ETHDR Hsiao Chien Sung via B4 Relay
` (12 more replies)
0 siblings, 13 replies; 20+ messages in thread
From: Hsiao Chien Sung via B4 Relay @ 2024-06-16 8:29 UTC (permalink / raw)
To: Chun-Kuang Hu, Philipp Zabel, David Airlie, Daniel Vetter,
Matthias Brugger, AngeloGioacchino Del Regno, CK Hu, Bibby Hsieh,
Daniel Kurtz, YT Shen, Mao Huang, Nancy.Lin
Cc: dri-devel, linux-mediatek, linux-kernel, linux-arm-kernel,
Hsiao Chien Sung
This series fixes the errors of MediaTek display driver found by IGT.
Signed-off-by: Hsiao Chien Sung <shawn.sung@mediatek.com>
---
Hsiao Chien Sung (13):
soc: mediatek: Disable 9-bit alpha in ETHDR
drm/mediatek: Add OVL compatible name for MT8195
drm/mediatek: Add missing plane settings when async update
drm/mediatek: Add DRM_MODE_ROTATE_0 to rotation property
drm/mediatek: Set DRM mode configs accordingly
drm/mediatek: Turn off the layers with zero width or height
drm/mediatek: Support more 10bit formats in OVL
drm/mediatek: Support RGBA8888 and RGBX8888 in OVL on MT8195
drm/mediatek: Fix XRGB setting error in OVL
drm/mediatek: Fix XRGB setting error in Mixer
drm/mediatek: Add new color format MACROs in OVL
drm/mediatek: Support DRM plane alpha in OVL
drm/mediatek: Support DRM plane alpha in Mixer
drivers/gpu/drm/mediatek/mtk_ddp_comp.h | 6 +-
drivers/gpu/drm/mediatek/mtk_disp_ovl.c | 85 +++++++++++++++++--------
drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c | 2 +-
drivers/gpu/drm/mediatek/mtk_drm_drv.c | 24 +++++++
drivers/gpu/drm/mediatek/mtk_drm_drv.h | 4 ++
drivers/gpu/drm/mediatek/mtk_ethdr.c | 26 ++++++--
drivers/gpu/drm/mediatek/mtk_plane.c | 4 +-
drivers/soc/mediatek/mtk-mmsys.c | 1 +
8 files changed, 118 insertions(+), 34 deletions(-)
---
base-commit: 62fe4b067581d480e863191305f108bebffbc0e9
change-id: 20240615-mediatek-drm-next-ad601b349f23
Best regards,
--
Hsiao Chien Sung <shawn.sung@mediatek.com>
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH 01/13] soc: mediatek: Disable 9-bit alpha in ETHDR
2024-06-16 8:29 [PATCH 00/13] Fix the errors of MediaTek display driver found by IGT Hsiao Chien Sung via B4 Relay
@ 2024-06-16 8:29 ` Hsiao Chien Sung via B4 Relay
2024-06-16 8:29 ` [PATCH 02/13] drm/mediatek: Add OVL compatible name for MT8195 Hsiao Chien Sung via B4 Relay
` (11 subsequent siblings)
12 siblings, 0 replies; 20+ messages in thread
From: Hsiao Chien Sung via B4 Relay @ 2024-06-16 8:29 UTC (permalink / raw)
To: Chun-Kuang Hu, Philipp Zabel, David Airlie, Daniel Vetter,
Matthias Brugger, AngeloGioacchino Del Regno, CK Hu, Bibby Hsieh,
Daniel Kurtz, YT Shen, Mao Huang, Nancy.Lin
Cc: dri-devel, linux-mediatek, linux-kernel, linux-arm-kernel,
Hsiao Chien Sung
From: Hsiao Chien Sung <shawn.sung@mediatek.com>
When 9-bit alpha is enabled, its value will be converted from 0-255 to
0-256 (255 = not defined). This is designed for special HDR related
calculation, which should be disabled by default, otherwise, alpha
blending will not work correctly.
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Hsiao Chien Sung <shawn.sung@mediatek.com>
---
drivers/gpu/drm/mediatek/mtk_ethdr.c | 3 +--
drivers/soc/mediatek/mtk-mmsys.c | 1 +
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/mediatek/mtk_ethdr.c b/drivers/gpu/drm/mediatek/mtk_ethdr.c
index 156c6ff547e8..d7d16482c947 100644
--- a/drivers/gpu/drm/mediatek/mtk_ethdr.c
+++ b/drivers/gpu/drm/mediatek/mtk_ethdr.c
@@ -50,7 +50,6 @@
#define MIXER_INX_MODE_BYPASS 0
#define MIXER_INX_MODE_EVEN_EXTEND 1
-#define DEFAULT_9BIT_ALPHA 0x100
#define MIXER_ALPHA_AEN BIT(8)
#define MIXER_ALPHA 0xff
#define ETHDR_CLK_NUM 13
@@ -169,7 +168,7 @@ void mtk_ethdr_layer_config(struct device *dev, unsigned int idx,
alpha_con = MIXER_ALPHA_AEN | MIXER_ALPHA;
mtk_mmsys_mixer_in_config(priv->mmsys_dev, idx + 1, alpha_con ? false : true,
- DEFAULT_9BIT_ALPHA,
+ MIXER_ALPHA,
pending->x & 1 ? MIXER_INX_MODE_EVEN_EXTEND :
MIXER_INX_MODE_BYPASS, align_width / 2 - 1, cmdq_pkt);
diff --git a/drivers/soc/mediatek/mtk-mmsys.c b/drivers/soc/mediatek/mtk-mmsys.c
index f370f4ec4b88..938240714e54 100644
--- a/drivers/soc/mediatek/mtk-mmsys.c
+++ b/drivers/soc/mediatek/mtk-mmsys.c
@@ -236,6 +236,7 @@ void mtk_mmsys_mixer_in_config(struct device *dev, int idx, bool alpha_sel, u16
mtk_mmsys_update_bits(mmsys, MT8195_VDO1_MIXER_IN1_ALPHA + (idx - 1) * 4, ~0,
alpha << 16 | alpha, cmdq_pkt);
+ mtk_mmsys_update_bits(mmsys, MT8195_VDO1_HDR_TOP_CFG, BIT(15 + idx), 0, cmdq_pkt);
mtk_mmsys_update_bits(mmsys, MT8195_VDO1_HDR_TOP_CFG, BIT(19 + idx),
alpha_sel << (19 + idx), cmdq_pkt);
mtk_mmsys_update_bits(mmsys, MT8195_VDO1_MIXER_IN1_PAD + (idx - 1) * 4,
--
Git-146)
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH 02/13] drm/mediatek: Add OVL compatible name for MT8195
2024-06-16 8:29 [PATCH 00/13] Fix the errors of MediaTek display driver found by IGT Hsiao Chien Sung via B4 Relay
2024-06-16 8:29 ` [PATCH 01/13] soc: mediatek: Disable 9-bit alpha in ETHDR Hsiao Chien Sung via B4 Relay
@ 2024-06-16 8:29 ` Hsiao Chien Sung via B4 Relay
2024-06-16 8:29 ` [PATCH 03/13] drm/mediatek: Add missing plane settings when async update Hsiao Chien Sung via B4 Relay
` (10 subsequent siblings)
12 siblings, 0 replies; 20+ messages in thread
From: Hsiao Chien Sung via B4 Relay @ 2024-06-16 8:29 UTC (permalink / raw)
To: Chun-Kuang Hu, Philipp Zabel, David Airlie, Daniel Vetter,
Matthias Brugger, AngeloGioacchino Del Regno, CK Hu, Bibby Hsieh,
Daniel Kurtz, YT Shen, Mao Huang, Nancy.Lin
Cc: dri-devel, linux-mediatek, linux-kernel, linux-arm-kernel,
Hsiao Chien Sung
From: Hsiao Chien Sung <shawn.sung@mediatek.com>
Add OVL compatible name for MT8195.
Without this commit, DRM won't work after modifying the device tree.
Reviewed-by: CK Hu <ck.hu@mediatek.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Hsiao Chien Sung <shawn.sung@mediatek.com>
---
drivers/gpu/drm/mediatek/mtk_drm_drv.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
index b5f605751b0a..8e047043202b 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
@@ -743,6 +743,8 @@ static const struct of_device_id mtk_ddp_comp_dt_ids[] = {
.data = (void *)MTK_DISP_OVL },
{ .compatible = "mediatek,mt8192-disp-ovl",
.data = (void *)MTK_DISP_OVL },
+ { .compatible = "mediatek,mt8195-disp-ovl",
+ .data = (void *)MTK_DISP_OVL },
{ .compatible = "mediatek,mt8183-disp-ovl-2l",
.data = (void *)MTK_DISP_OVL_2L },
{ .compatible = "mediatek,mt8192-disp-ovl-2l",
--
Git-146)
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH 03/13] drm/mediatek: Add missing plane settings when async update
2024-06-16 8:29 [PATCH 00/13] Fix the errors of MediaTek display driver found by IGT Hsiao Chien Sung via B4 Relay
2024-06-16 8:29 ` [PATCH 01/13] soc: mediatek: Disable 9-bit alpha in ETHDR Hsiao Chien Sung via B4 Relay
2024-06-16 8:29 ` [PATCH 02/13] drm/mediatek: Add OVL compatible name for MT8195 Hsiao Chien Sung via B4 Relay
@ 2024-06-16 8:29 ` Hsiao Chien Sung via B4 Relay
2024-06-16 8:29 ` [PATCH 04/13] drm/mediatek: Add DRM_MODE_ROTATE_0 to rotation property Hsiao Chien Sung via B4 Relay
` (9 subsequent siblings)
12 siblings, 0 replies; 20+ messages in thread
From: Hsiao Chien Sung via B4 Relay @ 2024-06-16 8:29 UTC (permalink / raw)
To: Chun-Kuang Hu, Philipp Zabel, David Airlie, Daniel Vetter,
Matthias Brugger, AngeloGioacchino Del Regno, CK Hu, Bibby Hsieh,
Daniel Kurtz, YT Shen, Mao Huang, Nancy.Lin
Cc: dri-devel, linux-mediatek, linux-kernel, linux-arm-kernel,
Hsiao Chien Sung
From: Hsiao Chien Sung <shawn.sung@mediatek.com>
Fix an issue that plane coordinate was not saved when
calling async update.
Fixes: 920fffcc8912 ("drm/mediatek: update cursors by using async atomic update")
Reviewed-by: CK Hu <ck.hu@mediatek.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Hsiao Chien Sung <shawn.sung@mediatek.com>
---
drivers/gpu/drm/mediatek/mtk_plane.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/gpu/drm/mediatek/mtk_plane.c b/drivers/gpu/drm/mediatek/mtk_plane.c
index 4625deb21d40..a74b26d35985 100644
--- a/drivers/gpu/drm/mediatek/mtk_plane.c
+++ b/drivers/gpu/drm/mediatek/mtk_plane.c
@@ -227,6 +227,8 @@ static void mtk_plane_atomic_async_update(struct drm_plane *plane,
plane->state->src_y = new_state->src_y;
plane->state->src_h = new_state->src_h;
plane->state->src_w = new_state->src_w;
+ plane->state->dst.x1 = new_state->dst.x1;
+ plane->state->dst.y1 = new_state->dst.y1;
mtk_plane_update_new_state(new_state, new_plane_state);
swap(plane->state->fb, new_state->fb);
--
Git-146)
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH 04/13] drm/mediatek: Add DRM_MODE_ROTATE_0 to rotation property
2024-06-16 8:29 [PATCH 00/13] Fix the errors of MediaTek display driver found by IGT Hsiao Chien Sung via B4 Relay
` (2 preceding siblings ...)
2024-06-16 8:29 ` [PATCH 03/13] drm/mediatek: Add missing plane settings when async update Hsiao Chien Sung via B4 Relay
@ 2024-06-16 8:29 ` Hsiao Chien Sung via B4 Relay
2024-06-16 8:29 ` [PATCH 05/13] drm/mediatek: Set DRM mode configs accordingly Hsiao Chien Sung via B4 Relay
` (8 subsequent siblings)
12 siblings, 0 replies; 20+ messages in thread
From: Hsiao Chien Sung via B4 Relay @ 2024-06-16 8:29 UTC (permalink / raw)
To: Chun-Kuang Hu, Philipp Zabel, David Airlie, Daniel Vetter,
Matthias Brugger, AngeloGioacchino Del Regno, CK Hu, Bibby Hsieh,
Daniel Kurtz, YT Shen, Mao Huang, Nancy.Lin
Cc: dri-devel, linux-mediatek, linux-kernel, linux-arm-kernel,
Hsiao Chien Sung
From: Hsiao Chien Sung <shawn.sung@mediatek.com>
Always add DRM_MODE_ROTATE_0 to rotation property to meet
IGT's (Intel GPU Tools) requirement.
Reviewed-by: CK Hu <ck.hu@mediatek.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Hsiao Chien Sung <shawn.sung@mediatek.com>
---
drivers/gpu/drm/mediatek/mtk_ddp_comp.h | 6 +++++-
drivers/gpu/drm/mediatek/mtk_disp_ovl.c | 17 +++++------------
drivers/gpu/drm/mediatek/mtk_plane.c | 2 +-
3 files changed, 11 insertions(+), 14 deletions(-)
diff --git a/drivers/gpu/drm/mediatek/mtk_ddp_comp.h b/drivers/gpu/drm/mediatek/mtk_ddp_comp.h
index 26236691ce4c..f7fe2e08dc8e 100644
--- a/drivers/gpu/drm/mediatek/mtk_ddp_comp.h
+++ b/drivers/gpu/drm/mediatek/mtk_ddp_comp.h
@@ -192,7 +192,11 @@ unsigned int mtk_ddp_comp_supported_rotations(struct mtk_ddp_comp *comp)
if (comp->funcs && comp->funcs->supported_rotations)
return comp->funcs->supported_rotations(comp->dev);
- return 0;
+ /*
+ * In order to pass IGT tests, DRM_MODE_ROTATE_0 is required when
+ * rotation is not supported.
+ */
+ return DRM_MODE_ROTATE_0;
}
static inline unsigned int mtk_ddp_comp_layer_nr(struct mtk_ddp_comp *comp)
diff --git a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
index b552a02d7eae..862ab683ed1b 100644
--- a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
+++ b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
@@ -296,27 +296,20 @@ int mtk_ovl_layer_check(struct device *dev, unsigned int idx,
struct mtk_plane_state *mtk_state)
{
struct drm_plane_state *state = &mtk_state->base;
- unsigned int rotation = 0;
- rotation = drm_rotation_simplify(state->rotation,
- DRM_MODE_ROTATE_0 |
- DRM_MODE_REFLECT_X |
- DRM_MODE_REFLECT_Y);
- rotation &= ~DRM_MODE_ROTATE_0;
-
- /* We can only do reflection, not rotation */
- if ((rotation & DRM_MODE_ROTATE_MASK) != 0)
+ /* check if any unsupported rotation is set */
+ if (state->rotation & ~mtk_ovl_supported_rotations(dev))
return -EINVAL;
/*
* TODO: Rotating/reflecting YUV buffers is not supported at this time.
* Only RGB[AX] variants are supported.
+ * Since DRM_MODE_ROTATE_0 means "no rotation", we should not
+ * reject layers with this property.
*/
- if (state->fb->format->is_yuv && rotation != 0)
+ if (state->fb->format->is_yuv && (state->rotation & ~DRM_MODE_ROTATE_0))
return -EINVAL;
- state->rotation = rotation;
-
return 0;
}
diff --git a/drivers/gpu/drm/mediatek/mtk_plane.c b/drivers/gpu/drm/mediatek/mtk_plane.c
index a74b26d35985..1723d4333f37 100644
--- a/drivers/gpu/drm/mediatek/mtk_plane.c
+++ b/drivers/gpu/drm/mediatek/mtk_plane.c
@@ -338,7 +338,7 @@ int mtk_plane_init(struct drm_device *dev, struct drm_plane *plane,
return err;
}
- if (supported_rotations & ~DRM_MODE_ROTATE_0) {
+ if (supported_rotations) {
err = drm_plane_create_rotation_property(plane,
DRM_MODE_ROTATE_0,
supported_rotations);
--
Git-146)
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH 05/13] drm/mediatek: Set DRM mode configs accordingly
2024-06-16 8:29 [PATCH 00/13] Fix the errors of MediaTek display driver found by IGT Hsiao Chien Sung via B4 Relay
` (3 preceding siblings ...)
2024-06-16 8:29 ` [PATCH 04/13] drm/mediatek: Add DRM_MODE_ROTATE_0 to rotation property Hsiao Chien Sung via B4 Relay
@ 2024-06-16 8:29 ` Hsiao Chien Sung via B4 Relay
2024-06-16 8:29 ` [PATCH 06/13] drm/mediatek: Turn off the layers with zero width or height Hsiao Chien Sung via B4 Relay
` (7 subsequent siblings)
12 siblings, 0 replies; 20+ messages in thread
From: Hsiao Chien Sung via B4 Relay @ 2024-06-16 8:29 UTC (permalink / raw)
To: Chun-Kuang Hu, Philipp Zabel, David Airlie, Daniel Vetter,
Matthias Brugger, AngeloGioacchino Del Regno, CK Hu, Bibby Hsieh,
Daniel Kurtz, YT Shen, Mao Huang, Nancy.Lin
Cc: dri-devel, linux-mediatek, linux-kernel, linux-arm-kernel,
Hsiao Chien Sung
From: Hsiao Chien Sung <shawn.sung@mediatek.com>
Set DRM mode configs limitation according to the hardware capabilities
and pass the IGT checks as below:
- The test "graphics.IgtKms.kms_plane" requires a frame buffer with
width of 4512 pixels (> 4096).
- The test "graphics.IgtKms.kms_cursor_crc" checks if the cursor size is
defined, and run the test with cursor size from 1x1 to 512x512.
Please notice that the test conditions may change as IGT is updated.
Reviewed-by: CK Hu <ck.hu@mediatek.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Hsiao Chien Sung <shawn.sung@mediatek.com>
---
drivers/gpu/drm/mediatek/mtk_drm_drv.c | 22 ++++++++++++++++++++++
drivers/gpu/drm/mediatek/mtk_drm_drv.h | 4 ++++
2 files changed, 26 insertions(+)
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
index 8e047043202b..c9cad3a82737 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
@@ -294,6 +294,9 @@ static const struct mtk_mmsys_driver_data mt8188_vdosys0_driver_data = {
.conn_routes = mt8188_mtk_ddp_main_routes,
.num_conn_routes = ARRAY_SIZE(mt8188_mtk_ddp_main_routes),
.mmsys_dev_num = 2,
+ .max_width = 8191,
+ .min_width = 1,
+ .min_height = 1,
};
static const struct mtk_mmsys_driver_data mt8192_mmsys_driver_data = {
@@ -308,6 +311,9 @@ static const struct mtk_mmsys_driver_data mt8195_vdosys0_driver_data = {
.main_path = mt8195_mtk_ddp_main,
.main_len = ARRAY_SIZE(mt8195_mtk_ddp_main),
.mmsys_dev_num = 2,
+ .max_width = 8191,
+ .min_width = 1,
+ .min_height = 1,
};
static const struct mtk_mmsys_driver_data mt8195_vdosys1_driver_data = {
@@ -315,6 +321,9 @@ static const struct mtk_mmsys_driver_data mt8195_vdosys1_driver_data = {
.ext_len = ARRAY_SIZE(mt8195_mtk_ddp_ext),
.mmsys_id = 1,
.mmsys_dev_num = 2,
+ .max_width = 8191,
+ .min_width = 2, /* 2-pixel align when ethdr is bypassed */
+ .min_height = 1,
};
static const struct of_device_id mtk_drm_of_ids[] = {
@@ -493,6 +502,15 @@ static int mtk_drm_kms_init(struct drm_device *drm)
for (j = 0; j < private->data->mmsys_dev_num; j++) {
priv_n = private->all_drm_private[j];
+ if (priv_n->data->max_width)
+ drm->mode_config.max_width = priv_n->data->max_width;
+
+ if (priv_n->data->min_width)
+ drm->mode_config.min_width = priv_n->data->min_width;
+
+ if (priv_n->data->min_height)
+ drm->mode_config.min_height = priv_n->data->min_height;
+
if (i == CRTC_MAIN && priv_n->data->main_len) {
ret = mtk_crtc_create(drm, priv_n->data->main_path,
priv_n->data->main_len, j,
@@ -520,6 +538,10 @@ static int mtk_drm_kms_init(struct drm_device *drm)
}
}
+ /* IGT will check if the cursor size is configured */
+ drm->mode_config.cursor_width = drm->mode_config.max_width;
+ drm->mode_config.cursor_height = drm->mode_config.max_height;
+
/* Use OVL device for all DMA memory allocations */
crtc = drm_crtc_from_index(drm, 0);
if (crtc)
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.h b/drivers/gpu/drm/mediatek/mtk_drm_drv.h
index 78d698ede1bf..ce897984de51 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_drv.h
+++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.h
@@ -46,6 +46,10 @@ struct mtk_mmsys_driver_data {
bool shadow_register;
unsigned int mmsys_id;
unsigned int mmsys_dev_num;
+
+ u16 max_width;
+ u16 min_width;
+ u16 min_height;
};
struct mtk_drm_private {
--
Git-146)
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH 06/13] drm/mediatek: Turn off the layers with zero width or height
2024-06-16 8:29 [PATCH 00/13] Fix the errors of MediaTek display driver found by IGT Hsiao Chien Sung via B4 Relay
` (4 preceding siblings ...)
2024-06-16 8:29 ` [PATCH 05/13] drm/mediatek: Set DRM mode configs accordingly Hsiao Chien Sung via B4 Relay
@ 2024-06-16 8:29 ` Hsiao Chien Sung via B4 Relay
2024-06-16 8:29 ` [PATCH 07/13] drm/mediatek: Support more 10bit formats in OVL Hsiao Chien Sung via B4 Relay
` (6 subsequent siblings)
12 siblings, 0 replies; 20+ messages in thread
From: Hsiao Chien Sung via B4 Relay @ 2024-06-16 8:29 UTC (permalink / raw)
To: Chun-Kuang Hu, Philipp Zabel, David Airlie, Daniel Vetter,
Matthias Brugger, AngeloGioacchino Del Regno, CK Hu, Bibby Hsieh,
Daniel Kurtz, YT Shen, Mao Huang, Nancy.Lin
Cc: dri-devel, linux-mediatek, linux-kernel, linux-arm-kernel,
Hsiao Chien Sung
From: Hsiao Chien Sung <shawn.sung@mediatek.com>
We found that IGT (Intel GPU Tool) will try to commit layers with
zero width or height and lead to undefined behaviors in hardware.
Disable the layers in such a situation.
Fixes: 453c3364632a ("drm/mediatek: Add ovl_adaptor support for MT8195")
Fixes: d886c0009bd0 ("drm/mediatek: Add ETHDR support for MT8195")
Reviewed-by: CK Hu <ck.hu@mediatek.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Hsiao Chien Sung <shawn.sung@mediatek.com>
---
drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c | 2 +-
drivers/gpu/drm/mediatek/mtk_ethdr.c | 7 ++++++-
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c b/drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c
index 02dd7dcdfedb..2b62d6475918 100644
--- a/drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c
+++ b/drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c
@@ -158,7 +158,7 @@ void mtk_ovl_adaptor_layer_config(struct device *dev, unsigned int idx,
merge = ovl_adaptor->ovl_adaptor_comp[OVL_ADAPTOR_MERGE0 + idx];
ethdr = ovl_adaptor->ovl_adaptor_comp[OVL_ADAPTOR_ETHDR0];
- if (!pending->enable) {
+ if (!pending->enable || !pending->width || !pending->height) {
mtk_merge_stop_cmdq(merge, cmdq_pkt);
mtk_mdp_rdma_stop(rdma_l, cmdq_pkt);
mtk_mdp_rdma_stop(rdma_r, cmdq_pkt);
diff --git a/drivers/gpu/drm/mediatek/mtk_ethdr.c b/drivers/gpu/drm/mediatek/mtk_ethdr.c
index d7d16482c947..b5484a286060 100644
--- a/drivers/gpu/drm/mediatek/mtk_ethdr.c
+++ b/drivers/gpu/drm/mediatek/mtk_ethdr.c
@@ -159,7 +159,12 @@ void mtk_ethdr_layer_config(struct device *dev, unsigned int idx,
if (idx >= 4)
return;
- if (!pending->enable) {
+ if (!pending->enable || !pending->width || !pending->height) {
+ /*
+ * instead of disabling layer with MIX_SRC_CON directly
+ * set the size to 0 to avoid screen shift due to mixer
+ * mode switch (hardware behavior)
+ */
mtk_ddp_write(cmdq_pkt, 0, &mixer->cmdq_base, mixer->regs, MIX_L_SRC_SIZE(idx));
return;
}
--
Git-146)
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH 07/13] drm/mediatek: Support more 10bit formats in OVL
2024-06-16 8:29 [PATCH 00/13] Fix the errors of MediaTek display driver found by IGT Hsiao Chien Sung via B4 Relay
` (5 preceding siblings ...)
2024-06-16 8:29 ` [PATCH 06/13] drm/mediatek: Turn off the layers with zero width or height Hsiao Chien Sung via B4 Relay
@ 2024-06-16 8:29 ` Hsiao Chien Sung via B4 Relay
2024-06-16 8:29 ` [PATCH 08/13] drm/mediatek: Support RGBA8888 and RGBX8888 in OVL on MT8195 Hsiao Chien Sung via B4 Relay
` (5 subsequent siblings)
12 siblings, 0 replies; 20+ messages in thread
From: Hsiao Chien Sung via B4 Relay @ 2024-06-16 8:29 UTC (permalink / raw)
To: Chun-Kuang Hu, Philipp Zabel, David Airlie, Daniel Vetter,
Matthias Brugger, AngeloGioacchino Del Regno, CK Hu, Bibby Hsieh,
Daniel Kurtz, YT Shen, Mao Huang, Nancy.Lin
Cc: dri-devel, linux-mediatek, linux-kernel, linux-arm-kernel,
Hsiao Chien Sung
From: Hsiao Chien Sung <shawn.sung@mediatek.com>
Support more 10bit formats in OVL.
Reviewed-by: CK Hu <ck.hu@mediatek.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Hsiao Chien Sung <shawn.sung@mediatek.com>
---
drivers/gpu/drm/mediatek/mtk_disp_ovl.c | 32 +++++++++++++++++++++++++++++---
1 file changed, 29 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
index 862ab683ed1b..d970cdce06bc 100644
--- a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
+++ b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
@@ -71,6 +71,22 @@
#define OVL_CON_VIRT_FLIP BIT(9)
#define OVL_CON_HORZ_FLIP BIT(10)
+static inline bool is_10bit_rgb(u32 fmt)
+{
+ switch (fmt) {
+ case DRM_FORMAT_XRGB2101010:
+ case DRM_FORMAT_ARGB2101010:
+ case DRM_FORMAT_RGBX1010102:
+ case DRM_FORMAT_RGBA1010102:
+ case DRM_FORMAT_XBGR2101010:
+ case DRM_FORMAT_ABGR2101010:
+ case DRM_FORMAT_BGRX1010102:
+ case DRM_FORMAT_BGRA1010102:
+ return true;
+ }
+ return false;
+}
+
static const u32 mt8173_formats[] = {
DRM_FORMAT_XRGB8888,
DRM_FORMAT_ARGB8888,
@@ -88,12 +104,18 @@ static const u32 mt8173_formats[] = {
static const u32 mt8195_formats[] = {
DRM_FORMAT_XRGB8888,
DRM_FORMAT_ARGB8888,
+ DRM_FORMAT_XRGB2101010,
DRM_FORMAT_ARGB2101010,
DRM_FORMAT_BGRX8888,
DRM_FORMAT_BGRA8888,
+ DRM_FORMAT_BGRX1010102,
DRM_FORMAT_BGRA1010102,
DRM_FORMAT_ABGR8888,
DRM_FORMAT_XBGR8888,
+ DRM_FORMAT_XBGR2101010,
+ DRM_FORMAT_ABGR2101010,
+ DRM_FORMAT_RGBX1010102,
+ DRM_FORMAT_RGBA1010102,
DRM_FORMAT_RGB888,
DRM_FORMAT_BGR888,
DRM_FORMAT_RGB565,
@@ -253,9 +275,7 @@ static void mtk_ovl_set_bit_depth(struct device *dev, int idx, u32 format,
reg = readl(ovl->regs + DISP_REG_OVL_CLRFMT_EXT);
reg &= ~OVL_CON_CLRFMT_BIT_DEPTH_MASK(idx);
- if (format == DRM_FORMAT_RGBA1010102 ||
- format == DRM_FORMAT_BGRA1010102 ||
- format == DRM_FORMAT_ARGB2101010)
+ if (is_10bit_rgb(format))
bit_depth = OVL_CON_CLRFMT_10_BIT;
reg |= OVL_CON_CLRFMT_BIT_DEPTH(bit_depth, idx);
@@ -368,17 +388,23 @@ static unsigned int ovl_fmt_convert(struct mtk_disp_ovl *ovl, unsigned int fmt)
return OVL_CON_CLRFMT_RGB888(ovl) | OVL_CON_BYTE_SWAP;
case DRM_FORMAT_RGBX8888:
case DRM_FORMAT_RGBA8888:
+ case DRM_FORMAT_RGBX1010102:
+ case DRM_FORMAT_RGBA1010102:
return OVL_CON_CLRFMT_ARGB8888;
case DRM_FORMAT_BGRX8888:
case DRM_FORMAT_BGRA8888:
+ case DRM_FORMAT_BGRX1010102:
case DRM_FORMAT_BGRA1010102:
return OVL_CON_CLRFMT_ARGB8888 | OVL_CON_BYTE_SWAP;
case DRM_FORMAT_XRGB8888:
case DRM_FORMAT_ARGB8888:
+ case DRM_FORMAT_XRGB2101010:
case DRM_FORMAT_ARGB2101010:
return OVL_CON_CLRFMT_RGBA8888;
case DRM_FORMAT_XBGR8888:
case DRM_FORMAT_ABGR8888:
+ case DRM_FORMAT_XBGR2101010:
+ case DRM_FORMAT_ABGR2101010:
return OVL_CON_CLRFMT_RGBA8888 | OVL_CON_BYTE_SWAP;
case DRM_FORMAT_UYVY:
return OVL_CON_CLRFMT_UYVY | OVL_CON_MTX_YUV_TO_RGB;
--
Git-146)
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH 08/13] drm/mediatek: Support RGBA8888 and RGBX8888 in OVL on MT8195
2024-06-16 8:29 [PATCH 00/13] Fix the errors of MediaTek display driver found by IGT Hsiao Chien Sung via B4 Relay
` (6 preceding siblings ...)
2024-06-16 8:29 ` [PATCH 07/13] drm/mediatek: Support more 10bit formats in OVL Hsiao Chien Sung via B4 Relay
@ 2024-06-16 8:29 ` Hsiao Chien Sung via B4 Relay
2024-06-16 8:29 ` [PATCH 09/13] drm/mediatek: Fix XRGB setting error in OVL Hsiao Chien Sung via B4 Relay
` (4 subsequent siblings)
12 siblings, 0 replies; 20+ messages in thread
From: Hsiao Chien Sung via B4 Relay @ 2024-06-16 8:29 UTC (permalink / raw)
To: Chun-Kuang Hu, Philipp Zabel, David Airlie, Daniel Vetter,
Matthias Brugger, AngeloGioacchino Del Regno, CK Hu, Bibby Hsieh,
Daniel Kurtz, YT Shen, Mao Huang, Nancy.Lin
Cc: dri-devel, linux-mediatek, linux-kernel, linux-arm-kernel,
Hsiao Chien Sung
From: Hsiao Chien Sung <shawn.sung@mediatek.com>
Support RGBA8888 and RGBX8888 formats in OVL on MT8195.
Reviewed-by: CK Hu <ck.hu@mediatek.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Hsiao Chien Sung <shawn.sung@mediatek.com>
---
drivers/gpu/drm/mediatek/mtk_disp_ovl.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
index d970cdce06bc..738244a6164e 100644
--- a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
+++ b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
@@ -114,6 +114,8 @@ static const u32 mt8195_formats[] = {
DRM_FORMAT_XBGR8888,
DRM_FORMAT_XBGR2101010,
DRM_FORMAT_ABGR2101010,
+ DRM_FORMAT_RGBX8888,
+ DRM_FORMAT_RGBA8888,
DRM_FORMAT_RGBX1010102,
DRM_FORMAT_RGBA1010102,
DRM_FORMAT_RGB888,
--
Git-146)
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH 09/13] drm/mediatek: Fix XRGB setting error in OVL
2024-06-16 8:29 [PATCH 00/13] Fix the errors of MediaTek display driver found by IGT Hsiao Chien Sung via B4 Relay
` (7 preceding siblings ...)
2024-06-16 8:29 ` [PATCH 08/13] drm/mediatek: Support RGBA8888 and RGBX8888 in OVL on MT8195 Hsiao Chien Sung via B4 Relay
@ 2024-06-16 8:29 ` Hsiao Chien Sung via B4 Relay
2024-06-17 8:02 ` CK Hu (胡俊光)
2024-06-17 11:21 ` AngeloGioacchino Del Regno
2024-06-16 8:29 ` [PATCH 10/13] drm/mediatek: Fix XRGB setting error in Mixer Hsiao Chien Sung via B4 Relay
` (3 subsequent siblings)
12 siblings, 2 replies; 20+ messages in thread
From: Hsiao Chien Sung via B4 Relay @ 2024-06-16 8:29 UTC (permalink / raw)
To: Chun-Kuang Hu, Philipp Zabel, David Airlie, Daniel Vetter,
Matthias Brugger, AngeloGioacchino Del Regno, CK Hu, Bibby Hsieh,
Daniel Kurtz, YT Shen, Mao Huang, Nancy.Lin
Cc: dri-devel, linux-mediatek, linux-kernel, linux-arm-kernel,
Hsiao Chien Sung
From: Hsiao Chien Sung <shawn.sung@mediatek.com>
CONST_BLD must be enabled for XRGB formats although the alpha channel
can be ignored, or OVL will still read the value from memory.
This error only affects CRC generation.
Fixes: 119f5173628a ("drm/mediatek: Add DRM Driver for Mediatek SoC MT8173.")
Signed-off-by: Hsiao Chien Sung <shawn.sung@mediatek.com>
---
drivers/gpu/drm/mediatek/mtk_disp_ovl.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
index 738244a6164e..615b75919d1b 100644
--- a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
+++ b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
@@ -38,6 +38,7 @@
#define DISP_REG_OVL_PITCH_MSB(n) (0x0040 + 0x20 * (n))
#define OVL_PITCH_MSB_2ND_SUBBUF BIT(16)
#define DISP_REG_OVL_PITCH(n) (0x0044 + 0x20 * (n))
+#define OVL_CONST_BLEND BIT(28)
#define DISP_REG_OVL_RDMA_CTRL(n) (0x00c0 + 0x20 * (n))
#define DISP_REG_OVL_RDMA_GMC(n) (0x00c8 + 0x20 * (n))
#define DISP_REG_OVL_ADDR_MT2701 0x0040
@@ -428,6 +429,7 @@ void mtk_ovl_layer_config(struct device *dev, unsigned int idx,
unsigned int fmt = pending->format;
unsigned int offset = (pending->y << 16) | pending->x;
unsigned int src_size = (pending->height << 16) | pending->width;
+ unsigned int ignore_pixel_alpha = 0;
unsigned int con;
bool is_afbc = pending->modifier != DRM_FORMAT_MOD_LINEAR;
union overlay_pitch {
@@ -449,6 +451,14 @@ void mtk_ovl_layer_config(struct device *dev, unsigned int idx,
if (state->base.fb && state->base.fb->format->has_alpha)
con |= OVL_CON_AEN | OVL_CON_ALPHA;
+ /* CONST_BLD must be enabled for XRGB formats although the alpha channel
+ * can be ignored, or OVL will still read the value from memory.
+ * For RGB888 related formats, whether CONST_BLD is enabled or not won't
+ * affect the result. Therefore we use !has_alpha as the condition.
+ */
+ if (state->base.fb && !state->base.fb->format->has_alpha)
+ ignore_pixel_alpha = OVL_CONST_BLEND;
+
if (pending->rotation & DRM_MODE_REFLECT_Y) {
con |= OVL_CON_VIRT_FLIP;
addr += (pending->height - 1) * pending->pitch;
@@ -464,8 +474,8 @@ void mtk_ovl_layer_config(struct device *dev, unsigned int idx,
mtk_ddp_write_relaxed(cmdq_pkt, con, &ovl->cmdq_reg, ovl->regs,
DISP_REG_OVL_CON(idx));
- mtk_ddp_write_relaxed(cmdq_pkt, overlay_pitch.split_pitch.lsb, &ovl->cmdq_reg, ovl->regs,
- DISP_REG_OVL_PITCH(idx));
+ mtk_ddp_write_relaxed(cmdq_pkt, overlay_pitch.split_pitch.lsb | ignore_pixel_alpha,
+ &ovl->cmdq_reg, ovl->regs, DISP_REG_OVL_PITCH(idx));
mtk_ddp_write_relaxed(cmdq_pkt, src_size, &ovl->cmdq_reg, ovl->regs,
DISP_REG_OVL_SRC_SIZE(idx));
mtk_ddp_write_relaxed(cmdq_pkt, offset, &ovl->cmdq_reg, ovl->regs,
--
Git-146)
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH 10/13] drm/mediatek: Fix XRGB setting error in Mixer
2024-06-16 8:29 [PATCH 00/13] Fix the errors of MediaTek display driver found by IGT Hsiao Chien Sung via B4 Relay
` (8 preceding siblings ...)
2024-06-16 8:29 ` [PATCH 09/13] drm/mediatek: Fix XRGB setting error in OVL Hsiao Chien Sung via B4 Relay
@ 2024-06-16 8:29 ` Hsiao Chien Sung via B4 Relay
2024-06-17 11:20 ` AngeloGioacchino Del Regno
2024-06-16 8:29 ` [PATCH 11/13] drm/mediatek: Add new color format MACROs in OVL Hsiao Chien Sung via B4 Relay
` (2 subsequent siblings)
12 siblings, 1 reply; 20+ messages in thread
From: Hsiao Chien Sung via B4 Relay @ 2024-06-16 8:29 UTC (permalink / raw)
To: Chun-Kuang Hu, Philipp Zabel, David Airlie, Daniel Vetter,
Matthias Brugger, AngeloGioacchino Del Regno, CK Hu, Bibby Hsieh,
Daniel Kurtz, YT Shen, Mao Huang, Nancy.Lin
Cc: dri-devel, linux-mediatek, linux-kernel, linux-arm-kernel,
Hsiao Chien Sung
From: Hsiao Chien Sung <shawn.sung@mediatek.com>
Although the alpha channel in XRGB formats can be ignored, ALPHA_CON
must be configured accordingly when using XRGB formats or it will still
affects CRC generation.
Fixes: d886c0009bd0 ("drm/mediatek: Add ETHDR support for MT8195")
Signed-off-by: Hsiao Chien Sung <shawn.sung@mediatek.com>
Reviewed-by: CK Hu <ck.hu@mediatek.com>
---
drivers/gpu/drm/mediatek/mtk_ethdr.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/mediatek/mtk_ethdr.c b/drivers/gpu/drm/mediatek/mtk_ethdr.c
index b5484a286060..a302b12aae3f 100644
--- a/drivers/gpu/drm/mediatek/mtk_ethdr.c
+++ b/drivers/gpu/drm/mediatek/mtk_ethdr.c
@@ -153,6 +153,7 @@ void mtk_ethdr_layer_config(struct device *dev, unsigned int idx,
unsigned int offset = (pending->x & 1) << 31 | pending->y << 16 | pending->x;
unsigned int align_width = ALIGN_DOWN(pending->width, 2);
unsigned int alpha_con = 0;
+ bool replace_src_a = false;
dev_dbg(dev, "%s+ idx:%d", __func__, idx);
@@ -172,8 +173,15 @@ void mtk_ethdr_layer_config(struct device *dev, unsigned int idx,
if (state->base.fb && state->base.fb->format->has_alpha)
alpha_con = MIXER_ALPHA_AEN | MIXER_ALPHA;
- mtk_mmsys_mixer_in_config(priv->mmsys_dev, idx + 1, alpha_con ? false : true,
- MIXER_ALPHA,
+ if (state->base.fb && !state->base.fb->format->has_alpha) {
+ /*
+ * Mixer doesn't support CONST_BLD mode,
+ * use a trick to make the output equivalent
+ */
+ replace_src_a = true;
+ }
+
+ mtk_mmsys_mixer_in_config(priv->mmsys_dev, idx + 1, replace_src_a, MIXER_ALPHA,
pending->x & 1 ? MIXER_INX_MODE_EVEN_EXTEND :
MIXER_INX_MODE_BYPASS, align_width / 2 - 1, cmdq_pkt);
--
Git-146)
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH 11/13] drm/mediatek: Add new color format MACROs in OVL
2024-06-16 8:29 [PATCH 00/13] Fix the errors of MediaTek display driver found by IGT Hsiao Chien Sung via B4 Relay
` (9 preceding siblings ...)
2024-06-16 8:29 ` [PATCH 10/13] drm/mediatek: Fix XRGB setting error in Mixer Hsiao Chien Sung via B4 Relay
@ 2024-06-16 8:29 ` Hsiao Chien Sung via B4 Relay
2024-06-17 11:20 ` AngeloGioacchino Del Regno
2024-06-16 8:29 ` [PATCH 12/13] drm/mediatek: Support DRM plane alpha " Hsiao Chien Sung via B4 Relay
2024-06-16 8:29 ` [PATCH 13/13] drm/mediatek: Support DRM plane alpha in Mixer Hsiao Chien Sung via B4 Relay
12 siblings, 1 reply; 20+ messages in thread
From: Hsiao Chien Sung via B4 Relay @ 2024-06-16 8:29 UTC (permalink / raw)
To: Chun-Kuang Hu, Philipp Zabel, David Airlie, Daniel Vetter,
Matthias Brugger, AngeloGioacchino Del Regno, CK Hu, Bibby Hsieh,
Daniel Kurtz, YT Shen, Mao Huang, Nancy.Lin
Cc: dri-devel, linux-mediatek, linux-kernel, linux-arm-kernel,
Hsiao Chien Sung
From: Hsiao Chien Sung <shawn.sung@mediatek.com>
Define new color formats to hide the bit operation in the MACROs to make
the switch statement more concise.
Change the MACROs to align the naming rule in DRM.
Signed-off-by: Hsiao Chien Sung <shawn.sung@mediatek.com>
Reviewed-by: CK Hu <ck.hu@mediatek.com>
---
drivers/gpu/drm/mediatek/mtk_disp_ovl.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
index 615b75919d1b..33b58da15ba4 100644
--- a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
+++ b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
@@ -55,8 +55,10 @@
#define OVL_CON_BYTE_SWAP BIT(24)
#define OVL_CON_MTX_YUV_TO_RGB (6 << 16)
#define OVL_CON_CLRFMT_RGB (1 << 12)
-#define OVL_CON_CLRFMT_RGBA8888 (2 << 12)
-#define OVL_CON_CLRFMT_ARGB8888 (3 << 12)
+#define OVL_CON_CLRFMT_ARGB8888 (2 << 12)
+#define OVL_CON_CLRFMT_RGBA8888 (3 << 12)
+#define OVL_CON_CLRFMT_ABGR8888 (OVL_CON_CLRFMT_RGBA8888 | OVL_CON_BYTE_SWAP)
+#define OVL_CON_CLRFMT_BGRA8888 (OVL_CON_CLRFMT_ARGB8888 | OVL_CON_BYTE_SWAP)
#define OVL_CON_CLRFMT_UYVY (4 << 12)
#define OVL_CON_CLRFMT_YUYV (5 << 12)
#define OVL_CON_CLRFMT_RGB565(ovl) ((ovl)->data->fmt_rgb565_is_0 ? \
@@ -393,22 +395,22 @@ static unsigned int ovl_fmt_convert(struct mtk_disp_ovl *ovl, unsigned int fmt)
case DRM_FORMAT_RGBA8888:
case DRM_FORMAT_RGBX1010102:
case DRM_FORMAT_RGBA1010102:
- return OVL_CON_CLRFMT_ARGB8888;
+ return OVL_CON_CLRFMT_RGBA8888;
case DRM_FORMAT_BGRX8888:
case DRM_FORMAT_BGRA8888:
case DRM_FORMAT_BGRX1010102:
case DRM_FORMAT_BGRA1010102:
- return OVL_CON_CLRFMT_ARGB8888 | OVL_CON_BYTE_SWAP;
+ return OVL_CON_CLRFMT_BGRA8888;
case DRM_FORMAT_XRGB8888:
case DRM_FORMAT_ARGB8888:
case DRM_FORMAT_XRGB2101010:
case DRM_FORMAT_ARGB2101010:
- return OVL_CON_CLRFMT_RGBA8888;
+ return OVL_CON_CLRFMT_ARGB8888;
case DRM_FORMAT_XBGR8888:
case DRM_FORMAT_ABGR8888:
case DRM_FORMAT_XBGR2101010:
case DRM_FORMAT_ABGR2101010:
- return OVL_CON_CLRFMT_RGBA8888 | OVL_CON_BYTE_SWAP;
+ return OVL_CON_CLRFMT_ABGR8888;
case DRM_FORMAT_UYVY:
return OVL_CON_CLRFMT_UYVY | OVL_CON_MTX_YUV_TO_RGB;
case DRM_FORMAT_YUYV:
--
Git-146)
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH 12/13] drm/mediatek: Support DRM plane alpha in OVL
2024-06-16 8:29 [PATCH 00/13] Fix the errors of MediaTek display driver found by IGT Hsiao Chien Sung via B4 Relay
` (10 preceding siblings ...)
2024-06-16 8:29 ` [PATCH 11/13] drm/mediatek: Add new color format MACROs in OVL Hsiao Chien Sung via B4 Relay
@ 2024-06-16 8:29 ` Hsiao Chien Sung via B4 Relay
2024-06-17 11:20 ` AngeloGioacchino Del Regno
2024-06-16 8:29 ` [PATCH 13/13] drm/mediatek: Support DRM plane alpha in Mixer Hsiao Chien Sung via B4 Relay
12 siblings, 1 reply; 20+ messages in thread
From: Hsiao Chien Sung via B4 Relay @ 2024-06-16 8:29 UTC (permalink / raw)
To: Chun-Kuang Hu, Philipp Zabel, David Airlie, Daniel Vetter,
Matthias Brugger, AngeloGioacchino Del Regno, CK Hu, Bibby Hsieh,
Daniel Kurtz, YT Shen, Mao Huang, Nancy.Lin
Cc: dri-devel, linux-mediatek, linux-kernel, linux-arm-kernel,
Hsiao Chien Sung
From: Hsiao Chien Sung <shawn.sung@mediatek.com>
Set the plane alpha according to DRM plane property.
Signed-off-by: Hsiao Chien Sung <shawn.sung@mediatek.com>
Reviewed-by: CK Hu <ck.hu@mediatek.com>
---
drivers/gpu/drm/mediatek/mtk_disp_ovl.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
index 33b58da15ba4..f358dbfed5e3 100644
--- a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
+++ b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
@@ -450,8 +450,10 @@ void mtk_ovl_layer_config(struct device *dev, unsigned int idx,
}
con = ovl_fmt_convert(ovl, fmt);
- if (state->base.fb && state->base.fb->format->has_alpha)
- con |= OVL_CON_AEN | OVL_CON_ALPHA;
+ if (state->base.fb) {
+ con |= OVL_CON_AEN;
+ con |= state->base.alpha & OVL_CON_ALPHA;
+ }
/* CONST_BLD must be enabled for XRGB formats although the alpha channel
* can be ignored, or OVL will still read the value from memory.
--
Git-146)
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH 13/13] drm/mediatek: Support DRM plane alpha in Mixer
2024-06-16 8:29 [PATCH 00/13] Fix the errors of MediaTek display driver found by IGT Hsiao Chien Sung via B4 Relay
` (11 preceding siblings ...)
2024-06-16 8:29 ` [PATCH 12/13] drm/mediatek: Support DRM plane alpha " Hsiao Chien Sung via B4 Relay
@ 2024-06-16 8:29 ` Hsiao Chien Sung via B4 Relay
2024-06-17 11:20 ` AngeloGioacchino Del Regno
12 siblings, 1 reply; 20+ messages in thread
From: Hsiao Chien Sung via B4 Relay @ 2024-06-16 8:29 UTC (permalink / raw)
To: Chun-Kuang Hu, Philipp Zabel, David Airlie, Daniel Vetter,
Matthias Brugger, AngeloGioacchino Del Regno, CK Hu, Bibby Hsieh,
Daniel Kurtz, YT Shen, Mao Huang, Nancy.Lin
Cc: dri-devel, linux-mediatek, linux-kernel, linux-arm-kernel,
Hsiao Chien Sung
From: Hsiao Chien Sung <shawn.sung@mediatek.com>
Set the plane alpha according to DRM plane property.
Signed-off-by: Hsiao Chien Sung <shawn.sung@mediatek.com>
Reviewed-by: CK Hu <ck.hu@mediatek.com>
---
drivers/gpu/drm/mediatek/mtk_ethdr.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/mediatek/mtk_ethdr.c b/drivers/gpu/drm/mediatek/mtk_ethdr.c
index a302b12aae3f..16be98cee505 100644
--- a/drivers/gpu/drm/mediatek/mtk_ethdr.c
+++ b/drivers/gpu/drm/mediatek/mtk_ethdr.c
@@ -170,8 +170,10 @@ void mtk_ethdr_layer_config(struct device *dev, unsigned int idx,
return;
}
- if (state->base.fb && state->base.fb->format->has_alpha)
- alpha_con = MIXER_ALPHA_AEN | MIXER_ALPHA;
+ if (state->base.fb) {
+ alpha_con |= MIXER_ALPHA_AEN;
+ alpha_con |= state->base.alpha & MIXER_ALPHA;
+ }
if (state->base.fb && !state->base.fb->format->has_alpha) {
/*
--
Git-146)
^ permalink raw reply related [flat|nested] 20+ messages in thread
* Re: [PATCH 09/13] drm/mediatek: Fix XRGB setting error in OVL
2024-06-16 8:29 ` [PATCH 09/13] drm/mediatek: Fix XRGB setting error in OVL Hsiao Chien Sung via B4 Relay
@ 2024-06-17 8:02 ` CK Hu (胡俊光)
2024-06-17 11:21 ` AngeloGioacchino Del Regno
1 sibling, 0 replies; 20+ messages in thread
From: CK Hu (胡俊光) @ 2024-06-17 8:02 UTC (permalink / raw)
To: Bibby Hsieh (謝濟遠), chunkuang.hu@kernel.org,
Shawn Sung (宋孝謙), djkurtz@chromium.org,
Nancy Lin (林欣螢), daniel@ffwll.ch,
p.zabel@pengutronix.de, airlied@gmail.com,
YT Shen (沈岳霆), matthias.bgg@gmail.com,
littlecvr@chromium.org, angelogioacchino.delregno@collabora.com
Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
linux-mediatek@lists.infradead.org,
linux-arm-kernel@lists.infradead.org
Hi, Shawn:
On Sun, 2024-06-16 at 16:29 +0800, Hsiao Chien Sung via B4 Relay wrote:
>
> External email : Please do not click links or open attachments until you have verified the sender or the content.
> From: Hsiao Chien Sung <shawn.sung@mediatek.com>
>
> CONST_BLD must be enabled for XRGB formats although the alpha channel
> can be ignored, or OVL will still read the value from memory.
> This error only affects CRC generation.
Reviewed-by: CK Hu <ck.hu@mediatek.com>
>
> Fixes: 119f5173628a ("drm/mediatek: Add DRM Driver for Mediatek SoC MT8173.")
> Signed-off-by: Hsiao Chien Sung <shawn.sung@mediatek.com>
> ---
> drivers/gpu/drm/mediatek/mtk_disp_ovl.c | 14 ++++++++++++--
> 1 file changed, 12 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
> index 738244a6164e..615b75919d1b 100644
> --- a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
> +++ b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
> @@ -38,6 +38,7 @@
> #define DISP_REG_OVL_PITCH_MSB(n)(0x0040 + 0x20 * (n))
> #define OVL_PITCH_MSB_2ND_SUBBUFBIT(16)
> #define DISP_REG_OVL_PITCH(n)(0x0044 + 0x20 * (n))
> +#define OVL_CONST_BLENDBIT(28)
> #define DISP_REG_OVL_RDMA_CTRL(n)(0x00c0 + 0x20 * (n))
> #define DISP_REG_OVL_RDMA_GMC(n)(0x00c8 + 0x20 * (n))
> #define DISP_REG_OVL_ADDR_MT27010x0040
> @@ -428,6 +429,7 @@ void mtk_ovl_layer_config(struct device *dev, unsigned int idx,
> unsigned int fmt = pending->format;
> unsigned int offset = (pending->y << 16) | pending->x;
> unsigned int src_size = (pending->height << 16) | pending->width;
> +unsigned int ignore_pixel_alpha = 0;
> unsigned int con;
> bool is_afbc = pending->modifier != DRM_FORMAT_MOD_LINEAR;
> union overlay_pitch {
> @@ -449,6 +451,14 @@ void mtk_ovl_layer_config(struct device *dev, unsigned int idx,
> if (state->base.fb && state->base.fb->format->has_alpha)
> con |= OVL_CON_AEN | OVL_CON_ALPHA;
>
> +/* CONST_BLD must be enabled for XRGB formats although the alpha channel
> + * can be ignored, or OVL will still read the value from memory.
> + * For RGB888 related formats, whether CONST_BLD is enabled or not won't
> + * affect the result. Therefore we use !has_alpha as the condition.
> + */
> +if (state->base.fb && !state->base.fb->format->has_alpha)
> +ignore_pixel_alpha = OVL_CONST_BLEND;
> +
> if (pending->rotation & DRM_MODE_REFLECT_Y) {
> con |= OVL_CON_VIRT_FLIP;
> addr += (pending->height - 1) * pending->pitch;
> @@ -464,8 +474,8 @@ void mtk_ovl_layer_config(struct device *dev, unsigned int idx,
>
> mtk_ddp_write_relaxed(cmdq_pkt, con, &ovl->cmdq_reg, ovl->regs,
> DISP_REG_OVL_CON(idx));
> -mtk_ddp_write_relaxed(cmdq_pkt, overlay_pitch.split_pitch.lsb, &ovl->cmdq_reg, ovl->regs,
> - DISP_REG_OVL_PITCH(idx));
> +mtk_ddp_write_relaxed(cmdq_pkt, overlay_pitch.split_pitch.lsb | ignore_pixel_alpha,
> + &ovl->cmdq_reg, ovl->regs, DISP_REG_OVL_PITCH(idx));
> mtk_ddp_write_relaxed(cmdq_pkt, src_size, &ovl->cmdq_reg, ovl->regs,
> DISP_REG_OVL_SRC_SIZE(idx));
> mtk_ddp_write_relaxed(cmdq_pkt, offset, &ovl->cmdq_reg, ovl->regs,
>
> --
> Git-146)
>
>
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 10/13] drm/mediatek: Fix XRGB setting error in Mixer
2024-06-16 8:29 ` [PATCH 10/13] drm/mediatek: Fix XRGB setting error in Mixer Hsiao Chien Sung via B4 Relay
@ 2024-06-17 11:20 ` AngeloGioacchino Del Regno
0 siblings, 0 replies; 20+ messages in thread
From: AngeloGioacchino Del Regno @ 2024-06-17 11:20 UTC (permalink / raw)
To: shawn.sung, Chun-Kuang Hu, Philipp Zabel, David Airlie,
Daniel Vetter, Matthias Brugger, CK Hu, Bibby Hsieh, Daniel Kurtz,
YT Shen, Mao Huang, Nancy.Lin
Cc: dri-devel, linux-mediatek, linux-kernel, linux-arm-kernel
Il 16/06/24 10:29, Hsiao Chien Sung via B4 Relay ha scritto:
> From: Hsiao Chien Sung <shawn.sung@mediatek.com>
>
> Although the alpha channel in XRGB formats can be ignored, ALPHA_CON
> must be configured accordingly when using XRGB formats or it will still
> affects CRC generation.
>
> Fixes: d886c0009bd0 ("drm/mediatek: Add ETHDR support for MT8195")
> Signed-off-by: Hsiao Chien Sung <shawn.sung@mediatek.com>
> Reviewed-by: CK Hu <ck.hu@mediatek.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 11/13] drm/mediatek: Add new color format MACROs in OVL
2024-06-16 8:29 ` [PATCH 11/13] drm/mediatek: Add new color format MACROs in OVL Hsiao Chien Sung via B4 Relay
@ 2024-06-17 11:20 ` AngeloGioacchino Del Regno
0 siblings, 0 replies; 20+ messages in thread
From: AngeloGioacchino Del Regno @ 2024-06-17 11:20 UTC (permalink / raw)
To: shawn.sung, Chun-Kuang Hu, Philipp Zabel, David Airlie,
Daniel Vetter, Matthias Brugger, CK Hu, Bibby Hsieh, Daniel Kurtz,
YT Shen, Mao Huang, Nancy.Lin
Cc: dri-devel, linux-mediatek, linux-kernel, linux-arm-kernel
Il 16/06/24 10:29, Hsiao Chien Sung via B4 Relay ha scritto:
> From: Hsiao Chien Sung <shawn.sung@mediatek.com>
>
> Define new color formats to hide the bit operation in the MACROs to make
> the switch statement more concise.
> Change the MACROs to align the naming rule in DRM.
>
> Signed-off-by: Hsiao Chien Sung <shawn.sung@mediatek.com>
> Reviewed-by: CK Hu <ck.hu@mediatek.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 12/13] drm/mediatek: Support DRM plane alpha in OVL
2024-06-16 8:29 ` [PATCH 12/13] drm/mediatek: Support DRM plane alpha " Hsiao Chien Sung via B4 Relay
@ 2024-06-17 11:20 ` AngeloGioacchino Del Regno
0 siblings, 0 replies; 20+ messages in thread
From: AngeloGioacchino Del Regno @ 2024-06-17 11:20 UTC (permalink / raw)
To: shawn.sung, Chun-Kuang Hu, Philipp Zabel, David Airlie,
Daniel Vetter, Matthias Brugger, CK Hu, Bibby Hsieh, Daniel Kurtz,
YT Shen, Mao Huang, Nancy.Lin
Cc: dri-devel, linux-mediatek, linux-kernel, linux-arm-kernel
Il 16/06/24 10:29, Hsiao Chien Sung via B4 Relay ha scritto:
> From: Hsiao Chien Sung <shawn.sung@mediatek.com>
>
> Set the plane alpha according to DRM plane property.
>
> Signed-off-by: Hsiao Chien Sung <shawn.sung@mediatek.com>
> Reviewed-by: CK Hu <ck.hu@mediatek.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 13/13] drm/mediatek: Support DRM plane alpha in Mixer
2024-06-16 8:29 ` [PATCH 13/13] drm/mediatek: Support DRM plane alpha in Mixer Hsiao Chien Sung via B4 Relay
@ 2024-06-17 11:20 ` AngeloGioacchino Del Regno
0 siblings, 0 replies; 20+ messages in thread
From: AngeloGioacchino Del Regno @ 2024-06-17 11:20 UTC (permalink / raw)
To: shawn.sung, Chun-Kuang Hu, Philipp Zabel, David Airlie,
Daniel Vetter, Matthias Brugger, CK Hu, Bibby Hsieh, Daniel Kurtz,
YT Shen, Mao Huang, Nancy.Lin
Cc: dri-devel, linux-mediatek, linux-kernel, linux-arm-kernel
Il 16/06/24 10:29, Hsiao Chien Sung via B4 Relay ha scritto:
> From: Hsiao Chien Sung <shawn.sung@mediatek.com>
>
> Set the plane alpha according to DRM plane property.
>
> Signed-off-by: Hsiao Chien Sung <shawn.sung@mediatek.com>
> Reviewed-by: CK Hu <ck.hu@mediatek.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 09/13] drm/mediatek: Fix XRGB setting error in OVL
2024-06-16 8:29 ` [PATCH 09/13] drm/mediatek: Fix XRGB setting error in OVL Hsiao Chien Sung via B4 Relay
2024-06-17 8:02 ` CK Hu (胡俊光)
@ 2024-06-17 11:21 ` AngeloGioacchino Del Regno
1 sibling, 0 replies; 20+ messages in thread
From: AngeloGioacchino Del Regno @ 2024-06-17 11:21 UTC (permalink / raw)
To: shawn.sung, Chun-Kuang Hu, Philipp Zabel, David Airlie,
Daniel Vetter, Matthias Brugger, CK Hu, Bibby Hsieh, Daniel Kurtz,
YT Shen, Mao Huang, Nancy.Lin
Cc: dri-devel, linux-mediatek, linux-kernel, linux-arm-kernel
Il 16/06/24 10:29, Hsiao Chien Sung via B4 Relay ha scritto:
> From: Hsiao Chien Sung <shawn.sung@mediatek.com>
>
> CONST_BLD must be enabled for XRGB formats although the alpha channel
> can be ignored, or OVL will still read the value from memory.
> This error only affects CRC generation.
>
> Fixes: 119f5173628a ("drm/mediatek: Add DRM Driver for Mediatek SoC MT8173.")
> Signed-off-by: Hsiao Chien Sung <shawn.sung@mediatek.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
^ permalink raw reply [flat|nested] 20+ messages in thread
end of thread, other threads:[~2024-06-17 11:21 UTC | newest]
Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-16 8:29 [PATCH 00/13] Fix the errors of MediaTek display driver found by IGT Hsiao Chien Sung via B4 Relay
2024-06-16 8:29 ` [PATCH 01/13] soc: mediatek: Disable 9-bit alpha in ETHDR Hsiao Chien Sung via B4 Relay
2024-06-16 8:29 ` [PATCH 02/13] drm/mediatek: Add OVL compatible name for MT8195 Hsiao Chien Sung via B4 Relay
2024-06-16 8:29 ` [PATCH 03/13] drm/mediatek: Add missing plane settings when async update Hsiao Chien Sung via B4 Relay
2024-06-16 8:29 ` [PATCH 04/13] drm/mediatek: Add DRM_MODE_ROTATE_0 to rotation property Hsiao Chien Sung via B4 Relay
2024-06-16 8:29 ` [PATCH 05/13] drm/mediatek: Set DRM mode configs accordingly Hsiao Chien Sung via B4 Relay
2024-06-16 8:29 ` [PATCH 06/13] drm/mediatek: Turn off the layers with zero width or height Hsiao Chien Sung via B4 Relay
2024-06-16 8:29 ` [PATCH 07/13] drm/mediatek: Support more 10bit formats in OVL Hsiao Chien Sung via B4 Relay
2024-06-16 8:29 ` [PATCH 08/13] drm/mediatek: Support RGBA8888 and RGBX8888 in OVL on MT8195 Hsiao Chien Sung via B4 Relay
2024-06-16 8:29 ` [PATCH 09/13] drm/mediatek: Fix XRGB setting error in OVL Hsiao Chien Sung via B4 Relay
2024-06-17 8:02 ` CK Hu (胡俊光)
2024-06-17 11:21 ` AngeloGioacchino Del Regno
2024-06-16 8:29 ` [PATCH 10/13] drm/mediatek: Fix XRGB setting error in Mixer Hsiao Chien Sung via B4 Relay
2024-06-17 11:20 ` AngeloGioacchino Del Regno
2024-06-16 8:29 ` [PATCH 11/13] drm/mediatek: Add new color format MACROs in OVL Hsiao Chien Sung via B4 Relay
2024-06-17 11:20 ` AngeloGioacchino Del Regno
2024-06-16 8:29 ` [PATCH 12/13] drm/mediatek: Support DRM plane alpha " Hsiao Chien Sung via B4 Relay
2024-06-17 11:20 ` AngeloGioacchino Del Regno
2024-06-16 8:29 ` [PATCH 13/13] drm/mediatek: Support DRM plane alpha in Mixer Hsiao Chien Sung via B4 Relay
2024-06-17 11:20 ` AngeloGioacchino Del Regno
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).