On Sun, 2001-11-25 at 01:30, Olivier Cahagne wrote:

>  > Please find out which accelerated operation is broken by playing with
>  > the various "XaaNo..." options (they're documented in the XF86Config
>  > manpage). Hint: The screenshots look like it's related to lines, and
>  > with DRI enabled, there's less to be played with. :)
> 
> So far, I played with the various "XaaNo..." and bug only disappears 
> when using:
> 
> Option  "XaaNoSolidTwoPointLine"

Please try the attached program (courtesy of Mark Vojkovich) without
this option. If the moving line leaves artifacts, there's probably
something wrong with the radeon driver's line acceleration.


-- 
Earthling Michel D�nzer (MrCooper)/ Debian GNU/Linux (powerpc) developer
XFree86 and DRI project member   /  CS student, Free Software enthusiast
/* 
   linetest.c -- 


    To compile: 


     gcc -o linetest linetest.c -L/usr/X11R6/lib -lX11 
   
    Useage: 


      linetest [-w width] 


      This draws solid lines in the given width then erases them 
      with tiled lines. If the tiled lines do not match the 
      solid lines you will get artifacts. The default width is 
      zero which will result in hardware accelerated lines being used 
      for the solid lines. Widths larger than zero will use XAA's 
      wide line code when a "one rect" situation exists, that is, 
      when the destination drawable consists of a single rectangle - 
      unclipped or clipped in a simple way. If your driver 
      accelerates trapezoids, XAA will use these for the wide lines. 


      So if you get artifacts on zero width lines, your lines are 
      wrong. Artifacts on wide lines means your trapezoids are 
      wrong. Some artifacts will only appear when clipping. 
      Remember that trapezoids are only used when the window is 
      clipped to "one rect," while for zero width lines hardware 
      lines are used no matter how complex the clipping. 


      Artifacts only in particular octants usually indicate 
      a simple biasing problem. For zero-width lines these 
      can usually be fixed by changing the server's zero-width 
      line bias. 
  
     ps. click the mouse button in the window to quit. 
      
*/ 




#include <X11/X.h> 
#include <X11/Xlib.h> 
#include <stdio.h> 
#include <string.h> 
#include <stdlib.h> 


static Display* TheDisplay; 
static GC fgContext; 
static GC bgContext; 
static Visual* TheVisual; 
static Window TheWindow; 
static int TheScreenNumber; 




void DoSeg() 
{ 
    XEvent event; 
    int x1 = 50,y1 = 50,x2 = 449,y2 = 449; 


    XDrawLine(TheDisplay,TheWindow,fgContext,x1,y1,x2,y2); 


    while(1) { 
            XNextEvent(TheDisplay,&event); 


        if(event.type == ButtonPress) break; 
        else if(event.type == MotionNotify) { 
                XDrawLine(TheDisplay,TheWindow,bgContext,x1,y1,x2,y2); 
            x1 = event.xmotion.x; 
            y1 = event.xmotion.y; 
            x2 = 500 - x1; 
            y2 = 500 - y1; 
        } 
            XDrawLine(TheDisplay,TheWindow,fgContext,x1,y1,x2,y2); 
    } 




} 


#define GCMASK \
 (GCForeground | GCLineWidth) 


int main(int argc, char* argv[]) 
{ 
    int i, width = 0; 
    XGCValues values; 
    unsigned long black, white; 


    for(i = 1; i < argc; i++) { 
        if(!strcmp(argv[i], "-w")) 
            width = atoi(argv[++i]); 
    } 


                    
    TheDisplay = XOpenDisplay("\0"); 
    TheScreenNumber = DefaultScreen(TheDisplay); 
    TheVisual = DefaultVisual(TheDisplay,TheScreenNumber); 


    white = XWhitePixel(TheDisplay,TheScreenNumber); 
    black = XBlackPixel(TheDisplay,TheScreenNumber); 


    TheWindow = XCreateSimpleWindow(TheDisplay, DefaultRootWindow(TheDisplay), 
                        0, 0, 500, 500, 0, 0, black); 


    XMapWindow(TheDisplay,TheWindow); 
    XSelectInput(TheDisplay,TheWindow,PointerMotionMask|ButtonPressMask); 
    XClearWindow(TheDisplay,TheWindow); 


    values.line_width = width; 


    values.foreground = white; 
    fgContext = XCreateGC(TheDisplay,TheWindow,GCMASK,&values); 


    values.foreground = black; 
    values.fill_style = FillTiled; 
    bgContext = XCreateGC(TheDisplay,TheWindow,GCMASK | GCFillStyle,&values); 


    DoSeg(); 
      
    XCloseDisplay(TheDisplay); 


    return 1; 
}

Reply via email to