This is an old revision of the document!
[“KGI”] enables to connect APIs of different kinds. One of them (which is part of the KgiAPI) is known as the KGI device API (see also KgiDisplay).
A KGI device is not what we are used to think of e.g a peripheral or anything related to HW. Instead, a KGI device is a piece of code and data using / sharing KgiResources with other KGI devices. Everything that uses the HW resources of a KgiDisplay (mode setting, framebuffer, HW pointers, palettes…) must register itself as a KGI device.
Maybe this layer of KGI was wrongly called devices because /dev/graphic and /dev/event which are the general KGI and KII user entrypoints are from Unix point of view called devices…
Different KGI devices are known currently:
- KgiGraphic, the kernel/user limit for the support of userland ioctl's including mode setting
- KgcRender, the rendering engines of [“KGC”]
Data of a KGI device are:
- The unique identifier of the device
kgi_u_t id;
- The identifier of the KgiDisplay the device interacts with
kgi_u_t dpy_id;
- Various flags
kgi_device_flags_t flags;
- Currently set mode for the device
kgi_mode_t *mode;
- Per device instance private data
kgi_private_t priv;
The three methods of a KGI device are callbacks called by KGI on KGI events:
- When the device is mapped to its display
kgi_device_map_device_fn *MapDevice;
- When the device is unmapped from its display
kgi_device_unmap_device_fn *UnmapDevice;
- When a KiiEvent has to be delivered to the KGI device
kgi_device_handle_event_fn *HandleEvent;
The visible effect of mapping a KgiDevice to a KgiDisplay is the change of mode on that display. Before mapping a device, a mode must have been negociated with its display. When the device is mapped, the display is requested by KGI to set the mode previously negociated. When the device is unmapped, the display is asked to unset the mode before another device is mapped and so on.
Device mapping / unmapping is performed typically when:
- console events occur (special key hit for example) on the KgiFocus the device's display is attached to
- an application sets a mode, it is supposed to take control of the screen: the device, allocated when opening the /dev/graphic Unix device, is then mapped with the mode just negociated
- the console enters DDB (the debugger), the currently mapped KGI device (graphic app or whatelse) is unmapped and the console's KGI device is mapped
The device methods enable the device for example to redraw the screen when mapped or to block anything being performed on the display when unmapped.