Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp4387366rdh; Tue, 28 Nov 2023 23:03:35 -0800 (PST) X-Google-Smtp-Source: AGHT+IGamVrX6G7DHoM72GJLwWoSbBPmjp+fn34SzD0H4m/aimwQXwPU11tz+yAjzPRvrVAR7Fbz X-Received: by 2002:a17:902:6947:b0:1cf:c2dc:1c1c with SMTP id k7-20020a170902694700b001cfc2dc1c1cmr13958411plt.29.1701241415431; Tue, 28 Nov 2023 23:03:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701241415; cv=none; d=google.com; s=arc-20160816; b=rO+qJv+xEeOpFt5SPBpF8F/DKum+BSxy5gEg6+CD80IvEflzTFmho9JbSuXpEjJcCl wCQ0jfaUzg8VG3hiAfqkFdkw55VbumiZVk8IqA78eT+oNUuP4KUXKu6rXI/VhPBTNgAz Wok+8fRASbmlfcWlL4JKWFNmQ2zJ4pRv/qNRCMPdK5HjnuM9Ce89TmjKsUBrd9Mr5Wgl 4kiWT1SC60uVhjcbIgdS9ZV8YS112H6C7VHUMLUIr3TkzzkCBOIzLIjjiwYTigQO+hKu wUCrha9Wa3TEvxZLHvP00OUzo2BjU+NuAByjl/fvOBqf7T8lcQ3PtBlOTOiEN1HCtvdh W4ww== 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 :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=Kp7KhheW6iIZn3I5ex3GwoD360GOF4bAbDlX84aX464=; fh=F6YU5Ota188ujzaRaIWKsEehgPcPTRIUuGaVJ5QRzqU=; b=gpXJnZCzJ3ADb4xZR0v7PdJExFeQLwvFmm19LzwVUxN3OCPABpa+1GNelFN3swK6Xg rsI6vOnDjeIgbhwQHVsV06l87AqqIYcKbDXXI82OYtKUN2p1UASTF9X+SGn3F6tjCHcE Lm9dIThyvJb0DiNVVL3fsn56Stv4H6C+Hdip0qrmw7p+ituJOXcxCsPdeSFwnZP9R5Gp LjefMbFCtmxSyEKKATIwaMK9GN23h2XKHwAL4vB6mumvV8KsgVaoCtTf0Ug6n3wRIG4K AWRtFvSBzXil3mMm+wybjn6g5AS0nExgQs6SSehuueX8PIXENOVdUPGuVbP4lozh52cG ykIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rock-chips.com header.s=default header.b=BGYVZATQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=rock-chips.com Return-Path: Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id iz15-20020a170902ef8f00b001cfb4d36d44si9239279plb.64.2023.11.28.23.03.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Nov 2023 23:03:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@rock-chips.com header.s=default header.b=BGYVZATQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=rock-chips.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id D44F280A64FF; Tue, 28 Nov 2023 23:03:30 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229933AbjK2HDN (ORCPT + 99 others); Wed, 29 Nov 2023 02:03:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33440 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229588AbjK2HDM (ORCPT ); Wed, 29 Nov 2023 02:03:12 -0500 X-Greylist: delayed 561 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Tue, 28 Nov 2023 23:03:17 PST Received: from mail-m12793.qiye.163.com (mail-m12793.qiye.163.com [115.236.127.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 06713DC; Tue, 28 Nov 2023 23:03:16 -0800 (PST) DKIM-Signature: a=rsa-sha256; b=BGYVZATQB6lTahhv420xh9G/Uxq5CQrrNTWhRt7vbpKAoczsUpZwYQ2N3vDEJfKqV+pdvlC4UKyIcyrtTnmPT+It97feALmocPJgXkwViY181JJaSyFTMPC0hsdWUkvPucVkNtKCK5HnVeGe2DiByNVJDQ7dl3NAXjCfcOBeYdM=; c=relaxed/relaxed; s=default; d=rock-chips.com; v=1; bh=Kp7KhheW6iIZn3I5ex3GwoD360GOF4bAbDlX84aX464=; h=date:mime-version:subject:message-id:from; Received: from [172.16.12.141] (unknown [58.22.7.114]) by mail-m12779.qiye.163.com (Hmail) with ESMTPA id 0F87B780201; Wed, 29 Nov 2023 14:52:56 +0800 (CST) Message-ID: <9cdedbb6-67c0-4c43-9f82-629504aae933@rock-chips.com> Date: Wed, 29 Nov 2023 14:52:55 +0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 05/12] drm/rockchip: vop2: Set YUV/RGB overlay mode Content-Language: en-US To: Sascha Hauer , Andy Yan Cc: heiko@sntech.de, hjc@rock-chips.com, dri-devel@lists.freedesktop.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, krzysztof.kozlowski+dt@linaro.org, robh+dt@kernel.org, devicetree@vger.kernel.org, sebastian.reichel@collabora.com, kever.yang@rock-chips.com, chris.obbard@collabora.com References: <20231122125316.3454268-1-andyshrk@163.com> <20231122125438.3454608-1-andyshrk@163.com> <20231127141632.GF977968@pengutronix.de> From: Andy Yan In-Reply-To: <20231127141632.GF977968@pengutronix.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-HM-Spam-Status: e1kfGhgUHx5ZQUpXWQgPGg8OCBgUHx5ZQUlOS1dZFg8aDwILHllBWSg2Ly tZV1koWUFDSUNOT01LS0k3V1ktWUFJV1kPCRoVCBIfWUFZGRkYQlZLHU5KTENDTR8ZShhVEwETFh oSFyQUDg9ZV1kYEgtZQVlOQ1VJSVVMVUpKT1lXWRYaDxIVHRRZQVlPS0hVSk1PSU5JVUpLS1VKQl kG X-HM-Tid: 0a8c19da26c7b24fkuuu0f87b780201 X-HM-MType: 1 X-HM-Sender-Digest: e1kMHhlZQR0aFwgeV1kSHx4VD1lBWUc6ME06PDo4CDwxSxw8HRcKODoL HQgaCjxVSlVKTEtKSU9LTExNQkJOVTMWGhIXVRoVHwJVAhoVOwkUGBBWGBMSCwhVGBQWRVlXWRIL WUFZTkNVSUlVTFVKSk9ZV1kIAVlBTUpOQzcG X-Spam-Status: No, score=0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_SORBS_WEB,SPF_HELO_NONE,SPF_PASS,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 fry.vger.email 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 (fry.vger.email [0.0.0.0]); Tue, 28 Nov 2023 23:03:31 -0800 (PST) Hi Sasha: On 11/27/23 22:16, Sascha Hauer wrote: > On Wed, Nov 22, 2023 at 08:54:38PM +0800, Andy Yan wrote: >> From: Andy Yan >> >> Set overlay mode register according to the >> output mode is yuv or rgb. >> >> Signed-off-by: Andy Yan >> --- >> >> (no changes since v1) >> >> drivers/gpu/drm/rockchip/rockchip_drm_drv.h | 1 + >> drivers/gpu/drm/rockchip/rockchip_drm_vop2.c | 19 ++++++++++++++++--- >> 2 files changed, 17 insertions(+), 3 deletions(-) >> >> diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.h b/drivers/gpu/drm/rockchip/rockchip_drm_drv.h >> index 3d8ab2defa1b..7a58c5c9d4ec 100644 >> --- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.h >> +++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.h >> @@ -51,6 +51,7 @@ struct rockchip_crtc_state { >> u32 bus_format; >> u32 bus_flags; >> int color_space; >> + bool yuv_overlay; > This struct already contains a bool type variable. Please add this one > next to it to keep the struct size smaller. Okay, will do. > >> }; >> #define to_rockchip_crtc_state(s) \ >> container_of(s, struct rockchip_crtc_state, base) >> diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c >> index a019cc9bbd54..b32a291c5caa 100644 >> --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c >> +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c >> @@ -1612,6 +1612,8 @@ static void vop2_crtc_atomic_enable(struct drm_crtc *crtc, >> >> vop2->enable_count++; >> >> + vcstate->yuv_overlay = is_yuv_output(vcstate->bus_format); >> + >> vop2_crtc_enable_irq(vp, VP_INT_POST_BUF_EMPTY); >> >> polflags = 0; >> @@ -1639,7 +1641,7 @@ static void vop2_crtc_atomic_enable(struct drm_crtc *crtc, >> if (vop2_output_uv_swap(vcstate->bus_format, vcstate->output_mode)) >> dsp_ctrl |= RK3568_VP_DSP_CTRL__DSP_RB_SWAP; >> >> - if (is_yuv_output(vcstate->bus_format)) >> + if (vcstate->yuv_overlay) >> dsp_ctrl |= RK3568_VP_DSP_CTRL__POST_DSP_OUT_R2Y; >> >> vop2_dither_setup(crtc, &dsp_ctrl); >> @@ -1948,10 +1950,12 @@ static void vop2_setup_layer_mixer(struct vop2_video_port *vp) >> u16 hdisplay; >> u32 bg_dly; >> u32 pre_scan_dly; >> + u32 ovl_ctrl; >> int i; >> struct vop2_video_port *vp0 = &vop2->vps[0]; >> struct vop2_video_port *vp1 = &vop2->vps[1]; >> struct vop2_video_port *vp2 = &vop2->vps[2]; >> + struct rockchip_crtc_state *vcstate = to_rockchip_crtc_state(vp->crtc.state); >> >> adjusted_mode = &vp->crtc.state->adjusted_mode; >> hsync_len = adjusted_mode->crtc_hsync_end - adjusted_mode->crtc_hsync_start; >> @@ -1964,7 +1968,14 @@ static void vop2_setup_layer_mixer(struct vop2_video_port *vp) >> pre_scan_dly = ((bg_dly + (hdisplay >> 1) - 1) << 16) | hsync_len; >> vop2_vp_write(vp, RK3568_VP_PRE_SCAN_HTIMING, pre_scan_dly); >> >> - vop2_writel(vop2, RK3568_OVL_CTRL, 0); >> + ovl_ctrl = vop2_readl(vop2, RK3568_OVL_CTRL); >> + if (vcstate->yuv_overlay) >> + ovl_ctrl |= BIT(vp->id); >> + else >> + ovl_ctrl &= ~BIT(vp->id); > Some > > #define RK3568_OVL_CTRL__YUV_MODE(vp) BIT(vp) > > Would be nice. Okay, will do. >> + >> + vop2_writel(vop2, RK3568_OVL_CTRL, ovl_ctrl); > Is it necessary to write this register twice? I don't think so. Just follow the original code write it here. Anyway, I will just write once in next version. And would you please check my response about debugfs patch[0] when it is convenient for you? I want to know what you think, and prepare the next version. [0]https://patchwork.kernel.org/project/dri-devel/patch/20231122125601.3455031-1-andyshrk@163.com/ > >> + >> port_sel = vop2_readl(vop2, RK3568_OVL_PORT_SEL); >> port_sel &= RK3568_OVL_PORT_SEL__SEL_PORT; >> >> @@ -2036,9 +2047,11 @@ static void vop2_setup_layer_mixer(struct vop2_video_port *vp) >> layer_sel |= RK3568_OVL_LAYER_SEL__LAYER(nlayer + ofs, 5); >> } >> >> + ovl_ctrl |= RK3568_OVL_CTRL__LAYERSEL_REGDONE_IMD; >> + >> vop2_writel(vop2, RK3568_OVL_LAYER_SEL, layer_sel); >> vop2_writel(vop2, RK3568_OVL_PORT_SEL, port_sel); >> - vop2_writel(vop2, RK3568_OVL_CTRL, RK3568_OVL_CTRL__LAYERSEL_REGDONE_IMD); >> + vop2_writel(vop2, RK3568_OVL_CTRL, ovl_ctrl); > Sascha >