Raspi: Can't write to framebuffer?
Posted: Sat Feb 13, 2016 12:16 am
Hey again guys,
I've been running into some bumps trying to write an OS for Raspberry Pi. Note I'm using (and thus writing for) a Pi 2 Model B, in case that matters.
I've started communicating with the GPU via the "mailbox" and I can get it to send me an address for a framebuffer. When I do so, the screen goes blank (previously showing the rainbow thing). So things SEEM to work okay. But...
I can't write any pixels to it.
In one example, I have requested a 640x480x32-bit frame buffer, and I was given one by the GPU of the appropriate size, pitch, etc, at address 0xFDACE000.
So I start writing some pixels within the region right after 0xFDACE00. But it doesn't work. I see nothing on the monitor and if I read back that memory address, I always get zero. This is from my serial log:
I've double-checked that the addresses I'm writing the pixels to are correct (you can do the calculations of the pixels shown in my log to see).
Why isn't it letting me change the pixels? This has been driving me crazy for a week.
Code for framebuffer is here: framebuffer.cpp
Code that is calling it to set pixels is here: kernel.cpp (Line 113)
Thanks for any help you can provide.
I've been running into some bumps trying to write an OS for Raspberry Pi. Note I'm using (and thus writing for) a Pi 2 Model B, in case that matters.
I've started communicating with the GPU via the "mailbox" and I can get it to send me an address for a framebuffer. When I do so, the screen goes blank (previously showing the rainbow thing). So things SEEM to work okay. But...
I can't write any pixels to it.
In one example, I have requested a 640x480x32-bit frame buffer, and I was given one by the GPU of the appropriate size, pitch, etc, at address 0xFDACE000.
So I start writing some pixels within the region right after 0xFDACE00. But it doesn't work. I see nothing on the monitor and if I read back that memory address, I always get zero. This is from my serial log:
Code: Select all
[INFO:Framebuffer]: Initialized 1228800-byte framebuffer at 640x480x32bpp (pitch 2560) at FDACE000. Virtual offset is 0.
[INFO:Framebuffer]: Setting pixel (100,100) at 0xFDB0C990 to (255, 0, 255)
[WARNING:KernelMain]: Unable to set pixel, value was 0x0
[INFO:Framebuffer]: Setting pixel (101,100) at 0xFDB0C994 to (255, 0, 255)
[WARNING:KernelMain]: Unable to set pixel, value was 0x0
[INFO:Framebuffer]: Setting pixel (102,100) at 0xFDB0C998 to (255, 0, 255)
[WARNING:KernelMain]: Unable to set pixel, value was 0x0
Why isn't it letting me change the pixels? This has been driving me crazy for a week.
Code for framebuffer is here: framebuffer.cpp
Code that is calling it to set pixels is here: kernel.cpp (Line 113)
Thanks for any help you can provide.