[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference bulova::decw_jan-89_to_nov-90

Title:DECWINDOWS 26-JAN-89 to 29-NOV-90
Notice:See 1639.0 for VMS V5.3 kit; 2043.0 for 5.4 IFT kit
Moderator:STAR::VATNE
Created:Mon Oct 30 1989
Last Modified:Mon Dec 31 1990
Last Successful Update:Fri Jun 06 1997
Number of topics:3726
Total number of notes:19516

1163.0. "Error message from the X Server with XCreatePixmap" by EVTIS2::HOANG () Mon Jul 24 1989 11:42

    Hi there,
    
    	I've got a problem with The routine XCreatePixmap. It generates
    a message from the Server and an ACCVIO in the routine.
    Could some one help me to find out what's wrong ?      
    
    	If I set pixmap_width = 600 and pixmap_height = 600, everything    
    	is OK.
    	The problem appears with these values set to 1000.
	The errors logged were :
    --------------------Start here-------------------
X error event received from server: BadAlloc - insufficient resources
  Failed request major op code 53 X_CreatePixmap
  Failed request minor op code 0 (if applicable)
  ResourceID 0x90000b in failed request (if applicable)
  Serial number of failed request 45
  Current serial number in output stream 49
X error event received from server: BadDrawable - parameter not a Pixmap or Window
  Failed request major op code 70 X_PolyFillRectangle
  Failed request minor op code 0 (if applicable)
  ResourceID 0x90000b in failed request (if applicable)
  Serial number of failed request 47
  Current serial number in output stream 49
 ------------------------End error here ---------------------
           
    Pixmap.c
    -------- 
    ---------------------Start Here PIXMAP.C --------------------
    
#include <decw$include/Xlib.h>
#include <stdio.h>

#ifdef vms 
#include <decw$include/DECwDwtApplProg.h>
#else
#include <x11/DECDwtApplProg.h>
#endif

#define zone_grph	1

#define xStart		40
#define yStart		140
#define uidFile		"pixmap.uid"
#define nFiles(x)	(sizeof(x)/sizeof(char *))
#define nRegs(x)	(sizeof(x)/sizeof(DRMRegisterArg))
#define nint(x)		((int)(x+0.5))

static void WidgetCreated();

Widget top_level;
Pixmap pixmap;
int pixmap_height = 1000,      /* Error Here !!!! */
    pixmap_width = 1000;       /* OK with pixmap_height=pixmap_width=600*/
    

GC pixmap_GC;
Window myWin;
GC gc,gc_point;
Display *dpy;
char *display=NULL;
int screen;
XGCValues xgcv;
Widget widget_id[2];
Arg args[1];

static DRMHierarchy hierarchy;
static char *namvec[] = {uidFile};
static DRMCode class;

static DRMRegisterArg regvec[] = {
	{"WidgetCreated",	(caddr_t)WidgetCreated}
	};




static void MakeWidgetTree()
{
   Widget main_widget;

   if (DwtOpenHierarchy(nFiles(namvec),namvec,
			NULL,
			&hierarchy) != DRMSuccess) {
	fprintf(stderr,"Can't open DRM hierarchy\n");
	exit(0);
   }


   DwtRegisterDRMNames(regvec,nRegs(regvec));

   if (DwtFetchWidget(hierarchy,"mainWindow",top_level,
		&main_widget,&class) != DRMSuccess) {
	fprintf(stderr,"Can't fetch main widget\n");
	exit(0);
   }

   XSync(dpy,1);
   XtManageChild(main_widget);
   XSync(dpy,0);
}


Init()
{
   screen = DefaultScreen(dpy);
   myWin = XtWindow(widget_id[zone_grph]);

   xgcv.function = GXcopy;
   xgcv.line_width = 2;
   xgcv.foreground = XBlackPixel(dpy,screen);
   xgcv.background = XWhitePixel(dpy,screen);
   gc = XCreateGC(dpy,myWin,
		GCFunction|GCLineWidth|GCForeground|GCBackground,&xgcv);
   XtSetArg(args[0],DwtNbackground,&xgcv.foreground);
   XtGetValues(widget_id[zone_grph],args,1);

   pixmap = XCreatePixmap(dpy,myWin,pixmap_width,pixmap_height,8);

   pixmap_GC = DefaultGC(dpy,screen);
   XChangeGC(dpy,pixmap_GC,GCForeground,&xgcv);
   XFillRectangle(dpy,pixmap,pixmap_GC,0,0,pixmap_width,pixmap_height);
   XSetForeground(dpy,pixmap_GC,XBlackPixel(dpy,screen));

   XDrawRectangle(dpy,myWin,gc,10,10,110,60);
}




static void WidgetCreated(widget,tag,reason)
   Widget widget;
   int *tag;
   DwtAnyCallbackStruct *reason;
{
   widget_id[*tag] = widget;
}



main(argc,argv)
unsigned int argc;
char *argv[];
{
   Arg args[3];

   DwtInitializeDRM();
   top_level = XtInitialize("PixmapBug",
			    "Demo",
			    NULL,0,
			    &argc,argv);

   if (! (dpy = XtDisplay(top_level)))
   {
      printf("Erreur d'ouverture du display !\n");
      exit(0);
   }

   MakeWidgetTree();
   XtSetArg(args[0],DwtNx,xStart);
   XtSetArg(args[1],DwtNy,yStart);
   XtSetArg(args[2],DwtNnoResize,True);
   XtSetValues(top_level,args,3);

   XSync(dpy,1);
   XtRealizeWidget(top_level);
   XSync(dpy,0);

   Init();
   XtMainLoop();
}
   
----------------------------End here Pixmap.c ------------------------
    
    
	Pixmap.uil
        ----------
    
    -----------------------------__Start here Pixmap.uil -------------
module SuperPro
	version = 'v1.0'
	names = case_sensitive
	objects = {
			separator = widget;
			label = widget;
			push_button = widget;
			toggle_button = widget;
	}

include file 'DECW$INCLUDE:DECwDwtApplProg.uil';

value
	zone_grph:	1;

procedure
	WidgetCreated(integer);

object
	mainWindow: main_window {
	   arguments {
	      width = 250;
	      height = 250;
	   };
	   controls {
	      window zone_graphic;
	   };
	};


object
	zone_graphic: window {
	   arguments {
	      x = 0;
	      y = 0;
	      width = 250;
	      height = 250;
	   };
	   callbacks {
	      create = procedure WidgetCreated(zone_grph);
	   };
	};


end module;
    -------------------------End Here Pixmap.uil-----------------

    	Thanks for any help.
    		Dung HOANG
    		TSC EVRY FRANCE

T.RTitleUserPersonal
Name
DateLines
1163.1limited by display memoryCSC32::B_WACKERMon Jul 24 1989 11:592
On a color workstation I think you're limited to 1024x768.

1163.2DECWIN::FISHERBurns Fisher 381-1466, ZKO3-4/W23Mon Jul 24 1989 13:008
That should be, "on a GPX" regardless of whether it is monochrome or
black and white.  A Color FireFox will have different limitations.

You should also have gotten an alloc error of some sort with the create
pixmap.  If you did not, that sounds like QAR time.

Burns

1163.3More info please...EVTIS2::HOANGWed Jul 26 1989 05:2811
    Hi again,
    	How could you know the limitations of the display memory for
    each workstation ?
    	What are the values for the VS3100?
    	If there're hardware limitations, I can't understand why it
    could be a bug (to submit an QAR..)
    	Are these limitations documented somewhere in XLIB ?
    
    		Thanks for the helps,
    			Dung HOANG

1163.4App must be prepared to handle pixmap create failureSTAR::BMATTHEWSWed Jul 26 1989 11:385
You can't know the limitations of the server and the app needs to be prepared
to handle createpixmap failures. PC's and X terminals are very likely to
generate these errors.
						Bill

1163.5It should tell youDECWIN::FISHERBurns Fisher 381-1466, ZKO3-4/W23Thu Jul 27 1989 13:119
My point about the QAR is that if the CreatePixmap does not return an "Alloc"
error, but nonetheless fails, that is a bug.  The fact that it failed for
too big a pixmap is not a bug.

Of course, not infrequently, people set up error handlers to throw away
X errors.  This is not a bug in the server, but in the application!

Burns

1163.6why limit pixmap to display hardware?CSC32::B_WACKERThu Jul 27 1989 14:585
Why should it be acceptable to fail for too big a pixmap if there is 
enough memory?  It seems reasonable to allow the user to create any
size pixmap so that pieces of it could be selectively displayed and 
let the display side deal with display hardware limitations.

1163.7It comes down to a lot of code to get terrible performanceDECWIN::FISHERBurns Fisher 381-1466, ZKO3-4/W23Fri Jul 28 1989 14:3116
You wanna write the code? :-)

