Changes between Initial Version and Version 1 of fbf_device_api


Ignore:
Timestamp:
Jan 20, 2020, 3:10:40 PM (5 years ago)
Author:
alain
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • fbf_device_api

    v1 v1  
     1= FBF device API =
     2
     3[[PageOutline]]
     4
     5== __A) General principles__ ==
     6
     7This device provide access to an external graphic display, that is seen as a fixed size frame buffer, mapped in the kernel address space. The only pixel encoding type in the current implementation is one byte per pixel (256 levels of gray).
     8
     9It defines a first API, implementing the user syscalls, and implementing a simple, kernel controlled, windows manager.
     10This windows manager allows any process to create and use for display one (or several) window(s). Each window defines a private buffer, dynamically allocated in user space, that can be directly accessed (for read and write) by the owner process.
     11
     12These windows can be moved in the frame buffer, they can be resized, they can overlap other windows, but a window must be entirely contained in the frame buffer.
     13
     14To avoid contention, the window descriptor, and the associated user buffer are not allocated in the cluster containing the FBF chdev, but are distributed: each window is allocated in the cluster defined by the thread that required the window creation.
     15
     16Each window has a single process owner, but all the windows are registered in the FBF chdev in a windows_tbl[] array, indexed by the window identifier (wid). Each array entry contains an extended pointer on the window descriptor. All windows are also registered in a trans-cluster xlist, defining the overlapping order (last window in xlist has the highest priority).
     17
     18All FBF access functions are defined in the [https://www-soc.lip6.fr/trac/almos-mkh/kernel/devices/dev_fbf.c  dev_fbf.c] et [https://www-soc.lip6.fr/trac/almos-mkh/kernel/devices/dev_fbf.h dev_fbf.h] files.
     19
     20== __B) Initialisation__ ==
     21
     22The '''dev_fbf_init()''' function completes the FBF chdev descriptor initialisation. It calls the specific driver initialisation function, to initialise the specific hardware device, and initializes the FBF chdev extension. It must be called by a local thread.
     23
     24== __C) Sys-calls API__ ==
     25
     26The ''syscalls'' API define the following access functions, that do NOT use the the FBF device waiting queue, the associated
     27device thread and the FBF IRQ, as the client thread does NOT deschedules,
     28
     29=== C.1) dev_fbf_get_config() ===
     30
     31This function implements the ''fbf_get_config()'' syscall. It returns the FBF number of lines, the number of pixels per line, and the pixel encoding type. It can be called by a client thread running in any cluster.
     32It does not access the hardware, as the size and type have been registered in the chdev descriptor extension by the dev_fbf_init() function.
     33
     34=== C.2) dev_fbf_create_window() ===
     35
     36This blocking function implements the ''fbf_create_window()'' sys-call. It registers a new window in the windows_tbl[] array, and in the windows list, rooted in FBF device descriptor. It registers in the reference VSL an ANON vseg, that will be mapped in local cluster. The window index <wid> is dynamically allocated. The owner process is the calling process. The FBF window is defined by the <nlines>, <npixels>, <l_min>, <p_min> arguments. The created vseg base address in user space is returned in the <user_base> argument. It can be called by any thread running in any cluster.
     37
     38As the vseg associated to the window is not directly  mapped to the frame buffer, the owner process can read and write in the window buffer without syscall. As for any other vseg, the physical memory is allocated on demand, at each page fault.
     39
     40=== C.3) dev_fbf_refresh_window() ===
     41
     42This blocking function implements the ''fbf_refresh_window()'' sys-call. It allows the owner process to signal the windows manager that some lines of a window identified by the <wid>, <line_min>, and <line_max> arguments have been modified, and must be refreshed in the FBF. It scans all the registered FBF windows to respect the overlap order defined by the windows xlist. It can be called by any thread running in any cluster.
     43
     44=== C.4) dev_fbf_move_window() ===
     45
     46This blocking function implements the ''fbf_move_window()'' sys-call. It moves a window identified by the <wid> argument to a new position in the FBF, defined by the <l_min> and <p_min> arguments. It can be called by any thread running in any cluster.
     47
     48=== C.5) dev_fbf_resize_window() ===
     49
     50This blocking function implements the ''fbf_resize_window()'' syscall. It changes the <width> and <height> of a window identified by the <wid> argument. It updates the size of the associated vseg, but does not change the vseg "base". When the new window buffer is larger than the existing one, this buffer is 0 filled. It can be called by any thread running in any cluster.
     51
     52=== C.6) dev_fbf_delete_window() ===
     53
     54This function implements the ''fbf_delete_window()'' syscall to delete a FBF window. It releases all memory allocated for the window buffer and for the window descriptor. It can be called by any thread running in any cluster.
     55
     56=== C.7) dev_fbf_move_data() ===
     57
     58This function implements the deprecated ''fbf_read()'' and ''fbf_write()'' sys-calls.
     59 * 2) Two extra syscalls exist but are deprecated:
     60 * - FBF_DIRECT_WRITE   : move synchronously pixels from an user buffer to the FBF.
     61 * - FBF_DIRECT_READ    : move synchronously pixels from the FBF to an user buffer.
     62 *
     63 * For these deprecated operations, the client thread calls
     64 * directly the driver to move data between the user buffer and the FBF.
     65 *
     66
     67=== C) Drivers API FBF The FBF device defines defines four command types to access FBF driver(s) :
     68 * - FBF_DRIVER_KERNEL_WRITE : move pixels from a kernel window to the FBF.
     69 * - FBF_DRIVER_KERNEL_READ  : move pixels from the FBF to a kernel window.
     70 * - FBF_DRIVER_USER_WRITE   : move bytes from an user buffer to the FBF.
     71 * - FBF_DRIVER_USER_READ    : move bytes from the FBF to an user buffer.
     72 *
     73 * Note: As we don'