From patchwork Wed Mar 8 14:12:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 9611237 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 AFC426046A for ; Wed, 8 Mar 2017 14:14:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 02DCB2853E for ; Wed, 8 Mar 2017 14:14:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EB6B428552; Wed, 8 Mar 2017 14:14:29 +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_SIGNED, 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 412792853E for ; Wed, 8 Mar 2017 14:14:29 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 12D416E971; Wed, 8 Mar 2017 14:13:22 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wr0-x241.google.com (mail-wr0-x241.google.com [IPv6:2a00:1450:400c:c0c::241]) by gabe.freedesktop.org (Postfix) with ESMTPS id 07AF26E96B for ; Wed, 8 Mar 2017 14:13:21 +0000 (UTC) Received: by mail-wr0-x241.google.com with SMTP id g10so4317538wrg.0 for ; Wed, 08 Mar 2017 06:13:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=9UGvgajLtqx2ksvtQwWPwKiPp+N4kA4tnxfwm2KBWDY=; b=HAUMUQZBAPSv7Ei7//N37AqGYiVRHiGDdW+3KiEVLMWBaX2X7k0RsM1mu8mZr+1Ddj tCBU9LbukJj2DGbaqoZr+RvoMRobOBOikEIvibQaFImWeSpUpoL51oT7d1VA7pxFnsYV P/AK4G4rUvVVAmaDFtFa24gXU5StnjnkYvcH4= 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=9UGvgajLtqx2ksvtQwWPwKiPp+N4kA4tnxfwm2KBWDY=; b=MAZr7gqUP8MzBBNjEg8aTx2eyqz7PtkLg5D4QwnMkWTXT5GJqLIitlQyiX9QkzyQlm 2Q0GM8WjhywytWZMqZC6fzkJuBcnJqmPXDBsy79Y0u9WokZtEAG/ku50S3k4b/esvHX/ HASQCiDggQb4srrH+68+nFM5y9Q3C2RpBhCeUEHznNUqFtRcy6Rlpjq1cgV0tIMRrvK2 mYwIiObXi9nXmUIdSCJdvv2ggF0N9rtBCTmN8VazVejI/T7Ltbn1UPnoB+MEsFxGyKzh 7iaRFC/KCsrZM8Xcyf9FVRTogha2tnfqtkZXKnwN1ad7kcaE9rA0U9fv9e2O5Y9h9Nts Dqkg== X-Gm-Message-State: AMke39n2rxzO+ENaz8qP32086XoAQxlJvZBc7+Px3vi6UAlahyx1nCIVXMK/8vRQLq0jXA== X-Received: by 10.223.141.148 with SMTP id o20mr5790629wrb.75.1488982399673; Wed, 08 Mar 2017 06:13:19 -0800 (PST) Received: from phenom.ffwll.local ([2a02:168:56c9:0:decc:6e78:7e96:b452]) by smtp.gmail.com with ESMTPSA id m186sm17012515wmd.21.2017.03.08.06.13.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 08 Mar 2017 06:13:18 -0800 (PST) From: Daniel Vetter To: DRI Development Date: Wed, 8 Mar 2017 15:12:48 +0100 Message-Id: <20170308141257.12119-16-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170308141257.12119-1-daniel.vetter@ffwll.ch> References: <20170308141257.12119-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 Cc: Daniel Vetter , Intel Graphics Development , amd-gfx@lists.freedesktop.org, Alex Deucher , Daniel Vetter , =?UTF-8?q?Christian=20K=C3=B6nig?= Subject: [Intel-gfx] [PATCH 15/24] drm/radeon: Merge pre/postclose hooks X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP Again no apparent explanation for the split except hysterical raisins. Merging them also makes it a bit more obviuos what's going on wrt the runtime pm refdancing. Cc: Alex Deucher Cc: Christian König Cc: amd-gfx@lists.freedesktop.org Signed-off-by: Daniel Vetter Reviewed-by: Christian König for this one and --- drivers/gpu/drm/radeon/radeon_drv.c | 3 --- drivers/gpu/drm/radeon/radeon_kms.c | 42 +++++++++++++------------------------ 2 files changed, 14 insertions(+), 31 deletions(-) diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c index 956c425e639e..312436a8d9e5 100644 --- a/drivers/gpu/drm/radeon/radeon_drv.c +++ b/drivers/gpu/drm/radeon/radeon_drv.c @@ -108,8 +108,6 @@ void radeon_driver_lastclose_kms(struct drm_device *dev); int radeon_driver_open_kms(struct drm_device *dev, struct drm_file *file_priv); void radeon_driver_postclose_kms(struct drm_device *dev, struct drm_file *file_priv); -void radeon_driver_preclose_kms(struct drm_device *dev, - struct drm_file *file_priv); int radeon_suspend_kms(struct drm_device *dev, bool suspend, bool fbcon, bool freeze); int radeon_resume_kms(struct drm_device *dev, bool resume, bool fbcon); @@ -538,7 +536,6 @@ static struct drm_driver kms_driver = { DRIVER_PRIME | DRIVER_RENDER, .load = radeon_driver_load_kms, .open = radeon_driver_open_kms, - .preclose = radeon_driver_preclose_kms, .postclose = radeon_driver_postclose_kms, .lastclose = radeon_driver_lastclose_kms, .set_busid = drm_pci_set_busid, diff --git a/drivers/gpu/drm/radeon/radeon_kms.c b/drivers/gpu/drm/radeon/radeon_kms.c index 56f35c06742c..a32a62e03a44 100644 --- a/drivers/gpu/drm/radeon/radeon_kms.c +++ b/drivers/gpu/drm/radeon/radeon_kms.c @@ -691,13 +691,26 @@ int radeon_driver_open_kms(struct drm_device *dev, struct drm_file *file_priv) * @dev: drm dev pointer * @file_priv: drm file * - * On device post close, tear down vm on cayman+ (all asics). + * On device close, tear down hyperz and cmask filps on r1xx-r5xx + * (all asics). And tear down vm on cayman+ (all asics). */ void radeon_driver_postclose_kms(struct drm_device *dev, struct drm_file *file_priv) { struct radeon_device *rdev = dev->dev_private; + pm_runtime_get_sync(dev->dev); + + mutex_lock(&rdev->gem.mutex); + if (rdev->hyperz_filp == file_priv) + rdev->hyperz_filp = NULL; + if (rdev->cmask_filp == file_priv) + rdev->cmask_filp = NULL; + mutex_unlock(&rdev->gem.mutex); + + radeon_uvd_free_handles(rdev, file_priv); + radeon_vce_free_handles(rdev, file_priv); + /* new gpu have virtual address space support */ if (rdev->family >= CHIP_CAYMAN && file_priv->driver_priv) { struct radeon_fpriv *fpriv = file_priv->driver_priv; @@ -721,33 +734,6 @@ void radeon_driver_postclose_kms(struct drm_device *dev, pm_runtime_put_autosuspend(dev->dev); } -/** - * radeon_driver_preclose_kms - drm callback for pre close - * - * @dev: drm dev pointer - * @file_priv: drm file - * - * On device pre close, tear down hyperz and cmask filps on r1xx-r5xx - * (all asics). - */ -void radeon_driver_preclose_kms(struct drm_device *dev, - struct drm_file *file_priv) -{ - struct radeon_device *rdev = dev->dev_private; - - pm_runtime_get_sync(dev->dev); - - mutex_lock(&rdev->gem.mutex); - if (rdev->hyperz_filp == file_priv) - rdev->hyperz_filp = NULL; - if (rdev->cmask_filp == file_priv) - rdev->cmask_filp = NULL; - mutex_unlock(&rdev->gem.mutex); - - radeon_uvd_free_handles(rdev, file_priv); - radeon_vce_free_handles(rdev, file_priv); -} - /* * VBlank related functions. */