Index: xc/ChangeLog =================================================================== RCS file: /cvs/xorg/xc/ChangeLog,v retrieving revision 1.870 diff -u -2 -0 -r1.870 ChangeLog --- xc/ChangeLog 11 Apr 2005 10:54:13 -0000 1.870 +++ xc/ChangeLog 12 Apr 2005 23:58:11 -0000 @@ -1,20 +1,30 @@ +2005-04-12 Roland Mainz + * xc/programs/Xserver/Xprint/ps/psout.c + bugzilla #3001 (https://bugs.freedesktop.org/show_bug.cgi?id=3001) + attachment #xxx (https://bugs.freedesktop.org/attachment.cgi?id=xxx) + Improve rendering performance when glXSwapBuffers()| or |XPutImage()| + are called for the PostScript DDX via optimizing the codepath around + |PsOut_OutImageBytes()|. + Patch by Simon Toedt and Roland Mainz + . + 2005-04-11 Egbert Eich * programs/Xserver/hw/vfb/InitOutput.c: (vfbScreenInit): Reenable BackingStore in Xvfb. 2005-04-11 Egbert Eich * config/cf/linux.cf: Removing the compiler flag -fsigned-char which is only used for a few BE platforms. This still needs some testing - which can only be done when in the tree, but since most platforms don't need I strongly assume it's not needed. Ticket remains open for discussion (Bugzilla #2964). 2005-04-11 Egbert Eich * programs/Xserver/hw/xfree86/os-support/bus/xf86Pci.h: Correct the mask bits when checking for a 64bit memory base in PCI config space (bugzilla #2963). Index: xc/programs/Xserver/Xprint/ps/psout.c =================================================================== RCS file: /cvs/xorg/xc/programs/Xserver/Xprint/ps/psout.c,v retrieving revision 1.5 diff -u -2 -0 -r1.5 psout.c --- xc/programs/Xserver/Xprint/ps/psout.c 4 Oct 2004 05:34:32 -0000 1.5 +++ xc/programs/Xserver/Xprint/ps/psout.c 12 Apr 2005 23:58:19 -0000 @@ -292,93 +292,111 @@ /* * Setup definitions */ static char *S_SetupDefs = "\ /mx_ mx d\ /im_ mx d\ /tm1_ mx d\ /tm2_ mx d\ /str3 3 str d\ /str1 1 str d\ "; /******************************************************************* * PRIVATE FUNCTIONS * *******************************************************************/ void S_Flush(PsOutPtr self) { - if( self->Buf[0] ) + int len; + + if( self->Buf[0] == '\0' ) + return; + + len = strlen(self->Buf); + + /* Append a newline char ('\n') if there isn't one there already */ + if( self->Buf[len-1] != '\n' ) { - if( self->Buf[strlen(self->Buf)-1]!='\n' ) strcat(self->Buf, "\n"); + self->Buf[len++] = '\n'; + self->Buf[len] = '\0'; + } - if (!ferror(self->Fp)) { - (void) fputs(self->Buf, self->Fp); - } + (void)fwrite(self->Buf, len, 1, self->Fp); - self->Buf[0] = '\0'; - } + self->Buf[0] = '\0'; } static void S_Comment(PsOutPtr self, char *comment) { S_Flush(self); strcpy(self->Buf, comment); S_Flush(self); } static void S_OutDefs(PsOutPtr self, char *defs) { int i, k=0; S_Flush(self); memset(self->Buf, 0, sizeof(self->Buf)); for( i=0 ; defs[i]!='\0' ;) { if( k>70 && (i==0 || (i && defs[i-1]!='/')) && (defs[i]==' ' || defs[i]=='/' || defs[i]=='{') ) { S_Flush(self); k = 0; memset(self->Buf, 0, sizeof(self->Buf)); } if( k && self->Buf[k-1]==' ' && defs[i]==' ' ) { i++; continue; } self->Buf[k] = defs[i]; k++; i++; } S_Flush(self); } void S_OutNum(PsOutPtr self, float num) { int i; char buf[64]; + int len; + sprintf(buf, "%.3f", num); + + /* Remove any zeros at the end */ for( i=strlen(buf)-1 ; buf[i]=='0' ; i-- ); buf[i+1] = '\0'; - if( buf[strlen(buf)-1]=='.' ) buf[strlen(buf)-1] = '\0'; - if( self->Buf[0] ) strcat(self->Buf, " "); - strcat(self->Buf, buf); - if( strlen(self->Buf)>70 ) S_Flush(self); + /* Remove '.' if it is the last character */ + i = strlen(buf)-1; if( buf[i]=='.' ) buf[i] = '\0'; + + len = strlen(self->Buf); + if( len > 0 ) + { + self->Buf[len++] = ' '; + self->Buf[len] = '\0'; + } + strcpy(&self->Buf[len], buf); + if( (len+i)>70 ) S_Flush(self); } static void S_OutStr(PsOutPtr self, char *txt, int txtl) { int i, k; char buf[1024]; for( i=0,k=0 ; i=' ' && txt[i]<='~') && txt[i]!='(' && txt[i]!=')' && txt[i]!='\\' ) { buf[k] = txt[i]; k++; continue; } buf[k] = '\\'; k++; sprintf(&buf[k], "%03o", txt[i]&0xFF); /* Skip to the end of the buffer */ while( buf[k] != '\0' ) k++; } strcat(self->Buf, "("); i = strlen(self->Buf); @@ -399,42 +417,47 @@ if( (txt[i]>=' ' && txt[i]<='~') && txt[i]!='(' && txt[i]!=')' && txt[i]!='\\' ) { buf[k] = txt[i]; k++; continue; } buf[k] = '\\'; k++; sprintf(&buf[k], "%03o", txt[i]&0xFFFF); /* Skip to the end of the buffer */ while( buf[k] != '\0' ) k++; } strcat(self->Buf, "("); i = strlen(self->Buf); memcpy(&self->Buf[i], buf, k); self->Buf[i+k] = '\0'; strcat(self->Buf, ")"); if( strlen(self->Buf)>70 ) S_Flush(self); } void S_OutTok(PsOutPtr self, char *tok, int cr) { - if( self->Buf[0] ) strcat(self->Buf, " "); - strcat(self->Buf, tok); + int len = strlen(self->Buf); + if( len > 0 ) + { + self->Buf[len++] = ' '; + self->Buf[len] = '\0'; + } + strcpy(&self->Buf[len], tok); if( cr ) S_Flush(self); } static void S_Color(PsOutPtr self, PsOutColor clr) { int ir, ig, ib; ir = PSOUTCOLOR_TO_REDBITS(clr); ig = PSOUTCOLOR_TO_GREENBITS(clr); ib = PSOUTCOLOR_TO_BLUEBITS(clr); if( ir==ig && ig==ib ) { S_OutNum(self, PSOUTCOLOR_BITS_TO_PSFLOAT(ir)); S_OutTok(self, "g", 1); } else { S_OutNum(self, PSOUTCOLOR_BITS_TO_PSFLOAT(ir)); S_OutNum(self, PSOUTCOLOR_BITS_TO_PSFLOAT(ig)); S_OutNum(self, PSOUTCOLOR_BITS_TO_PSFLOAT(ib)); S_OutTok(self, "sc", 1); } } @@ -1458,49 +1481,63 @@ #endif self->ImageFormat = 0; self->RevImage = 0; #ifdef BM_CACHE if(self->start_image) { self->start_image = 0; S_OutTok(self, "gr", 0); } else S_OutTok(self, "gr", 1); #else S_OutTok(self, "gr", 1); #endif } void PsOut_OutImageBytes(PsOutPtr self, int nBytes, char *bytes) { int i; - char buf[5]; + int b; + int len; + const char hex[] = { '0', '1', '2', '3', '4', '5', '6', '7', + '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }; if( (!self->ImageFormat) || self->ImgSkip ) return; + + len = strlen(self->Buf); + for( i=0 ; iRevImage ) sprintf(buf, "%02x", (int)(bytes[i]^0xFF)&0xFF); - else sprintf(buf, "%02x", (int)bytes[i]&0xFF); - strcat(self->Buf, buf); - if( strlen(self->Buf)>70 ) S_Flush(self); + if( self->RevImage ) b = (int)((bytes[i]^0xFF)&0xFF); + else b = (int)(bytes[i]&0xFF); + + self->Buf[len++] = hex[(b&0xF0) >> 4]; + self->Buf[len++] = hex[(b&0x0F)]; + self->Buf[len] = '\0'; + + if( len>70 ) + { + S_Flush(self); + len = 0; + } } } void PsOut_BeginFrame(PsOutPtr self, int xoff, int yoff, int x, int y, int w, int h) { int xo = self->XOff; int yo = self->YOff; if( self->InFrame ) xo = yo = 0; S_OutTok(self, "gs", 0); S_OutNum(self, (float)(x+xo)); S_OutNum(self, (float)(y+yo)); S_OutNum(self, (float)w); S_OutNum(self, (float)h); S_OutTok(self, "R cl n", 0); xoff += xo; yoff += yo; if( xoff || yoff ) {