If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.
I want to output a pixel on the screen by directly accessing the video memory. How do I do that in C ?
You don't.
Directly accessing video memory is a very complex thing on modern GPUs, and essentially not possible without a metric crapload of supporting code to figure out where you need to write, what format to write it in, and so on. Writing may involve a lot of complex GPU rendering commands and not even allow directly writing to the video memory, or memory might only be accessible through special interfaces (not something you can mmap). Tiled displays and the like make this even more difficult.
Even if someone could provide some code for you, it would likely work on only a specific single chipset. It certainly wouldn't work while the rest of the graphics stack was running.
This isn't the 80s anymore. Or even the 90s. Writing directly to framebuffer memory is not the way to accomplish whatever it is you're trying to do. You're almost certainly better off rendering whatever it is you're doing into a regular block of memory and then using SDL/GL/xlib to blit it to your app's window/buffer.
The only ways I can think of to do this (write to the framebuffer) is to use the Linux framebuffer, or the new kms with gem (I think that allows you to write to the framebuffer.
As far as directly modifying video memory, that's not something most sane people want to attempt. The GPU is almost a computer unto itself these days, with it's own memory management and threading system.
I am trying to build a experimental x server that I have in mind. So I need to learn the low level hair pulling stuff I dont want to use the xlib/x.org.
You might be better off looking into KMS and EGL for your low-level graphics support. e.g, Kristian's Wayland project that's been recently reported on here on Phoronix.
I got the /dev/fb0 working. Any guides on how to write to the framebuffer directly without going through Xlib/DirectFb/etc..
You could checkout the sources of those projects. I'm a bit confused why you don't just use an existing complete low-level graphics library, though -- DirectFB itself might be perfect for your needs.
Comment