Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp952238rwr; Thu, 20 Apr 2023 08:11:11 -0700 (PDT) X-Google-Smtp-Source: AKy350bUiAdek123uKlSUYRbj6D4/az+5OOElvxUKQGuHYrrmUbOfNYBjZllBHn4J15GYjF5RJ82 X-Received: by 2002:a17:90b:3e84:b0:23f:3:49c5 with SMTP id rj4-20020a17090b3e8400b0023f000349c5mr1919038pjb.2.1682003470903; Thu, 20 Apr 2023 08:11:10 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1682003470; cv=pass; d=google.com; s=arc-20160816; b=mDEWsH6rT+pwxl+ygXM4b/dGzOCOTh7DzKrAzSda7hPU0Z52TWtxTRDv3PR1+f/9AU YwiJu3NZEGQsIfv1lX4eOhoT1zawAJuwupIRTGGDlgVvIAQljNQL7dg+MIYJI1Sgh5xx 9gZllKsGffLXiOTIYO1TDhpwXO0BVcJll+LrsAi+ihBrOXwhYBkqT+FY5Wub69ZCHjFR Gu/hiwfnZt6dfylolbwjso6YHk9pyvSGUpSKEyVZf0tZtF9Jkak9MSKYdr/UkRCZVV8z jUaA9edyq/ZUb2RMXce3fyGtLtk41Zrvjku8C6hDruaTCyTazbxlfzZQhXEpYlTqoDZv WzZw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :msip_labels:content-language:accept-language:in-reply-to:references :message-id:date:thread-index:thread-topic:subject:cc:to:from :dkim-signature; bh=QAljY8gJXpiLYeHSX5v3xuQ7FPY3/GYWPN7F0zfAuXw=; b=Q/HKjn8oLEeChsL8JLe/1zkoy952DrNp7tcQqUKy00nCCH8LhBuwbsla5hxk5bo3tq LHlVDbTV6PkBum9DjpU2XReiF/GvZb7dtKS1+n0NfJbBv3AsBJSv27UslD18oUDpqelI BQG9D0YYfjXpBLxUl+794sPyn/C6WntlDNJR6P5sq9/GnNH1X328j7f2vK8eB52muQ9T JoDOoQIZ0/FMYqCoNB1IFq0th55YQoX+QdFI70M47sg8vphAUUMox8/fabanWAaTrUfv fZ5fUBLQnHRbxf5dpMuy5SRWlpaSdDsE36J6JnLwb0vwrn9kKBr2+dGJjF1Ls6B1HcG8 Ovvg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=xzjG9DJj; arc=pass (i=1 spf=pass spfdomain=amd.com dkim=pass dkdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s5-20020a17090ad48500b0024686879af0si4451651pju.169.2023.04.20.08.10.43; Thu, 20 Apr 2023 08:11:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=xzjG9DJj; arc=pass (i=1 spf=pass spfdomain=amd.com dkim=pass dkdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232042AbjDTOv5 (ORCPT + 99 others); Thu, 20 Apr 2023 10:51:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43544 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231699AbjDTOvw (ORCPT ); Thu, 20 Apr 2023 10:51:52 -0400 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2043.outbound.protection.outlook.com [40.107.93.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 96E797ED5; Thu, 20 Apr 2023 07:51:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QMz0GSIxBGNxqWppHJqhh8Q/FWaGF2v14wAbGZKkeS+or/kTdMPmx49yVNu0JsLScwXhKlZjro7DYdNDged8rcuTSV81neycD+/5N+XdB8tXEF/KczJcInR+ePThIKIxW+DT72vSYASXSjODaMFBInhyXa3Gh9QGP4nrK8nqRDq2kPRx9oQY8Dcls3/H/hE9iZxBwVUrHvNJF0mXwwFuWZRJHm8Xa49Nm7Al7nrJDCc21KMdqnHP1bKiIwrbJaaWxUC5luBepgKYz2iF/Q2ZGvp1X5hSMF0Va8Stb8Hjag0vICcD/b4tqxnUbLXrk+ktrmTM5eCLyOlSokGdtCrReg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=QAljY8gJXpiLYeHSX5v3xuQ7FPY3/GYWPN7F0zfAuXw=; b=TCGgHO6S7mZ+JmwDr0yYQs3CDA/D+Ljpq8Dyjb2zs0BkeVrCGZGG0xeY0qQqvwnNEDlQFFQyPJoL/LAM8giCPBspztz7RRPVoMIm77vC/c4obffyPzQxurGuTQCbYetHcCJYJg9unWTuyXF0hA90WsjpwCmwuKUfDBnEvW76nDHB9qxAT0DGXoeiDeYpibIFRgAs7SyHDP9vj7T05e4KWsZ1OzK/Fd0ggiSy+cHpW1UWKcPCn3tDfeOYUxbghkQrQwE8SBMGaF+rMp7Je/xzXVKMnLuOP0Y6FfH8dFKLMMsA6n2TrYUHN3B5yNuSD+38U9NkxQCOpAhV5estVOFz9g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=QAljY8gJXpiLYeHSX5v3xuQ7FPY3/GYWPN7F0zfAuXw=; b=xzjG9DJjJaowz95zgmJDDAJniY9r3MFUFPsLVJja/AACZJSYpRgsgwUdYp9yFpVj7b4q7DV/uLf6BLSEZTZ8ZTSNPZQbAUxsPxqmuXgnEgBN6j75176xJDXNF/vg3mLYYyCkvbwTJL2hgEiSIgf8jBZM1o/xAGLuKX+AYmyh/cY= Received: from CY8PR12MB8193.namprd12.prod.outlook.com (2603:10b6:930:71::22) by BL1PR12MB5969.namprd12.prod.outlook.com (2603:10b6:208:398::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6319.22; Thu, 20 Apr 2023 14:51:29 +0000 Received: from CY8PR12MB8193.namprd12.prod.outlook.com ([fe80::57b4:c54f:f569:87c6]) by CY8PR12MB8193.namprd12.prod.outlook.com ([fe80::57b4:c54f:f569:87c6%7]) with mapi id 15.20.6319.022; Thu, 20 Apr 2023 14:51:29 +0000 From: "Li, Roman" To: "Mahfooz, Hamza" , "amd-gfx@lists.freedesktop.org" CC: "Wang, Chao-kai (Stylon)" , "Tuikov, Luben" , "dri-devel@lists.freedesktop.org" , "Li, Sun peng (Leo)" , David Airlie , "Zhuo, Qingqing (Lillian)" , "Pan, Xinhui" , "Siqueira, Rodrigo" , "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" , Hans de Goede , "Pillai, Aurabindo" , "Wu, Hersen" , "Mahfooz, Hamza" , Daniel Vetter , "Deucher, Alexander" , "Wentland, Harry" , "Koenig, Christian" Subject: RE: [PATCH v3] drm/amd/display: fix flickering caused by S/G mode Thread-Topic: [PATCH v3] drm/amd/display: fix flickering caused by S/G mode Thread-Index: AQHZc44UphO80f4k9E2EWH4AfM2QFK80R9Dg Date: Thu, 20 Apr 2023 14:51:29 +0000 Message-ID: References: <20230420134414.44538-1-hamza.mahfooz@amd.com> In-Reply-To: <20230420134414.44538-1-hamza.mahfooz@amd.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_d4243a53-6221-4f75-8154-e4b33a5707a1_ActionId=c213a279-5216-41c6-8260-96959f0d0ee9;MSIP_Label_d4243a53-6221-4f75-8154-e4b33a5707a1_ContentBits=0;MSIP_Label_d4243a53-6221-4f75-8154-e4b33a5707a1_Enabled=true;MSIP_Label_d4243a53-6221-4f75-8154-e4b33a5707a1_Method=Privileged;MSIP_Label_d4243a53-6221-4f75-8154-e4b33a5707a1_Name=Public-AIP 2.0;MSIP_Label_d4243a53-6221-4f75-8154-e4b33a5707a1_SetDate=2023-04-20T14:50:50Z;MSIP_Label_d4243a53-6221-4f75-8154-e4b33a5707a1_SiteId=3dd8961f-e488-4e60-8e11-a82d994e183d; authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: CY8PR12MB8193:EE_|BL1PR12MB5969:EE_ x-ms-office365-filtering-correlation-id: 06392b2b-fa9e-4403-d2ef-08db41aeb95b x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: UwvqlJPxPYmvFQHjhvdCCMFCKVE7RqTBmrE1sYNAfPOMSTe94nd0ZmAwSGMU+gTJnqbG3CBoJ6SkaIuhD5M3Lilj19mKc3XsdjWbd+X45MKAOaFEmpM7bBi+4OPsPMPPHTu294xGNlhMFjs57BPzJPz72MAImwefMll41AK6YoSsxh1umq/uDtiHWM/JYaDd0N731UH2TGwSKhLKTfr07zhjSaLpAJnSJAoRnB8qpPiDW5niykGzgQXK2qNxAIfOjJJH7fWmMKl8MGJH/14rxRTVBZ+RYHPNj+KmpYunmT5bQ3nbpGL1dJjGYnDScTUIu5Qlr/TMjd/PN42mWPgSAk8jkwFnkMPKUKa/RZEzkYMbaHzpbWIOcg39nKXSYi3vxGLR3tMUkksTDDXPbUsF99i/OsJ9JPykTHjakrpOVKMttMQghCpZ1myRBx6pGpthGIJcIWGGu9OkmDBl2N5X3l1HYEEcAj+CwE6TSxFdFPbGxwisPXZ8i9X44C+7FPkqkcYode26bPGBUDveMy+KQ9JJFRfTdkH2pLBDQsICw+zyX9WURmcty+1+ydRmKPOF x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CY8PR12MB8193.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(136003)(376002)(396003)(366004)(346002)(39860400002)(451199021)(122000001)(4326008)(316002)(110136005)(54906003)(966005)(64756008)(76116006)(66946007)(66556008)(66476007)(66446008)(186003)(26005)(9686003)(6506007)(53546011)(38100700002)(83380400001)(5660300002)(41300700001)(8676002)(55016003)(8936002)(478600001)(7696005)(71200400001)(38070700005)(33656002)(86362001)(2906002)(52536014);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?xHlrTjnMIwzCncoD1HBuJ5dFEnq5RXdWUQtOrxv1hf1gTNss6Q1lcUxUyytd?= =?us-ascii?Q?o/aGaZy32cbQYudSVB4akHYFizxR3mgie9xDQTDyckLb5v5r5vBB/S6hUF5m?= =?us-ascii?Q?O3b5YFIqXubVO/mbt/Eljva0XFPjiXm0Q8YzMv3idRiZiNubeX6/Z/BJpiNj?= =?us-ascii?Q?HkD9X1AywB/pifVcEFcnRrUAwRrKQqlf47QvoLygegGNI4uGsBAArMoLcpYv?= =?us-ascii?Q?Hf+sHhYjzq1BEEpKoPWffhj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ii?Q?/zyrzaECglF466z0ertyjtmznqBHv2cH3EWybv4rchmZV+2TM6DiMcCdZ4N5?= =?us-ascii?Q?wyGzDPEeNlP1EOM/U5CTqpw4rJe/61mrpl+4ZEvTD6AHl/I972w3ICQ61FHV?= =?us-ascii?Q?ipllQcTQxjmyJyWJ+Siks42fUGuFivWaNCHImobSmTF6kJFuduK/AvHCc1Nn?= =?us-ascii?Q?p4N0JBQIs/U9DoyLIExLMKhC9JYUgJgHDHC//XVg73P8UuTczBL8SnJPNaJ9?= =?us-ascii?Q?szk//+uMFXfQ8jjWsa6q8phBwYDrQSdhvnrM2u3Im5L2jqNWjuWkZsKMleBe?= =?us-ascii?Q?k3J2ZyrPQZUmIZc283R/6gglrtvPjZvD+JRcXST6MIQcddSOuDMHmJ82hdgd?= =?us-ascii?Q?iVrcm6Kzv4PQMVZtqJnwlydwfk4Yfntuw9HZ/1jOREnxFNVCicZQ8/Nl4bFt?= =?us-ascii?Q?GSh+mqGhW7EGvEblbWM=3D?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: CY8PR12MB8193.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 06392b2b-fa9e-4403-d2ef-08db41aeb95b X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Apr 2023 14:51:29.2654 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: pCSe7efK/TL9uC8NyRsjIYxGPo0bLvGKY3Mq3GZMt64LPON7BO6zcxSiSNKKdUbK X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR12MB5969 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_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 [Public] Reviewed-by: Roman Li > -----Original Message----- > From: amd-gfx On Behalf Of Hamza > Mahfooz > Sent: Thursday, April 20, 2023 9:44 AM > To: amd-gfx@lists.freedesktop.org > Cc: Wang, Chao-kai (Stylon) ; Tuikov, Luben > ; dri-devel@lists.freedesktop.org; Li, Sun peng (Le= o) > ; David Airlie ; Zhuo, Qingqing > (Lillian) ; Pan, Xinhui ; > Siqueira, Rodrigo ; linux-kernel@vger.kernel.or= g; > stable@vger.kernel.org; Hans de Goede ; Pillai, > Aurabindo ; Wu, Hersen > ; Mahfooz, Hamza ; > Daniel Vetter ; Deucher, Alexander > ; Wentland, Harry > ; Koenig, Christian > Subject: [PATCH v3] drm/amd/display: fix flickering caused by S/G mode > > Currently, on a handful of ASICs. We allow the framebuffer for a given pl= ane to > exist in either VRAM or GTT. However, if the plane's new framebuffer is i= n a > different memory domain than it's previous framebuffer, flipping between > them can cause the screen to flicker. So, to fix this, don't perform an > immediate flip in the aforementioned case. > > Cc: stable@vger.kernel.org > Link: https://gitlab.freedesktop.org/drm/amd/-/issues/2354 > Fixes: 81d0bcf99009 ("drm/amdgpu: make display pinning more flexible (v2)= ") > Signed-off-by: Hamza Mahfooz > --- > v2: make a number of clarifications to the commit message and drop > locking. > v3: use a stronger check > --- > .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 16 ++++++++++++++- > - > 1 file changed, 14 insertions(+), 2 deletions(-) > > diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c > b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c > index dfcb9815b5a8..875111340203 100644 > --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c > +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c > @@ -7900,6 +7900,13 @@ static void amdgpu_dm_commit_cursors(struct > drm_atomic_state *state) > amdgpu_dm_plane_handle_cursor_update(plane, > old_plane_state); } > > +static inline uint32_t get_mem_type(struct drm_framebuffer *fb) { > + struct amdgpu_bo *abo =3D gem_to_amdgpu_bo(fb->obj[0]); > + > + return abo->tbo.resource ? abo->tbo.resource->mem_type : 0; } > + > static void amdgpu_dm_commit_planes(struct drm_atomic_state *state, > struct dc_state *dc_state, > struct drm_device *dev, > @@ -7919,6 +7926,7 @@ static void amdgpu_dm_commit_planes(struct > drm_atomic_state *state, > > to_dm_crtc_state(drm_atomic_get_old_crtc_state(state, pcrtc)); > int planes_count =3D 0, vpos, hpos; > unsigned long flags; > + uint32_t mem_type; > u32 target_vblank, last_flip_vblank; > bool vrr_active =3D amdgpu_dm_crtc_vrr_active(acrtc_state); > bool cursor_update =3D false; > @@ -8040,13 +8048,17 @@ static void amdgpu_dm_commit_planes(struct > drm_atomic_state *state, > } > } > > + mem_type =3D get_mem_type(old_plane_state->fb); > + > /* > * Only allow immediate flips for fast updates that don't > - * change FB pitch, DCC state, rotation or mirroing. > + * change memory domain, FB pitch, DCC state, rotation or > + * mirroring. > */ > bundle->flip_addrs[planes_count].flip_immediate =3D > crtc->state->async_flip && > - acrtc_state->update_type =3D=3D UPDATE_TYPE_FAST; > + acrtc_state->update_type =3D=3D UPDATE_TYPE_FAST && > + mem_type && get_mem_type(fb) =3D=3D mem_type; > > timestamp_ns =3D ktime_get_ns(); > bundle->flip_addrs[planes_count].flip_timestamp_in_us =3D > div_u64(timestamp_ns, 1000); > -- > 2.40.0