From patchwork Fri Feb 12 19:30:31 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Kleiner X-Patchwork-Id: 8296681 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 8757D9F6E4 for ; Fri, 12 Feb 2016 19:31:53 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AC9B820452 for ; Fri, 12 Feb 2016 19:31:52 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id BD8A120454 for ; Fri, 12 Feb 2016 19:31:49 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id DE7276EA5D; Fri, 12 Feb 2016 11:31:48 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm0-f65.google.com (mail-wm0-f65.google.com [74.125.82.65]) by gabe.freedesktop.org (Postfix) with ESMTPS id 898436EA5D for ; Fri, 12 Feb 2016 11:31:47 -0800 (PST) Received: by mail-wm0-f65.google.com with SMTP id 128so4388425wmz.3 for ; Fri, 12 Feb 2016 11:31:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=AVFolE4GwEC1apjxlWlWw4HknECl4eWDF8C2eQTqg0s=; b=XGacRCnpYjqmusRkPKaUSKuZDDhyzyoqcB6QXM43zaOZJsbEUS8PmtLcVN7o1nFebK T1xEu2ktm4qIpRUmHaMlojFtrDWQPKj8hYqWist0yV2io6W4BCgn+e6+aVK8e+OLnANv 8+bOsmEvoUAgQp488SNex95pq9ApePDgYnVdeII7BpS+pV5MtgPHTvsQCsEulRrg/1/e 6GKfWQZkgrcc+GbkjwOZMaEh6NwbQdn0/L6VNbMWVHL3+t+cV24HNBMu5e85y0YEMzCI 32T0pPhlpZgRgT5yDeekmbdmIdx+Sy3iL5BaaLoNHpB7j3szIpPwdl1v0LtTP0ofXGr2 Va0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=AVFolE4GwEC1apjxlWlWw4HknECl4eWDF8C2eQTqg0s=; b=HEjEgbunbCwfr3t25RxkxnjLfO9yr0F4QHZ4Pgsy8+WPm0YQShN6zl2Fzb3KzjSPQe ofky93LFJd3wZDBiyu6l54dSIEer4/32VYjIeUQ73LWDCIC2bt+0IvWrJ4cz0DaJvTjd fSqtMsLURD8der19JXrNc1lFb6cQm+7Yf/TAArmU81rSx4sykz0GUenFYOXu2GLMoRNH +iMB18371cA6EVQlE5sQmC+RPFhM9Iyg5yJ84rja6d5je6MGxW7yh+WbuWnIdtyJSSup Ra4NPq0wg/KCTSvj3Sk5aO8HYsjY/RmRk2r7mawMLyVZnbhIkIIPbMbn/+OH2WxuL1eB kkfA== X-Gm-Message-State: AG10YOQ6GCjf0DspStAQqMLiUhBj8htj+tjAxDWEra8R6lhrG5+E+LRzKsqnnlNPJs3PTA== X-Received: by 10.28.180.84 with SMTP id d81mr5045515wmf.42.1455305461364; Fri, 12 Feb 2016 11:31:01 -0800 (PST) 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 v78sm3637797wmv.23.2016.02.12.11.31.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 12 Feb 2016 11:31:00 -0800 (PST) From: Mario Kleiner To: dri-devel@lists.freedesktop.org Subject: [PATCH 5/6] drm/radeon/pm: Handle failure of drm_vblank_get. Date: Fri, 12 Feb 2016 20:30:31 +0100 Message-Id: <1455305432-28770-6-git-send-email-mario.kleiner.de@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1455305432-28770-1-git-send-email-mario.kleiner.de@gmail.com> References: <1455305432-28770-1-git-send-email-mario.kleiner.de@gmail.com> Cc: alexander.deucher@amd.com, michel@daenzer.net, christian.koenig@amd.com 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-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Make sure that drm_vblank_get/put() stay balanced in case drm_vblank_get fails, by skipping the corresponding put. Signed-off-by: Mario Kleiner Reviewed-by: Daniel Vetter Cc: michel@daenzer.net Cc: dri-devel@lists.freedesktop.org Cc: alexander.deucher@amd.com Cc: christian.koenig@amd.com --- drivers/gpu/drm/radeon/radeon_pm.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/radeon/radeon_pm.c b/drivers/gpu/drm/radeon/radeon_pm.c index 59abebd..a94979f 100644 --- a/drivers/gpu/drm/radeon/radeon_pm.c +++ b/drivers/gpu/drm/radeon/radeon_pm.c @@ -276,8 +276,12 @@ static void radeon_pm_set_clocks(struct radeon_device *rdev) if (rdev->irq.installed) { for (i = 0; i < rdev->num_crtc; i++) { if (rdev->pm.active_crtcs & (1 << i)) { - rdev->pm.req_vblank |= (1 << i); - drm_vblank_get(rdev->ddev, i); + /* This can fail if a modeset is in progress */ + if (drm_vblank_get(rdev->ddev, i) == 0) + rdev->pm.req_vblank |= (1 << i); + else + DRM_DEBUG_DRIVER("crtc %d no vblank, can glitch\n", + i); } } }