On 04/22/2013 05:29 PM, J. Liles wrote:
I guess you're talking about drawing to a cairo_xlib surfaces. The xlib
backend
is slow. To get speed use an image surface as a backbuffer and 'xputimage'
it ( or parts of it ) to a window.
That is (kind of) what NTK does. Do you have any numbers (or a test
program) to back up the claim that drawing to an xlib surface (pixmap)
and copying it into another is slower than drawing into an image
surface and copying that? I'm pretty sure I tested this myself a while
ago and determined that there was no difference.
attached is im-x-test.c
compile with : gcc -g `pkg-config cairo --cflags --libs` -lX11
im-x-test.c -o rtest
no arguments==use image
one or more args==use xlib
my results :
egag@slack64:$ time ./rtest
Render to image surface and copy...
real 0m0.136s
user 0m0.112s
sys 0m0.011s
~/c
egag@slack64:$ time ./rtest it
Render to xlib surface and copy...
real 0m1.413s
user 0m0.102s
sys 0m0.005s
that's bonus points for the image surface, 10+ times faster;
but of course i picked a non int linewidth....
Drawing pixel aligned (linewidth 2 or so ) shows a close finish and if
you scrap the png
xlib will be faster. But that means no more than hor. and vert. lines
and fills... not much
of a graphic lib. that is.
I rebooted my pc this morning and things are faster now.
(less than a sec. for a redraw with only jack/zynn/non-mix and
non-seq running).
When it took 2 sec.'s ( and 3+ when zoomed out ), the x-server
was using 98% cpu while updating and every other gui action was very slow.
But
it looks like the cause was not ( only ) the seq-gui doing a lot of server
requests.
Non-seq. is much more responsive now, but still not fast.
I wouldn't say that the version in 'master' will ever be fast. Either
try the new branch or revert to the pre-NTK (pre-cairo) version of
non-sequencer.
Maybe i'll try to make an image surface testcase for the current seq.
Just to look what it does...
And i'll try the older/coming versions
I did compile and run it but there were no cells visible so i
couldn't try. Should the cells be visible ? I assumed it was in a to early
stage.
The new version does away with the cells and simply draws a grid
overlayed with notes. Cairo was simply too slow to draw that many
individual shapes. The new branch is almost done, however, some
functionality has been disabled and there may be bugs I don't know
about. It would be helpful if you could confirm that you perceive no
slowness on the new branch.
ok.
I need to know more about
your environment. Are *all* FLTK1.3 and NTK applications slow for you?
What video card and driver are you using? What version of X? Have you
tried switching between EXA and XAA? Have you tried the
XAAOffscreenPixmaps = "no" Xorg option?
Zynn is OK , non-mixer is always running and when i switch desks
from mixer to sequencer and back i see a blank mixer-window for
1/4 - 1/3 of a second ( not really a pain ) and a blank seq. window for
about 3/4 - 1 sec.
I have an NVIDIA card with prop. driver and X.Org X Server 1.9.5.
and never tried or needed other options than standard.
Hmm. Have you tried running it under Xephyr? If it's faster under
Xephyr, then it's definitely (at least partly) a problem with your X
setup.
wouldn't other programs also show some probs if that was the case ?
I'm concerned not about a problem with drawing speed (as I have
already solved this in the new branch), but about a potential problem
with the FLTK/NTK event loop.
I'll be playing around with the sequencer and see if it gets slower
while using it. It's rather addicting and i haven't connected my keyboard
yet.
Indeed. Glad you're having fun!
Looking foreward to your new implementation,
Yep. I've pretty much finished everything I planned to do to non-mixer
and non-timeline, so I should be able to get back to work finishing
the updates to get non-sequencer working optimally with NTK.
Ok....take your time...
#include <stdio.h>
#include <cairo.h>
#include<cairo-xlib.h>
#include<X11/Xlib.h>
int
main(int argc, char **argv)
{
cairo_surface_t *s, *d;
cairo_t *cr;
Display *dpy;
Pixmap ps, pd;
Window rootwin;
Window win;
XEvent e;
int scr;
int x, y, w=12, h=16, size=1000;
if(!(dpy=XOpenDisplay(NULL))) {
fprintf(stderr, "ERROR: Could not open display\n");
return 1;
}
if(argc > 1){
ps=XCreatePixmap(dpy, DefaultRootWindow(dpy), size, size,
DefaultDepth(dpy, DefaultScreen(dpy)));
s=cairo_xlib_surface_create(dpy, ps, DefaultVisual(dpy, 0), size, size);
printf("Render to xlib surface and copy...\n");
}else{
s=cairo_image_surface_create(CAIRO_FORMAT_RGB24, size, size);
printf("Render to image surface and copy...\n");
}
pd=XCreatePixmap(dpy, DefaultRootWindow(dpy), size, size,
DefaultDepth(dpy, DefaultScreen(dpy)));
d=cairo_xlib_surface_create(dpy, pd, DefaultVisual(dpy, 0), size,
size);
cr=cairo_create(s);
cairo_set_source_rgb(cr, 0, 0, 1);
cairo_paint(cr);
for( x=2; x <990; x +=(w+5)){
for(y=2; y < 990; y += (h+5)){
cairo_rectangle(cr, x, y, w, h);
cairo_set_source_rgb(cr, 1, 0, 0);
cairo_set_line_width(cr, 2.3);
cairo_stroke_preserve(cr);
cairo_set_source_rgb(cr, .7, .7, .7);
cairo_fill(cr);
}
}
cairo_destroy(cr);
cr=cairo_create(d);
cairo_set_source_surface(cr, s, 0, 0);
cairo_paint(cr);
cairo_destroy(cr);
cairo_surface_write_to_png(d, "catest.png");
cairo_surface_destroy(s);
cairo_surface_destroy(d);
XFreePixmap(dpy, pd);
if(argc > 1)
XFreePixmap(dpy, ps);
XCloseDisplay(dpy);
return 0;
}