Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp377101rwi; Mon, 10 Oct 2022 01:26:15 -0700 (PDT) X-Google-Smtp-Source: AMsMyM54nM7gxcnkyQKgx6bxUnvcx5QFUUUFhN4Y+sKKjtpw88ZQyu6pCkfpcifTBvLXb4pjeDwG X-Received: by 2002:a05:6402:1cc1:b0:45c:3a90:9499 with SMTP id ds1-20020a0564021cc100b0045c3a909499mr1431114edb.61.1665390375493; Mon, 10 Oct 2022 01:26:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665390375; cv=none; d=google.com; s=arc-20160816; b=xwfkh/iLeJPDFafHDSlLC++HITfOckPFlofvGk37Pr0vR2JhinL9hjB7B0gmmzcgqG 8b8hgARPC3O1IF+1hYVzFkMzkR6mTjFDuBAhs8C0OZEfrm0eQqXqqjFZO+6aXq7zJBYK bxEGiH0z/jGvfnFv662S8tgDBBNITgv76zzXhSS7o6Xl7OB6A6DbqHuD3ThtCzUKxgc3 NJms+4R6t05x6jKdTMrjnKf3VTIzRBYl3ZAa/4zbiMTovBVxEwGmooPc15MngL2NL4jV pug+c/kIXn9kP5qW4hSU9okGScmoDfhA41/DpcL2hXRyR9DqlMqyoAmqrcunwRTUJogi C2dg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=0srgr026bo5PYeI4zNRMkSBm9YamD/HrwEJ5WAPXsgM=; b=tXpymZgzcNv4C8C0pYCDsOS0RNb2rgbmij4O9eYTS6X+jTqX8x5oAYirSoWcTWIM0I Rrbs+xkt9ya2QveNa8QXw5PjKfM4eCzfAXsaSgrNGZ/Jy1/uro/+4ahwPQGMUeWaTR0a kopzkSxdAK5qPFnf+ZFBntodd2MPaJC6Yi3jv7DXA6IcugVn2rcyd3aiDRfo02gKdcsw ZzdTLEqZ0W3vHxiKT9OBIscUHZTmyax1VbQUBbRGPOydaKtrx/tBWhrG/rvFVwDuAjVH Rw4TAPG+IDUpxAFno4SaWhlZJYrlJv7wpN50gdcvoE4PR82PidX/6mlZb/1wlgBUj4sW PE4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="QZE/83TZ"; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cr14-20020a170906d54e00b00780fd433b59si1113980ejc.460.2022.10.10.01.25.49; Mon, 10 Oct 2022 01:26:15 -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=@linuxfoundation.org header.s=korg header.b="QZE/83TZ"; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232124AbiJJHR4 (ORCPT + 99 others); Mon, 10 Oct 2022 03:17:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35272 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232359AbiJJHR2 (ORCPT ); Mon, 10 Oct 2022 03:17:28 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C9805FADD; Mon, 10 Oct 2022 00:11:34 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id BD15FB80E56; Mon, 10 Oct 2022 07:08:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 372F3C433D6; Mon, 10 Oct 2022 07:08:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1665385733; bh=1Btak+V6mpWCjnqSLc99b3Qti2O6zO1lxM7YkezTo3I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QZE/83TZ5d4k9ma2S+YuF89r0ZDQytASt4BPiSmRj5O5hhw6kl55NDRk3wRrI9+oa wpawC9r+soBYeQOs0Cp9Q3G5HW6oAWy+JIEihadS3Oc5y2Vxd6/oE3kzv0sOgksMi6 JnqE4vvTLrK01EZEPePFOHUwgyQozx8VtBkirleM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bhawanpreet Lakha , Wayne Lin , Leo Li , Daniel Wheeler , Alex Deucher , Sasha Levin Subject: [PATCH 5.15 24/37] drm/amd/display: Fix double cursor on non-video RGB MPO Date: Mon, 10 Oct 2022 09:05:43 +0200 Message-Id: <20221010070331.913262431@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221010070331.211113813@linuxfoundation.org> References: <20221010070331.211113813@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 From: Leo Li [ Upstream commit b261509952bc19d1012cf732f853659be6ebc61e ] [Why] DC makes use of layer_index (zpos) when picking the HW plane to enable HW cursor on. However, some compositors will not attach zpos information to each DRM plane. Consequently, in amdgpu, we default layer_index to 0 and do not update it. This causes said DC logic to enable HW cursor on all planes of the same layer_index, which manifests as a double cursor issue if one of the planes is scaled (and hence scaling the cursor as well). [How] Use DRM core helpers to calculate a normalized_zpos value for each drm_plane_state under each crtc, within the atomic state. This helper will first consider existing zpos values, and if identical/unset, fallback to plane ID ordering. The normalized_zpos is then passed to dc_plane_info during atomic check for later use by the cursor logic. Reviewed-by: Bhawanpreet Lakha Acked-by: Wayne Lin Signed-off-by: Leo Li Tested-by: Daniel Wheeler Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 12 ++++++++++-- 1 file changed, 10 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 e3dfea3d44a4..c826fc493e0f 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -5442,7 +5442,7 @@ fill_dc_plane_info_and_addr(struct amdgpu_device *adev, plane_info->visible = true; plane_info->stereo_format = PLANE_STEREO_FORMAT_NONE; - plane_info->layer_index = 0; + plane_info->layer_index = plane_state->normalized_zpos; ret = fill_plane_color_attributes(plane_state, plane_info->format, &plane_info->color_space); @@ -5509,7 +5509,7 @@ static int fill_dc_plane_attributes(struct amdgpu_device *adev, dc_plane_state->global_alpha = plane_info.global_alpha; dc_plane_state->global_alpha_value = plane_info.global_alpha_value; dc_plane_state->dcc = plane_info.dcc; - dc_plane_state->layer_index = plane_info.layer_index; // Always returns 0 + dc_plane_state->layer_index = plane_info.layer_index; dc_plane_state->flip_int_enabled = true; /* @@ -10828,6 +10828,14 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev, } } + /* + * DC consults the zpos (layer_index in DC terminology) to determine the + * hw plane on which to enable the hw cursor (see + * `dcn10_can_pipe_disable_cursor`). By now, all modified planes are in + * atomic state, so call drm helper to normalize zpos. + */ + drm_atomic_normalize_zpos(dev, state); + /* Remove exiting planes if they are modified */ for_each_oldnew_plane_in_state_reverse(state, plane, old_plane_state, new_plane_state, i) { ret = dm_update_plane_state(dc, state, plane, -- 2.35.1