TextOut

Hello ,

I have a strange problem which I have encountered in my code ,The DrvTextOut
Method of my driver fails when tested with speedy , on further debugging I
found out that it fails in the pcfallocatecachedFont method and at these
lines

// swap a cached font (using LRU method)

pFCNode = ppdev->pFC->pUsedList.pPrev;

//Change status into uncached

pFCNode->pfo->pvConsumer = NULL;

//clear glyph tag

pjFCTag = (PBYTE) pFCNode->pjTag;

for (i = 0; i < FC_MAX_GLYPH_ID; i += 4)

{

*(PULONG) pjFCTag = 0;

pjFCTag += 4;

} //for

Now the problems are as follows:

1.The driver doesn’t break at the same position all the time sometimes it
breaks in the for loop some times just after the font is swapped .it also
doesn’t break for a specific font id it just breaks randomly.

2.The same driver is working fine with speedy on a Pentium 4 machine with
256 mb ram whereas the orignal machine is intel celeron with 196 mb ram.

Now my doubts are :

1.Can this be because of the CPU speed , I think it might be a swapping
problem because it is giving me a page fault in non paged area.if it is how
can I make changes in the code to make it compatiable for the celeron
platform.

2.The replacement algorithm I have used is incorrect,I should not use LRU .

Please advise , as I am not clear if I am on right tracks.for further
refrece I am attaching the pcfAllocatecachedfont method.

Thanks & Regards,

Nitin Kapoor

PFCNODE pcfAllocateCachedFont(

PDEV* ppdev)

{

ULONG i;

PFCNODE pFCNode;

PBYTE pjFCTag;

pFCNode = ppdev->pFC->pFreeList;

if (pFCNode == NULL)

{

if (ppdev->pFC->pDiscardList != NULL)

{

ppdev->pFC->pFreeList = ppdev->pFC->pDiscardList;

ppdev->pFC->pDiscardList = NULL;

pFCNode = ppdev->pFC->pFreeList;

while (pFCNode)

{

//set the state into FC_FREE

pFCNode->iState = FC_FREE;

//clear glyph tag

pjFCTag = (PBYTE) pFCNode->pjTag;

for (i = 0; i < FC_MAX_GLYPH_ID; i += 4)

{

*(PULONG) pjFCTag = 0;

pjFCTag += 4;

} //for

pFCNode = pFCNode->pNext;

} //while

// wait engine idle

vWaitEngineIdle( ppdev );

// take the 1st free node

pFCNode = ppdev->pFC->pFreeList;

ppdev->pFC->pFreeList = pFCNode->pNext;

pFCNode->iState = FC_USED;

}

else

{

// swap a cached font (using LRU method)

pFCNode = ppdev->pFC->pUsedList.pPrev;

//Change status into uncached

pFCNode->pfo->pvConsumer = NULL;

//clear glyph tag

pjFCTag = (PBYTE) pFCNode->pjTag;

for (i = 0; i < FC_MAX_GLYPH_ID; i += 4)

{

*(PULONG) pjFCTag = 0;

pjFCTag += 4;

} //for

//delete from used list

vFCDeleteNode(pFCNode);

DISPDBG((0,“FONT CACHE AFTER DELETE NODE.\n”,pFCNode->iUniq));

// wait engine idle

vWaitEngineIdle( ppdev );

DISPDBG((0,“FONT CACHE After WaitEngine Idle.\n”,pFCNode->iUniq));

} //if-else

}

else

{

pFCNode->iState = FC_USED;

ppdev->pFC->pFreeList = pFCNode->pNext;

} //if

// keep double links for insert & delete

vFCInsertNode(&ppdev->pFC->pUsedList, pFCNode);

return(pFCNode);

} //pcfAllocateCachedFont(

I may be barking up the wrong tree, and it’s been many moons I last worked
with Speedy, but my experience is that it drives things too fast and
sometimes chips barf because of that. Try inserting a delay into your code
and see if the problem goes away. Also, if you can afford yourself the
luxury of scanning individual chips, get one that you’re sure it can be
significantly overclocked, so as to minimize the possibility of driving the
chip too hard, and see if the problem goes away.

Alberto.

-----Original Message-----
From: Nitin Kapoor [mailto:xxxxx@hotmail.com]
Sent: Tuesday, July 01, 2003 7:07 AM
To: NT Developers Interest List
Subject: [ntdev] TextOut

Hello ,

I have a strange problem which I have encountered in my code ,The DrvTextOut
Method of my driver fails when tested with speedy , on further debugging I
found out that it fails in the pcfallocatecachedFont method and at these
lines

