nanogui: GrCopyArea is blocking on X11


Previous by date: 29 May 2006 01:34:04 +0100 Re: Font support, Greg Haerr
Next by date: 29 May 2006 01:34:04 +0100 Re: Segmentation fault, Greg Haerr
Previous in thread: 29 May 2006 01:34:04 +0100 Re: GrCopyArea is blocking on X11, Martin Hansen
Next in thread: 29 May 2006 01:34:04 +0100 Re: GrCopyArea is blocking on X11, Martin Hansen

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: ####@####.####
: 
: 
: 

Previous by date: 29 May 2006 01:34:04 +0100 Re: Font support, Greg Haerr
Next by date: 29 May 2006 01:34:04 +0100 Re: Segmentation fault, Greg Haerr
Previous in thread: 29 May 2006 01:34:04 +0100 Re: GrCopyArea is blocking on X11, Martin Hansen
Next in thread: 29 May 2006 01:34:04 +0100 Re: GrCopyArea is blocking on X11, Martin Hansen


Powered by ezmlm-browse 0.20.