Benchmarking XRenderComposite() at runtime?

Olivier Fourdan fourdan at xfce.org
Thu Mar 30 21:50:54 PST 2006


Hi all,

I'd like to test the speed of XRenderComposite() at runtime (to enable 
or disable the compositor automatically) so I wrote a function that 
measures the time it takes to perform a few XRenderComposite() calls.

Unfortunately, the results computed don't vary much between the 
accelerated NVidia driver and the Open Source "nv" driver although the 
compositor is hardly usable with transparency with the "nv" driver, so I 
must be missing something here.

Any idea how I could test the speed of the XRender implementation 
accurately?

Thanks in advance,
Cheers,
Olivier.

gboolean
compositorBenchmark (Display *dpy)
{
     Picture picture1, picture2;
     XRenderPictureAttributes pa;
     XRenderPictFormat *render_format;
     Pixmap pixmap;
     XRenderColor c;
     int i;

     c.alpha = 0x7fff;
     c.red   = 0x7fff;
     c.green = 0x7fff;
     c.blue  = 0x7fff;

     render_format = XRenderFindStandardFormat (dpy,
                                                PictStandardARGB32);

     pixmap = XCreatePixmap (dpy,
                             DefaultRootWindow(dpy),
                             100, 100, 32);
     pa.repeat = TRUE;
     picture1 = XRenderCreatePicture (dpy, pixmap,
                                     render_format, CPRepeat, &pa);
     picture2 = XRenderCreatePicture (dpy, pixmap,
                                     render_format, CPRepeat, &pa);
     XRenderFillRectangle (dpy, PictOpSrc,
                           picture1, &c, 0, 0, 100, 100);
     XRenderFillRectangle (dpy, PictOpSrc,
                           picture2, &c, 0, 0, 100, 100);
     XFreePixmap (dpy, pixmap);
     for (i = 0; i < 100; i++)
     {
         XRenderComposite (dpy, PictOpOver, picture1, picture2,
                           None, 0, 0, 0, 0, 0, 0, 100, 100);
         XSync (dpy, FALSE);
     }
     XRenderFreePicture (dpy, picture1);
     XRenderFreePicture (dpy, picture2);

     return TRUE;
}





More information about the xorg mailing list