The manual
ginnOS
The reference: libc, the libraries and the kernel
Loading...
Searching...
No Matches
virtio_gpu.c File Reference

the virtio-gpu display (QEMU -vga virtio, or -device virtio-gpu). More...

Data Structures

struct  __attribute__
 ELF32 file header. More...

Macros

#define DEVICE_ID   0x1050
#define MAX_WIDTH   3840
#define MAX_HEIGHT   2400
#define CMD_GET_DISPLAY_INFO   0x0100
#define CMD_RESOURCE_CREATE_2D   0x0101
#define CMD_RESOURCE_UNREF   0x0102
#define CMD_SET_SCANOUT   0x0103
#define CMD_RESOURCE_FLUSH   0x0104
#define CMD_TRANSFER_TO_HOST_2D   0x0105
#define CMD_RESOURCE_ATTACH_BACKING   0x0106
#define CMD_UPDATE_CURSOR   0x0300
#define CMD_MOVE_CURSOR   0x0301
#define RESP_OK_NODATA   0x1100
#define RESP_OK_DISPLAY_INFO   0x1101
#define FORMAT_B8G8R8A8   1
#define FORMAT_B8G8R8X8   2
#define MAX_SCANOUTS   16
#define EVENT_DISPLAY   1
#define CONFIG_EVENTS_READ   0
#define CONFIG_EVENTS_CLEAR   4

Functions

bool virtio_gpu_init (void)
 find a virtio-gpu, take over the screen from the boot framebuffer and set the size the screen wants.

Detailed Description

the virtio-gpu display (QEMU -vga virtio, or -device virtio-gpu).

2D only. a mode is a resource in guest RAM (contiguous frames) shown on scanout 0; the host sees changes after a transfer and a flush, which the display layer asks for (display_driver_t.flush). the size the screen wants is the QEMU window: the device says when it changes with a configuration interrupt. the pointer is the device's own cursor (a 64 x 64 resource on the cursor queue), so moving it draws nothing.

Macro Definition Documentation

◆ DEVICE_ID

#define DEVICE_ID   0x1050

◆ MAX_WIDTH

#define MAX_WIDTH   3840

◆ MAX_HEIGHT

#define MAX_HEIGHT   2400

◆ CMD_GET_DISPLAY_INFO

#define CMD_GET_DISPLAY_INFO   0x0100

◆ CMD_RESOURCE_CREATE_2D

#define CMD_RESOURCE_CREATE_2D   0x0101

◆ CMD_RESOURCE_UNREF

#define CMD_RESOURCE_UNREF   0x0102

◆ CMD_SET_SCANOUT

#define CMD_SET_SCANOUT   0x0103

◆ CMD_RESOURCE_FLUSH

#define CMD_RESOURCE_FLUSH   0x0104

◆ CMD_TRANSFER_TO_HOST_2D

#define CMD_TRANSFER_TO_HOST_2D   0x0105

◆ CMD_RESOURCE_ATTACH_BACKING

#define CMD_RESOURCE_ATTACH_BACKING   0x0106

◆ CMD_UPDATE_CURSOR

#define CMD_UPDATE_CURSOR   0x0300

◆ CMD_MOVE_CURSOR

#define CMD_MOVE_CURSOR   0x0301

◆ RESP_OK_NODATA

#define RESP_OK_NODATA   0x1100

◆ RESP_OK_DISPLAY_INFO

#define RESP_OK_DISPLAY_INFO   0x1101

◆ FORMAT_B8G8R8A8

#define FORMAT_B8G8R8A8   1

◆ FORMAT_B8G8R8X8

#define FORMAT_B8G8R8X8   2

◆ MAX_SCANOUTS

#define MAX_SCANOUTS   16

◆ EVENT_DISPLAY

#define EVENT_DISPLAY   1

◆ CONFIG_EVENTS_READ

#define CONFIG_EVENTS_READ   0

◆ CONFIG_EVENTS_CLEAR

#define CONFIG_EVENTS_CLEAR   4

Function Documentation

◆ virtio_gpu_init()

bool virtio_gpu_init ( void )

find a virtio-gpu, take over the screen from the boot framebuffer and set the size the screen wants.

call after fb_init and display_init.

Returns
false if there is no virtio-gpu (the boot framebuffer stays).