Go Back   nV News Forums > Linux Support Forums > NVIDIA Linux

Newegg Daily Deals

Reply
 
Thread Tools
Old 06-24-09, 03:39 PM   #1
ocelot09
Registered User
 
Join Date: Jun 2009
Posts: 5
Default XCopyPlane is awfully slow

// Check the following X code. It's super slow to exec XCopyPlane
// on NVS 290 with latest nVidia driver (185.18.14). CPU is 100%
// grabbed by X. If comment out that X call, it becomes smooth.

#include <X11/Xlib.h>
#include <X11/Xutil.h>

#define WINW 800
#define WINH 600

int main(int argc, char **argv)
{
Display *dpy = XOpenDisplay(0); // try with 24bit visual
int screen=DefaultScreen(dpy);

Window root = RootWindow(dpy, screen);
Pixmap mask = XCreatePixmap(dpy, root, WINW, WINH, 1);

GC gc = XCreateGC(dpy, root, 0, 0);
GC gc1 = XCreateGC(dpy, mask, 0, 0);

XSetWindowAttributes attr;
attr.background_pixel = 0;
attr.backing_store =WhenMapped;
Window win = XCreateWindow(dpy, root, 0, 0, WINW, WINH, 0,
DefaultDepth(dpy, screen),
InputOutput, DefaultVisual(dpy, screen),
CWBackPixel|CWBackingStore, &attr);

XSelectInput(dpy, win, PointerMotionMask|LeaveWindowMask);
XMapRaised(dpy, win);

int px=-1, py=-1;
XEvent event;
while (1)
{
XNextEvent(dpy, &event);

if (event.type == LeaveNotify)
{
XClearWindow(dpy, win);
px=py= -1;
}
else if (event.type == MotionNotify)
{
if (px!=-1 && py!=-1) // erase small box
{
XSetForeground(dpy, gc, 0);
XFillRectangle(dpy, win, gc, px-5, py-5, 10+1, 10+1);
}

px=event.xmotion.x; // set new pos
py=event.xmotion.y;

XSetForeground(dpy, gc, 0xffffff);
XDrawRectangle(dpy, win, gc, px-5, py-5, 10, 10); //redraw small box

// slow .........
XCopyPlane(dpy, win, mask, gc1, 0, 0, WINW, WINH, 0, 0, 0x01);
}
}
}
ocelot09 is offline   Reply With Quote
Old 06-26-09, 04:01 AM   #2
hl_
Registered User
 
Join Date: Feb 2009
Posts: 138
Default Re: XCopyPlane is awfully slow

You should use XRender instead. The architecture of today's GPUs is not very fit for some of these data types (e.g. 1 bpp pixmaps) and operations on them.
hl_ is offline   Reply With Quote
Reply


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 09:03 PM.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Copyright 1998 - 2014, nV News.