summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/radeon_driver.c12
-rw-r--r--src/radeon_probe.h2
2 files changed, 10 insertions, 4 deletions
diff --git a/src/radeon_driver.c b/src/radeon_driver.c
index dea2a226..7167ea06 100644
--- a/src/radeon_driver.c
+++ b/src/radeon_driver.c
@@ -409,6 +409,7 @@ static Bool RADEONMapMMIO(ScrnInfoPtr pScrn)
RADEONEntPtr pRADEONEnt = RADEONEntPriv(pScrn);
if (pRADEONEnt->MMIO) {
+ pRADEONEnt->MMIO_cnt++;
info->MMIO = pRADEONEnt->MMIO;
return TRUE;
}
@@ -441,6 +442,7 @@ static Bool RADEONMapMMIO(ScrnInfoPtr pScrn)
#endif
pRADEONEnt->MMIO = info->MMIO;
+ pRADEONEnt->MMIO_cnt = 1;
return TRUE;
}
@@ -452,8 +454,8 @@ static Bool RADEONUnmapMMIO(ScrnInfoPtr pScrn)
RADEONInfoPtr info = RADEONPTR(pScrn);
RADEONEntPtr pRADEONEnt = RADEONEntPriv(pScrn);
- if (info->IsPrimary || info->IsSecondary) {
- /* never unmap on zaphod */
+ /* refcount for zaphod */
+ if (--pRADEONEnt->MMIO_cnt != 0) {
info->MMIO = NULL;
return TRUE;
}
@@ -479,6 +481,7 @@ static Bool RADEONMapFB(ScrnInfoPtr pScrn)
RADEONEntPtr pRADEONEnt = RADEONEntPriv(pScrn);
if (pRADEONEnt->FB) {
+ pRADEONEnt->FB_cnt++;
info->FB = pRADEONEnt->FB;
return TRUE;
}
@@ -515,6 +518,7 @@ static Bool RADEONMapFB(ScrnInfoPtr pScrn)
#endif
pRADEONEnt->FB = info->FB;
+ pRADEONEnt->FB_cnt = 1;
return TRUE;
}
@@ -524,8 +528,8 @@ static Bool RADEONUnmapFB(ScrnInfoPtr pScrn)
RADEONInfoPtr info = RADEONPTR(pScrn);
RADEONEntPtr pRADEONEnt = RADEONEntPriv(pScrn);
- if (info->IsPrimary || info->IsSecondary) {
- /* never unmap on zaphod */
+ /* refcount for zaphod */
+ if (--pRADEONEnt->FB_cnt != 0) {
info->FB = NULL;
return TRUE;
}
diff --git a/src/radeon_probe.h b/src/radeon_probe.h
index 5b16f271..fb905959 100644
--- a/src/radeon_probe.h
+++ b/src/radeon_probe.h
@@ -644,7 +644,9 @@ typedef struct
RADEONSaveRec SavedReg; /* Original (text) mode */
void *MMIO; /* Map of MMIO region */
+ int *MMIO_cnt; /* Map of FB region refcount */
void *FB; /* Map of FB region */
+ int *FB_cnt; /* Map of FB region refcount */
int fd; /* for sharing across zaphod heads */
} RADEONEntRec, *RADEONEntPtr;