From patchwork Wed Jun 21 01:44:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Mario Kleiner X-Patchwork-Id: 9800567 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 088C2600F6 for ; Wed, 21 Jun 2017 01:52:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D395C27EE2 for ; Wed, 21 Jun 2017 01:52:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C5587283AF; Wed, 21 Jun 2017 01:52:41 +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=-4.1 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 572ED27EE2 for ; Wed, 21 Jun 2017 01:52:40 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C3C1989F82; Wed, 21 Jun 2017 01:52:35 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr0-x242.google.com (mail-wr0-x242.google.com [IPv6:2a00:1450:400c:c0c::242]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5124D6E414; Wed, 21 Jun 2017 01:45:28 +0000 (UTC) Received: by mail-wr0-x242.google.com with SMTP id y25so20072207wrd.1; Tue, 20 Jun 2017 18:45:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=kKOOUIMkDqV8pZLddVi6Me2GLH9V7PLqt+fTzU8pMeQ=; b=GDnH+OOJB7zMGNCkLGtppgPeXe7CRaTO6sJQcRKJ+OB9T9/QWu4umWYxAz6d/UN4OG Zl2YTKVvoPP0vQDKAr/pSvtK6esusJfrNCVyaYfpNjewf0yYPVlV7aMdAnJvNevweaKw bQHK1iOC+EDy7h5ydSTa10H7Io2enpUGhkXxMVH/uXE7cM/D+LGECwiRxasbDcLocaEJ t6rzVt6Qb31HgV8s0UmzydCne8Ke5shyf304nbhy8zp362d37NhaUuq6I2t5oSJPWZzl gytEMURbxybeGLCYSopcJRCf1iX9kHbHZDtwO2WHxpV5os6nzehdFTPGNzlwP8HELZCO 3Ahg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=kKOOUIMkDqV8pZLddVi6Me2GLH9V7PLqt+fTzU8pMeQ=; b=NhP2g1xe1Ruae1tlGtLH4/qWjVJosn1DsMZr2TeV3W4l5GzaKVbZG6pPNRDUlMxe1k 8nM59ARgBbpQY/TKdGUJh7Mxiz5UP9JL/aCAzUAgHGVDVU5dRDD2rIq23OKja53tUCZf VJ+YinLqQCMCL7gMXBw1fgDweme5GLmC0EfjJjG0GDGJZkwbqYOPeYDLwzQp4EzRbFvz FjVJr2ykjq7tkV6WaIUREcXO8KHKi3phL3fxQ/3Dz8MiOw2qIAK4K9x0rBT/P81BmzSY o7pSEBRAKVj2IR3O6dZgz75a2WtDJkbCAjHq3aJZ9JJgRbRYZSwP9Ul1G6HtUgmtSTCC k7xg== X-Gm-Message-State: AKS2vOwP7HU0Y+2zXyXp8jDbnmjv5eoo5zilm+3wV6SIpeHc8ArTfQku Gt8wjXijjiSTRBzW X-Received: by 10.28.113.214 with SMTP id d83mr599096wmi.62.1498009526669; Tue, 20 Jun 2017 18:45:26 -0700 (PDT) Received: from twisty.cin.medizin.uni-tuebingen.de (cin-11.medizin.uni-tuebingen.de. [134.2.118.242]) by smtp.gmail.com with ESMTPSA id 29sm24507651wrv.23.2017.06.20.18.45.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 20 Jun 2017 18:45:25 -0700 (PDT) From: Mario Kleiner To: dri-devel@lists.freedesktop.org Subject: [PATCH 3/4] drm/amdgpu: Allow vblank_disable_immediate. Date: Wed, 21 Jun 2017 03:44:56 +0200 Message-Id: <20170621014457.26587-4-mario.kleiner.de@gmail.com> X-Mailer: git-send-email 2.13.0.rc1.294.g07d810a77f In-Reply-To: <20170621014457.26587-1-mario.kleiner.de@gmail.com> References: <20170621014457.26587-1-mario.kleiner.de@gmail.com> MIME-Version: 1.0 Cc: nouveau@lists.freedesktop.org, =?UTF-8?q?Michel=20D=C3=A4nzer?= , amd-gfx@lists.freedesktop.org, Alex Deucher X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP With instantaneous high precision vblank timestamping that updates at leading edge of vblank, a cooked hw vblank counter which increments at leading edge of vblank, and reliable page flip execution and completion at leading edge of vblank, we should meet the requirements for fast/immediate vblank irq disable/enable. Testing on Linux-4.12-rc5 + drm-next on a Radeon R9 380 Tonga Pro (DCE 10) with timing measurement equipment indicates this works fine, so allow immediate vblank disable for power saving. For debugging in case of unexpected trouble, booting with kernel cmdline option drm.vblankoffdelay=0 (or echo 0 > /sys/module/drm/parameters/vblankoffdelay) would keep vblank irqs permanently on to approximate old behavior. Signed-off-by: Mario Kleiner Cc: Alex Deucher Cc: Michel Dänzer Reviewed-by: Michel Dänzer --- drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c index 62da6c5..a28f8aa 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c @@ -220,6 +220,10 @@ int amdgpu_irq_init(struct amdgpu_device *adev) int r = 0; spin_lock_init(&adev->irq.lock); + + /* Disable vblank irqs aggressively for power-saving */ + adev->ddev->vblank_disable_immediate = true; + r = drm_vblank_init(adev->ddev, adev->mode_info.num_crtc); if (r) { return r;