Seriously, the big reason we have limited it on the GPX and FF hardware is
that the hardware can't draw into virtual memory.  In order to draw into the
pixmap, you have to load it into offscreen memory.  If you pixmap is bigger
than offscreen memory, then for every operation you have to load section
1 into memory and draw, load section 2 into memory and draw, ...  Flinging
bits between offscreen and virtual memory is terribly slow.  You don't want
to do this.

Another alternative is to draw with software.  This is quite good with
1-bit-deep systems, but with 4 and 8 and 24-bit deep systems, it becomes
roughly 4, 8 or 24 times as slow.

Burns

1163.8What goes on off screen?CSC32::B_WACKERFri Jul 28 1989 17:5912
Makes sense, but could you elaborate on what limits offscreen memory?  

My understanding is that a gpx has 2048x2048 with 1024x768 mapped to 
the screen.  With no other pixmaps allocated shouldn't you be able to
create a full depth pixmap that is (2048-1024)x(2048-768) or
1024x1280?  It seems to be limited to 1024x768, though. 

Does it do any memory management to consolidate deleted pixmaps, move 
things around to try to make room, or anything like that?

Bruce

1163.9gpx offscreen memory managementSTAR::BMATTHEWSMon Jul 31 1989 10:5825
re: -1
>Makes sense, but could you elaborate on what limits offscreen memory?  

