From patchwork Wed Jun 21 01:44:57 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Kleiner X-Patchwork-Id: 9800569 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 A91B76086C for ; Wed, 21 Jun 2017 02:02:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8322E28563 for ; Wed, 21 Jun 2017 02:02:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 778D328567; Wed, 21 Jun 2017 02:02:12 +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 F28EF28562 for ; Wed, 21 Jun 2017 02:02:11 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 035DE6E40A; Wed, 21 Jun 2017 01:58:39 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr0-x243.google.com (mail-wr0-x243.google.com [IPv6:2a00:1450:400c:c0c::243]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2F6856E417; Wed, 21 Jun 2017 01:45:31 +0000 (UTC) Received: by mail-wr0-x243.google.com with SMTP id 77so22254939wrb.3; Tue, 20 Jun 2017 18:45:31 -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; bh=uE3A14WGgt6QHqzqf0Z/UoUroGGIyEOoIjPT+WmpBUk=; b=R9docMPZfFrqdlXk01dd7nJBa5zmBU6rKmsbBToPg8OToTfKKFdPQIPG1xsxZbvr3q PL3ZGAXSeSIpMsrbp8JjlebVkgcbmL/opP+crrlzLMaC53rcnnarIa+95C8jkCdqgSIq xvfWY0DJW15Pd52RnaZYphKEsg5nMo28VwDz4+TcoH/akHykFmK+vBil+Tw73K6XHSSc 073hLezPG+gNQBsV6jGD/6Y507m8jNVQ4HuK3smGV4GM2V5WlDE6tByuPSFGMLTT84cz bucWZ1QJ3cDptG+NyPZ9R8iMERgD//T2kjpaFRnUCRQ7PWKbmm6eOGuN7sUhcmk+6yym WHbQ== 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; bh=uE3A14WGgt6QHqzqf0Z/UoUroGGIyEOoIjPT+WmpBUk=; b=UVyxhHgnIOL1NvZ1rgeqlxRZXxga1QkYdraWaatXzlEIWqypKdis04IMlSBBwQTKz3 PYRUDc7wDvnzt26bcuZo970PYNgExyXNbwP2sqSppDVCK2pO3Gl7vG1MK343C1BoN9Td zYY4oZl9mzjjts+oGcjfryOgYo3Q47XXcRTn8HraI46r1o+J6yYiV4+rzKwA6gRqwzbb qtejVmuIuz6hdXJAjHf8GRPBIbZRaF0ohxOZvMcBTtABo1WSkiRvDc/ChXRUNF8nC4J6 X/h0a8f9CRtj8NZMonOU++k2wfT60+kdMUEdLAyquX5g+xP4dPeWtckZifFExI+z2r3k dq8A== X-Gm-Message-State: AKS2vOzOtFxnjMuIV1SaJasW8thO/xTBz4sEj8s03dNr/1LLGyzvxzBz +jZ081Zy0vBNLdnl X-Received: by 10.223.142.202 with SMTP id q68mr12095002wrb.13.1498009529549; Tue, 20 Jun 2017 18:45:29 -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.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 20 Jun 2017 18:45:28 -0700 (PDT) From: Mario Kleiner To: dri-devel@lists.freedesktop.org Subject: [PATCH 4/4] drm/nouveau/kms/nv50-: Allow vblank_disable_immediate. Date: Wed, 21 Jun 2017 03:44:57 +0200 Message-Id: <20170621014457.26587-5-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> Cc: nouveau@lists.freedesktop.org, Ben Skeggs , amd-gfx@lists.freedesktop.org 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: , MIME-Version: 1.0 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, the emulated "hw vblank counter" from vblank timestamping, 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. This is only allowed on nv50+ gpu's, ie. the ones with atomic modesetting. One requirement for immediate vblank disable is that high precision vblank timestamping works reliably all the time on all connectors. This is not the case on all pre-nv50 parts for analog VGA outputs, where we currently don't always have support for scanout position queries and therefore fall back to vblank interrupt timestamping. The implementation in nv04_head_state() does not return valid values for vblanks, vtotal, hblanks, htotal for VGA outputs on all cards, but those are needed for scanout position queries. Testing on Linux-4.12-rc5 + drm-next on a GeForce 9500 GT (NV G96) 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: Ben Skeggs --- drivers/gpu/drm/nouveau/nv50_display.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpu/drm/nouveau/nv50_display.c b/drivers/gpu/drm/nouveau/nv50_display.c index e3132a2..f2f2a7c 100644 --- a/drivers/gpu/drm/nouveau/nv50_display.c +++ b/drivers/gpu/drm/nouveau/nv50_display.c @@ -4495,6 +4495,9 @@ nv50_display_create(struct drm_device *dev) connector->funcs->destroy(connector); } + /* Disable vblank irqs aggressively for power-saving, safe on nv50+ */ + dev->vblank_disable_immediate = true; + out: if (ret) nv50_display_destroy(dev);