DevVGA.h revision 67c86f9399de01713db0dd215736998507ebdc60
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * DevVGA - VBox VGA/VESA device, internal header.
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * Copyright (C) 2006-2013 Oracle Corporation
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * available from http://www.virtualbox.org. This file is free software;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * you can redistribute it and/or modify it under the terms of the GNU
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * General Public License (GPL) as published by the Free Software
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * --------------------------------------------------------------------
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * This code is based on:
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * QEMU internal VGA defines.
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * Copyright (c) 2003-2004 Fabrice Bellard
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * Permission is hereby granted, free of charge, to any person obtaining a copy
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * of this software and associated documentation files (the "Software"), to deal
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * in the Software without restriction, including without limitation the rights
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * copies of the Software, and to permit persons to whom the Software is
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * furnished to do so, subject to the following conditions:
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * The above copyright notice and this permission notice shall be included in
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * all copies or substantial portions of the Software.
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * THE SOFTWARE.
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/** Use VBE bytewise I/O. Only needed for Windows Longhorn/Vista betas and backwards compatibility. */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/** Use VBE new dynamic mode list.
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * If this is not defined, no checks are carried out to see if the modes all
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * fit into the framebuffer! See the VRAM_SIZE_FIX define. */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/** The default amount of VRAM. */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/** The maximum amount of VRAM. Limited by VBOX_MAX_ALLOC_PAGE_COUNT. */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/** The minimum amount of VRAM. */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#endif /* VBOX_WITH_HGSMI */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/* bochs VBE support */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/* Cross reference with <VBox/Hardware/VBoxVideoVBE.h> */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#define VBE_DISPI_INDEX_NB_SAVED 0xb /* Number of saved registers (vbe_regs array) */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#define VBE_DISPI_INDEX_NB 0xc /* Total number of VBE registers */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#endif /* !CONFIG_BOCHS_VBE */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsynctypedef struct vga_retrace_s {
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync unsigned frame_cclks; /* Character clocks per frame. */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync unsigned cclk_ns; /* Character clock duration in ns. */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync unsigned vb_start; /* Vertical blanking start (scanline). */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync unsigned vb_end; /* Vertical blanking end (scanline). */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync unsigned vb_end_ns; /* Vertical blanking end time (length) in ns. */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync unsigned vs_start; /* Vertical sync start (scanline). */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync unsigned vs_end; /* Vertical sync end (scanline). */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync unsigned vs_start_ns; /* Vertical sync start time in ns. */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync unsigned vs_end_ns; /* Vertical sync end time in ns. */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync unsigned h_total; /* Horizontal total (cclks per scanline). */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync unsigned h_total_ns; /* Scanline duration in ns. */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync unsigned hb_start; /* Horizontal blanking start (cclk). */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync unsigned hb_end; /* Horizontal blanking end (cclk). */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync unsigned hb_end_ns; /* Horizontal blanking end time (length) in ns. */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync unsigned v_freq_hz; /* Vertical refresh rate to emulate. */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync unsigned long vram_offset; \
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync unsigned int vram_size; \
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync /* display refresh support */ \
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync uint32_t last_width, last_height; /* in chars or pixels */ \
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync uint32_t last_scr_width, last_scr_height; /* in pixels */ \
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync unsigned int (*rgb_to_pixel)(unsigned int r, \
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync unsigned int g, unsigned b); \
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync /* hardware mouse cursor support */ \
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync uint32_t invalidated_y_table[VGA_MAX_HEIGHT / 32]; \
struct VGAState;
typedef void FNGETOFFSETS(struct VGAState *s, uint32_t *pline_offset, uint32_t *pstart_addr, uint32_t *pline_compare);
typedef unsigned int FNRGBTOPIXEL(unsigned int r, unsigned int g, unsigned b);
#ifdef VBOX_WITH_VDMA
#ifdef VBOX_WITH_VIDEOHWACCEL
typedef struct _VBOX_VHWA_PENDINGCMD
typedef struct VGAState {
#ifndef VBOX
# ifdef VBOX_WITH_HGSMI
# ifdef VBOX_WITH_VDMA
#ifdef VBOX_WITH_VMSVGA
/** R3 Opaque pointer to a copy of the first 32k of the framebuffer before switching into svga mode. */
bool f3DEnabled;
bool fVRAMTracking;
} svga;
bool fHasDirtyBits;
bool fLFBUpdated;
bool fGCEnabled;
bool fR0Enabled;
/** Flag indicating that the VGA memory in the 0xa0000-0xbffff region has been remapped to allow direct access. */
bool fRemappedVGA;
bool fRenderVRAM;
#ifdef VBOX_WITH_VMSVGA
bool fVMSVGAEnabled;
# ifdef VBE_BYTEWISE_IO
# ifdef VBE_NEW_DYN_LIST
bool fRealRetrace;
# ifdef VBE_NEW_DYN_LIST
# ifdef VBOX_WITH_HGSMI
# ifdef VBOX_WITH_WDDM
} dummy;
} VGAState;
#ifdef VBOX
#ifdef VBE_NEW_DYN_LIST
* @remark duplicated in vbe.h.
typedef struct VBEHeader
} VBEHeader;
* @remark duplicated in vbe.h. */
* @remark duplicated in vbe.h. */
* @remark duplicated in vbe.h. */
static inline int c6_to_8(int v)
#ifdef VBOX_WITH_HGSMI
int VBVAGetScreenInfo(PVGASTATE pVGAState, unsigned uScreenId, struct VBVAINFOSCREEN *pScreen, void **ppvVram);
# ifdef VBOX_WITH_VIDEOHWACCEL
#ifdef VBOX_WITH_HGSMI
#define PPDMIDISPLAYVBVACALLBACKS_2_PVGASTATE(_pcb) ( (PVGASTATE)((uint8_t *)(_pcb) - RT_OFFSETOF(VGASTATE, IVBVACallbacks)) )
# ifdef VBOX_WITH_CRHGSMI
int vboxVDMACrHgsmiCommandCompleteAsync(PPDMIDISPLAYVBVACALLBACKS pInterface, PVBOXVDMACMD_CHROMIUM_CMD pCmd, int rc);
int vboxVDMACrHgsmiControlCompleteAsync(PPDMIDISPLAYVBVACALLBACKS pInterface, PVBOXVDMACMD_CHROMIUM_CTL pCmd, int rc);
void *pvCompletion);
# ifdef VBOX_WITH_VDMA
# ifdef VBOX_WITH_VMSVGA
int vgaR3UpdateDisplay(PVGASTATE pVGAState, unsigned xStart, unsigned yStart, unsigned width, unsigned height);
#ifndef VBOX
int poffset, int w,
unsigned int color_xor);
int poffset, int w,
unsigned int color_xor);
int poffset, int w,
unsigned int color_xor);