XCreateColormap() for Pseudocolor 15bit fails

Roland Mainz roland.mainz at nrubsig.org
Fri Apr 8 15:17:33 PDT 2005


Felix Schulte wrote:
> does anyone know under which conditions XCreateColormap() can fail? I
> have selected a Pseudocolor 15bit visual but calling XCreateColormap()
> fails all the time:
> X Error of failed request:  BadAlloc (insufficient resources for operation)
>   Major opcode of failed request:  78 (X_CreateColormap)
>   Serial number of failed request:  39
>   Current serial number in output stream:  40
> 
> Breakpoint 1, 0x40178ab6 in exit () from /lib/libc.so.6
> (gdb) where
> #0  0x40178ab6 in exit () from /lib/libc.so.6
> #1  0x40070d10 in _XDefaultError (dpy=0x8052838, event=0xbffff340) at
> XlibInt.c:2831
> #2  0x40070e82 in _XError (dpy=0x8052838, rep=0xbffff430) at XlibInt.c:2883
> #3  0x4006edde in _XReply (dpy=0x8052838, rep=0xbffff430, extra=0,
> discard=1) at XlibInt.c:1812
> #4  0x40068762 in XSync (dpy=0x8052838, discard=0) at Sync.c:45
> #5  0x40068825 in _XSyncFunction (dpy=0x1) at Synchro.c:34
> #6  0x40047725 in XCreateColormap (dpy=0x8052838, w=61,
> visual=0x8057d38, alloc=0) at CrCmap.c:51
> 
> Any ideas, comments, opinions on what I am doing wrong?

AFAIK you're doing nothing wrong. The problem is that the core X
protocol defines |ColormapEntries| as |CARD16| (which is AFAIK a |signed
short|). There are two solutions:
1. Create a extension (XC-BIGCOLORMAP) which hooks into libX11 and
allows larger colormaps (e.g. make the field |CARD32| and adjust the
matching function calls).
2. Limit the driver to 14bit (16384 colormap entries or keep the 15bit
but set the available number of colors to 32768-2 to avoid the datatype
overflow).

Option [1] sounds better here as we will need larger colormaps for the
COLORSPACE extension anyway.

----

Bye,
Roland

-- 
  __ .  . __
 (o.\ \/ /.o) roland.mainz at nrubsig.org
  \__\/\/__/  MPEG specialist, C&&JAVA&&Sun&&Unix programmer
  /O /==\ O\  TEL +49 641 7950090
 (;O/ \/ \O;)


More information about the xorg-arch mailing list