Received: by 2002:ac0:950c:0:0:0:0:0 with SMTP id f12csp3392701imc; Wed, 13 Mar 2019 17:22:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqxsEl+EYsfp1BFL/rCG4UFmhrpR8lZ3da2KPrMy1L0XVg+YEj42DVN855DsbtyPxiCb5C8+ X-Received: by 2002:a63:360a:: with SMTP id d10mr8827336pga.361.1552522932123; Wed, 13 Mar 2019 17:22:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552522932; cv=none; d=google.com; s=arc-20160816; b=bR/Gk64dB8aNY7fohO08NhL46dnMzi7o3uCaIJPogz8jdN0Ft2S5MntgX0Fn0wS2lC ra6e0MFQqvpEhDAtAGAjwv2LCjSY8htMi/jsaCabTggA8XPC/OFDlszqhJIPHDJcM5Vo waIulEec7+xh80MKdRbxzqHUw9qlRQd/X1wF/82wYYu4sjWH8YG5DnjfFuGJqy1v6lUH yFPkoETB+2f8RpIUAGtsx70sKvgzXV/inHqGPs1XrmMinDavGksTdBkDiCXvSSDlf5Zn zKFPmkEf/e3/WQ7NoaiLjSJAG06fJUIduCVdEJZhCqBVMIIhY0kGoR26pm7EdUgxngb8 jilg== 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; bh=9ORwuTJ3kZ7XOsrbWKVrZd0FzjviSqQDGaRao+QwIYs=; b=IyV3Lx8w+LbsRINW71GfnR1i7QT3L4NXQTyf1+PaYpLwO1Gmdz5eEOJQGG7YectvAa ERWqb8Ly1o92k3cGjmdeVdZVXDjyJ9ofEsVTyAUXDj+9vsrM9ayxCLgLvyttB1BAWcfD yka/JA1Q79W7Hy3ek6TSK61z9Q1TRbEaopHmRHldQn5cJWS6AbRbIjHzoLypezDkVm+j Zk3p0yYgx4zrdzXdCAZY6Yq2Czwyzmx8tCIYBp/wQuoA6zmybmg5Rkt7kml4B3/pwxWu p7jqGkF/xbOzesatC1hNWbCEBLtgwagNfRJwjtg+B+ADwO7FfMr0Gn3fDEphXMcWsCp+ uQ5A== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u9si10835879pgr.551.2019.03.13.17.21.55; Wed, 13 Mar 2019 17:22:12 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727272AbfCNAVJ (ORCPT + 99 others); Wed, 13 Mar 2019 20:21:09 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:38156 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726640AbfCNAVH (ORCPT ); Wed, 13 Mar 2019 20:21:07 -0400 Received: from localhost.localdomain (unknown [IPv6:2804:431:9719:798c:867b:ebff:fe52:de60]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: koike) by bhuna.collabora.co.uk (Postfix) with ESMTPSA id 3A39C28145E; Thu, 14 Mar 2019 00:21:01 +0000 (GMT) From: Helen Koike To: dri-devel@lists.freedesktop.org, nicholas.kazlauskas@amd.com Cc: andrey.grodzovsky@amd.com, daniel.vetter@ffwll.ch, linux-kernel@vger.kernel.org, Tomasz Figa , boris.brezillon@collabora.com, David Airlie , Sean Paul , kernel@collabora.com, harry.wentland@amd.com, =?UTF-8?q?St=C3=A9phane=20Marchesin?= , Helen Koike , stable@vger.kernel.org, Sean Paul , linux-arm-msm@vger.kernel.org, robdclark@gmail.com, =?UTF-8?q?Ville=20Syrj=C3=A4l=C3=A4?= , Maarten Lankhorst , freedreno@lists.freedesktop.org, Mamta Shukla , Daniel Vetter Subject: [PATCH v3 3/5] drm/msm: fix fb references in async update Date: Wed, 13 Mar 2019 21:20:24 -0300 Message-Id: <20190314002027.7833-4-helen.koike@collabora.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190314002027.7833-1-helen.koike@collabora.com> References: <20190314002027.7833-1-helen.koike@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Async update callbacks are expected to set the old_fb in the new_state so prepare/cleanup framebuffers are balanced. Cc: # v4.14+ Fixes: 224a4c970987 ("drm/msm: update cursors asynchronously through atomic") Suggested-by: Boris Brezillon Signed-off-by: Helen Koike --- Hello, As mentioned in the cover letter, But I couldn't test on MSM because I don't have the hardware and I would appreciate if anyone could test it. In other platforms (VC4, AMD, Rockchip), there is a hidden drm_framebuffer_get(new_fb)/drm_framebuffer_put(old_fb) in async_update that is wrong, but I couldn't identify those here, not sure if it is hidden somewhere else, but if tests fail this is probably the cause. Thanks! Helen Changes in v3: None Changes in v2: - update CC stable and Fixes tag drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c index be13140967b4..b854f471e9e5 100644 --- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c +++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c @@ -502,6 +502,8 @@ static int mdp5_plane_atomic_async_check(struct drm_plane *plane, static void mdp5_plane_atomic_async_update(struct drm_plane *plane, struct drm_plane_state *new_state) { + struct drm_framebuffer *old_fb = plane->state->fb; + plane->state->src_x = new_state->src_x; plane->state->src_y = new_state->src_y; plane->state->crtc_x = new_state->crtc_x; @@ -524,6 +526,8 @@ static void mdp5_plane_atomic_async_update(struct drm_plane *plane, *to_mdp5_plane_state(plane->state) = *to_mdp5_plane_state(new_state); + + new_state->fb = old_fb; } static const struct drm_plane_helper_funcs mdp5_plane_helper_funcs = { -- 2.20.1