From: Michel Dänzer <[email protected]>

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 <[email protected]>
---
 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
[email protected]
http://lists.x.org/mailman/listinfo/xorg-driver-ati

Reply via email to