Video driver design question
Posted: Fri Jan 27, 2006 4:59 pm
I have developed some basic code which switches video modes and all that, I have a dinky little box for a mouse which changes colours when I click the buttons. It's a good test of the correctness of the code, but has no real design.
So want to design a good driver system and the thing that is really holding me up is video. I have no idea how I want to present the driver to rest of the system.
I would love to have my video server to be a user space application. How should it draw graphics? Should my video driver itself provide primitives like drawPixel, drawLine, drawRect, etc? I feel that any access to these would be slow.
So now I am thinking, well i'll just make my video driver be able to switch modes, and return basic information on it such as where the LFB is in memory. Now my current idea is to have a system call which would let an app ask to have a block of memory mapped into it's address space so the process would do something like the following:
(syscall may become ioctl in the future if i ever have them)
execute syscall: enumerate_video_modes
pick a mode
execute syscall: switch_video_mode
execute syscall: get_linear_frame_buffer
execute syscall: map_memory (passing LFB address and where i would like it in my process)
from this point on, the application, would have direct access to video memory which would be nice and fast...
But this seems like an awful security flaw, since an application could just map memory and write it and such. I mean we could put limitations on this, such as an application may not map memory owned by another process, fine that's better, but now there is a "false" gui attack that can happen if some malicious application requests the memory first.
So what do you guys think? Anyone implemented any good systems for user mode graphics?
proxy
So want to design a good driver system and the thing that is really holding me up is video. I have no idea how I want to present the driver to rest of the system.
I would love to have my video server to be a user space application. How should it draw graphics? Should my video driver itself provide primitives like drawPixel, drawLine, drawRect, etc? I feel that any access to these would be slow.
So now I am thinking, well i'll just make my video driver be able to switch modes, and return basic information on it such as where the LFB is in memory. Now my current idea is to have a system call which would let an app ask to have a block of memory mapped into it's address space so the process would do something like the following:
(syscall may become ioctl in the future if i ever have them)
execute syscall: enumerate_video_modes
pick a mode
execute syscall: switch_video_mode
execute syscall: get_linear_frame_buffer
execute syscall: map_memory (passing LFB address and where i would like it in my process)
from this point on, the application, would have direct access to video memory which would be nice and fast...
But this seems like an awful security flaw, since an application could just map memory and write it and such. I mean we could put limitations on this, such as an application may not map memory owned by another process, fine that's better, but now there is a "false" gui attack that can happen if some malicious application requests the memory first.
So what do you guys think? Anyone implemented any good systems for user mode graphics?
proxy