[PATCH xf86-video-amdgpu 5/5] Remove amdgpu_reference_drm_fd

Zhou, Jammy Jammy.Zhou at amd.com
Thu Oct 29 18:38:44 PDT 2015


The series are Reviewed-by: Jammy Zhou <Jammy.Zhou at amd.com>

Regards,
Jammy

-----Original Message-----
From: xorg-driver-ati [mailto:xorg-driver-ati-bounces at lists.x.org] On Behalf Of Michel D?nzer
Sent: Thursday, October 29, 2015 5:18 PM
To: xorg-driver-ati at lists.x.org
Subject: [PATCH xf86-video-amdgpu 5/5] Remove amdgpu_reference_drm_fd

From: Michel Dänzer <michel.daenzer at amd.com>

Increase pAMDGPUEnt->fd_ref in the probe code instead when we're reusing the existing fd.

The previous reference counting was imbalanced, so pAMDGPUEnt->fd_ref could never go to 0.

Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
---
 src/amdgpu_kms.c   | 9 ---------
 src/amdgpu_probe.c | 2 ++
 2 files changed, 2 insertions(+), 9 deletions(-)

diff --git a/src/amdgpu_kms.c b/src/amdgpu_kms.c index 7861cf6..5e17525 100644
--- a/src/amdgpu_kms.c
+++ b/src/amdgpu_kms.c
@@ -624,13 +624,6 @@ static Bool AMDGPUPreInitChipType_KMS(ScrnInfoPtr pScrn)
 	return TRUE;
 }
 
-static void amdgpu_reference_drm_fd(ScrnInfoPtr pScrn) -{
-	AMDGPUEntPtr pAMDGPUEnt = AMDGPUEntPriv(pScrn);
-
-	pAMDGPUEnt->fd_ref++;
-}
-
 static Bool amdgpu_get_tile_config(ScrnInfoPtr pScrn)  {
 	AMDGPUInfoPtr info = AMDGPUPTR(pScrn); @@ -767,8 +760,6 @@ Bool AMDGPUPreInit_KMS(ScrnInfoPtr pScrn, int flags)
 	if (!AMDGPUPreInitChipType_KMS(pScrn))
 		goto fail;
 
-	amdgpu_reference_drm_fd(pScrn);
-
 	info->dri2.available = FALSE;
 	info->dri2.enabled = FALSE;
 	info->dri2.pKernelDRMVersion = drmGetVersion(pAMDGPUEnt->fd); diff --git a/src/amdgpu_probe.c b/src/amdgpu_probe.c index 61605b9..e4f5c75 100644
--- a/src/amdgpu_probe.c
+++ b/src/amdgpu_probe.c
@@ -245,6 +245,7 @@ static Bool amdgpu_get_scrninfo(int entity_num, struct pci_device *pci_dev)
 		}
 	} else {
 		pAMDGPUEnt = pPriv->ptr;
+		pAMDGPUEnt->fd_ref++;
 	}
 
 	xf86SetEntityInstanceForScreen(pScrn, pEnt->index, @@ -360,6 +361,7 @@ amdgpu_platform_probe(DriverPtr pDriver,
 		}
 	} else {
 		pAMDGPUEnt = pPriv->ptr;
+		pAMDGPUEnt->fd_ref++;
 	}
 	pAMDGPUEnt->platform_dev = dev;
 
--
2.6.1

_______________________________________________
xorg-driver-ati mailing list
xorg-driver-ati at lists.x.org
http://lists.x.org/mailman/listinfo/xorg-driver-ati


More information about the xorg-driver-ati mailing list