Received: by 2002:ac0:950c:0:0:0:0:0 with SMTP id f12csp3230556imc; Wed, 13 Mar 2019 12:12:35 -0700 (PDT) X-Google-Smtp-Source: APXvYqyVryDfgh+nO7m48cJ8HQGsPrGDGEis+wAw6OgKETgoYeQrkBbplT0Yzw0+4C1v8YI8m5sR X-Received: by 2002:a17:902:a60c:: with SMTP id u12mr10871448plq.301.1552504355727; Wed, 13 Mar 2019 12:12:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552504355; cv=none; d=google.com; s=arc-20160816; b=RV1LsS0nqhCN/4t2NGEwOG6rG0nrJ997olMYLjZrw7cWqcdIY89C7mxkBEYJ+IPJR0 xK2UA0nVHXNvBbeN9W7JjAg8TgP0CyVgro1faPAyOTlp7SkKpfDEj5vyQvEdOPFSd7MH HAYXC9xZdxTSuqKK1wQ5/h8nFIi1ft2rD7HkgxrDP8NQzncOd/Ap8ABkYFIvrMTYG26z ML32dNerk2IIuBgWfpa9kOmHVb/uan7JPYszGFV7J+3WK6k4XY7f08aRUzhShtvN9Xpq nylTSUElI2TVvY2ej/lIW6ww7A6yvDF+a5UwoCJl+jOmScEjESc0M76hiyIKcv/DIuBF dSQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=SR2jEY2t2PUw+JkKrn4KdNwbL7rnFI/74tOgBIOlImc=; b=Y7ipdcd4uKqIaS//bQQlWu1w5PEhnwQDlbsoppN7zV5+WGg+5vLoLdyazuXRe1xDKN 0WCWmwzcpHoQPsP2JChvXfeLeYJHZgRYzamd6ueDbN3CLmukgXOTWSDqW2yKoYdaEuUg 3zKjDiu9KwFWEUWk+hR/ad+utb4SX5AZhADjb4M0oa77ipobsHk+0JsKNeIUNk54VRLB 2bfPo3b3IqPCDHs20Tk4s0lAG7CKc0oCq3IPjBpabhv0NAnx007xBjMJyiRIAeNiRnHi ZvUhHFYQpX7LFkm1SODX9Bf8Jf1/VgLpVYoQGKLGmVzXWIH8jwv7GHas2K8zRkdkNtsY BT4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=rPe3Raxc; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a11si10630128pff.126.2019.03.13.12.12.19; Wed, 13 Mar 2019 12:12:35 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=rPe3Raxc; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727051AbfCMTLc (ORCPT + 99 others); Wed, 13 Mar 2019 15:11:32 -0400 Received: from mail.kernel.org ([198.145.29.99]:42050 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727453AbfCMTL3 (ORCPT ); Wed, 13 Mar 2019 15:11:29 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id DD8B5213A2; Wed, 13 Mar 2019 19:11:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1552504289; bh=kheTHIygLSt5QDraeXk6hJ+3u9RmmtJxD/+jReERaOQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rPe3Raxc6+s2GI6yPMJaWazT6lqfQCGoudYh+V+VCcs8JoYlLoxzunEmbDyQ5qvAF SBrxA/cr/cbzusrvIbTHGt+AGMT/nKGW/qgU61Bdl+fFH7EWxFNpC42duOZXTb639h n6K4ZHi7EggQSAPy3mnpls5nNcAP9b+/niwiTGVk= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Nicholas Kazlauskas , Alex Deucher , Sasha Levin , amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org Subject: [PATCH AUTOSEL 4.20 32/60] drm/amd/display: Fix negative cursor pos programming Date: Wed, 13 Mar 2019 15:09:53 -0400 Message-Id: <20190313191021.158171-32-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190313191021.158171-1-sashal@kernel.org> References: <20190313191021.158171-1-sashal@kernel.org> MIME-Version: 1.0 X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Nicholas Kazlauskas [ Upstream commit 0921c41e19028314830b33daa681e46b46477c5e ] [Why] If the cursor pos passed from DM is less than the plane_state->dst_rect top left corner then the unsigned cursor pos wraps around to a large positive number since cursor pos is a u32. There was an attempt to guard against this in hubp1_cursor_set_position by checking the src_x_offset and src_y_offset and offseting the cursor hotspot within hubp1_cursor_set_position. However, the cursor position itself is still being programmed incorrectly as a large value. This manifests itself visually as the cursor disappearing or containing strange artifacts near the middle of the screen on raven. [How] Don't subtract the destination rect top left corner from the pos but add it to the hotspot instead. This happens before the pos gets passed into hubp1_cursor_set_position. This achieves the same result but avoids the subtraction wrap around. With this fix the original cursor programming logic can be used again. Signed-off-by: Nicholas Kazlauskas Reviewed-by: Charlene Liu Acked-by: Leo Li Acked-by: Murton Liu Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c index 220ba828748d..5bc214ce5227 100644 --- a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +++ b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c @@ -2654,8 +2654,8 @@ static void dcn10_set_cursor_position(struct pipe_ctx *pipe_ctx) .mirror = pipe_ctx->plane_state->horizontal_mirror }; - pos_cpy.x -= pipe_ctx->plane_state->dst_rect.x; - pos_cpy.y -= pipe_ctx->plane_state->dst_rect.y; + pos_cpy.x_hotspot += pipe_ctx->plane_state->dst_rect.x; + pos_cpy.y_hotspot += pipe_ctx->plane_state->dst_rect.y; if (pipe_ctx->plane_state->address.type == PLN_ADDR_TYPE_VIDEO_PROGRESSIVE) -- 2.19.1