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);
}