Patch "drm/rockchip: vop: Fix color for RGB888/BGR888 format on VOP full" has been added to the 5.15-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/rockchip: vop: Fix color for RGB888/BGR888 format on VOP full

to the 5.15-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-rockchip-vop-fix-color-for-rgb888-bgr888-format-.patch
and it can be found in the queue-5.15 subdirectory.

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



commit 984f5cafc0578e2b38c0c702c81323bd17ac5853
Author: Jonas Karlman <jonas@xxxxxxxxx>
Date:   Thu Oct 26 19:14:58 2023 +0000

    drm/rockchip: vop: Fix color for RGB888/BGR888 format on VOP full
    
    [ Upstream commit bb0a05acd6121ff0e810b44fdc24dbdfaa46b642 ]
    
    Use of DRM_FORMAT_RGB888 and DRM_FORMAT_BGR888 on e.g. RK3288, RK3328
    and RK3399 result in wrong colors being displayed.
    
    The issue can be observed using modetest:
    
      modetest -s <connector_id>@<crtc_id>:1920x1080-60@RG24
      modetest -s <connector_id>@<crtc_id>:1920x1080-60@BG24
    
    Vendor 4.4 kernel apply an inverted rb swap for these formats on VOP
    full framework (IP version 3.x) compared to VOP little framework (2.x).
    
    Fix colors by applying different rb swap for VOP full framework (3.x)
    and VOP little framework (2.x) similar to vendor 4.4 kernel.
    
    Fixes: 85a359f25388 ("drm/rockchip: Add BGR formats to VOP")
    Signed-off-by: Jonas Karlman <jonas@xxxxxxxxx>
    Tested-by: Diederik de Haas <didi.debian@xxxxxxxxx>
    Reviewed-by: Christopher Obbard <chris.obbard@xxxxxxxxxxxxx>
    Tested-by: Christopher Obbard <chris.obbard@xxxxxxxxxxxxx>
    Signed-off-by: Heiko Stuebner <heiko@xxxxxxxxx>
    Link: https://patchwork.freedesktop.org/patch/msgid/20231026191500.2994225-1-jonas@xxxxxxxxx
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
index e53b1ecbd7bc0..c7106f1165466 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
@@ -249,14 +249,22 @@ static inline void vop_cfg_done(struct vop *vop)
 	VOP_REG_SET(vop, common, cfg_done, 1);
 }
 
-static bool has_rb_swapped(uint32_t format)
+static bool has_rb_swapped(uint32_t version, uint32_t format)
 {
 	switch (format) {
 	case DRM_FORMAT_XBGR8888:
 	case DRM_FORMAT_ABGR8888:
-	case DRM_FORMAT_BGR888:
 	case DRM_FORMAT_BGR565:
 		return true;
+	/*
+	 * full framework (IP version 3.x) only need rb swapped for RGB888 and
+	 * little framework (IP version 2.x) only need rb swapped for BGR888,
+	 * check for 3.x to also only rb swap BGR888 for unknown vop version
+	 */
+	case DRM_FORMAT_RGB888:
+		return VOP_MAJOR(version) == 3;
+	case DRM_FORMAT_BGR888:
+		return VOP_MAJOR(version) != 3;
 	default:
 		return false;
 	}
@@ -998,7 +1006,7 @@ static void vop_plane_atomic_update(struct drm_plane *plane,
 	VOP_WIN_SET(vop, win, dsp_info, dsp_info);
 	VOP_WIN_SET(vop, win, dsp_st, dsp_st);
 
-	rb_swap = has_rb_swapped(fb->format->format);
+	rb_swap = has_rb_swapped(vop->data->version, fb->format->format);
 	VOP_WIN_SET(vop, win, rb_swap, rb_swap);
 
 	/*



[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