mouse@LIGHTNING.MCRCIM.MCGILL.EDU (11/07/90)
[this is being sent to xbugs and xpert both] X Window System Bug Report xbugs@expo.lcs.mit.edu VERSION: R4 CLIENT MACHINE and OPERATING SYSTEM: SPARCstation 1+ SunOS 4.1 NeXT 1.0 (the old cube, not one of the new machines) DISPLAY TYPE: Sun cg3 on the SS1+ NeXT 2-bit grayscale on the NeXT WINDOW MANAGER: any or none AREA: server SYNOPSIS: XFillRectangle with a fill-style of FillTiled displays garbage under at least some conditions. DESCRIPTION: Under at least some conditions, XFillRectangle displays garbage. This happens at least when filling a 360x480 window with a 120x120 tile, when the tile/stipple origin is set to (i,i), where i>0 and i%120 is [1..119]. The contents of the tile appear to make no difference. The garbage looks as though the server is using whatever happens to be in memory before the beginning of the data for the tile. This does not seem to happen on mfb displays. I have tried it on a Sun-3/60 with a bwtwo and a Sun SPARCstation SLC with a bwtwo. Neither of them exhibits the bug. (Thus, across four processors of two basic architectures and three displays, precisely those displays with depth greater than 1 misbehave.) All four machines are running MIT sample servers (the NeXT is running my beta R4 port, not the R3 port.) REPEAT BY: Compile this with -lX11 and run on such a server. Notice that the top (and to a slight extent the left) of the window contain junk. #include <stdio.h> #include <X11/X.h> #include <X11/Xlib.h> #include <X11/Xutil.h> #include <X11/Xatom.h> #include <X11/Xresource.h> #define WIN_X 100 #define WIN_Y 100 #define WIN_W 360 #define WIN_H 480 #define TILE_W 120 #define TILE_H 120 /* extern XXX */ int argcnt; /* extern XXX */ char **argvec; char *getenv(); char *malloc(); Display *disp; Screen *scr; int depth; Window rootwin; GC tilegc; Window win; Pixmap tile; unsigned long int fgcolor; unsigned long int bgcolor; setup_colors() { fgcolor = XWhitePixelOfScreen(scr); bgcolor = XBlackPixelOfScreen(scr); } setup_tile() { int i; GC gc; tile = XCreatePixmap(disp,rootwin,TILE_W,TILE_H,depth); gc = XCreateGC(disp,rootwin,0L,(XGCValues *)0); XSetForeground(disp,gc,bgcolor); XFillRectangle(disp,tile,gc,0,0,TILE_W,TILE_H); XSetFunction(disp,gc,GXxor); XSetForeground(disp,gc,fgcolor^bgcolor); for (i=0;i<TILE_W;i++) XDrawLine(disp,tile,gc,0,0,i,TILE_H-1); for (i=0;i<TILE_H;i++) XDrawLine(disp,tile,gc,0,0,TILE_W-1,i); XSetFunction(disp,gc,GXcopy); XDrawRectangle(disp,tile,gc,0,0,TILE_W,TILE_H); XFreeGC(disp,gc); } setup_window() { unsigned long int attrmask; unsigned long int gcvalmask; XGCValues gcval; XSetWindowAttributes attr; XTextProperty wn_prop; XTextProperty in_prop; XSizeHints normal_hints; XWMHints wm_hints; XClassHint class_hints; attrmask = 0; attr.background_pixel = bgcolor; attrmask |= CWBackPixel; attr.border_pixel = fgcolor; attrmask |= CWBorderPixel; attr.backing_store = NotUseful; attrmask |= CWBackingStore; attr.event_mask = ExposureMask; attrmask |= CWEventMask; win = XCreateWindow(disp,rootwin,WIN_X,WIN_Y,WIN_W,WIN_H,1,depth,InputOutput,CopyFromParent,attrmask,&attr); /* isn't boilerplate fun... */ wn_prop.value = (unsigned char *) "Bug Test"; wn_prop.encoding = XA_STRING; wn_prop.format = 8; wn_prop.nitems = strlen((char *)wn_prop.value); in_prop.value = (unsigned char *) "bugtest"; in_prop.encoding = XA_STRING; in_prop.format = 8; in_prop.nitems = strlen((char *)in_prop.value); normal_hints.flags = PMinSize | PResizeInc; normal_hints.x = WIN_X; normal_hints.y = WIN_Y; normal_hints.flags |= PPosition; normal_hints.width = WIN_W; normal_hints.height = WIN_H; normal_hints.flags |= PSize; normal_hints.min_width = 1; normal_hints.min_height = 1; normal_hints.width_inc = 1; normal_hints.height_inc = 1; wm_hints.flags = InputHint; wm_hints.input = False; class_hints.res_name = "bugtest"; class_hints.res_class = "BugTest"; XSetWMProperties(disp,win,&wn_prop,&in_prop,argvec,argcnt,&normal_hints,&wm_hints,&class_hints); XMapRaised(disp,win); gcvalmask = 0; gcval.foreground = fgcolor; gcvalmask |= GCForeground; gcval.background = bgcolor; gcvalmask |= GCBackground; gcval.fill_style = FillTiled; gcvalmask |= GCFillStyle; gcval.tile = tile; gcvalmask |= GCTile; tilegc = XCreateGC(disp,win,gcvalmask,&gcval); XMapRaised(disp,win); } expose_wait() { XEvent e; while (1) { XNextEvent(disp,&e); if (e.type == Expose) return; } } dotiles() { int i; unsigned long int gcvalmask; XGCValues gcval; for (i=0;i<1200;i++) { gcval.ts_x_origin = i; gcval.ts_y_origin = i; XChangeGC(disp,tilegc,GCTileStipXOrigin|GCTileStipYOrigin,&gcval); XFillRectangle(disp,win,tilegc,0,0,WIN_W,WIN_H); } } main(ac,av) int ac; char **av; { argcnt = ac; /* XXX */ argvec = av; /* XXX */ disp = XOpenDisplay((char *)0); scr = XDefaultScreenOfDisplay(disp); depth = XDefaultDepthOfScreen(scr); rootwin = XRootWindowOfScreen(scr); setup_colors(); setup_tile(); setup_window(); expose_wait(); dotiles(); XCloseDisplay(disp); exit(0); } SAMPLE FIX: I have no clue. der Mouse old: mcgill-vision!mouse new: mouse@larry.mcrcim.mcgill.edu