tim@appenzell.cs.wisc.edu (Tim Theisen) (05/05/90)
I have found and resolved a problem where he Xqdss server hangs and must be terminated with a kill -9. The problem occurs most often when using xdvi. However, other clients can hang the server too. This patch is in use on 75 machines at the University of Wisconsin-Madison. Hope this helps, ...Tim Tim Theisen Department of Computer Sciences tim@cs.wisc.edu University of Wisconsin-Madison uwvax!tim 1210 West Dayton Street (608)262-0438 Madison, WI 53706 X Window System Bug Report xbugs@expo.lcs.mit.edu VERSION: R4 CLIENT MACHINE and OPERATING SYSTEM: uVax 3200 running Ultrix 3.1 (OS not important problems occurs with BSD4.3 too.) DISPLAY TYPE: Digital QDSS WINDOW MANAGER: twm (doesn't matter) AREA: server SYNOPSIS: The Xqdss server hangs when using xdvi. DESCRIPTION: The server hangs when painting bitmaps to the screen. The problem is that GPX hardware sometimes hangs when executing PTOBXYCLEAN. The old code would set up the GPX for a bitmap transfer, transfer the bitmap part and then reset (clean) the GPX state after the transfer. Large bitmaps would be transferred in multiple dma packets. The solution is to invoke the PTOBXYCLEAN after all the bitmap parts have been transferred. In addition, the state of the GPX must settle before issuing the clean. Therefore the dma queue is flushed after the last bitmap packet. The PTOBXYCLEAN is the first call in the next packet. I have also made changes to correctly account for the PTOBOVERHEAD. I found a similar error in tloffscreen.c. (The tloffscreen error does not actually cause any problem. However, it is possible that more packets than necessary might be used to load an off screen bitmap.) In addition, comments elsewhere in the code indicate that the GPX has problems if the bitmap transferred is entirely clipped. The routine checked for this condition in y. I added a corresponding check to clipping in the x direction. REPEAT BY: Compile xdvi with the -DBUTTON flag. Preview a page. When the page is painting to the screen, moved the cursor up and down over the buttons causing them to highlight. The server usually does not finish the first page before it hangs. SAMPLE FIX: Apply the following path in the mit/server/ddx/dec/libtl directory. *** /tmp/,RCSt1a13498 Thu May 3 10:50:06 1990 --- tloffscreen.c Wed May 2 10:36:54 1990 *************** *** 478,486 **** */ nlongsscanline = LONGSPADDED( x0, width); /* ! * save 15 words for setup display list */ ! nscansperblock = ( min( req_buf_size, MAXDMAPACKET/sizeof(short)) - 15 ) / (nlongsscanline<<1); blockstride = nscansperblock*nlongsscanline; for (nscansdone=0; --- 478,486 ---- */ nlongsscanline = LONGSPADDED( x0, width); /* ! * save 11 words for setup display list */ ! nscansperblock = ( min( req_buf_size, MAXDMAPACKET/sizeof(short)) - 11 ) / (nlongsscanline<<1); blockstride = nscansperblock*nlongsscanline; for (nscansdone=0; *** /tmp/,RCSt1a13498 Thu May 3 10:50:16 1990 --- tlptobmask.c Wed May 2 10:40:49 1990 *************** *** 37,45 **** #ifdef BICHROME ! # define PTOBOVERHEAD NMASKSHORTS + 12 + 8 + 2*NCOLORSHORTS #else ! # define PTOBOVERHEAD NMASKSHORTS + 12 + 7 + 1*NCOLORSHORTS #endif /* --- 37,45 ---- #ifdef BICHROME ! # define PTOBOVERHEAD (4 + 2*NCOLORSHORTS + 12) #else ! # define PTOBOVERHEAD (4 + 1*NCOLORSHORTS + 12) #endif /* *************** *** 61,70 **** --- 61,72 ---- int x0, y0; BoxPtr box; /* clipping */ { + register unsigned short *p; unsigned short * pshort = (unsigned short *) QD_PIX_DATA(qbit); int slwidthshorts = qbit->devKind>>1; int height = QDPIX_HEIGHT(qbit); int width = QDPIX_WIDTH(qbit); + int tw; int nscansperblock; unsigned short * buf; *************** *** 83,88 **** --- 85,92 ---- if (y0 + height > box->y2) height = box->y2 - y0; if (height <= 0) return; + tw = min( box->x2, x0+width) - max( box->x1, x0); + if (tw <= 0) return; if ((x0 & 0xF) != 0) { /* must shift */ *************** *** 98,107 **** else buf = NULL; nscansperblock = ( min( req_buf_size, MAXDMAPACKET / sizeof(short)) ! - 50 - PTOBOVERHEAD - slwidthshorts) / slwidthshorts; for (; ; ) { - register unsigned short *p; int curHeight = min(nscansperblock, height); register unsigned nshort = slwidthshorts * curHeight; height -= curHeight; --- 102,110 ---- else buf = NULL; nscansperblock = ( min( req_buf_size, MAXDMAPACKET / sizeof(short)) ! - PTOBOVERHEAD) / slwidthshorts; for (; ; ) { int curHeight = min(nscansperblock, height); register unsigned nshort = slwidthshorts * curHeight; height -= curHeight; *************** *** 162,175 **** *p++ = 0x06000 | (0x01fff & -nshort); bcopy( pshort, p, nshort<<1); p += nshort; - *p++ = JMPT_PTOBXYCLEAN; - #ifdef BICHROME - if (pGC->alu == GXcopy) - *p++ = JMPT_RESET_FORE_BACK; - #else - *p++ = JMPT_SETMASK; - *p++ = 0xFFFF; - #endif Confirm_dma (); if (height <= 0) break; --- 165,170 ---- *************** *** 176,182 **** --- 171,188 ---- y0 += nscansperblock; pshort += nscansperblock*slwidthshorts; } + dmafxns.flush (TRUE); if (buf) { DEALLOCATE_LOCAL(buf); } + Need_dma(3); + *p++ = JMPT_PTOBXYCLEAN; + #ifdef BICHROME + if (pGC->alu == GXcopy) + *p++ = JMPT_RESET_FORE_BACK; + #else + *p++ = JMPT_SETMASK; + *p++ = 0xFFFF; + #endif + Confirm_dma (); } #ifdef BICHROME /* only one instance of bitmapShiftRight in library */ -- Tim Theisen Department of Computer Sciences tim@cs.wisc.edu University of Wisconsin-Madison uwvax!tim 1210 West Dayton Street (608)262-0438 Madison, WI 53706