提交 78910246 编写于 作者: D Daniel Vetter 提交者: Alex Deucher

drm/radeon: Merge pre/postclose hooks

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 <alexander.deucher@amd.com>
Cc: Christian König <christian.koenig@amd.com>
Cc: amd-gfx@lists.freedesktop.org
Reviewed-by: NChristian König <christian.koenig@amd.com>
Signed-off-by: NDaniel Vetter <daniel.vetter@intel.com>
Signed-off-by: NAlex Deucher <alexander.deucher@amd.com>
上级 82c6bd46
...@@ -109,8 +109,6 @@ void radeon_driver_lastclose_kms(struct drm_device *dev); ...@@ -109,8 +109,6 @@ void radeon_driver_lastclose_kms(struct drm_device *dev);
int radeon_driver_open_kms(struct drm_device *dev, struct drm_file *file_priv); int radeon_driver_open_kms(struct drm_device *dev, struct drm_file *file_priv);
void radeon_driver_postclose_kms(struct drm_device *dev, void radeon_driver_postclose_kms(struct drm_device *dev,
struct drm_file *file_priv); 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, int radeon_suspend_kms(struct drm_device *dev, bool suspend,
bool fbcon, bool freeze); bool fbcon, bool freeze);
int radeon_resume_kms(struct drm_device *dev, bool resume, bool fbcon); int radeon_resume_kms(struct drm_device *dev, bool resume, bool fbcon);
...@@ -539,7 +537,6 @@ static struct drm_driver kms_driver = { ...@@ -539,7 +537,6 @@ static struct drm_driver kms_driver = {
DRIVER_PRIME | DRIVER_RENDER, DRIVER_PRIME | DRIVER_RENDER,
.load = radeon_driver_load_kms, .load = radeon_driver_load_kms,
.open = radeon_driver_open_kms, .open = radeon_driver_open_kms,
.preclose = radeon_driver_preclose_kms,
.postclose = radeon_driver_postclose_kms, .postclose = radeon_driver_postclose_kms,
.lastclose = radeon_driver_lastclose_kms, .lastclose = radeon_driver_lastclose_kms,
.set_busid = drm_pci_set_busid, .set_busid = drm_pci_set_busid,
......
...@@ -691,13 +691,26 @@ int radeon_driver_open_kms(struct drm_device *dev, struct drm_file *file_priv) ...@@ -691,13 +691,26 @@ int radeon_driver_open_kms(struct drm_device *dev, struct drm_file *file_priv)
* @dev: drm dev pointer * @dev: drm dev pointer
* @file_priv: drm file * @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, void radeon_driver_postclose_kms(struct drm_device *dev,
struct drm_file *file_priv) struct drm_file *file_priv)
{ {
struct radeon_device *rdev = dev->dev_private; 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 */ /* new gpu have virtual address space support */
if (rdev->family >= CHIP_CAYMAN && file_priv->driver_priv) { if (rdev->family >= CHIP_CAYMAN && file_priv->driver_priv) {
struct radeon_fpriv *fpriv = 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, ...@@ -721,33 +734,6 @@ void radeon_driver_postclose_kms(struct drm_device *dev,
pm_runtime_put_autosuspend(dev->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. * VBlank related functions.
*/ */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册