Doesn't work on virtual framebuffers
Opened this issue · 2 comments
I eventually want to use this on a Raspberry Pi with the new "fbtft" drivers, but I'm currently trying to set up a development environment on my desktop system.
So I created a virtual framebuffer, and set it up to look like my small TFT:
# modprobe vfb vfb_enable=1
# chown `id -u`:`id -u` /dev/fb1
# fbset -fb /dev/fb1 -xres 128 -yres 64 -depth 32
To test that it worked I copied garbage to it:
cat /dev/urandom > /dev/fb1
And checked with fbgrab
that it did indeed add garbage:
fbgrab -d /dev/fb1 foo.png
That worked, I can now clear the framebuffer:
cat /dev/zero > /dev/fb1
(checking the result again gives us a black screen)
Now, using this stripped down version of the example:
from cairotft import tft
import cairocffi
class MyDisplay(tft.TftDisplay):
def __init__(self):
super(MyDisplay, self).__init__(interface='/dev/fb1', cairo_format=cairocffi.FORMAT_ARGB32)
def draw_interface(self, ctx):
self.blank_screen(ctx=ctx,
color=(1.0, 0.0, 0.0, 1.0),
blit=True)
if __name__ == '__main__':
disp = MyDisplay()
disp.run()
Gives me the attached output, instead of a red screen. Any ideas?
Note that my test changed slightly.
I used a 16bpp framebuffer:
fbset -fb /dev/fb1 -xres 128 -yres 64 -depth 16
And changed the format to match:
from cairotft import tft
import cairocffi
class MyDisplay(tft.TftDisplay):
def __init__(self):
super(MyDisplay, self).__init__(interface='/dev/fb1', cairo_format=cairocffi.FORMAT_RGB16_565)
def draw_interface(self, ctx):
self.blank_screen(ctx=ctx,
color=(1.0, 0.0, 0.0),
blit=True)
if __name__ == '__main__':
disp = MyDisplay()
disp.run()