Commit 8e7ee03f authored by Michel Dänzer's avatar Michel Dänzer Committed by Michel Dänzer

Remove amdgpu_reference_drm_fd

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.
Reviewed-by: Jammy Zhou's avatarJammy Zhou <Jammy.Zhou@amd.com>
parent 6bab8fab
......@@ -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);
......
......@@ -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;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment