From patchwork Fri Jun 19 02:12:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?6buE5a626ZKX?= X-Patchwork-Id: 11613277 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C802A13B1 for ; Fri, 19 Jun 2020 06:58:21 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id AFB0820809 for ; Fri, 19 Jun 2020 06:58:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AFB0820809 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=rock-chips.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A37EC6EC06; Fri, 19 Jun 2020 06:58:11 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org X-Greylist: delayed 421 seconds by postgrey-1.36 at gabe; Fri, 19 Jun 2020 02:20:02 UTC Received: from lucky1.263xmail.com (lucky1.263xmail.com [211.157.147.131]) by gabe.freedesktop.org (Postfix) with ESMTPS id 85C7E6E463 for ; Fri, 19 Jun 2020 02:20:02 +0000 (UTC) Received: from localhost (unknown [192.168.167.69]) by lucky1.263xmail.com (Postfix) with ESMTP id 21911B01AE; Fri, 19 Jun 2020 10:12:58 +0800 (CST) X-MAIL-GRAY: 0 X-MAIL-DELIVERY: 1 X-ADDR-CHECKED4: 1 X-ANTISPAM-LEVEL: 2 X-ABS-CHECKED: 0 Received: from localhost.localdomain (unknown [58.22.7.114]) by smtp.263.net (postfix) whith ESMTP id P15428T140189174576896S1592532776016090_; Fri, 19 Jun 2020 10:12:57 +0800 (CST) X-IP-DOMAINF: 1 X-UNIQUE-TAG: <47f99c70dacf3540e239705ea51efd83> X-RL-SENDER: hjc@rock-chips.com X-SENDER: hjc@rock-chips.com X-LOGIN-NAME: hjc@rock-chips.com X-FST-TO: hjc@rock-chips.com X-SENDER-IP: 58.22.7.114 X-ATTACHMENT-NUM: 0 X-DNS-TYPE: 0 X-System-Flag: 0 From: Sandy Huang To: Sandy Huang , =?utf-8?q?Heiko_St=C3=BCbner?= , David Airlie , Daniel Vetter Subject: [PATCH] drm/rockchip: vop: fix vop full rgb24 r/b color error Date: Fri, 19 Jun 2020 10:12:51 +0800 Message-Id: <20200619021251.22991-1-hjc@rock-chips.com> X-Mailer: git-send-email 2.17.1 X-Mailman-Approved-At: Fri, 19 Jun 2020 06:58:10 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: huangtao@rock-chips.com, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-rockchip@lists.infradead.org, andy.yan@rock-chips.com, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" RGB888 format msb is red component and the lsb is blue component, at vop full platform this is swapped, and this is different from vop lite and vop next, so add this patch to fix it. Signed-off-by: Sandy Huang --- drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c index c80f7d9fd13f..1c17048ad737 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c @@ -132,6 +132,7 @@ struct vop_win { struct rockchip_rgb; struct vop { + uint32_t version; struct drm_crtc crtc; struct device *dev; struct drm_device *drm_dev; @@ -989,6 +990,12 @@ static void vop_plane_atomic_update(struct drm_plane *plane, VOP_WIN_SET(vop, win, dsp_st, dsp_st); rb_swap = has_rb_swapped(fb->format->format); + /* + * VOP full need to do rb swap to show rgb888/bgr888 format color correctly + */ + if ((fb->format->format == DRM_FORMAT_RGB888 || fb->format->format == DRM_FORMAT_BGR888) && + VOP_MAJOR(vop->version) == 3) + rb_swap = !rb_swap; VOP_WIN_SET(vop, win, rb_swap, rb_swap); /* @@ -2091,6 +2098,7 @@ static int vop_bind(struct device *dev, struct device *master, void *data) vop->dev = dev; vop->data = vop_data; vop->drm_dev = drm_dev; + vop->version = vop_data->version; dev_set_drvdata(dev, vop); vop_win_init(vop);