From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 852D7C4332F for ; Thu, 17 Nov 2022 13:40:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:References:Cc:To:Subject:MIME-Version: Date:Message-ID:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=LzXm0oleaJN4cQdG0r0XlDYsGBhdizbxRSqbqj6t1lA=; b=S0yZKBmA6rKn+Cx0NNKex4JT5J dKZHdvQ+LXl6QN7RhPiRP9XLMFg4tJ+2weVdRYtXfDswpFlwPfiMAFEROmddCzcQS3TQZp1HTcGr0 v7Tfhlc83K12OZC+IdQyJn1VAKYFFcnlQ2jkQBc4ZN3U5ZiwVUS2Qj0Qi/3UEJyUPwpnJwmxYof1N pEhS9nNB2EN/70fvGmwJblNIUBvM1yq9sCC2AFp/Ev1RniFJJTCU6Zz5HnzQopcOhF7rpBBVwBgv6 JZybAj5JPWE9I5h4o+BhLon3TxWqcorDlp44waP2krlFXcKsURKNTuzoUtdaiven/pLXoEumRgZjv kV47qYZQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ovf8A-00ETfm-Rb; Thu, 17 Nov 2022 13:40:39 +0000 Received: from mail-ej1-x630.google.com ([2a00:1450:4864:20::630]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ovf7k-00ETCy-EV; Thu, 17 Nov 2022 13:40:17 +0000 Received: by mail-ej1-x630.google.com with SMTP id m22so5049215eji.10; Thu, 17 Nov 2022 05:40:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:sender:from:to:cc:subject:date:message-id:reply-to; bh=dOA/XrnM55biePtmSgVQuz/vvaK7Pp/nrxDlHicjXLw=; b=b55P44Wa551fN/B8v9btv1bZewuklhAEgqDACB3G4DxO/3tSA+sMxdYw79PP7i80z5 /sVk8z6Z/ARHsSepF2anN36AOd8gexjbGfhK26rciQbxdkKhb9vn8KyzriTRPVB2kMEM BHxe73XSue/R/bzTj2piXsRdJ5SgLqwV+E9Pwc/C5gHFgqdc1qJYwmqN7865ePorvG4M RDTmId2tnAr4IBFbw3VlRu9cYDr1GiOL16dxTuDfxgz2dLoLoThE0kNwsv+kdenLKzsY EH7hxIxJOu4fvN045NCztwjhhpGrImBWX5L/cRK2m6N45tm3ZYG/rqVRO252aDUQcpyQ gzMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:sender:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=dOA/XrnM55biePtmSgVQuz/vvaK7Pp/nrxDlHicjXLw=; b=Zp5z8RWt1MNbr1B29+6U3Pb1QUQ69si4gb47t/pukSh9VtWzQ+Bj5EyaxUDp/VmTYi zuKDx2tZPXW2Q79IMegRnrpj79lt83/jTUPvCnltCT4p/U+reFmZTO8eua/NpZKtQvnj i1wN/Sxc0DwE08oGA44KSTwtsDAOzRxRJn6EAJ40vq3LNOsUb2GWnpU1/u1u884mtoM3 u5kiKaDbyN3vjOYXK3ytyGNzHtOYlWDTI5eGl27rhbjyPoP2G+DRiUz3ejskD4onZymC DMhJTqaLqi2yYC6EA5bjOL5quEVMJnzWYGYUxccZJzaJagcT9h5qyPYCBLLJv4m0eE8g 6RXw== X-Gm-Message-State: ANoB5pllXPT4XiiSEZRhNlrslhT+wZoPZZRE5EPhXY3Y6vvRYvvLvycZ bFaK3gekRDdY4NMiYyy04NQ= X-Google-Smtp-Source: AA0mqf6BksfbC9nZboB5WTuEjWop9CJaYyFiqnM/7Bx6amuVd+tme9UjR6NShhiXVh2I+/3cyukngA== X-Received: by 2002:a17:907:767a:b0:7ad:e518:13fd with SMTP id kk26-20020a170907767a00b007ade51813fdmr2155160ejc.323.1668692407595; Thu, 17 Nov 2022 05:40:07 -0800 (PST) Received: from ?IPV6:2a0e:41a:894f:0:7a60:27eb:954c:5ab1? ([2a0e:41a:894f:0:7a60:27eb:954c:5ab1]) by smtp.gmail.com with ESMTPSA id bw10-20020a170906c1ca00b0078dce9984afsm373454ejb.220.2022.11.17.05.40.06 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 17 Nov 2022 05:40:06 -0800 (PST) From: Carlo Caione X-Google-Original-From: Carlo Caione Message-ID: Date: Thu, 17 Nov 2022 14:40:05 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: [PATCH 2/3] drm/tiny: ili9486: Do not assume 8-bit only SPI controllers Content-Language: en-US To: Mark Brown Cc: Kamlesh Gurudasani , Neil Armstrong , Jerome Brunet , David Airlie , Martin Blumenstingl , Kevin Hilman , Daniel Vetter , linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org, linux-spi@vger.kernel.org, dri-devel@lists.freedesktop.org References: <20221116-s905x_spi_ili9486-v1-0-630401cb62d5@baylibre.com> <20221116-s905x_spi_ili9486-v1-2-630401cb62d5@baylibre.com> In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221117_054012_586093_2A5660C5 X-CRM114-Status: GOOD ( 22.76 ) X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+linux-amlogic=archiver.kernel.org@lists.infradead.org On 17/11/2022 12:09, Mark Brown wrote: > I don't understand what the commit log is saying here. The > meson-spicc driver advertises support for 8 bit words, if the driver > is sending data formatted as a byte stream everything should be fine. > It may be that there is some optimisation available from taking > advantage of the hardware's ability to handle larger word sizes but > there should be no data corruption issue. There is no data corruption but the 16-bit pixel data have per-pixel bytes swapped: for example 0x55AD is sent instead of 0xAD55 and this is causing the wrong color to be displayed on the panel. The problem is that the current code is sending data with an hardcoded bpw == 8 whether the data is swapped or not before the sending. For 8-bit only controllers the data is swapped by the MIPI DBI code but this is not true for controllers supporting 16-bit as well, but in both cases we are sending the data out the same way with an 8 bpw. So the same image is basically displayed differently whether the SPI controller supports 16 bpw or not. I'm trying to fix this by sending data with 16-bit bpw when the controller is supporting that. Please note that this is what it is done also by mipi_dbi_typec3_command(). >> + /* + * Check whether pixel data bytes needs to be swapped or not >> + */ + if (*cmd == MIPI_DCS_WRITE_MEMORY_START && >> !mipi->swap_bytes) + bpw = 16; + > > You should check the SPI controller compatibility here. This is already done in mipi_dbi_spi_init() by using spi_is_bpw_supported(). Cheers, -- Carlo Caione _______________________________________________ linux-amlogic mailing list linux-amlogic@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-amlogic From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AA1C4C4332F for ; Thu, 17 Nov 2022 13:40:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240162AbiKQNkR (ORCPT ); Thu, 17 Nov 2022 08:40:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52386 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240192AbiKQNkO (ORCPT ); Thu, 17 Nov 2022 08:40:14 -0500 Received: from mail-ej1-x62c.google.com (mail-ej1-x62c.google.com [IPv6:2a00:1450:4864:20::62c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4D6C4742DB; Thu, 17 Nov 2022 05:40:09 -0800 (PST) Received: by mail-ej1-x62c.google.com with SMTP id i10so5111968ejg.6; Thu, 17 Nov 2022 05:40:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:sender:from:to:cc:subject:date:message-id:reply-to; bh=dOA/XrnM55biePtmSgVQuz/vvaK7Pp/nrxDlHicjXLw=; b=b55P44Wa551fN/B8v9btv1bZewuklhAEgqDACB3G4DxO/3tSA+sMxdYw79PP7i80z5 /sVk8z6Z/ARHsSepF2anN36AOd8gexjbGfhK26rciQbxdkKhb9vn8KyzriTRPVB2kMEM BHxe73XSue/R/bzTj2piXsRdJ5SgLqwV+E9Pwc/C5gHFgqdc1qJYwmqN7865ePorvG4M RDTmId2tnAr4IBFbw3VlRu9cYDr1GiOL16dxTuDfxgz2dLoLoThE0kNwsv+kdenLKzsY EH7hxIxJOu4fvN045NCztwjhhpGrImBWX5L/cRK2m6N45tm3ZYG/rqVRO252aDUQcpyQ gzMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:sender:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=dOA/XrnM55biePtmSgVQuz/vvaK7Pp/nrxDlHicjXLw=; b=A/+2AkMG1eOm6Ay9p+vBKYHA7fxZFjRxaYwyZ2yhE2e7mV2TmnsYbqhqRoU931bCFK m96min/p4UGtJFQFJwXLRwGtGeLfJVVmeQFuMqoGmseOzbzwt668pNZaRNK2Va27HHyk 6O6206K3o3NUFIKyem9uenQopZp6zq8tR9QlfP7G4I3uxymked1GRJtGU1NlP1HEh5hk pxqOZb1k/XNeHyILnMyHMxPJirNGPpsltgkBTdgypnWSOcuLuExG4no8IksZEBH+261Z j2bm2IVm7hqQXbKH+s/7OnEHQ1UzzM+hQ2/JoM5aDovgETnwcurULS+r7RwN3usHqLR1 JnWg== X-Gm-Message-State: ANoB5pmvc/2B4eFHEUxxzCVCNdwLE5lfTDNCaoszlw5C+hCNZ+rmv0PZ mvnoyy0g9u8Cvw3YPaOFSYs= X-Google-Smtp-Source: AA0mqf6BksfbC9nZboB5WTuEjWop9CJaYyFiqnM/7Bx6amuVd+tme9UjR6NShhiXVh2I+/3cyukngA== X-Received: by 2002:a17:907:767a:b0:7ad:e518:13fd with SMTP id kk26-20020a170907767a00b007ade51813fdmr2155160ejc.323.1668692407595; Thu, 17 Nov 2022 05:40:07 -0800 (PST) Received: from ?IPV6:2a0e:41a:894f:0:7a60:27eb:954c:5ab1? ([2a0e:41a:894f:0:7a60:27eb:954c:5ab1]) by smtp.gmail.com with ESMTPSA id bw10-20020a170906c1ca00b0078dce9984afsm373454ejb.220.2022.11.17.05.40.06 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 17 Nov 2022 05:40:06 -0800 (PST) Sender: Carlo Caione From: Carlo Caione X-Google-Original-From: Carlo Caione Message-ID: Date: Thu, 17 Nov 2022 14:40:05 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: [PATCH 2/3] drm/tiny: ili9486: Do not assume 8-bit only SPI controllers Content-Language: en-US To: Mark Brown Cc: Kamlesh Gurudasani , Neil Armstrong , Jerome Brunet , David Airlie , Martin Blumenstingl , Kevin Hilman , Daniel Vetter , linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org, linux-spi@vger.kernel.org, dri-devel@lists.freedesktop.org References: <20221116-s905x_spi_ili9486-v1-0-630401cb62d5@baylibre.com> <20221116-s905x_spi_ili9486-v1-2-630401cb62d5@baylibre.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org On 17/11/2022 12:09, Mark Brown wrote: > I don't understand what the commit log is saying here. The > meson-spicc driver advertises support for 8 bit words, if the driver > is sending data formatted as a byte stream everything should be fine. > It may be that there is some optimisation available from taking > advantage of the hardware's ability to handle larger word sizes but > there should be no data corruption issue. There is no data corruption but the 16-bit pixel data have per-pixel bytes swapped: for example 0x55AD is sent instead of 0xAD55 and this is causing the wrong color to be displayed on the panel. The problem is that the current code is sending data with an hardcoded bpw == 8 whether the data is swapped or not before the sending. For 8-bit only controllers the data is swapped by the MIPI DBI code but this is not true for controllers supporting 16-bit as well, but in both cases we are sending the data out the same way with an 8 bpw. So the same image is basically displayed differently whether the SPI controller supports 16 bpw or not. I'm trying to fix this by sending data with 16-bit bpw when the controller is supporting that. Please note that this is what it is done also by mipi_dbi_typec3_command(). >> + /* + * Check whether pixel data bytes needs to be swapped or not >> + */ + if (*cmd == MIPI_DCS_WRITE_MEMORY_START && >> !mipi->swap_bytes) + bpw = 16; + > > You should check the SPI controller compatibility here. This is already done in mipi_dbi_spi_init() by using spi_is_bpw_supported(). Cheers, -- Carlo Caione From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 86B7CC433FE for ; Thu, 17 Nov 2022 13:41:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:References:Cc:To:Subject:MIME-Version: Date:Message-ID:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=7/l88LJB+hAJLfSLg8jBiR5fOIBOjDrzmAE0C/2Ucn4=; b=pJ/hPSoXgX7FkEsKY0HukAjFmI b9hUWzk8RDFxvzGI1rP/Z28cHKT3pCUIP7Pk/rP0J1wNYkLiYksNDWgnDtQsFCbNaDUO/dwYkoarX 5+vdKXYN/C4PKGWDbP727Q2Pa8CkSRe/D2PUsZ/dF5UrnbWVjGs+GBTy5Djv7uRdsVBh+ks+soyN1 u8rj+yqK+KH3Vh7U8OEmzXosvcFN18uv9PkYN2H9tPd1gf2SqsjW7jgH3gFZdI7nRYKMxz+CsBu2h OKh0kiD6Ws7SRvYLrWu/fu+HmUOgc/fxT1+kG0g+ImxKfXoeT49qxqWOAznC1+3E5Yyfp+xJ4RX0q 7LMY05gg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ovf7v-00ETNB-8K; Thu, 17 Nov 2022 13:40:23 +0000 Received: from mail-ej1-x630.google.com ([2a00:1450:4864:20::630]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ovf7k-00ETCy-EV; Thu, 17 Nov 2022 13:40:17 +0000 Received: by mail-ej1-x630.google.com with SMTP id m22so5049215eji.10; Thu, 17 Nov 2022 05:40:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:sender:from:to:cc:subject:date:message-id:reply-to; bh=dOA/XrnM55biePtmSgVQuz/vvaK7Pp/nrxDlHicjXLw=; b=b55P44Wa551fN/B8v9btv1bZewuklhAEgqDACB3G4DxO/3tSA+sMxdYw79PP7i80z5 /sVk8z6Z/ARHsSepF2anN36AOd8gexjbGfhK26rciQbxdkKhb9vn8KyzriTRPVB2kMEM BHxe73XSue/R/bzTj2piXsRdJ5SgLqwV+E9Pwc/C5gHFgqdc1qJYwmqN7865ePorvG4M RDTmId2tnAr4IBFbw3VlRu9cYDr1GiOL16dxTuDfxgz2dLoLoThE0kNwsv+kdenLKzsY EH7hxIxJOu4fvN045NCztwjhhpGrImBWX5L/cRK2m6N45tm3ZYG/rqVRO252aDUQcpyQ gzMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:sender:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=dOA/XrnM55biePtmSgVQuz/vvaK7Pp/nrxDlHicjXLw=; b=Zp5z8RWt1MNbr1B29+6U3Pb1QUQ69si4gb47t/pukSh9VtWzQ+Bj5EyaxUDp/VmTYi zuKDx2tZPXW2Q79IMegRnrpj79lt83/jTUPvCnltCT4p/U+reFmZTO8eua/NpZKtQvnj i1wN/Sxc0DwE08oGA44KSTwtsDAOzRxRJn6EAJ40vq3LNOsUb2GWnpU1/u1u884mtoM3 u5kiKaDbyN3vjOYXK3ytyGNzHtOYlWDTI5eGl27rhbjyPoP2G+DRiUz3ejskD4onZymC DMhJTqaLqi2yYC6EA5bjOL5quEVMJnzWYGYUxccZJzaJagcT9h5qyPYCBLLJv4m0eE8g 6RXw== X-Gm-Message-State: ANoB5pllXPT4XiiSEZRhNlrslhT+wZoPZZRE5EPhXY3Y6vvRYvvLvycZ bFaK3gekRDdY4NMiYyy04NQ= X-Google-Smtp-Source: AA0mqf6BksfbC9nZboB5WTuEjWop9CJaYyFiqnM/7Bx6amuVd+tme9UjR6NShhiXVh2I+/3cyukngA== X-Received: by 2002:a17:907:767a:b0:7ad:e518:13fd with SMTP id kk26-20020a170907767a00b007ade51813fdmr2155160ejc.323.1668692407595; Thu, 17 Nov 2022 05:40:07 -0800 (PST) Received: from ?IPV6:2a0e:41a:894f:0:7a60:27eb:954c:5ab1? ([2a0e:41a:894f:0:7a60:27eb:954c:5ab1]) by smtp.gmail.com with ESMTPSA id bw10-20020a170906c1ca00b0078dce9984afsm373454ejb.220.2022.11.17.05.40.06 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 17 Nov 2022 05:40:06 -0800 (PST) From: Carlo Caione X-Google-Original-From: Carlo Caione Message-ID: Date: Thu, 17 Nov 2022 14:40:05 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: [PATCH 2/3] drm/tiny: ili9486: Do not assume 8-bit only SPI controllers Content-Language: en-US To: Mark Brown Cc: Kamlesh Gurudasani , Neil Armstrong , Jerome Brunet , David Airlie , Martin Blumenstingl , Kevin Hilman , Daniel Vetter , linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org, linux-spi@vger.kernel.org, dri-devel@lists.freedesktop.org References: <20221116-s905x_spi_ili9486-v1-0-630401cb62d5@baylibre.com> <20221116-s905x_spi_ili9486-v1-2-630401cb62d5@baylibre.com> In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221117_054012_586093_2A5660C5 X-CRM114-Status: GOOD ( 22.76 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 17/11/2022 12:09, Mark Brown wrote: > I don't understand what the commit log is saying here. The > meson-spicc driver advertises support for 8 bit words, if the driver > is sending data formatted as a byte stream everything should be fine. > It may be that there is some optimisation available from taking > advantage of the hardware's ability to handle larger word sizes but > there should be no data corruption issue. There is no data corruption but the 16-bit pixel data have per-pixel bytes swapped: for example 0x55AD is sent instead of 0xAD55 and this is causing the wrong color to be displayed on the panel. The problem is that the current code is sending data with an hardcoded bpw == 8 whether the data is swapped or not before the sending. For 8-bit only controllers the data is swapped by the MIPI DBI code but this is not true for controllers supporting 16-bit as well, but in both cases we are sending the data out the same way with an 8 bpw. So the same image is basically displayed differently whether the SPI controller supports 16 bpw or not. I'm trying to fix this by sending data with 16-bit bpw when the controller is supporting that. Please note that this is what it is done also by mipi_dbi_typec3_command(). >> + /* + * Check whether pixel data bytes needs to be swapped or not >> + */ + if (*cmd == MIPI_DCS_WRITE_MEMORY_START && >> !mipi->swap_bytes) + bpw = 16; + > > You should check the SPI controller compatibility here. This is already done in mipi_dbi_spi_init() by using spi_is_bpw_supported(). Cheers, -- Carlo Caione _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 99418C4332F for ; Fri, 18 Nov 2022 00:33:01 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id AFF9F10E6BF; Fri, 18 Nov 2022 00:32:58 +0000 (UTC) Received: from mail-ej1-x62b.google.com (mail-ej1-x62b.google.com [IPv6:2a00:1450:4864:20::62b]) by gabe.freedesktop.org (Postfix) with ESMTPS id CB29B10E5FB for ; Thu, 17 Nov 2022 13:40:09 +0000 (UTC) Received: by mail-ej1-x62b.google.com with SMTP id kt23so5093691ejc.7 for ; Thu, 17 Nov 2022 05:40:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:sender:from:to:cc:subject:date:message-id:reply-to; bh=dOA/XrnM55biePtmSgVQuz/vvaK7Pp/nrxDlHicjXLw=; b=b55P44Wa551fN/B8v9btv1bZewuklhAEgqDACB3G4DxO/3tSA+sMxdYw79PP7i80z5 /sVk8z6Z/ARHsSepF2anN36AOd8gexjbGfhK26rciQbxdkKhb9vn8KyzriTRPVB2kMEM BHxe73XSue/R/bzTj2piXsRdJ5SgLqwV+E9Pwc/C5gHFgqdc1qJYwmqN7865ePorvG4M RDTmId2tnAr4IBFbw3VlRu9cYDr1GiOL16dxTuDfxgz2dLoLoThE0kNwsv+kdenLKzsY EH7hxIxJOu4fvN045NCztwjhhpGrImBWX5L/cRK2m6N45tm3ZYG/rqVRO252aDUQcpyQ gzMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:sender:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=dOA/XrnM55biePtmSgVQuz/vvaK7Pp/nrxDlHicjXLw=; b=pb6uhBpHwQ+joZbUWHw6iDAJt8EObQD64sex6CMTKH9eF5UIZGvP4JddJ1Uy44LpS5 +jA2BU2ap+ns6nZWQ7oUOh0OVteA2AfoqktO1Zm+WwEk4uSOFyMD54muYMonBJkAggL5 uFFsvWqocEZ1PnmfYTVwQLFuBCo4APf4+pctrS1pCMygngIqugzZ4UTiZXmO/ZkDVCUY 616MltIWaCeMHO8oU+ApFVj4mewxNt6OVcJ81exWKtf2UM/kLUDw0p5ZH7fgK33fqaB8 MCjfPjAaXWGXBBlQSmV+oh8w8q7En8G11vUrkSDFwW4qAKUoryQ+ufL0+NOXc0FXDQmH 1MwA== X-Gm-Message-State: ANoB5plvH6yKPMv6FKi7IjvK0/0yotcSxIyeL5wUd8922cRV9RF0bLzu vLjR8QMFv1VpDk3lV7cAKaQ= X-Google-Smtp-Source: AA0mqf6BksfbC9nZboB5WTuEjWop9CJaYyFiqnM/7Bx6amuVd+tme9UjR6NShhiXVh2I+/3cyukngA== X-Received: by 2002:a17:907:767a:b0:7ad:e518:13fd with SMTP id kk26-20020a170907767a00b007ade51813fdmr2155160ejc.323.1668692407595; Thu, 17 Nov 2022 05:40:07 -0800 (PST) Received: from ?IPV6:2a0e:41a:894f:0:7a60:27eb:954c:5ab1? ([2a0e:41a:894f:0:7a60:27eb:954c:5ab1]) by smtp.gmail.com with ESMTPSA id bw10-20020a170906c1ca00b0078dce9984afsm373454ejb.220.2022.11.17.05.40.06 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 17 Nov 2022 05:40:06 -0800 (PST) From: Carlo Caione X-Google-Original-From: Carlo Caione Message-ID: Date: Thu, 17 Nov 2022 14:40:05 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: [PATCH 2/3] drm/tiny: ili9486: Do not assume 8-bit only SPI controllers Content-Language: en-US To: Mark Brown References: <20221116-s905x_spi_ili9486-v1-0-630401cb62d5@baylibre.com> <20221116-s905x_spi_ili9486-v1-2-630401cb62d5@baylibre.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Mailman-Approved-At: Fri, 18 Nov 2022 00:32:52 +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: Neil Armstrong , Martin Blumenstingl , Kevin Hilman , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-spi@vger.kernel.org, linux-amlogic@lists.infradead.org, Kamlesh Gurudasani , linux-arm-kernel@lists.infradead.org, Jerome Brunet Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On 17/11/2022 12:09, Mark Brown wrote: > I don't understand what the commit log is saying here. The > meson-spicc driver advertises support for 8 bit words, if the driver > is sending data formatted as a byte stream everything should be fine. > It may be that there is some optimisation available from taking > advantage of the hardware's ability to handle larger word sizes but > there should be no data corruption issue. There is no data corruption but the 16-bit pixel data have per-pixel bytes swapped: for example 0x55AD is sent instead of 0xAD55 and this is causing the wrong color to be displayed on the panel. The problem is that the current code is sending data with an hardcoded bpw == 8 whether the data is swapped or not before the sending. For 8-bit only controllers the data is swapped by the MIPI DBI code but this is not true for controllers supporting 16-bit as well, but in both cases we are sending the data out the same way with an 8 bpw. So the same image is basically displayed differently whether the SPI controller supports 16 bpw or not. I'm trying to fix this by sending data with 16-bit bpw when the controller is supporting that. Please note that this is what it is done also by mipi_dbi_typec3_command(). >> + /* + * Check whether pixel data bytes needs to be swapped or not >> + */ + if (*cmd == MIPI_DCS_WRITE_MEMORY_START && >> !mipi->swap_bytes) + bpw = 16; + > > You should check the SPI controller compatibility here. This is already done in mipi_dbi_spi_init() by using spi_is_bpw_supported(). Cheers, -- Carlo Caione