// swap a cached font (using LRU method)

pFCNode = ppdev->pFC->pUsedList.pPrev;

//Change status into uncached

pFCNode->pfo->pvConsumer = NULL;

//clear glyph tag

pjFCTag = (PBYTE) pFCNode->pjTag;

for (i = 0; i < FC_MAX_GLYPH_ID; i += 4)

{

*(PULONG) pjFCTag = 0;

pjFCTag += 4;

} //for

Now the problems are as follows:

1.The driver doesn’t break at the same position all the time sometimes it
breaks in the for loop some times just after the font is swapped .it also
doesn’t break for a specific font id it just breaks randomly.

2.The same driver is working fine with speedy on a Pentium 4 machine with
256 mb ram whereas the orignal machine is intel celeron with 196 mb ram.

Now my doubts are :

1.Can this be because of the CPU speed , I think it might be a swapping
problem because it is giving me a page fault in non paged area.if it is how
can I make changes in the code to make it compatiable for the celeron
platform.

2.The replacement algorithm I have used is incorrect,I should not use LRU .

Please advise , as I am not clear if I am on right tracks.for further
refrece I am attaching the pcfAllocatecachedfont method.

Thanks & Regards,

Nitin Kapoor

PFCNODE pcfAllocateCachedFont(

PDEV* ppdev)

{

ULONG i;

PFCNODE pFCNode;

PBYTE pjFCTag;

pFCNode = ppdev->pFC->pFreeList;

if (pFCNode == NULL)

{

if (ppdev->pFC->pDiscardList != NULL)

{

ppdev->pFC->pFreeList = ppdev->pFC->pDiscardList;

ppdev->pFC->pDiscardList = NULL;

pFCNode = ppdev->pFC->pFreeList;

while (pFCNode)

{

//set the state into FC_FREE

pFCNode->iState = FC_FREE;

//clear glyph tag

pjFCTag = (PBYTE) pFCNode->pjTag;

for (i = 0; i < FC_MAX_GLYPH_ID; i += 4)

{

*(PULONG) pjFCTag = 0;

pjFCTag += 4;

} //for

pFCNode = pFCNode->pNext;

} //while

// wait engine idle

vWaitEngineIdle( ppdev );

// take the 1st free node

pFCNode = ppdev->pFC->pFreeList;

ppdev->pFC->pFreeList = pFCNode->pNext;

pFCNode->iState = FC_USED;

}

else

{

// swap a cached font (using LRU method)

pFCNode = ppdev->pFC->pUsedList.pPrev;

//Change status into uncached

pFCNode->pfo->pvConsumer = NULL;

//clear glyph tag

pjFCTag = (PBYTE) pFCNode->pjTag;

for (i = 0; i < FC_MAX_GLYPH_ID; i += 4)

{

*(PULONG) pjFCTag = 0;

pjFCTag += 4;

} //for

//delete from used list

vFCDeleteNode(pFCNode);

DISPDBG((0,“FONT CACHE AFTER DELETE NODE.\n”,pFCNode->iUniq));

// wait engine idle

vWaitEngineIdle( ppdev );

DISPDBG((0,“FONT CACHE After WaitEngine Idle.\n”,pFCNode->iUniq));

} //if-else

}

else

{

pFCNode->iState = FC_USED;

ppdev->pFC->pFreeList = pFCNode->pNext;

} //if

// keep double links for insert & delete

vFCInsertNode(&ppdev->pFC->pUsedList, pFCNode);

return(pFCNode);

} //pcfAllocateCachedFont(


You are currently subscribed to ntdev as: xxxxx@compuware.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

The contents of this e-mail are intended for the named addressee only. It
contains information that may be confidential. Unless you are the named
addressee or an authorized designee, you may not copy or use it, or disclose
it to anyone else. If you received it in error please notify us immediately
and then destroy it.

Just a hunch, what is the “pjTag” field? Is this a pointer to something that belongs to a GDI font object? This point might become stale or is reclaimed for something else when your code accesses it. i.e. When you run this line -

*(PULONG) pjFCTag = 0;

pjFCTag may not be pointing to anything valid for every single occurance.

Gary

-----Original Message-----
From: Moreira, Alberto [mailto:xxxxx@compuware.com]
Sent: Tuesday, July 01, 2003 6:00 AM
To: NT Developers Interest List
Subject: [ntdev] RE: TextOut

I may be barking up the wrong tree, and it’s been many moons I last worked
with Speedy, but my experience is that it drives things too fast and
sometimes chips barf because of that. Try inserting a delay into your code
and see if the problem goes away. Also, if you can afford yourself the
luxury of scanning individual chips, get one that you’re sure it can be
significantly overclocked, so as to minimize the possibility of driving the
chip too hard, and see if the problem goes away.

