Hi Mark,
Sorry for my rather rough way of programming, butr I am
newbie in xfree programming.
I send below my modified version of AllocateArea with lots
of output messages and then the corresponding log file.
(note that this is the corrected version of the function).
You can note that you can go into the test if(area) ....
even if a new item in the list has not been allocated
(search for the string "PROBLEM IS HERE" to find
the relevant line in the log file")
So if you could help me to clear this, I would appreciate.
Jacques
static FBAreaPtr
AllocateArea(
FBManagerPtr offman,
int w, int h,
int granularity,
MoveAreaCallbackProcPtr moveCB,
RemoveAreaCallbackProcPtr removeCB,
pointer privData
){
ScreenPtr pScreen = offman->pScreen;
FBLinkPtr link = NULL;
FBAreaPtr area = NULL;
RegionRec NewReg;
int i, x = 0, num, newlink = 0;
BoxPtr boxp;
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
if(granularity <= 1) granularity = 0;
xf86DrvMsg(pScrn->scrnIndex,X_INFO,"Avant regionrects.\n");
boxp = REGION_RECTS(offman->FreeBoxes);
xf86DrvMsg(pScrn->scrnIndex,X_INFO,"ICI1.\n");
num = REGION_NUM_RECTS(offman->FreeBoxes);
xf86DrvMsg(pScrn->scrnIndex,X_INFO,"ICI2.\n");
/* look through the free boxes */
for(i = 0; i < num; i++, boxp++) {
x = boxp->x1;
if(granularity) {
int tmp = x % granularity;
if(tmp) x += (granularity - tmp);
}
xf86DrvMsg(pScrn->scrnIndex,X_INFO,"ICI3.\n");
if(((boxp->y2 - boxp->y1) < h) || ((boxp->x2 - x) < w))
continue;
xf86DrvMsg(pScrn->scrnIndex,X_INFO,"Avant xalloc.\n");
link = xalloc(sizeof(FBLink));
newlink = 1;
if(!link) return NULL;
area = &(link->area);
break;
}
xf86DrvMsg(pScrn->scrnIndex,X_INFO,"ICI4.\n");
/* try to boot a removeable one out if we are not expendable ourselves */
if(!area && !removeCB) {
xf86DrvMsg(pScrn->scrnIndex,X_INFO,"ICI5.\n");
link = offman->UsedAreas;
while(link) {
xf86DrvMsg(pScrn->scrnIndex,X_INFO,"ICI6.\n");
if(!link->area.RemoveAreaCallback) {
xf86DrvMsg(pScrn->scrnIndex,X_INFO,"ICI7.\n");
link = link->next;
continue;
}
xf86DrvMsg(pScrn->scrnIndex,X_INFO,"ICI8.\n");
boxp = &(link->area.box);
xf86DrvMsg(pScrn->scrnIndex,X_INFO,"ICI9.\n");
x = boxp->x1;
xf86DrvMsg(pScrn->scrnIndex,X_INFO,"ICI10.\n");
if(granularity) {
int tmp = x % granularity;
xf86DrvMsg(pScrn->scrnIndex,X_INFO,"ICI11.\n");
if(tmp) x += (granularity - tmp);
}
xf86DrvMsg(pScrn->scrnIndex,X_INFO,"ICI12.\n");
if(((boxp->y2 - boxp->y1) < h) || ((boxp->x2 - x) < w)) {
xf86DrvMsg(pScrn->scrnIndex,X_INFO,"ICI13.\n");
link = link->next;
xf86DrvMsg(pScrn->scrnIndex,X_INFO,"1:link: %p\n", link );
continue;
}
xf86DrvMsg(pScrn->scrnIndex,X_INFO,"2:link: %p\n", link );
xf86DrvMsg(pScrn->scrnIndex,X_INFO,"Avant region_init.\n");
/* bye, bye */
(*link->area.RemoveAreaCallback)(&link->area);
REGION_INIT(pScreen, &NewReg, &(link->area.box), 1);
REGION_UNION(pScreen, offman->FreeBoxes, offman->FreeBoxes, &NewReg);
REGION_UNINIT(pScreen, &NewReg);
offman->NumUsedAreas--;
area = &(link->area);
break;
}
}
if(area) {
xf86DrvMsg(pScrn->scrnIndex,X_INFO,"On passe dans area.\n");
area->pScreen = pScreen;
area->granularity = granularity;
area->box.x1 = x;
area->box.x2 = x + w;
area->box.y1 = boxp->y1;
area->box.y2 = boxp->y1 + h;
area->MoveAreaCallback = moveCB;
area->RemoveAreaCallback = removeCB;
area->devPrivate.ptr = privData;
REGION_INIT(pScreen, &NewReg, &(area->box), 1);
REGION_SUBTRACT(pScreen, offman->FreeBoxes, offman->FreeBoxes, &NewReg);
REGION_UNINIT(pScreen, &NewReg);
if ( newlink ) {
link->next = offman->UsedAreas;
offman->UsedAreas = link;
}
offman->NumUsedAreas++;
}
xf86DrvMsg(pScrn->scrnIndex,X_INFO,"List after...\n");
link=offman->UsedAreas;
xf86DrvMsg(0,X_INFO,"link: %p\n", link);
while(link) {
link = link->next;
xf86DrvMsg(0,X_INFO,"link: %p\n", link);
if (link == link->next)
break;
}
return area;
}
(II) PM Event received: Power Status Change
(II) TRIDENT(0): xf86AllocateOffscreenArea
(II) TRIDENT(0): localAllocateOffscreenArea
(II) TRIDENT(0): Avant regionrects.
(II) TRIDENT(0): ICI1.
(II) TRIDENT(0): ICI2.
(II) TRIDENT(0): ICI3.
(II) TRIDENT(0): Avant xalloc.
(II) TRIDENT(0): ICI4.
(II) TRIDENT(0): On passe dans area.
(II) TRIDENT(0): List after...
(II) TRIDENT(0): link: 0x8779870
(II) TRIDENT(0): link: (nil)
(II) TRIDENT(0): SendCallFreeBoxCallbacks
(II) PM Event received: Power Status Change
(II) TRIDENT(0): xf86AllocateOffscreenArea
(II) TRIDENT(0): localAllocateOffscreenArea
(II) TRIDENT(0): Avant regionrects.
(II) TRIDENT(0): ICI1.
(II) TRIDENT(0): ICI2.
(II) TRIDENT(0): ICI3.
(II) TRIDENT(0): ICI3.
(II) TRIDENT(0): Avant xalloc.
(II) TRIDENT(0): ICI4.
(II) TRIDENT(0): On passe dans area.
(II) TRIDENT(0): List after...
(II) TRIDENT(0): link: 0x87d67e8
(II) TRIDENT(0): link: 0x8779870
(II) TRIDENT(0): link: (nil)
(II) TRIDENT(0): SendCallFreeBoxCallbacks
(II) TRIDENT(0): xf86FreeOffscreenArea
(II) TRIDENT(0): localFreeOffscreenArea
(II) TRIDENT(0): Chained list before...
(II) TRIDENT(0): pLink: 0x87d67e8
(II) TRIDENT(0): pLink: 0x8779870
(II) TRIDENT(0): pLink: (nil)
(II) TRIDENT(0): Scanning area...
(II) TRIDENT(0): pLink: 0x87d67e8
(II) TRIDENT(0): pLink: 0x8779870
(II) TRIDENT(0): pLinkPrev: 0x87d67e8
(II) TRIDENT(0): pLink->next: (nil)
(II) TRIDENT(0): Chained list after...
(II) TRIDENT(0): pLink: 0x87d67e8
(II) TRIDENT(0): pLink: (nil)
(II) TRIDENT(0): SendCallFreeBoxCallbacks
(II) PM Event received: Power Status Change
(II) TRIDENT(0): xf86AllocateOffscreenArea
(II) TRIDENT(0): localAllocateOffscreenArea
(II) TRIDENT(0): Avant regionrects.
(II) TRIDENT(0): ICI1.
(II) TRIDENT(0): ICI2.
(II) TRIDENT(0): ICI3.
(II) TRIDENT(0): ICI3.
(II) TRIDENT(0): ICI4.
(II) TRIDENT(0): List after...
(II) TRIDENT(0): link: 0x87d67e8
(II) TRIDENT(0): link: (nil)
(II) TRIDENT(0): xf86AllocateOffscreenArea
(II) TRIDENT(0): localAllocateOffscreenArea
(II) TRIDENT(0): Avant regionrects.
(II) TRIDENT(0): ICI1.
(II) TRIDENT(0): ICI2.
(II) TRIDENT(0): ICI3.
(II) TRIDENT(0): ICI3.
(II) TRIDENT(0): ICI4.
(II) TRIDENT(0): List after...
(II) TRIDENT(0): link: 0x87d67e8
(II) TRIDENT(0): link: (nil)
(II) TRIDENT(0): xf86AllocateOffscreenArea
(II) TRIDENT(0): localAllocateOffscreenArea
(II) TRIDENT(0): Avant regionrects.
(II) TRIDENT(0): ICI1.
(II) TRIDENT(0): ICI2.
(II) TRIDENT(0): ICI3.
(II) TRIDENT(0): ICI3.
(II) TRIDENT(0): ICI4.
(II) TRIDENT(0): List after...
(II) TRIDENT(0): link: 0x87d67e8
(II) TRIDENT(0): link: (nil)
(II) PM Event received: Power Status Change
(II) TRIDENT(0): xf86AllocateOffscreenArea
(II) TRIDENT(0): localAllocateOffscreenArea
(II) TRIDENT(0): Avant regionrects.
(II) TRIDENT(0): ICI1.
(II) TRIDENT(0): ICI2.
(II) TRIDENT(0): ICI3.
(II) TRIDENT(0): Avant xalloc.
(II) TRIDENT(0): ICI4.
(II) TRIDENT(0): On passe dans area.
(II) TRIDENT(0): List after...
(II) TRIDENT(0): link: 0x87e2e18
(II) TRIDENT(0): link: 0x87d67e8
(II) TRIDENT(0): link: (nil)
(II) TRIDENT(0): SendCallFreeBoxCallbacks
(II) TRIDENT(0): xf86FreeOffscreenArea
(II) TRIDENT(0): localFreeOffscreenArea
(II) TRIDENT(0): Chained list before...
(II) TRIDENT(0): pLink: 0x87e2e18
(II) TRIDENT(0): pLink: 0x87d67e8
(II) TRIDENT(0): pLink: (nil)
(II) TRIDENT(0): Scanning area...
(II) TRIDENT(0): pLink: 0x87e2e18
(II) TRIDENT(0): pLinkPrev: (nil)
(II) TRIDENT(0): pLink->next: 0x87d67e8
(II) TRIDENT(0): Chained list after...
(II) TRIDENT(0): pLink: 0x87d67e8
(II) TRIDENT(0): pLink: (nil)
(II) TRIDENT(0): SendCallFreeBoxCallbacks
(II) PM Event received: Power Status Change
(II) TRIDENT(0): xf86AllocateOffscreenArea
(II) TRIDENT(0): localAllocateOffscreenArea
(II) TRIDENT(0): Avant regionrects.
(II) TRIDENT(0): ICI1.
(II) TRIDENT(0): ICI2.
(II) TRIDENT(0): ICI3.
(II) TRIDENT(0): ICI3.
(II) TRIDENT(0): ICI4.
(II) TRIDENT(0): List after...
(II) TRIDENT(0): link: 0x87d67e8
(II) TRIDENT(0): link: (nil)
(II) TRIDENT(0): xf86AllocateOffscreenArea
(II) TRIDENT(0): localAllocateOffscreenArea
(II) TRIDENT(0): Avant regionrects.
(II) TRIDENT(0): ICI1.
(II) TRIDENT(0): ICI2.
(II) TRIDENT(0): ICI3.
(II) TRIDENT(0): ICI3.
(II) TRIDENT(0): ICI4.
(II) TRIDENT(0): List after...
(II) TRIDENT(0): link: 0x87d67e8
(II) TRIDENT(0): link: (nil)
(II) TRIDENT(0): new_size: 414720 dstPitch: 1440 height: 576 bpp: 2
(II) TRIDENT(0): Alloc normale.
(II) TRIDENT(0): xf86AllocateOffscreenLinear
(II) TRIDENT(0): localAllocateOffscreenLinear
(II) TRIDENT(0): Avant xalloc.
(II) TRIDENT(0): Apres extent.
(II) TRIDENT(0): Avant offscreenarea w: 1024 h: 405.
(II) TRIDENT(0): localAllocateOffscreenArea <-Call of the AllocateArea function
(II) TRIDENT(0): Avant regionrects.
(II) TRIDENT(0): ICI1.
(II) TRIDENT(0): ICI2.
(II) TRIDENT(0): ICI3.
(II) TRIDENT(0): ICI3.
(II) TRIDENT(0): ICI4.
(II) TRIDENT(0): ICI5.
(II) TRIDENT(0): ICI6.
(II) TRIDENT(0): ICI8.
(II) TRIDENT(0): ICI9.
(II) TRIDENT(0): ICI10.
(II) TRIDENT(0): ICI11.
(II) TRIDENT(0): ICI12.
(II) TRIDENT(0): 2:link: 0x87d67e8 <--- No new item has been allocated here but link
!= NULL
(II) TRIDENT(0): Avant region_init.
(II) TRIDENT(0): On passe dans area. <---PROBLEM IS HERE
(II) TRIDENT(0): List after...
(II) TRIDENT(0): link: 0x87d67e8
(II) TRIDENT(0): link: (nil)
(II) TRIDENT(0): SendCallFreeBoxCallbacks
--
_________________________________
(
) Jacques GANGLOFF
( Associate Professor
) LSIIT / GRAViR
( Bd S�bastien Brant
) 67400 Illkirch
( Tel : +33 (0)3 90 24 44 68
) Fax : +33 (0)3 90 24 44 80
( http://gravir.u-strasbg.fr
)_________________________________
_______________________________________________
Xpert mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/xpert