summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMaarten Lankhorst <maarten.lankhorst@canonical.com>2013-03-21 10:40:42 +0100
committerMaarten Lankhorst <maarten.lankhorst@canonical.com>2013-03-21 10:45:11 +0100
commit751c7259cf23a29fdd2653881e2db63ce3cf1ca5 (patch)
tree71fc942ad78b6d402bfb7396b1a6343754f4bc77 /src
parent1643b8cd2dc53ed36916e11003590c7037b4ddd6 (diff)
Move fd cleanup to correct place.
Oops, just after previous commit I realized that it needs to be done from RADEONFreeRec, because when preinit fails info pointer can be null in FreeScreen. Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Diffstat (limited to 'src')
-rw-r--r--src/radeon_kms.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/src/radeon_kms.c b/src/radeon_kms.c
index 763acd0d..e4f586c3 100644
--- a/src/radeon_kms.c
+++ b/src/radeon_kms.c
@@ -174,6 +174,20 @@ static void RADEONFreeRec(ScrnInfoPtr pScrn)
info = RADEONPTR(pScrn);
+ if (info->dri2.drm_fd > 0) {
+ DevUnion *pPriv;
+ RADEONEntPtr pRADEONEnt;
+ pPriv = xf86GetEntityPrivate(pScrn->entityList[0],
+ getRADEONEntityIndex());
+
+ pRADEONEnt = pPriv->ptr;
+ pRADEONEnt->fd_ref--;
+ if (!pRADEONEnt->fd_ref) {
+ drmClose(pRADEONEnt->fd);
+ pRADEONEnt->fd = 0;
+ }
+ }
+
if (info->accel_state) {
free(info->accel_state);
info->accel_state = NULL;
@@ -1083,19 +1097,10 @@ void RADEONFreeScreen_KMS(FREE_SCREEN_ARGS_DECL)
{
SCRN_INFO_PTR(arg);
RADEONInfoPtr info = RADEONPTR(pScrn);
- RADEONEntPtr pRADEONEnt = RADEONEntPriv(pScrn);
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, RADEON_LOGLEVEL_DEBUG,
"RADEONFreeScreen\n");
- if (info->dri2.drm_fd > 0) {
- pRADEONEnt->fd_ref--;
- if (!pRADEONEnt->fd_ref) {
- drmClose(pRADEONEnt->fd);
- pRADEONEnt->fd = 0;
- }
- }
-
/* when server quits at PreInit, we don't need do this anymore*/
if (!info) return;