DevVGA.h revision 12686bbcc13404db8fc0d9ddafea5a519b5376cd
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync/* $Id$ */
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync/** @file
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync * DevVGA - VBox VGA/VESA device, internal header.
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync */
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync/*
b3eb676cebf5407921b8f535095ca7655edb9db3vboxsync * Copyright (C) 2006-2007 Oracle Corporation
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync *
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync * available from http://www.virtualbox.org. This file is free software;
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync * you can redistribute it and/or modify it under the terms of the GNU
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync * General Public License (GPL) as published by the Free Software
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync * --------------------------------------------------------------------
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync *
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync * This code is based on:
8f28e374e0b8ea801e7b5364bccd8a7e0a6211d3vboxsync *
8f28e374e0b8ea801e7b5364bccd8a7e0a6211d3vboxsync * QEMU internal VGA defines.
8f28e374e0b8ea801e7b5364bccd8a7e0a6211d3vboxsync *
8f28e374e0b8ea801e7b5364bccd8a7e0a6211d3vboxsync * Copyright (c) 2003-2004 Fabrice Bellard
8f28e374e0b8ea801e7b5364bccd8a7e0a6211d3vboxsync *
8f28e374e0b8ea801e7b5364bccd8a7e0a6211d3vboxsync * Permission is hereby granted, free of charge, to any person obtaining a copy
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync * of this software and associated documentation files (the "Software"), to deal
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync * in the Software without restriction, including without limitation the rights
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync * copies of the Software, and to permit persons to whom the Software is
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync * furnished to do so, subject to the following conditions:
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync *
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync * The above copyright notice and this permission notice shall be included in
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync * all copies or substantial portions of the Software.
ea4433aedd4105e6599e57e0c5f6cb32a68e963cvboxsync *
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync * THE SOFTWARE.
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync */
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync#ifdef VBOX
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync/** The default amount of VRAM. */
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync# define VGA_VRAM_DEFAULT (_4M)
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync/** The maximum amount of VRAM. Limited by VBOX_MAX_ALLOC_PAGE_COUNT. */
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync# define VGA_VRAM_MAX (256 * _1M)
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync/** The minimum amount of VRAM. */
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync# define VGA_VRAM_MIN (_1M)
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync#endif
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync#ifdef VBOX_WITH_HGSMI
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync# include "HGSMI/HGSMIHost.h"
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync#endif /* VBOX_WITH_HGSMI */
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync#include "DevVGASavedState.h"
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync#define MSR_COLOR_EMULATION 0x01
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync#define MSR_PAGE_SELECT 0x20
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync#define ST01_V_RETRACE 0x08
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync#define ST01_DISP_ENABLE 0x01
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync/* bochs VBE support */
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync#define CONFIG_BOCHS_VBE
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync#ifdef VBOX
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync#define VBE_DISPI_MAX_XRES 16384
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync#define VBE_DISPI_MAX_YRES 16384
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync#else
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync#define VBE_DISPI_MAX_XRES 1600
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync#define VBE_DISPI_MAX_YRES 1200
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync#endif
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync#define VBE_DISPI_MAX_BPP 32
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync#define VBE_DISPI_INDEX_ID 0x0
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync#define VBE_DISPI_INDEX_XRES 0x1
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync#define VBE_DISPI_INDEX_YRES 0x2
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync#define VBE_DISPI_INDEX_BPP 0x3
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync#define VBE_DISPI_INDEX_ENABLE 0x4
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync#define VBE_DISPI_INDEX_BANK 0x5
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync#define VBE_DISPI_INDEX_VIRT_WIDTH 0x6
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync#define VBE_DISPI_INDEX_VIRT_HEIGHT 0x7
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync#define VBE_DISPI_INDEX_X_OFFSET 0x8
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync#define VBE_DISPI_INDEX_Y_OFFSET 0x9
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync#define VBE_DISPI_INDEX_VBOX_VIDEO 0xa
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync#define VBE_DISPI_INDEX_NB_SAVED 0xb /* Number of saved registers (vbe_regs array) */
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync#define VBE_DISPI_INDEX_NB 0xb /* Total number of VBE registers */
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync#define VBE_DISPI_ID0 0xB0C0
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync#define VBE_DISPI_ID1 0xB0C1
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync#define VBE_DISPI_ID2 0xB0C2
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync#define VBE_DISPI_ID3 0xB0C3
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync#define VBE_DISPI_ID4 0xB0C4
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync#ifdef VBOX
ea4433aedd4105e6599e57e0c5f6cb32a68e963cvboxsync/* The VBOX interface id. Indicates support for VBE_DISPI_INDEX_VBOX_VIDEO. */
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync#define VBE_DISPI_ID_VBOX_VIDEO 0xBE00
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync#ifdef VBOX_WITH_HGSMI
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync/* The VBOX interface id. Indicates support for VBVA shared memory interface. */
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync#define VBE_DISPI_ID_HGSMI 0xBE01
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync#endif /* VBOX_WITH_HGSMI */
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync#endif /* VBOX */
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync#define VBE_DISPI_DISABLED 0x00
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync#define VBE_DISPI_ENABLED 0x01
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync#define VBE_DISPI_GETCAPS 0x02
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync#define VBE_DISPI_8BIT_DAC 0x20
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync#define VBE_DISPI_LFB_ENABLED 0x40
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync#define VBE_DISPI_NOCLEARMEM 0x80
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync#define VBE_DISPI_LFB_PHYSICAL_ADDRESS 0xE0000000
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync#ifdef CONFIG_BOCHS_VBE
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync#define VGA_STATE_COMMON_BOCHS_VBE \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint16_t vbe_index; \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint16_t vbe_regs[VBE_DISPI_INDEX_NB_SAVED];\
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint32_t vbe_start_addr; \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint32_t vbe_line_offset; \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint32_t vbe_bank_max;
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync#else
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync#define VGA_STATE_COMMON_BOCHS_VBE
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync#endif /* !CONFIG_BOCHS_VBE */
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync#define CH_ATTR_SIZE (160 * 100)
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync#define VGA_MAX_HEIGHT VBE_DISPI_MAX_YRES
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync#ifndef VBOX
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync#define VGA_STATE_COMMON \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint8_t *vram_ptr; \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync unsigned long vram_offset; \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync unsigned int vram_size; \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint32_t latch; \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint8_t sr_index; \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint8_t sr[256]; \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint8_t gr_index; \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint8_t gr[256]; \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint8_t ar_index; \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint8_t ar[21]; \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync int ar_flip_flop; \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint8_t cr_index; \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint8_t cr[256]; /* CRT registers */ \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint8_t msr; /* Misc Output Register */ \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint8_t fcr; /* Feature Control Register */ \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint8_t st00; /* status 0 */ \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint8_t st01; /* status 1 */ \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint8_t dac_state; \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint8_t dac_sub_index; \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint8_t dac_read_index; \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint8_t dac_write_index; \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint8_t dac_cache[3]; /* used when writing */ \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint8_t palette[768]; \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync int32_t bank_offset; \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync int (*get_bpp)(struct VGAState *s); \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync void (*get_offsets)(struct VGAState *s, \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint32_t *pline_offset, \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint32_t *pstart_addr, \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint32_t *pline_compare); \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync void (*get_resolution)(struct VGAState *s, \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync int *pwidth, \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync int *pheight); \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync VGA_STATE_COMMON_BOCHS_VBE \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync /* display refresh support */ \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync DisplayState *ds; \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint32_t font_offsets[2]; \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync int graphic_mode; \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint8_t shift_control; \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint8_t double_scan; \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint32_t line_offset; \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint32_t line_compare; \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint32_t start_addr; \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint32_t plane_updated; \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint8_t last_cw, last_ch; \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint32_t last_width, last_height; /* in chars or pixels */ \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint32_t last_scr_width, last_scr_height; /* in pixels */ \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint8_t cursor_start, cursor_end; \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint32_t cursor_offset; \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync unsigned int (*rgb_to_pixel)(unsigned int r, \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync unsigned int g, unsigned b); \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync /* hardware mouse cursor support */ \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint32_t invalidated_y_table[VGA_MAX_HEIGHT / 32]; \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync void (*cursor_invalidate)(struct VGAState *s); \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync void (*cursor_draw_line)(struct VGAState *s, uint8_t *d, int y); \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync /* tell for each page if it has been updated since the last time */ \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint32_t last_palette[256]; \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint32_t last_ch_attr[CH_ATTR_SIZE]; /* XXX: make it dynamic */
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync#else /* VBOX */
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsyncstruct VGAState;
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsynctypedef int FNGETBPP(struct VGAState *s);
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsynctypedef void FNGETOFFSETS(struct VGAState *s, uint32_t *pline_offset, uint32_t *pstart_addr, uint32_t *pline_compare);
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsynctypedef void FNGETRESOLUTION(struct VGAState *s, int *pwidth, int *pheight);
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsynctypedef unsigned int FNRGBTOPIXEL(unsigned int r, unsigned int g, unsigned b);
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsynctypedef void FNCURSORINVALIDATE(struct VGAState *s);
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsynctypedef void FNCURSORDRAWLINE(struct VGAState *s, uint8_t *d, int y);
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync/* bird: vram_offset have been remove, function pointers declared external,
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync some type changes, and some padding have been added. */
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync#define VGA_STATE_COMMON \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync R3PTRTYPE(uint8_t *) vram_ptrR3; \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint32_t vram_size; \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint32_t latch; \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint8_t sr_index; \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint8_t sr[256]; \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint8_t gr_index; \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint8_t gr[256]; \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint8_t ar_index; \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint8_t ar[21]; \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync int32_t ar_flip_flop; \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint8_t cr_index; \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint8_t cr[256]; /* CRT registers */ \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint8_t msr; /* Misc Output Register */ \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint8_t fcr; /* Feature Control Register */ \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint8_t st00; /* status 0 */ \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint8_t st01; /* status 1 */ \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint8_t dac_state; \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint8_t dac_sub_index; \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint8_t dac_read_index; \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint8_t dac_write_index; \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint8_t dac_cache[3]; /* used when writing */ \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint8_t palette[768]; \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync int32_t bank_offset; \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync int32_t padding0; \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync R3PTRTYPE(FNGETBPP *) get_bpp; \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync R3PTRTYPE(FNGETOFFSETS *) get_offsets; \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync R3PTRTYPE(FNGETRESOLUTION *) get_resolution; \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync VGA_STATE_COMMON_BOCHS_VBE \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync /* display refresh support */ \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint32_t font_offsets[2]; \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync int32_t graphic_mode; \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint8_t shift_control; \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint8_t double_scan; \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint8_t padding1[2]; \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint32_t line_offset; \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint32_t line_compare; \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint32_t start_addr; \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint32_t plane_updated; \
ea4433aedd4105e6599e57e0c5f6cb32a68e963cvboxsync uint8_t last_cw, last_ch, padding2[2]; \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint32_t last_width, last_height; /* in chars or pixels */ \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint32_t last_scr_width, last_scr_height; /* in pixels */ \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint32_t last_bpp; \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint8_t cursor_start, cursor_end, padding3[2]; \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint32_t cursor_offset; \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint32_t padding4; \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync R3PTRTYPE(FNRGBTOPIXEL *) rgb_to_pixel; \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync /* hardware mouse cursor support */ \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint32_t invalidated_y_table[VGA_MAX_HEIGHT / 32]; \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync R3PTRTYPE(FNCURSORINVALIDATE *) cursor_invalidate; \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync R3PTRTYPE(FNCURSORDRAWLINE *) cursor_draw_line; \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync /* tell for each page if it has been updated since the last time */ \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint32_t last_palette[256]; \
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint32_t last_ch_attr[CH_ATTR_SIZE]; /* XXX: make it dynamic */
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync#endif /* VBOX */
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync#ifdef VBOX_WITH_VDMA
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsynctypedef struct VBOXVDMAHOST *PVBOXVDMAHOST;
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync#endif
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsynctypedef struct VGAState {
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync VGA_STATE_COMMON
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync#ifdef VBOX
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync /** end-of-common-state-marker */
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint32_t u32Marker;
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync /** The physical address the VRAM was assigned. */
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync RTGCPHYS32 GCPhysVRAM;
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync /** The R0 vram pointer... */
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync R0PTRTYPE(uint8_t *) vram_ptrR0;
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync /** Pointer to the GC vram mapping. */
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync RCPTRTYPE(uint8_t *) vram_ptrRC;
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync /** LFB was updated flag. */
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync bool fLFBUpdated;
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync /** Indicates if the GC extensions are enabled or not. */
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync bool fGCEnabled;
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync /** Indicates if the R0 extensions are enabled or not. */
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync bool fR0Enabled;
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync /** Flag indicating that there are dirty bits. This is used to optimize the handler resetting. */
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync bool fHasDirtyBits;
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync /** Flag indicating that the VGA memory in the 0xa0000-0xbffff region has been remapped to allow direct access. */
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync bool fRemappedVGA;
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync /** Whether to render the guest VRAM to the framebuffer memory. False only for some LFB modes. */
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync bool fRenderVRAM;
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync bool Padding1[2];
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint32_t cMonitors;
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync#ifdef VBOX_WITH_HGSMI
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync R3PTRTYPE(PHGSMIINSTANCE) pHGSMI;
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync#endif /* VBOX_WITH_HGSMI */
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync#ifdef VBOX_WITH_VDMA
ea4433aedd4105e6599e57e0c5f6cb32a68e963cvboxsync R3PTRTYPE(PVBOXVDMAHOST) pVdma;
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync#endif
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync /** Current refresh timer interval. */
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint32_t Padding2;
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint32_t cMilliesRefreshInterval;
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync /** Refresh timer handle - HC. */
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync PTMTIMERR3 RefreshTimer;
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync /** Bitmap tracking dirty pages. */
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint32_t au32DirtyBitmap[VGA_VRAM_MAX / PAGE_SIZE / 32];
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync /** Pointer to vgaGCLFBAccessHandler(). */
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync RTRCPTR RCPtrLFBHandler;
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync /** Pointer to the device instance - RC Ptr. */
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync PPDMDEVINSRC pDevInsRC;
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync /** Pointer to the device instance - R3 Ptr. */
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync PPDMDEVINSR3 pDevInsR3;
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync /** Pointer to the device instance - R0 Ptr. */
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync PPDMDEVINSR0 pDevInsR0;
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync /** The critical section. */
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync PDMCRITSECT lock;
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync /** LUN\#0: The display port base interface. */
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync PDMIBASE IBase;
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync /** LUN\#0: The display port interface. */
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync PDMIDISPLAYPORT IPort;
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync#if defined(VBOX_WITH_HGSMI) && defined(VBOX_WITH_VIDEOHWACCEL)
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync /** LUN\#0: VBVA callbacks interface */
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync PDMIDISPLAYVBVACALLBACKS IVBVACallbacks;
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync#else
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync# if HC_ARCH_BITS == 32
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint32_t Padding3;
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync# endif
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync#endif
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync /** Pointer to base interface of the driver. */
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync R3PTRTYPE(PPDMIBASE) pDrvBase;
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync /** Pointer to display connector interface of the driver. */
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync R3PTRTYPE(PPDMIDISPLAYCONNECTOR) pDrv;
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync /** The PCI device. */
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync PCIDEVICE Dev;
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync STAMPROFILE StatRZMemoryRead;
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync STAMPROFILE StatR3MemoryRead;
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync STAMPROFILE StatRZMemoryWrite;
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync STAMPROFILE StatR3MemoryWrite;
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync STAMCOUNTER StatMapPage; /**< Counts IOMMMIOMapMMIO2Page calls. */
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync STAMCOUNTER StatUpdateDisp; /**< Counts vgaPortUpdateDisplay calls. */
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync /* Keep track of ring 0 latched accesses to the VGA MMIO memory. */
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint64_t u64LastLatchedAccess;
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint32_t cLatchAccesses;
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint16_t uMaskLatchAccess;
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint16_t iMask;
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync#ifdef VBE_BYTEWISE_IO
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync /** VBE read/write data/index flags */
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint8_t fReadVBEData;
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint8_t fWriteVBEData;
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint8_t fReadVBEIndex;
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint8_t fWriteVBEIndex;
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync /** VBE write data/index one byte buffer */
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint8_t cbWriteVBEData;
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint8_t cbWriteVBEIndex;
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync# ifdef VBE_NEW_DYN_LIST
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync /** VBE Extra Data write address one byte buffer */
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint8_t cbWriteVBEExtraAddress;
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint8_t Padding4;
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync# else
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint8_t Padding4[2];
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync# endif
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync#endif
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync#ifdef VBE_NEW_DYN_LIST
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync /** The VBE BIOS extra data. */
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync R3PTRTYPE(uint8_t *) pu8VBEExtraData;
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync /** The size of the VBE BIOS extra data. */
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint16_t cbVBEExtraData;
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync /** The VBE BIOS current memory address. */
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint16_t u16VBEExtraAddress;
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint16_t Padding5[2];
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync#endif
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync /** Current logo data offset. */
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint32_t offLogoData;
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync /** The size of the BIOS logo data. */
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint32_t cbLogo;
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync /** The BIOS logo data. */
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync R3PTRTYPE(uint8_t *) pu8Logo;
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync /** The name of the logo file. */
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync R3PTRTYPE(char *) pszLogoFile;
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync /** Bitmap image data. */
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync R3PTRTYPE(uint8_t *) pu8LogoBitmap;
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync /** Current logo command. */
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint16_t LogoCommand;
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync /** Bitmap width. */
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint16_t cxLogo;
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync /** Bitmap height. */
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint16_t cyLogo;
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync /** Bitmap planes. */
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint16_t cLogoPlanes;
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync /** Bitmap depth. */
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint16_t cLogoBits;
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync /** Bitmap compression. */
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint16_t LogoCompression;
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync /** Bitmap colors used. */
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint16_t cLogoUsedColors;
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync /** Palette size. */
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint16_t cLogoPalEntries;
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync /** Clear screen flag. */
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint8_t fLogoClearScreen;
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint8_t Padding6[7];
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync /** Palette data. */
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint32_t au32LogoPalette[256];
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync#endif /* VBOX */
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync#ifdef VBOX_WITH_HGSMI
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync /** Base port in the assigned PCI I/O space. */
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync RTIOPORT IOPortBase;
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync#ifdef VBOX_WITH_WDDM
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint8_t Padding7[2];
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync /* specifies guest driver caps, i.e. whether it can handle IRQs from the adapter,
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync * the way it can handle async HGSMI command completion, etc. */
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint32_t fGuestCaps;
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync#else
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint8_t Padding7[6];
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync#endif
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync#endif /* VBOX_WITH_HGSMI */
ea4433aedd4105e6599e57e0c5f6cb32a68e963cvboxsync} VGAState;
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync#ifdef VBOX
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync/** VGA state. */
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsynctypedef VGAState VGASTATE;
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync/** Pointer to the VGA state. */
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsynctypedef VGASTATE *PVGASTATE;
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync#endif
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync#ifdef VBE_NEW_DYN_LIST
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync/**
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync * VBE Bios Extra Data structure.
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync * @remark duplicated in vbe.h.
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync */
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsynctypedef struct VBEHeader
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync{
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync /** Signature (VBEHEADER_MAGIC). */
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint16_t u16Signature;
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync /** Data size. */
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync uint16_t cbData;
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync} VBEHeader;
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync/** VBE Extra Data. */
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsynctypedef VBEHeader VBEHEADER;
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync/** Pointer to the VBE Extra Data. */
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsynctypedef VBEHEADER *PVBEHEADER;
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync/** The value of the VBEHEADER::u16Signature field.
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync * @remark duplicated in vbe.h. */
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync#define VBEHEADER_MAGIC 0x77CC
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync
ea4433aedd4105e6599e57e0c5f6cb32a68e963cvboxsync/** The extra port which is used to read the mode list.
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync * @remark duplicated in vbe.h. */
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync#define VBE_EXTRA_PORT 0x3b6
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync/** The extra port which is used for debug printf.
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync * @remark duplicated in vbe.h. */
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync#define VBE_PRINTF_PORT 0x3b7
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync#endif /* VBE_NEW_DYN_LIST */
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync#if !defined(VBOX) || defined(IN_RING3)
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsyncstatic inline int c6_to_8(int v)
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync{
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync int b;
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync v &= 0x3f;
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync b = v & 1;
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync return (v << 2) | (b << 1) | b;
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync}
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync#endif /* !VBOX || IN_RING3 */
ea4433aedd4105e6599e57e0c5f6cb32a68e963cvboxsync
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync#ifdef VBOX_WITH_HGSMI
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsyncint VBVAInit (PVGASTATE pVGAState);
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsyncvoid VBVADestroy (PVGASTATE pVGAState);
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsyncint VBVAUpdateDisplay (PVGASTATE pVGAState);
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsyncvoid VBVAReset (PVGASTATE pVGAState);
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsyncbool VBVAIsEnabled(PVGASTATE pVGAState);
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync/* @return host-guest flags that were set on reset
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync * this allows the caller to make further cleaning when needed,
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync * e.g. reset the IRQ */
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsyncuint32_t HGSMIReset (PHGSMIINSTANCE pIns);
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync# ifdef VBOX_WITH_VIDEOHWACCEL
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsyncint vbvaVHWACommandCompleteAsynch(PPDMIDISPLAYVBVACALLBACKS pInterface, PVBOXVHWACMD pCmd);
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsyncint vbvaVHWAConstruct (PVGASTATE pVGAState);
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsyncint vbvaVHWADisable (PVGASTATE pVGAState);
ea4433aedd4105e6599e57e0c5f6cb32a68e963cvboxsyncint vbvaVHWAReset (PVGASTATE pVGAState);
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsyncint vboxVBVASaveStatePrep (PPDMDEVINS pDevIns, PSSMHANDLE pSSM);
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync# endif
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsyncint vboxVBVASaveStateExec (PPDMDEVINS pDevIns, PSSMHANDLE pSSM);
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsyncint vboxVBVALoadStateExec (PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t u32Version);
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsyncint vboxVBVALoadStateDone (PPDMDEVINS pDevIns, PSSMHANDLE pSSM);
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync# ifdef VBOX_WITH_VDMA
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsynctypedef struct VBOXVDMAHOST *PVBOXVDMAHOST;
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsyncint vboxVDMAConstruct(PVGASTATE pVGAState, struct VBOXVDMAHOST **ppVdma, uint32_t cPipeElements);
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsyncint vboxVDMADestruct(PVBOXVDMAHOST pVdma);
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsyncvoid vboxVDMAControl(PVBOXVDMAHOST pVdma, PVBOXVDMA_CTL pCmd);
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsyncvoid vboxVDMACommand(PVBOXVDMAHOST pVdma, PVBOXVDMACBUF_DR pCmd);
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsyncbool vboxVDMAIsEnabled(PVBOXVDMAHOST pVdma);
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync# endif /* VBOX_WITH_VDMA */
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync#endif /* VBOX_WITH_HGSMI */
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync#ifndef VBOX
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsyncvoid vga_common_init(VGAState *s, DisplayState *ds, uint8_t *vga_ram_base,
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync unsigned long vga_ram_offset, int vga_ram_size);
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsyncuint32_t vga_mem_readb(void *opaque, target_phys_addr_t addr);
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsyncvoid vga_mem_writeb(void *opaque, target_phys_addr_t addr, uint32_t val);
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsyncvoid vga_invalidate_scanlines(VGAState *s, int y1, int y2);
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsyncvoid vga_draw_cursor_line_8(uint8_t *d1, const uint8_t *src1,
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync int poffset, int w,
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync unsigned int color0, unsigned int color1,
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync unsigned int color_xor);
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsyncvoid vga_draw_cursor_line_16(uint8_t *d1, const uint8_t *src1,
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync int poffset, int w,
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync unsigned int color0, unsigned int color1,
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync unsigned int color_xor);
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsyncvoid vga_draw_cursor_line_32(uint8_t *d1, const uint8_t *src1,
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync int poffset, int w,
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync unsigned int color0, unsigned int color1,
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync unsigned int color_xor);
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsyncextern const uint8_t sr_mask[8];
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsyncextern const uint8_t gr_mask[16];
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync#endif /* !VBOX */
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync