Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp695205rdh; Thu, 26 Oct 2023 13:03:05 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGtnuUdAtP2pX8f0hTI5fqx1nJP5Pai1KS+felKookQKD9CScYkt64hZ1aR/hj8Gu+OcfHX X-Received: by 2002:a25:d285:0:b0:da0:29df:ae62 with SMTP id j127-20020a25d285000000b00da029dfae62mr463609ybg.35.1698350584913; Thu, 26 Oct 2023 13:03:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698350584; cv=none; d=google.com; s=arc-20160816; b=VXRF9Tq8iEovFK8JYeTmY4g/ynVD8s6fu8/YScKoKGQ+psWsGDPe3jZEtYtBubmYq7 0krMrs0y1OLJkVvCVHCBx9LTaH40SA15/d1b1oU2zFwgY/pIfV+b8O/QKYWlDuIbG7v2 C0PilTB+cxRhR+JV0baxniJZhs2pDVklJCzGc6IB8l2OsV84T/UuJpgKwPZue/XpaVJG xiEsufOL2rUhpxSxyytL0YOS9fzbXHIl//YgcMxY+n1xZr1l7gAl2iz2DSUOK2mVqor/ VtTuz4iSXlOqHSzKx5qGyRDxGTc/jS+rkhDMOk0keJ0t6a8RPGWvB+s7IwOCZISl3HaE 98Kw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent :content-transfer-encoding:autocrypt:references:in-reply-to:date:cc :to:from:subject:message-id:dkim-signature; bh=hpizLwWHGymSP5c/jO8lJ683eLXtOEmGIMbYiDTkc1U=; fh=KiqlqJF91M//B+RiRim9SLW9H3mBlypmXrolAmEWRR4=; b=YEQFZdH1XfkRA+tpD+/GmZacQEFuRw0Du3QmAPvfvgjIl96v+9/avouN1PGcULoS4Z 42NP/OlsR+ig6mCFqIGXM+fKWiZfJuVf3SqF1YgHdhJDX8PSx2jtSkxugg5sEPeVQwA3 q5dv0ku7q2vYXgFU/lnJDn1DyhqdFyE7QKoE68bCo6q2S/TUqaaSJ9Se/X5Kqpce+90t FL4PlY7FS0KuyJmNKYje4o2buTTcKEED4P1jr6seAdenyzELd93GHIbDVXSTsJm0OkU5 3fcocuOKexhK7RIWtWYIDdenPPaYKVm5GcwqR3pi4ErqFTK+TYqjz4lvig7fXdusRLR0 Z/PQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=EuywgR9B; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id cj15-20020a056902188f00b00da046d44f01si289077ybb.286.2023.10.26.13.03.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Oct 2023 13:03:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=EuywgR9B; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id B8A34823CEA5; Thu, 26 Oct 2023 13:03:03 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231921AbjJZUDB (ORCPT + 99 others); Thu, 26 Oct 2023 16:03:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57946 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231841AbjJZUDA (ORCPT ); Thu, 26 Oct 2023 16:03:00 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A42AD4B for ; Thu, 26 Oct 2023 13:02:58 -0700 (PDT) Received: from [10.3.2.22] (unknown [185.62.158.188]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: obbardc) by madras.collabora.co.uk (Postfix) with ESMTPSA id CC382660732E; Thu, 26 Oct 2023 21:02:55 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1698350576; bh=e7XUc07AT+4xi8s8MSRNG7dxIS+tjw8B89BlZHRNQJM=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=EuywgR9BIt9IvIemZ7yJyjne3y5Nf3V3DFfR+eClIgChRGfzu8JSOXOvXfcLp5sXt M47Ry4ZTdB8mIfpeGBee9RbIG3buGONBsRtjeoL01BCZAWq96+8RX09nMc8M0qveNp UG66pzJ83yNpA/lSHU4+WU2+yD0f3ErTuIh01/E4EOQ3qxOIzaPrz3bQBXjguWHoJl n6tLEnWd3UepKcTFCd/qPQRfPXqWfo3dzg/naEorCNhdF/Vmh0V+8Xk5FHkE/WAT/e FwCX43sG1MbA3MJTufhj1c4oepIMinwjsXoLnX6emzvpoCQzv38xPIguHqYWT+Kfv+ A2B0yDAxal/9Q== Message-ID: Subject: Re: [PATCH v2] drm/rockchip: vop: Fix color for RGB888/BGR888 format on VOP full From: Christopher Obbard To: Jonas Karlman , Heiko Stuebner , Sandy Huang , David Airlie , Daniel Vetter , Tomasz Figa Cc: Andy Yan , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org Date: Thu, 26 Oct 2023 21:02:53 +0100 In-Reply-To: <20231026191500.2994225-1-jonas@kwiboo.se> References: <20231026191500.2994225-1-jonas@kwiboo.se> Autocrypt: addr=chris.obbard@collabora.com; prefer-encrypt=mutual; keydata=mQINBF7k5dIBEACmD3CqXJiJOtLEjilK2ghCO47y9Fl8+jc8yQPNsp4rMZuzlryL3vLseG0DpR3XE0bK0ojRLhUAqw13epLR5/nWp5ehm8kcy8WyDMBco9DaEyoElKCfelMvTtwmYkJXj8Z831nzzyh1CocFoFStL8HyLHc2/iU1wjczkL0t5hC9KvukV3koQTc9w03sNHeZyZedZIwR/r83k1myJXJsOPXZbmI2KGKq5QV4kTqgQJw3OkSVIQ9Mz2zVZNLKedWr2syrHFgojb7WX5iXbMUgJ8/Ikdttou0B/2xfgKNyKFe0DsbgkcEsJTIsx+C/Ju0+ycEk/7dW69oQLJo0j1oBP+8QfAeAT+M5C0uHC87KAmmy83Sh0xMGAVpcH2lLrE+5SjV3rnB+x/R4B/x7+1uYB5n7MU4/W2lYuAe1hfLtqDbEOyqLzC0FvFiZoDKxexQzcGpSW/LliBEvjjA/LXWADaM+mZezzLSjDwsGVohQrP0ZWOZ1NtC0e1sEt870fa4f+YkZeVHJRDInTcecw6c2QpNH4TzcTMD7bW9YZVqNiT5t9z+BzjJk3LtdrYPQ1SSpov7TB3LVKLIZDxgSlrur0dIklFFYPIx1KStCzqbvOEvlz03iZX4+tqZauNTkVhCoDLG+Z4w3OQdmR/uNqXqsbI04+kM3tOcVnXsosSW6E0TAJQARAQABtCZDaHJpc3RvcGhlciBPYmJhcmQgPG9iYmFyZGNAZ21haWwuY29tPokCUQQTAQgAOwIbAwULCQgHAwUVCgkICwUWAgMBAAIeAQIXgAIZARYhBPGL3ItsJfkKoj1RdGNNxPBocEb4BQJe+22mAAoJEGNNxPBocEb4iUIP+wWXh7bqqLWWo1uYYzMZN9WSnhC1qiD8RyK18DvN8UEOINmvuX2beZjVftZYLyp55bT09VZX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0nQwky5+14b3LsD5V9mjY0ASVcV5/lBRFjRMcfgqTLCO9YGoSVwrb1+xn6MdMIDgqL6Om5SmPx2g+quF9WZ1ElmJkDIY97lmihdxsWccynwSeF7KnSPnsah1h8WCchBQezMucSA6rbY51oO/DK1rqSeLAhM5JOG3MRWcI8jm9k+wHwU1Ct/Hxnt0kr5t+Rbnvog3cAbnmS0d8oLMOYAPaqgRkH72hPHclxzL5xfAgZ0K5/EXBCpZShbVWk4FoxYKOaoyok3ThEufkOHTyL3CBjHoXqlXLe3e+8oDQ6mmZKSjdG1yVHUdOw14cYynCxZU3PAKNihjk6ElnWnrrg/RXh7aoZUNGCFRtvSfmN5fftY7WdHM6B40BQ4mcS6G0agaFHQOTexwyAq511pgynCsRn7ZhaQLFJU7eoyquh9N0J4vrqWDq7VVnJAEyw1tOZEqWbvJrIVfsvgKnD3eIkGbZV39lkB4mEp8I5Z5RQja1kWwqpkjLT8iAaLyh53MmQJ9yxJztCSoU Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.50.1-1 MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Thu, 26 Oct 2023 13:03:03 -0700 (PDT) Hi Jonas, On Thu, 2023-10-26 at 19:14 +0000, Jonas Karlman wrote: > Use of DRM_FORMAT_RGB888 and DRM_FORMAT_BGR888 on e.g. RK3288, RK3328 > and RK3399 result in wrong colors being displayed. >=20 > The issue can be observed using modetest: >=20 > =C2=A0 modetest -s @:1920x1080-60@RG24 > =C2=A0 modetest -s @:1920x1080-60@BG24 >=20 > 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). >=20 > 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. >=20 > Fixes: 85a359f25388 ("drm/rockchip: Add BGR formats to VOP") > Signed-off-by: Jonas Karlman Reviewed-by: Christopher Obbard Tested-by: Christopher Obbard Since you missed adding my *-by tags in v2. > --- > Changes in v2: > - Add comment about different rb swap for IP version 3.x and 2.x > - Add fixes tag >=20 > =C2=A0drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 14 +++++++++++--- > =C2=A01 file changed, 11 insertions(+), 3 deletions(-) >=20 > diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c > b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c > index b3d0b6ae9294..ed2ed25959a2 100644 > --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c > +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c > @@ -247,14 +247,22 @@ static inline void vop_cfg_done(struct vop *vop) > =C2=A0 VOP_REG_SET(vop, common, cfg_done, 1); > =C2=A0} > =C2=A0 > -static bool has_rb_swapped(uint32_t format) > +static bool has_rb_swapped(uint32_t version, uint32_t format) > =C2=A0{ > =C2=A0 switch (format) { > =C2=A0 case DRM_FORMAT_XBGR8888: > =C2=A0 case DRM_FORMAT_ABGR8888: > - case DRM_FORMAT_BGR888: > =C2=A0 case DRM_FORMAT_BGR565: > =C2=A0 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) =3D=3D 3; > + case DRM_FORMAT_BGR888: > + return VOP_MAJOR(version) !=3D 3; > =C2=A0 default: > =C2=A0 return false; > =C2=A0 } > @@ -1035,7 +1043,7 @@ static void vop_plane_atomic_update(struct drm_plan= e > *plane, > =C2=A0 VOP_WIN_SET(vop, win, dsp_info, dsp_info); > =C2=A0 VOP_WIN_SET(vop, win, dsp_st, dsp_st); > =C2=A0 > - rb_swap =3D has_rb_swapped(fb->format->format); > + rb_swap =3D has_rb_swapped(vop->data->version, fb->format->format); > =C2=A0 VOP_WIN_SET(vop, win, rb_swap, rb_swap); > =C2=A0 > =C2=A0 /*