On Mon, Apr 19, 2010 at 04:05:36AM +0100, Owain G. Ainsworth wrote: > What we were doing previously was mapping the framebuffer for zaphod for > only this driver instances chunk, however, fbOffset was (rightly) set to > the offset into the whole framebuffer we were using. > > Since in some cases we did operations on the FB virtual address + > fbOffset (for example zeroing the framebuffer on entervt) we were > actually pissing all over ourselves in those cases. > > Fix this by implementing shared fb mappings like we do for MMIO already, > and whenever we wish to refer to our area of FB space we always use > fbOffset. Fixes zaphod for some users on r600 chipsets, my 4870 is still > behaving strangely on screen 0, but I suspect that is another bug. > > Once calculation (in PreInitAccel) is now wrong because of this, however > dri on zaphod does now happen so this is irrelavent, add a comment to > that effect.
Airlied expressed concern that leaking fb on server recycle was probably a bad idea, so I'd like to add the following patch to the series: >From 795d4bd626ad6c746a46fba6668606fb106c1f8e Mon Sep 17 00:00:00 2001 From: Owain G. Ainsworth <[email protected]> Date: Mon, 19 Apr 2010 14:28:29 +0100 Subject: [PATCH] Reference count shared driver mappings. With MMIO it wasn't *such* a bit deal if we leaked the smallish mapping. with FB it could be a larger deal. So instead of worrying about this, reference count the mappings in the entity structure and unmap them when no one cares anymore. Prompted by a discussion with airlied --- src/radeon_driver.c | 12 ++++++++---- src/radeon_probe.h | 2 ++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/radeon_driver.c b/src/radeon_driver.c index e138492..4c69eca 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 405f5b4..2538df9 100644 --- a/src/radeon_probe.h +++ b/src/radeon_probe.h @@ -638,7 +638,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; -- 1.6.5.7 _______________________________________________ xorg-driver-ati mailing list [email protected] http://lists.x.org/mailman/listinfo/xorg-driver-ati
