summaryrefslogtreecommitdiff
path: root/src/amdgpu_probe.c
diff options
context:
space:
mode:
authorHans De Goede <hdegoede@redhat.com>2016-10-18 16:48:40 +0200
committerMichel Dänzer <michel@daenzer.net>2017-03-07 16:58:29 +0900
commit7884e38e94c2cbd6c205f556f2b31ad59b4089b4 (patch)
tree40a9d4383fe67fa73725faed4c31cca5006d3eac /src/amdgpu_probe.c
parenta2c360fa1d33d6a5aa64c396197e119ff77d1379 (diff)
amdgpu_probe: Do not close server managed drm fds
This fixes the xserver only seeing AMD/ATI devices supported by the amdgpu driver, as by the time xf86-video-ati gets a chance to probe them, the fd has been closed. This fixes e.g. Xorg not seeing the dGPU on a Lenovo Thinkpad E465 laptop with a CARRIZO iGPU and a HAINAN dGPU. Signed-off-by: Hans de Goede <hdegoede@redhat.com> v2: Rebased on top of new patch 1. Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'src/amdgpu_probe.c')
-rw-r--r--src/amdgpu_probe.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/amdgpu_probe.c b/src/amdgpu_probe.c
index fc93ac6..fb62cb8 100644
--- a/src/amdgpu_probe.c
+++ b/src/amdgpu_probe.c
@@ -166,7 +166,7 @@ static Bool amdgpu_open_drm_master(ScrnInfoPtr pScrn, AMDGPUEntPtr pAMDGPUEnt,
if (err != 0) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"[drm] failed to set drm interface version.\n");
- drmClose(pAMDGPUEnt->fd);
+ amdgpu_kernel_close_fd(pAMDGPUEnt);
return FALSE;
}
@@ -254,7 +254,7 @@ static Bool amdgpu_get_scrninfo(int entity_num, struct pci_device *pci_dev)
return TRUE;
error_amdgpu:
- drmClose(pAMDGPUEnt->fd);
+ amdgpu_kernel_close_fd(pAMDGPUEnt);
error_fd:
free(pPriv->ptr);
error:
@@ -349,6 +349,7 @@ amdgpu_platform_probe(DriverPtr pDriver,
pPriv->ptr = xnfcalloc(sizeof(AMDGPUEntRec), 1);
pAMDGPUEnt = pPriv->ptr;
+ pAMDGPUEnt->platform_dev = dev;
pAMDGPUEnt->fd = amdgpu_kernel_open_fd(pScrn, busid, dev);
if (pAMDGPUEnt->fd < 0)
goto error_fd;
@@ -367,7 +368,6 @@ amdgpu_platform_probe(DriverPtr pDriver,
pAMDGPUEnt = pPriv->ptr;
pAMDGPUEnt->fd_ref++;
}
- pAMDGPUEnt->platform_dev = dev;
xf86SetEntityInstanceForScreen(pScrn, pEnt->index,
xf86GetNumEntityInstances(pEnt->
@@ -379,7 +379,7 @@ amdgpu_platform_probe(DriverPtr pDriver,
return TRUE;
error_amdgpu:
- drmClose(pAMDGPUEnt->fd);
+ amdgpu_kernel_close_fd(pAMDGPUEnt);
error_fd:
free(pPriv->ptr);
error: