From patchwork Tue Sep 27 15:59:56 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tobias Jakobi X-Patchwork-Id: 9352153 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1975860757 for ; Tue, 27 Sep 2016 16:00:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0B5AD2927A for ; Tue, 27 Sep 2016 16:00:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F3F602928A; Tue, 27 Sep 2016 16:00:08 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9AD122927A for ; Tue, 27 Sep 2016 16:00:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934101AbcI0QAF (ORCPT ); Tue, 27 Sep 2016 12:00:05 -0400 Received: from smtp.math.uni-bielefeld.de ([129.70.45.10]:40873 "EHLO smtp.math.uni-bielefeld.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932674AbcI0QAE (ORCPT ); Tue, 27 Sep 2016 12:00:04 -0400 Received: from chidori.dhcp.uni-bielefeld.de (unknown [10.68.161.86]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client did not present a certificate) by smtp.math.uni-bielefeld.de (Postfix) with ESMTPSA id E49CE5F61A; Tue, 27 Sep 2016 18:00:01 +0200 (CEST) From: Tobias Jakobi To: linux-samsung-soc@vger.kernel.org Cc: dri-devel@lists.freedesktop.org, m.szyprowski@samsung.com, inki.dae@samsung.com, Tobias Jakobi Subject: [PATCH 5/6] drm/exynos: g2d: use autosuspend mode for PM runtime Date: Tue, 27 Sep 2016 17:59:56 +0200 Message-Id: <1474991997-6350-1-git-send-email-tjakobi@math.uni-bielefeld.de> X-Mailer: git-send-email 2.7.3 Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The runqueue worker currently issues a get() when a new node is processed, and a put() once a node is completed. The corresponding suspend and resume calls currently only do clock gating, but with the upcoming introduction of IOMMU runpm also the corresponding IOMMU domain gets enabled (for get()) and disabled (for put()). This introduces performance regressions with we mitigate here. Switch PM runtime to autosuspend, such that clock gating and IOMMU control only happens when the engine is idle for a 'long' time. Signed-off-by: Tobias Jakobi --- drivers/gpu/drm/exynos/exynos_drm_g2d.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_g2d.c b/drivers/gpu/drm/exynos/exynos_drm_g2d.c index 5de5ea4..1a000c1 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_g2d.c +++ b/drivers/gpu/drm/exynos/exynos_drm_g2d.c @@ -903,7 +903,8 @@ static void g2d_runqueue_worker(struct work_struct *work) g2d->runqueue_node = NULL; if (runqueue_node) { - pm_runtime_put(g2d->dev); + pm_runtime_mark_last_busy(g2d->dev); + pm_runtime_put_autosuspend(g2d->dev); complete(&runqueue_node->complete); if (runqueue_node->async) @@ -1022,7 +1023,8 @@ static void g2d_wait_finish(struct g2d_data *g2d, struct drm_file *file) * the IRQ which triggers the PM runtime put(). * So do this manually here. */ - pm_runtime_put(dev); + pm_runtime_mark_last_busy(dev); + pm_runtime_put_autosuspend(dev); complete(&runqueue_node->complete); if (runqueue_node->async) @@ -1519,6 +1521,8 @@ static int g2d_probe(struct platform_device *pdev) goto err_destroy_workqueue; } + pm_runtime_use_autosuspend(dev); + pm_runtime_set_autosuspend_delay(dev, 2000); pm_runtime_enable(dev); clear_bit(G2D_BIT_SUSPEND_RUNQUEUE, &g2d->flags); clear_bit(G2D_BIT_ENGINE_BUSY, &g2d->flags); @@ -1590,6 +1594,7 @@ static int g2d_remove(struct platform_device *pdev) /* There should be no locking needed here. */ g2d_remove_runqueue_nodes(g2d, NULL); + pm_runtime_dont_use_autosuspend(&pdev->dev); pm_runtime_disable(&pdev->dev); g2d_fini_cmdlist(g2d);