>My understanding is that a gpx has 2048x2048 with 1024x768 mapped to 
>the screen.  With no other pixmaps allocated shouldn't you be able to
>create a full depth pixmap that is (2048-1024)x(2048-768) or
>1024x1280?  It seems to be limited to 1024x768, though. 

>Does it do any memory management to consolidate deleted pixmaps, move 
>things around to try to make room, or anything like that?


The gpx offscreen is 1024x2048. The first 1024x864 is the visible screen.
That leaves 1024x1184 free. We use some of that area as a glyph cache for
text. We cache individual glyphs from multiple fonts and the glyphs must be
in gpx memory to be used in drawing. We also use 1024x32 for a cache of
small pixmaps up to 32x32 both of depth 1 and depth 8. depth 1 pixmaps are
stacked in z. We also need an area of offscreen to save the visible screen
when the operator window come up and we need some scratch space to accomdate
operations that take multiple large pixmaps. Like copying one large pixmap
to another. after all that we are left with about 1024x864 for large pixmaps.
Yes we do consolidate deleted pixmaps when we have to.

							Bill

1163.10CASEE::LACROIXObject oriented dog food? No, sorryMon Jul 31 1989 13:0814
    Re .9 by STAR::BMATTHEWS:

>               We also need an area of offscreen to save the visible screen
> when the operator window come up and ...

    Bill,
    
    Speaking of the operator window, with EFT1 I have seen several times my
    screen corrupted when hittin CTRL-F2 to exit the operator's window.
    Logging out was the only way to fix the problem. I haven't QARed it
    b'cause I wanted to test the behaviour some more.

    Denis.

1163.11this program never gets errors from XCreatePixmap callNEURON::NICHOLSONA belly as big as an oil spillTue Aug 15 1989 17:0549
    Before reading this note, I was trying to determine how much off
    screen memory was available by looping in a program creating pixmaps
    till it blew up.
    
    The following program loops creating a 100 x 100 pixmap, calling
    XFlush, and printing out the accumulated size of offscreen memory.
    I would expect to get some warnings back from the server once I'm
    out of offscreen memory, but I never see any and I haven't established
    by own condition handler.  What I do see is the program aborting
    when the server aborts the connection for this program.  Version
    of VMS is 5.2-42W
    
    How come?
    Mark
/*
    see how much memory I can get by creating pixmaps before I get an error
*/

#include <stdio.h>
#include <decw$include/Xlib.h>

#define screenNumber    DefaultScreen(display)
#define rootWindow      RootWindow(display,screenNumber)
#define depth           DefaultDepth(display,screenNumber)
#define forever         while(1)

main(argc,argv)
   unsigned int argc;
   char *argv[];
{
    Display *display;       /* display pointer */
    Pixmap mypixmap;
    int	total_size = 0;

   if (!(display = XOpenDisplay(NULL))) 
   {
      fprintf(stderr,"Can't open display\n");
      exit(0);
   }

   forever
   {
	mypixmap = XCreatePixmap ( display, rootWindow, 100, 100, depth );
	XFlush ( display );
	total_size += 10000;
	printf ( "pixmap id = %d, total size = %d\n", mypixmap, total_size );
   }
}