Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp1812427pxb; Wed, 9 Feb 2022 05:09:23 -0800 (PST) X-Google-Smtp-Source: ABdhPJw+LneY4NtPb7KkcMnfRjL8cPeim4Bb7asY226kXv82QyHOa/wb+UMQ2SpD7eaTZTOwqamq X-Received: by 2002:a17:902:e810:: with SMTP id u16mr558026plg.10.1644412163327; Wed, 09 Feb 2022 05:09:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644412163; cv=none; d=google.com; s=arc-20160816; b=VGCkN9yYw4WLUuYJsxyLkb/WervK1+Uc5nootHRvrKE8NSgPOcE+ch5sK8zPiA4Icj AFc04bngcjjkJEXXGD0NLn4uK3kmH7cvEDZUSxyLnlM4V8AWrBqCAjeD5svOJCdlbW1a Ik/Sdxk2v9n1tXJP1cd+a+Ozr2gtj14a+WGfl0qZgUZ2U5f2Af66PrPWqCDgqrTZBKlX ZnfyGVJ7yYcftw72o/QkXb1ajYnzwR3btzsKa10Jxn8H3WQn6AUdR2RSNzk9Gly1wYfA cR9/njOiAuvYvFI+laXkEuA7bBCBC/ot085gnxa+KBUtqSIk5HLd2zQxetP7Ynqrq06D 3Sbw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from:cc :references:to:content-language:subject:user-agent:mime-version:date :message-id; bh=bc3++4Jn32TehURbWIG1uFe6ySQ2oz2DN/oNAyFq27Q=; b=o7/F+OpBNqdq3etUbVoWkLVtk1V6S10Ob+6guZme2UTR4fpHn7rKO6Z3QO3kgebX4+ x9qMa3WGh/XjeDDdQGqk2kC4CkrJRTWmICvZlV4Bgkxkg9/xbg4K34A/sNj+Q8L42EXz t7+/l2HIvIQGhOGCXQpiji5mgHHqdidA+PdCpmeCb+ClwODBNLIk9UDdP2tYq51iozwA 8azQAyyRAgdcEiRfolkNEsJtfbfLm0iavhPWdwN4CfLqyqhZ3ljWJ3PeqTaD65706IoO yEKR/2/cOPlz0R4FyWN/OOQFY6Pt4MfOGlKIukdaYtkiGcfDmncI8htIOZwZLMT80a/d po/g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id i70si3424089pge.859.2022.02.09.05.09.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Feb 2022 05:09:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 43259E17B85C; Wed, 9 Feb 2022 02:36:27 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230400AbiBIJti (ORCPT + 99 others); Wed, 9 Feb 2022 04:49:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53404 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230160AbiBIJth (ORCPT ); Wed, 9 Feb 2022 04:49:37 -0500 Received: from mx1.molgen.mpg.de (mx3.molgen.mpg.de [141.14.17.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4EEBFE01A2E8; Wed, 9 Feb 2022 01:49:27 -0800 (PST) Received: from [192.168.0.2] (ip5f5aee30.dynamic.kabel-deutschland.de [95.90.238.48]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: pmenzel) by mx.molgen.mpg.de (Postfix) with ESMTPSA id D9D6561EA1923; Wed, 9 Feb 2022 10:06:28 +0100 (CET) Message-ID: Date: Wed, 9 Feb 2022 10:06:28 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.1 Subject: Re: [PATCH v2] media: aspeed: Use full swing as JFIF to fix incorrect color Content-Language: en-US To: Jammy Huang References: <20220209084225.4456-1-jammy_huang@aspeedtech.com> Cc: eajames@linux.ibm.com, mchehab@kernel.org, joel@jms.id.au, andrew@aj.id.au, linux-media@vger.kernel.org, openbmc@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, linux-aspeed@lists.ozlabs.org, linux-kernel@vger.kernel.org From: Paul Menzel In-Reply-To: <20220209084225.4456-1-jammy_huang@aspeedtech.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 Dear Jammy, Am 09.02.22 um 09:42 schrieb Jammy Huang: > Current settings for video capture rgb-2-yuv is BT.601(studio swing), > but JFIF uses BT.601(full swing) to deocde. This mismatch will lead > to incorrect color. For example, input RGB value, (0, 0, 255), will > become (16, 16, 235) after jpg decoded. > > Add an enum, aspeed_video_capture_format, to define VR008[7:6] > capture format and correct default settings for video capture to fix > the problem. Maybe quote the datasheet: VR008[7:6] will decide the data format for video capture: 00: CCIR601 studio swing compliant YUV format 01: CCIR601 full swing compliant YUV format 10: RGB format 11: Gray color mode > Signed-off-by: Jammy Huang > --- > v2: > - update subject from 'media: aspeed: Fix-incorrect-color' to > 'media: aspeed: Use full swing as JFIF to fix incorrect' > - update commit message > - add enum, aspeed_video_capture_format, to define VR008[7:6] > --- > drivers/media/platform/aspeed-video.c | 14 +++++++++++--- > 1 file changed, 11 insertions(+), 3 deletions(-) > > diff --git a/drivers/media/platform/aspeed-video.c b/drivers/media/platform/aspeed-video.c > index eb9c17ac0e14..5bcf60b4628b 100644 > --- a/drivers/media/platform/aspeed-video.c > +++ b/drivers/media/platform/aspeed-video.c > @@ -86,8 +86,6 @@ > #define VE_CTRL_SOURCE BIT(2) > #define VE_CTRL_INT_DE BIT(4) > #define VE_CTRL_DIRECT_FETCH BIT(5) > -#define VE_CTRL_YUV BIT(6) > -#define VE_CTRL_RGB BIT(7) > #define VE_CTRL_CAPTURE_FMT GENMASK(7, 6) > #define VE_CTRL_AUTO_OR_CURSOR BIT(8) > #define VE_CTRL_CLK_INVERSE BIT(11) > @@ -202,6 +200,15 @@ enum { > VIDEO_CLOCKS_ON, > }; > > +// for VE_CTRL_CAPTURE_FMT > +enum aspeed_video_capture_format { > + VIDEO_CAP_FMT_YUV_STUDIO = 0, Maybe also append `_SWING`? > + VIDEO_CAP_FMT_YUV_FULL, > + VIDEO_CAP_FMT_RGB, > + VIDEO_CAP_FMT_GRAY, > + VIDEO_CAP_FMT_MAX > +}; > + > struct aspeed_video_addr { > unsigned int size; > dma_addr_t dma; > @@ -1089,7 +1096,8 @@ static void aspeed_video_init_regs(struct aspeed_video *video) > u32 comp_ctrl = VE_COMP_CTRL_RSVD | > FIELD_PREP(VE_COMP_CTRL_DCT_LUM, video->jpeg_quality) | > FIELD_PREP(VE_COMP_CTRL_DCT_CHR, video->jpeg_quality | 0x10); > - u32 ctrl = VE_CTRL_AUTO_OR_CURSOR; > + u32 ctrl = VE_CTRL_AUTO_OR_CURSOR | > + FIELD_PREP(VE_CTRL_CAPTURE_FMT, VIDEO_CAP_FMT_YUV_FULL); > u32 seq_ctrl = video->jpeg_mode; > > if (video->frame_rate) Reviewed-by: Paul Menzel Kind regards, Paul