Raspbian CreatePicture problem
Opened this issue · 8 comments
Hi;
I'm getting error this command;
Render.CreatePicture(pict, wid, Render.rgb24);
error message: Bad match
My system raspberry pi B+ and Raspbian Jezzy Lite.
Whats my problem ?
Thanks.
Hi! Could you post output of xdpyinfo
command on your system, value of Render.rgb24
and value from Render.QueryPictFormat(callback)
call?
The code to choose Render.rgb24
is here - https://github.com/sidorares/node-x11/blob/master/lib/ext/render.js#L599-L600
Also what was the visual and depth used to create win
?
Hi again;
Thanks for response.
Render.QueryPictFormat, formats value;
{ formats:
[ [ 34, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0 ],
[ 35, 1, 8, 0, 0, 0, 0, 0, 0, 0, 255, 0 ],
[ 36, 1, 4, 0, 0, 0, 0, 0, 0, 0, 15, 0 ],
[ 37, 1, 32, 16, 255, 8, 255, 0, 255, 24, 255, 0 ],
[ 38, 1, 32, 16, 255, 8, 255, 0, 255, 0, 0, 0 ],
[ 39, 1, 32, 8, 255, 16, 255, 24, 255, 0, 255, 0 ],
[ 40, 1, 32, 8, 255, 16, 255, 24, 255, 0, 0, 0 ],
[ 41, 1, 16, 11, 31, 5, 63, 0, 31, 0, 0, 0 ],
[ 42, 1, 16, 8, 15, 4, 15, 0, 15, 0, 0, 0 ],
[ 43, 1, 16, 0, 15, 4, 15, 8, 15, 0, 0, 0 ],
[ 44, 1, 16, 10, 31, 5, 31, 0, 31, 0, 0, 0 ],
[ 45, 1, 16, 0, 31, 5, 31, 10, 31, 0, 0, 0 ],
[ 46, 1, 16, 10, 31, 5, 31, 0, 31, 15, 1, 0 ],
[ 47, 1, 16, 0, 31, 5, 31, 10, 31, 15, 1, 0 ],
[ 48, 1, 16, 0, 31, 5, 63, 11, 31, 0, 0, 0 ],
[ 49, 1, 16, 8, 15, 4, 15, 0, 15, 12, 15, 0 ],
[ 50, 1, 16, 0, 15, 4, 15, 8, 15, 12, 15, 0 ],
[ 51, 1, 15, 8, 15, 4, 15, 0, 15, 0, 0, 0 ],
[ 52, 1, 15, 0, 15, 4, 15, 8, 15, 0, 0, 0 ],
[ 53, 1, 15, 10, 31, 5, 31, 0, 31, 0, 0, 0 ],
[ 54, 1, 15, 0, 31, 5, 31, 10, 31, 0, 0, 0 ],
[ 55, 1, 24, 16, 255, 8, 255, 0, 255, 0, 0, 0 ],
[ 56, 1, 24, 0, 255, 8, 255, 16, 255, 0, 0, 0 ],
[ 57, 1, 32, 0, 255, 8, 255, 16, 255, 0, 0, 0 ],
[ 58, 1, 32, 20, 1023, 10, 1023, 0, 1023, 30, 3, 0 ],
[ 59, 1, 32, 20, 1023, 10, 1023, 0, 1023, 0, 0, 0 ],
[ 60, 1, 32, 0, 1023, 10, 1023, 20, 1023, 30, 3, 0 ],
[ 61, 1, 32, 0, 1023, 10, 1023, 20, 1023, 0, 0, 0 ] ] }
xdpyinfo output;
debug1: client_input_channel_open: ctype x11 rchan 3 win 65536 max 16384
debug1: client_request_x11: request from ::1 39325
debug1: channel 1: new [x11]
debug1: confirm x11
name of display: localhost:10.0
version number: 11.0
vendor string: The X.Org Foundation
vendor release number: 11701000
X.Org version: 1.17.1
maximum request size: 16777212 bytes
motion buffer size: 256
bitmap unit, bit order, padding: 32, LSBFirst, 32
image byte order: LSBFirst
number of supported pixmap formats: 7
supported pixmap formats:
depth 1, bits_per_pixel 1, scanline_pad 32
depth 4, bits_per_pixel 8, scanline_pad 32
depth 8, bits_per_pixel 8, scanline_pad 32
depth 15, bits_per_pixel 16, scanline_pad 32
depth 16, bits_per_pixel 16, scanline_pad 32
depth 24, bits_per_pixel 32, scanline_pad 32
depth 32, bits_per_pixel 32, scanline_pad 32
keycode range: minimum 8, maximum 255
focus: window 0x440000c, revert to Parent
number of extensions: 29
BIG-REQUESTS
Composite
DAMAGE
DOUBLE-BUFFER
DPMS
DRI2
GLX
Generic Event Extension
MIT-SCREEN-SAVER
MIT-SHM
Present
RANDR
RECORD
RENDER
SECURITY
SGI-GLX
SHAPE
SYNC
X-Resource
XC-MISC
XFIXES
XFree86-DGA
XFree86-VidModeExtension
XINERAMA
XInputExtension
XKEYBOARD
XTEST
XVideo
XVideo-MotionCompensation
default screen number: 0
number of screens: 1
screen #0:
dimensions: 1366x768 pixels (361x203 millimeters)
resolution: 96x96 dots per inch
depths (7): 24, 1, 4, 8, 15, 16, 32
root window id: 0xbd
depth of root window: 24 planes
number of colormaps: minimum 1, maximum 1
default colormap: 0x49
default number of colormap cells: 256
preallocated pixels: black 0, white 16777215
options: backing-store WHEN MAPPED, save-unders NO
largest cursor: 256x256
current input event mask: 0x7a803f
KeyPressMask KeyReleaseMask ButtonPressMask
ButtonReleaseMask EnterWindowMask LeaveWindowMask
ExposureMask StructureNotifyMask SubstructureNotifyMask
SubstructureRedirectMask FocusChangeMask PropertyChangeMask
number of visuals: 24
default visual id: 0x47
visual:
visual id: 0x47
class: TrueColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 8 bits
visual:
visual id: 0x48
class: DirectColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 8 bits
visual:
visual id: 0xa7
class: TrueColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 8 bits
visual:
visual id: 0xa8
class: TrueColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 8 bits
visual:
visual id: 0xa9
class: TrueColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 8 bits
visual:
visual id: 0xaa
class: TrueColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 8 bits
visual:
visual id: 0xab
class: TrueColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 8 bits
visual:
visual id: 0xac
class: TrueColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 8 bits
visual:
visual id: 0xad
class: TrueColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 8 bits
visual:
visual id: 0xae
class: TrueColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 8 bits
visual:
visual id: 0xaf
class: TrueColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 8 bits
visual:
visual id: 0xb0
class: TrueColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 8 bits
visual:
visual id: 0xb1
class: DirectColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 8 bits
visual:
visual id: 0xb2
class: DirectColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 8 bits
visual:
visual id: 0xb3
class: DirectColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 8 bits
visual:
visual id: 0xb4
class: DirectColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 8 bits
visual:
visual id: 0xb5
class: DirectColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 8 bits
visual:
visual id: 0xb6
class: DirectColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 8 bits
visual:
visual id: 0xb7
class: DirectColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 8 bits
visual:
visual id: 0xb8
class: DirectColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 8 bits
visual:
visual id: 0xb9
class: DirectColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 8 bits
visual:
visual id: 0xba
class: DirectColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 8 bits
visual:
visual id: 0xbb
class: DirectColor
depth: 24 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 8 bits
visual:
visual id: 0x82
class: TrueColor
depth: 32 planes
available colormap entries: 256 per subfield
red, green, blue masks: 0xff0000, 0xff00, 0xff
significant bits in color specification: 8 bits
debug1: channel 1: FORCE input drain
my window create command;
X.CreateWindow(wid, root, genislik - 300, 0, 300, 150, 0, 0, 0, 0, {
backgroundPixel: white,
eventMask: KeyPress | Exposure
});
you haven't posted Render.rgb24
so I used this script to figure it out:
var formats = [ [ 34, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0 ],
[ 35, 1, 8, 0, 0, 0, 0, 0, 0, 0, 255, 0 ],
[ 36, 1, 4, 0, 0, 0, 0, 0, 0, 0, 15, 0 ],
[ 37, 1, 32, 16, 255, 8, 255, 0, 255, 24, 255, 0 ],
[ 38, 1, 32, 16, 255, 8, 255, 0, 255, 0, 0, 0 ],
[ 39, 1, 32, 8, 255, 16, 255, 24, 255, 0, 255, 0 ],
[ 40, 1, 32, 8, 255, 16, 255, 24, 255, 0, 0, 0 ],
[ 41, 1, 16, 11, 31, 5, 63, 0, 31, 0, 0, 0 ],
[ 42, 1, 16, 8, 15, 4, 15, 0, 15, 0, 0, 0 ],
[ 43, 1, 16, 0, 15, 4, 15, 8, 15, 0, 0, 0 ],
[ 44, 1, 16, 10, 31, 5, 31, 0, 31, 0, 0, 0 ],
[ 45, 1, 16, 0, 31, 5, 31, 10, 31, 0, 0, 0 ],
[ 46, 1, 16, 10, 31, 5, 31, 0, 31, 15, 1, 0 ],
[ 47, 1, 16, 0, 31, 5, 31, 10, 31, 15, 1, 0 ],
[ 48, 1, 16, 0, 31, 5, 63, 11, 31, 0, 0, 0 ],
[ 49, 1, 16, 8, 15, 4, 15, 0, 15, 12, 15, 0 ],
[ 50, 1, 16, 0, 15, 4, 15, 8, 15, 12, 15, 0 ],
[ 51, 1, 15, 8, 15, 4, 15, 0, 15, 0, 0, 0 ],
[ 52, 1, 15, 0, 15, 4, 15, 8, 15, 0, 0, 0 ],
[ 53, 1, 15, 10, 31, 5, 31, 0, 31, 0, 0, 0 ],
[ 54, 1, 15, 0, 31, 5, 31, 10, 31, 0, 0, 0 ],
[ 55, 1, 24, 16, 255, 8, 255, 0, 255, 0, 0, 0 ],
[ 56, 1, 24, 0, 255, 8, 255, 16, 255, 0, 0, 0 ],
[ 57, 1, 32, 0, 255, 8, 255, 16, 255, 0, 0, 0 ],
[ 58, 1, 32, 20, 1023, 10, 1023, 0, 1023, 30, 3, 0 ],
[ 59, 1, 32, 20, 1023, 10, 1023, 0, 1023, 0, 0, 0 ],
[ 60, 1, 32, 0, 1023, 10, 1023, 20, 1023, 30, 3, 0 ],
[ 61, 1, 32, 0, 1023, 10, 1023, 20, 1023, 0, 0, 0 ] ] ;
var ext = {};
for (var i=0; i < formats.length; ++i) {
var f = formats[i];
if (f[2] == 1 && f[10] == 1)
ext.mono1 = f[0] ;
if (f[2] == 24 && f[3] == 16 && f[5] == 8 && f[7] == 0)
ext.rgb24 = f[0];
// 1, 32, 16, 255, 8, 255, 0, 255, 24, 255, 0
if (f[2] == 32 && f[3] == 16 && f[4] == 255 && f[5] == 8 && f[6] == 255 && f[7] == 0 && f[9] == 24)
ext.rgba32 = f[0] ;
if (f[2] == 8 && f[10] == 255)
ext.a8 = f[0];
}
console.log(ext);
It prints { mono1: 34, a8: 35, rgba32: 37, rgb24: 55 }
Could you test what happens if you use 56 instead of rgb24?
Also make sure you don't pass 0 as height or width or els you'll get Match error.
If you create client with debug flag you'll see which request generates error:
x11.createConnection({debug: true}, function(err, display) {
/// ...
});
i'm test 56 value on CreatePicture still error.
My height and width not zero. i'm testing this code;
x11.createClient({ debug: true },function(err, display) {
var X = display.client;
display.client.require('render', function(err, Render) {
wid = X.AllocID();
var root = display.screen[0].root;
var white = display.screen[0].white_pixel;
var black = display.screen[0].black_pixel;
genislik = display.screen[0].pixel_width;
yukseklik = display.screen[0].pixel_height;
cidWhite = X.AllocID();
cidBlack = X.AllocID();
X.CreateWindow(wid, root, 0, 0, 300, 150, 0, 0, 0, 0, {
backgroundPixel: white,
eventMask: KeyPress | Exposure
});
X.CreateGC(cidBlack, wid, {foreground: black, background: white});
X.MapWindow(wid);
Render.QueryPictFormat(function(deger, formats) {
var pict = X.AllocID();
Render.CreatePicture(pict, wid, 56);
console.log(formats);
});
});
});
Match error;
Error
at Object.ext.CreatePicture (/home/node_modules/x11/lib/ext/render.js:151:26)
at /home/pi/mys.js:132:20
at ReadFixedRequest.callback (/home/node_modules/x11/lib/xcore.js:513:21)
at ReadFixedRequest.execute (/home/node_modules/x11/lib/unpackstream.js:41:10)
at UnpackStream.resume (/home/node_modules/x11/lib/unpackstream.js:165:30)
at UnpackStream.write (/home/node_modules/x11/lib/unpackstream.js:102:10)
at Socket. (/home/node_modules/x11/lib/xcore.js:63:21)
at emitOne (events.js:77:13)
at Socket.emit (events.js:169:7)
at readableAddChunk (_stream_readable.js:146:16)
events.js:141
throw er; // Unhandled 'error' event
^
Error: Bad match
at ReadFixedRequest.callback (/home/node_modules/x11/lib/xcore.js:433:29)
at ReadFixedRequest.execute (/home/node_modules/x11/lib/unpackstream.js:41:10)
at UnpackStream.resume (/home/node_modules/x11/lib/unpackstream.js:165:30)
at UnpackStream.write (/home/node_modules/x11/lib/unpackstream.js:102:10)
at Socket. (/home/node_modules/x11/lib/xcore.js:63:21)
at emitOne (events.js:77:13)
at Socket.emit (events.js:169:7)
at readableAddChunk (_stream_readable.js:146:16)
at Socket.Readable.push (_stream_readable.js:110:10)
at Pipe.onread (net.js:523:20)
xinit: connection to X server lost
I'll try to reproduce on Pi. Your example works fine in ubuntu/virtualbox
Thanks.
Yes this code work in ubuntu. I'm tested on Ubuntu 15.04.
I had the same problem today. Forcing the X server to 24 bit depth apparently solves it.
It looks like the pi's default is simply not to 24 bits (I couldn't find any reliable way to check the actual depth...).
I added this to the /boot/config.txt
file (found here ):
framebuffer_depth=24
framebuffer_ignore_alpha=1
Didn't took the time to test the other way around though.