xref: /openbmc/qemu/hw/display/framebuffer.h (revision ba632924)
1 #ifndef QEMU_FRAMEBUFFER_H
2 #define QEMU_FRAMEBUFFER_H
3 
4 #include "exec/memory.h"
5 
6 /* Framebuffer device helper routines.  */
7 
8 typedef void (*drawfn)(void *, uint8_t *, const uint8_t *, int, int);
9 
10 /* framebuffer_update_memory_section: Update framebuffer
11  * #MemoryRegionSection, for example if the framebuffer is switched to
12  * a different memory area.
13  *
14  * @mem_section: Output #MemoryRegionSection, to be passed to
15  * framebuffer_update_display().
16  * @root: #MemoryRegion within which the framebuffer lies
17  * @base: Base address of the framebuffer within @root.
18  * @rows: Height of the screen.
19  * @src_width: Number of bytes in framebuffer memory between two rows.
20  */
21 void framebuffer_update_memory_section(
22     MemoryRegionSection *mem_section,
23     MemoryRegion *root,
24     hwaddr base,
25     unsigned rows,
26     unsigned src_width);
27 
28 /* framebuffer_update_display: Draw the framebuffer on a surface.
29  *
30  * @ds: #DisplaySurface to draw to.
31  * @mem_section: #MemoryRegionSection provided by
32  * framebuffer_update_memory_section().
33  * @cols: Width the screen.
34  * @rows: Height of the screen.
35  * @src_width: Number of bytes in framebuffer memory between two rows.
36  * @dest_row_pitch: Number of bytes in the surface data between two rows.
37  * Negative if the framebuffer is stored in the opposite order (e.g.
38  * bottom-to-top) compared to the framebuffer.
39  * @dest_col_pitch: Number of bytes in the surface data between two pixels.
40  * Negative if the framebuffer is stored in the opposite order (e.g.
41  * right-to-left) compared to the framebuffer.
42  * @invalidate: True if the function should redraw the whole screen
43  * without checking the DIRTY_MEMORY_VGA dirty bitmap.
44  * @fn: Drawing function to be called for each row that has to be drawn.
45  * @opaque: Opaque pointer passed to @fn.
46  * @first_row: Pointer to an integer, receives the number of the first row
47  * that was drawn (either the first dirty row, or 0 if @invalidate is true).
48  * @last_row: Pointer to an integer, receives the number of the last row that
49  * was drawn (either the last dirty row, or @rows-1 if @invalidate is true).
50  */
51 void framebuffer_update_display(
52     DisplaySurface *ds,
53     MemoryRegionSection *mem_section,
54     int cols,
55     int rows,
56     int src_width,
57     int dest_row_pitch,
58     int dest_col_pitch,
59     int invalidate,
60     drawfn fn,
61     void *opaque,
62     int *first_row,
63     int *last_row);
64 
65 #endif
66