Alberto.

-----Original Message-----
From: Nitin Kapoor [mailto:xxxxx@hotmail.com]
Sent: Tuesday, July 01, 2003 7:07 AM
To: NT Developers Interest List
Subject: [ntdev] TextOut

Hello ,

I have a strange problem which I have encountered in my code ,The DrvTextOut
Method of my driver fails when tested with speedy , on further debugging I
found out that it fails in the pcfallocatecachedFont method and at these
lines

// swap a cached font (using LRU method)

pFCNode = ppdev->pFC->pUsedList.pPrev;

//Change status into uncached

pFCNode->pfo->pvConsumer = NULL;

//clear glyph tag

pjFCTag = (PBYTE) pFCNode->pjTag;

for (i = 0; i < FC_MAX_GLYPH_ID; i += 4)

{

*(PULONG) pjFCTag = 0;

pjFCTag += 4;

} //for

Now the problems are as follows:

1.The driver doesn’t break at the same position all the time sometimes it
breaks in the for loop some times just after the font is swapped .it also
doesn’t break for a specific font id it just breaks randomly.

2.The same driver is working fine with speedy on a Pentium 4 machine with
256 mb ram whereas the orignal machine is intel celeron with 196 mb ram.

Now my doubts are :

1.Can this be because of the CPU speed , I think it might be a swapping
problem because it is giving me a page fault in non paged area.if it is how
can I make changes in the code to make it compatiable for the celeron
platform.

2.The replacement algorithm I have used is incorrect,I should not use LRU .

Please advise , as I am not clear if I am on right tracks.for further
refrece I am attaching the pcfAllocatecachedfont method.

Thanks & Regards,

Nitin Kapoor

PFCNODE pcfAllocateCachedFont(

PDEV* ppdev)

{

ULONG i;

PFCNODE pFCNode;

PBYTE pjFCTag;

pFCNode = ppdev->pFC->pFreeList;

if (pFCNode == NULL)

{

if (ppdev->pFC->pDiscardList != NULL)

{

ppdev->pFC->pFreeList = ppdev->pFC->pDiscardList;

ppdev->pFC->pDiscardList = NULL;

pFCNode = ppdev->pFC->pFreeList;

while (pFCNode)

{

//set the state into FC_FREE

pFCNode->iState = FC_FREE;

//clear glyph tag

pjFCTag = (PBYTE) pFCNode->pjTag;

for (i = 0; i < FC_MAX_GLYPH_ID; i += 4)

{

*(PULONG) pjFCTag = 0;

pjFCTag += 4;

} //for

pFCNode = pFCNode->pNext;

} //while

// wait engine idle

vWaitEngineIdle( ppdev );

// take the 1st free node

pFCNode = ppdev->pFC->pFreeList;

ppdev->pFC->pFreeList = pFCNode->pNext;

pFCNode->iState = FC_USED;

}

else

{

// swap a cached font (using LRU method)

pFCNode = ppdev->pFC->pUsedList.pPrev;

//Change status into uncached

pFCNode->pfo->pvConsumer = NULL;

//clear glyph tag

pjFCTag = (PBYTE) pFCNode->pjTag;

for (i = 0; i < FC_MAX_GLYPH_ID; i += 4)

{

*(PULONG) pjFCTag = 0;

pjFCTag += 4;

} //for

//delete from used list

vFCDeleteNode(pFCNode);

DISPDBG((0,“FONT CACHE AFTER DELETE NODE.\n”,pFCNode->iUniq));

// wait engine idle

vWaitEngineIdle( ppdev );

DISPDBG((0,“FONT CACHE After WaitEngine Idle.\n”,pFCNode->iUniq));

} //if-else

}

else

{

pFCNode->iState = FC_USED;

ppdev->pFC->pFreeList = pFCNode->pNext;

} //if

// keep double links for insert & delete

vFCInsertNode(&ppdev->pFC->pUsedList, pFCNode);

return(pFCNode);

} //pcfAllocateCachedFont(


You are currently subscribed to ntdev as: xxxxx@compuware.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

The contents of this e-mail are intended for the named addressee only. It
contains information that may be confidential. Unless you are the named
addressee or an authorized designee, you may not copy or use it, or disclose
it to anyone else. If you received it in error please notify us immediately
and then destroy it.


You are currently subscribed to ntdev as: xxxxx@mobilian.com
To unsubscribe send a blank email to xxxxx@lists.osr.com