console: save current scanout details

Add a new DisplayScanout structure to save the current scanout details.
This allows to attach later UI backends and set the scanout.

Introduce displaychangelistener_display_console() helper function to
handle the dpy_gfx_switch/gl_scanout() & dpy_gfx_update() calls.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
This commit is contained in:
Marc-André Lureau 2021-02-20 16:23:03 +04:00
parent f6ef71bded
commit ebced09185
2 changed files with 138 additions and 54 deletions

View file

@ -108,6 +108,17 @@ struct QemuConsoleClass {
#define QEMU_ALLOCATED_FLAG 0x01
#define QEMU_PLACEHOLDER_FLAG 0x02
typedef struct ScanoutTexture {
uint32_t backing_id;
bool backing_y_0_top;
uint32_t backing_width;
uint32_t backing_height;
uint32_t x;
uint32_t y;
uint32_t width;
uint32_t height;
} ScanoutTexture;
typedef struct DisplaySurface {
pixman_format_code_t format;
pixman_image_t *image;
@ -178,6 +189,22 @@ typedef struct QemuDmaBuf {
bool draw_submitted;
} QemuDmaBuf;
enum display_scanout {
SCANOUT_NONE,
SCANOUT_SURFACE,
SCANOUT_TEXTURE,
SCANOUT_DMABUF,
};
typedef struct DisplayScanout {
enum display_scanout kind;
union {
/* DisplaySurface *surface; is kept in QemuConsole */
ScanoutTexture texture;
QemuDmaBuf *dmabuf;
};
} DisplayScanout;
typedef struct DisplayState DisplayState;
typedef struct DisplayGLCtx DisplayGLCtx;