[<<] [<] Page 1 of 1 [>] [>>] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Subject:
GrCopyArea is blocking on X11
From: Martin Hansen ####@####.#### Date: 22 May 2006 13:48:34 +0100 Message-Id: <1148303337.4009.23.camel@dustpuppy> Hi I have made a small app that show a graph scrolling verticaly across its window (a heart monitor demo) First i made it so that it would redraw the whole graph every time, this gave some flicker. So i redesigend it to use GrCopyArea, now I copy the graph inside the sanme window with an offset, and just dram the new part of the graph. (Se code snippet below) The update of the graph is based on a timer event. My problem is that when using the flickery version where i redraw the complete graph, everythis is working fine. But when using GrCopyArea version, the program suffers from considerable delays, but only on X11, I have the same app running fine on a mips32 target, using framebuffer. I discovered that when the delay occours i had to make some mouse events by just moving the mouse arround inside the microwindows window. I had a suspicion that the eventloop was somehow broken, so i made a new app. whth only the graph code just running inside a for() loop. no events checking at all. On my mips32 target this version runs for a short while, scrolling the graph at high speed until the for loop ends and exits as suposed to. But the X11 version still suffers from delays until i move the mouse arround in the window, this despite that i no not look at events at all. By use of printf debugging i see that it is the GrCopyArea function that blocks. but not every time, it can run a few turns in the loop then it bloks until a move the mouse, maybe becuase of events in the eventque. void HeartGraph(){ const unsigned int data[]= {30,30,30,15, 0, 5,15,20,25,30, 35,40,45,50,35,20,30,40,25,35, 30,30,30,30,30,30,30,30,30,30, 30,30,30,30,30,30,30,30,30,30, 30,30,30,30,30,30,30,30,30,30}; static int index; GrCopyArea(heartgW, heartgGC, 0, 0, OUT_WIN_WIDTH-2, OUT_WIN_HEIGHT, heartgW, 1, 0, 0); GrLine(heartgW, heartgGC, OUT_WIN_WIDTH-4 ,data[index],OUT_WIN_WIDTH-3,data[index+1]); index=(++index)%49; } -- Med venlig hilsen/mojn/regards Martin Hansen Center for Software Innovation Stenager 2, DK-6400 Sønderborg, Web: www.cfsi.dk | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Subject:
Re: [nanogui] GrCopyArea is blocking on X11
From: Martin Hansen ####@####.#### Date: 23 May 2006 12:45:46 +0100 Message-Id: <1148386190.3981.39.camel@dustpuppy> man, 22 05 2006 kl. 19:48 -0600, skrev Greg Haerr: > Martin - > > This is indeed pretty strange. Offhand, I looked around and > didn't see anything that might cause this behaviour. You might > browse drivers/scr_x11.c & kbd_x11.c. I did, but did not see anythig that catchd my eye. I probed a bit more with printf's I tested using a clean stub of my original program, the stub is quoted below. What i observe is that the GrCopyArea in srvfunc.c does complete. But the GrCopyArea in client.c does not. Wathing the terminals and the "microwindows" window, i see that after a lot of succesfull calls the server stops, and the therefore the graph stops. But the client continues a bit more, then it stops too. I traced the stop trough GrCopyArea calling LOCK(&nxGlobalLock) calling nxAllocReq (in nxproto.c) calling nxFlushReq(aligned_len,1) When the blocking happens, nxFlushReq(aligned_len,1) does not return, before i move the mouse over the "microwindows" window. Now the time that I can spend on this task has run out, maybe I will be given more time later on. But for now i just report my results in the hope that they are usefull. #define MWINCLUDECOLORS #include <stdlib.h> #include <stdio.h> #include "nano-X.h" /* main window dimension */ #define OUT_WIN_WIDTH 200 #define OUT_WIN_HEIGHT 50 /* default colors */ #define BGC BLACK /* Background color */ #define FGC GRAY /* Forground color */ /* forward declerations */ void HeartGraph(); void HeartGraph_init(); GR_GC_ID heartgGC; GR_WINDOW_ID heartgW; int main(int ac,char **av) { int i; if (GrOpen() < 0) { printf("Can't open graphics\n"); exit(1); } /* make heartgraph window */ heartgGC = GrNewGC(); GrSetGCBackground(heartgGC, BGC); GrSetGCUseBackground(heartgGC, GR_FALSE); heartgW= GrNewWindowEx(GR_WM_PROPS_BORDER, "", GR_ROOT_WINDOW_ID, 0,0 , OUT_WIN_WIDTH, OUT_WIN_HEIGHT, BGC); GrSetWindowBorderColor(heartgW,FGC); GrSetWindowBorderSize(heartgW,1); GrMapWindow(heartgW); HeartGraph_init(); for(i=0;i<100000;i++) { HeartGraph(); } GrClose(); return 0; } void HeartGraph(){ const unsigned int data[]= {30,30,30,15, 0, 5,15,20,25,30, 35,40,45,50,35,20,30,40,25,35, 30,30,30,30,30,30,30,30,30,30, 30,30,30,30,30,30,30,30,30,30, 30,30,30,30,30,30,30,30,30,30}; static int index=0; GrCopyArea(heartgW, heartgGC, 0, 0, OUT_WIN_WIDTH-2, OUT_WIN_HEIGHT, heartgW, 1, 0, MWMODE_COPY); GrLine(heartgW, heartgGC, OUT_WIN_WIDTH-4 ,data[index],OUT_WIN_WIDTH-3,data[index+1]); index=(++index)%49; } void HeartGraph_init(){ GrSetGCForeground(heartgGC, BGC); GrFillRect(heartgW, heartgGC, 0, 0, OUT_WIN_WIDTH, OUT_WIN_HEIGHT); GrSetGCForeground(heartgGC, WHITE); GrLine(heartgW, heartgGC, 0,30,OUT_WIN_WIDTH-4,30); } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Subject:
Re: [nanogui] GrCopyArea is blocking on X11
From: "Greg Haerr" ####@####.#### Date: 29 May 2006 01:34:04 +0100 Message-Id: <130001c682b6$dd1334c0$6401a8c0@winXP> Looking at your code below, your call HeartGraph() 100,000 times, without waiting reading an event or calling any function that might empty the event queue. Instead, you send 1000's of requests to the client, which likely causes some expose events to be generated, which are never read. Eventually, the client queue fills up and the system hangs. It shouldn't do this, but you ought to run your heart graph on a timer, rather than a full CPU speed. Regards, Greg : What i observe is that the GrCopyArea in srvfunc.c does complete. But : the GrCopyArea in client.c does not. : Wathing the terminals and the "microwindows" window, i see that after a : lot of succesfull calls the server stops, and the therefore the graph : stops. But the client continues a bit more, then it stops too. I traced : the stop trough GrCopyArea calling LOCK(&nxGlobalLock) calling : nxAllocReq (in nxproto.c) calling nxFlushReq(aligned_len,1) : : When the blocking happens, nxFlushReq(aligned_len,1) does not return, : before i move the mouse over the "microwindows" window. : : Now the time that I can spend on this task has run out, maybe I will be : given more time later on. But for now i just report my results in the : hope that they are usefull. : : : #define MWINCLUDECOLORS : #include <stdlib.h> : #include <stdio.h> : #include "nano-X.h" : : /* main window dimension */ : #define OUT_WIN_WIDTH 200 : #define OUT_WIN_HEIGHT 50 : : : /* default colors */ : #define BGC BLACK /* Background color */ : #define FGC GRAY /* Forground color */ : : /* forward declerations */ : void HeartGraph(); : void HeartGraph_init(); : : GR_GC_ID heartgGC; : GR_WINDOW_ID heartgW; : : int main(int ac,char **av) : { : int i; : : if (GrOpen() < 0) { : printf("Can't open graphics\n"); : exit(1); : } : : /* make heartgraph window */ : heartgGC = GrNewGC(); : GrSetGCBackground(heartgGC, BGC); : GrSetGCUseBackground(heartgGC, GR_FALSE); : heartgW= GrNewWindowEx(GR_WM_PROPS_BORDER, "", GR_ROOT_WINDOW_ID, : 0,0 , OUT_WIN_WIDTH, OUT_WIN_HEIGHT, BGC); : GrSetWindowBorderColor(heartgW,FGC); : GrSetWindowBorderSize(heartgW,1); : GrMapWindow(heartgW); : : HeartGraph_init(); : for(i=0;i<100000;i++) : { : HeartGraph(); : } : GrClose(); : return 0; : } : : : void HeartGraph(){ : : const unsigned int data[]= {30,30,30,15, 0, 5,15,20,25,30, : 35,40,45,50,35,20,30,40,25,35, : 30,30,30,30,30,30,30,30,30,30, : 30,30,30,30,30,30,30,30,30,30, : 30,30,30,30,30,30,30,30,30,30}; : : static int index=0; : : GrCopyArea(heartgW, heartgGC, 0, 0, OUT_WIN_WIDTH-2, OUT_WIN_HEIGHT, : heartgW, 1, 0, MWMODE_COPY); : : GrLine(heartgW, heartgGC, : OUT_WIN_WIDTH-4 ,data[index],OUT_WIN_WIDTH-3,data[index+1]); : index=(++index)%49; : } : : void HeartGraph_init(){ : : GrSetGCForeground(heartgGC, BGC); : GrFillRect(heartgW, heartgGC, 0, 0, OUT_WIN_WIDTH, OUT_WIN_HEIGHT); : GrSetGCForeground(heartgGC, WHITE); : : GrLine(heartgW, heartgGC, 0,30,OUT_WIN_WIDTH-4,30); : : } : : : : --------------------------------------------------------------------- : To unsubscribe, e-mail: ####@####.#### : For additional commands, e-mail: ####@####.#### : : : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Subject:
Re: [nanogui] GrCopyArea is blocking on X11
From: Martin Hansen ####@####.#### Date: 29 May 2006 08:41:04 +0100 Message-Id: <1148889017.3981.45.camel@dustpuppy> søn, 28 05 2006 kl. 18:28 -0600, skrev Greg Haerr: > Looking at your code below, your call HeartGraph() > 100,000 times, without waiting reading an event or > calling any function that might empty the event queue. Yes, i know. I saw the same problems when this was controlled by a typical event loop trigered by a timer event. I just made this test to eliminate that it was my event lop that was missing something. We have en exebition tomorrow so i cannot provide you more info today. But when I get back to nornal I will try to give you some test results from a version with a propper event loop. Note that this is not a problem when using framebuffer on mips target. Only when using X11. -- Med venlig hilsen/mojn/regards Martin Hansen Center for Software Innovation Stenager 2, DK-6400 Sønderborg, Web: www.cfsi.dk | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
[<<] [<] Page 1 of 1 [>] [>>] |