Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1930726ybv; Fri, 14 Feb 2020 08:25:19 -0800 (PST) X-Google-Smtp-Source: APXvYqxqtyXwSwuCEYofWmTw3cs2aN0ZmhX+PLJSj0Lcssodfwrv0NMdYjzGQfbt7Io/Alz6nJkM X-Received: by 2002:aca:ec15:: with SMTP id k21mr2422910oih.35.1581697519523; Fri, 14 Feb 2020 08:25:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581697519; cv=none; d=google.com; s=arc-20160816; b=zpZk/TQE6WXJEuyg9n5mqp2PEm5cRBHWP2bLpP5UZ1giqHlGlGETI0pqSb18uOfnrj vE6YcsPckEj3qjcPWGcWclnw2w6C3EIWFahdbacH4DFxW0i1TADPYq0hTJDoXywDPb88 g1M3WB3giT1fA0rC6BxjXMa4vcYI9OwPwlNsOOwSzxPB4OMeaAj+ERPvqQCdqYDJgh7V Li9mvHww/7MRrn0jXkKzhgIxGdZttpZ5kSbc6Wp5GWAMXGm7FxyuEpp+ld6aRqSeSAfE aeeh6WUzGL1kG15bpWrqAQdCHNsKhtZNR3/8xAM0ynUKIRWT8CU4LbkTzmhrG5etp+1J 6SKA== 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=p0cIvtPWvsz00M5Sk9u71kIsOSRIX4ww1TuWR0BYyh4=; b=uWVMN1VgN6NmL1PMcBmF1TDsFUVDxVRcrEm5DGjtRj7ccKLiTfOTWO5QicO7N3yGyb 6pjL9XnKEYTnQZnp3UXOqA/GG/7O/bMXrHroUOj/UDI5pdneZhC7iYCyFmPq9jRQlxmv uM9CmQ1RUvSoBckIWGLsBuUyJTS7t8g/jQE1XnkrvfV4+Z0xu8h5pdF0DxGMw9luca4u xOA1T1P3bYhCtW1Nmf5W+UvrLj0R4UR+ML+WM96ttbY+6CezncDoqJ7ImyVS7mlJhinM B+ykikTREeJtP2PY1pQvzjL5OmkNmVfgt6IjZfpjzh7jbU7vONHLuiMFteBZ478LBzx5 KOIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=HS99IKXj; 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 l11si3230115oth.286.2020.02.14.08.25.07; Fri, 14 Feb 2020 08:25:19 -0800 (PST) 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=HS99IKXj; 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 S2405922AbgBNQYg (ORCPT + 99 others); Fri, 14 Feb 2020 11:24:36 -0500 Received: from mail.kernel.org ([198.145.29.99]:58698 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2393250AbgBNQWv (ORCPT ); Fri, 14 Feb 2020 11:22:51 -0500 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 95B1F2475F; Fri, 14 Feb 2020 16:22:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1581697370; bh=JktK7OZ+PguGwXAN1oQ8D/VTtnD5HyaZVu3gKZGgxaM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HS99IKXjl9dANYiaf7VomzrYQCBwl0DE300TgVuI04mHeqOXgZSE1pxqNBwPDI8PT HoTXpkQRxulVsgvyJfQJlp1eidEQtM4MmQkEfNk1JQMebjPufwUCBm7JutOv3HNU5Y QpKihuHiqSoO4ZEWxUv9Lv8aFMqwjckSEmzJ/Xyo= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Bibby Hsieh , CK Hu , Sasha Levin , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH AUTOSEL 4.9 069/141] drm/mediatek: handle events when enabling/disabling crtc Date: Fri, 14 Feb 2020 11:20:09 -0500 Message-Id: <20200214162122.19794-69-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200214162122.19794-1-sashal@kernel.org> References: <20200214162122.19794-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review 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: Bibby Hsieh [ Upstream commit 411f5c1eacfebb1f6e40b653d29447cdfe7282aa ] The driver currently handles vblank events only when updating planes on an already enabled CRTC. The atomic update API however allows requesting an event when enabling or disabling a CRTC. This currently leads to event objects being leaked in the kernel and to events not being sent out. Fix it. Signed-off-by: Bibby Hsieh Signed-off-by: CK Hu Signed-off-by: Sasha Levin --- drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c index 01a21dd835b57..1ed60da76a0ce 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c +++ b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c @@ -306,6 +306,7 @@ static int mtk_crtc_ddp_hw_init(struct mtk_drm_crtc *mtk_crtc) static void mtk_crtc_ddp_hw_fini(struct mtk_drm_crtc *mtk_crtc) { struct drm_device *drm = mtk_crtc->base.dev; + struct drm_crtc *crtc = &mtk_crtc->base; int i; DRM_DEBUG_DRIVER("%s\n", __func__); @@ -327,6 +328,13 @@ static void mtk_crtc_ddp_hw_fini(struct mtk_drm_crtc *mtk_crtc) mtk_disp_mutex_unprepare(mtk_crtc->mutex); pm_runtime_put(drm->dev); + + if (crtc->state->event && !crtc->state->active) { + spin_lock_irq(&crtc->dev->event_lock); + drm_crtc_send_vblank_event(crtc, crtc->state->event); + crtc->state->event = NULL; + spin_unlock_irq(&crtc->dev->event_lock); + } } static void mtk_drm_crtc_enable(struct drm_crtc *crtc) -- 2.20.1