Patch "drm/mediatek: Fix destination alpha error in OVL" has been added to the 6.6-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    drm/mediatek: Fix destination alpha error in OVL

to the 6.6-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     drm-mediatek-fix-destination-alpha-error-in-ovl.patch
and it can be found in the queue-6.6 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 5d63145fcc0b6408b7ecd9101450e8a785cd2cdc
Author: Hsiao Chien Sung <shawn.sung@xxxxxxxxxxxx>
Date:   Thu Jun 20 00:38:45 2024 +0800

    drm/mediatek: Fix destination alpha error in OVL
    
    [ Upstream commit 31c0fbf67c8c0bb38d7fb21d404ea3dbd619d99e ]
    
    The formula of Coverage alpha blending is:
    dst.a = dst.a * (0xff - src.a * SCA / 0xff) / 0xff
          + src.a * SCA / 0xff
    
    dst.a: destination alpha
    src.a: pixel alpha
    SCA  : plane alpha
    
    When SCA = 0xff, the formula becomes:
    dst.a = dst.a * (0xff - src.a) + src.a
    
    This patch is to set the destination alpha (background) to 0xff:
    - When dst.a = 0    (before), dst.a = src.a
    - When dst.a = 0xff (after) , dst.a = 0xff * (0xff - src.a) + src.a
    
    According to the fomula above:
    - When src.a = 0   , dst.a = 0
    - When src.a = 0xff, dst.a = 0xff
    This two cases are just still correct. But when src.a is
    between 0 and 0xff, the difference starts to appear
    
    Fixes: 616443ca577e ("drm/mediatek: Move cmdq_reg info from struct mtk_ddp_comp to sub driver private data")
    Signed-off-by: Hsiao Chien Sung <shawn.sung@xxxxxxxxxxxx>
    Link: https://patchwork.kernel.org/project/dri-devel/patch/20240620-igt-v3-5-a9d62d2e2c7e@xxxxxxxxxxxx/
    Signed-off-by: Chun-Kuang Hu <chunkuang.hu@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
index 6c25fbc3db294..6f15069da8b02 100644
--- a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
+++ b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
@@ -72,6 +72,8 @@
 #define	OVL_CON_VIRT_FLIP	BIT(9)
 #define	OVL_CON_HORZ_FLIP	BIT(10)
 
+#define OVL_COLOR_ALPHA		GENMASK(31, 24)
+
 static const u32 mt8173_formats[] = {
 	DRM_FORMAT_XRGB8888,
 	DRM_FORMAT_ARGB8888,
@@ -274,7 +276,13 @@ void mtk_ovl_config(struct device *dev, unsigned int w,
 	if (w != 0 && h != 0)
 		mtk_ddp_write_relaxed(cmdq_pkt, h << 16 | w, &ovl->cmdq_reg, ovl->regs,
 				      DISP_REG_OVL_ROI_SIZE);
-	mtk_ddp_write_relaxed(cmdq_pkt, 0x0, &ovl->cmdq_reg, ovl->regs, DISP_REG_OVL_ROI_BGCLR);
+
+	/*
+	 * The background color must be opaque black (ARGB),
+	 * otherwise the alpha blending will have no effect
+	 */
+	mtk_ddp_write_relaxed(cmdq_pkt, OVL_COLOR_ALPHA, &ovl->cmdq_reg,
+			      ovl->regs, DISP_REG_OVL_ROI_BGCLR);
 
 	mtk_ddp_write(cmdq_pkt, 0x1, &ovl->cmdq_reg, ovl->regs, DISP_REG_OVL_RST);
 	mtk_ddp_write(cmdq_pkt, 0x0, &ovl->cmdq_reg, ovl->regs, DISP_REG_OVL_RST);




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux