DevVGA.h revision c97989161fbe75bc14cea477a5443bbf474dd3ad
/** @file
*
*/
/*
* Copyright (C) 2006-2007 innotek GmbH
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License as published by the Free Software Foundation,
* in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
* distribution. VirtualBox OSE is distributed in the hope that it will
* be useful, but WITHOUT ANY WARRANTY of any kind.
*
* If you received this file as part of a commercial VirtualBox
* distribution, then only the terms of your commercial VirtualBox
* license agreement apply instead of the previous paragraph.
*
* --------------------------------------------------------------------
*
* This code is based on:
*
* QEMU internal VGA defines.
*
* Copyright (c) 2003-2004 Fabrice Bellard
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#define MSR_COLOR_EMULATION 0x01
#define MSR_PAGE_SELECT 0x20
#define ST01_V_RETRACE 0x08
#define ST01_DISP_ENABLE 0x01
/* bochs VBE support */
#define CONFIG_BOCHS_VBE
#ifdef VBOX
#define VBE_DISPI_MAX_XRES 16384
#define VBE_DISPI_MAX_YRES 16384
#else
#define VBE_DISPI_MAX_XRES 1600
#define VBE_DISPI_MAX_YRES 1200
#endif
#define VBE_DISPI_MAX_BPP 32
#define VBE_DISPI_INDEX_ID 0x0
#define VBE_DISPI_INDEX_XRES 0x1
#define VBE_DISPI_INDEX_YRES 0x2
#define VBE_DISPI_INDEX_BPP 0x3
#define VBE_DISPI_INDEX_ENABLE 0x4
#define VBE_DISPI_INDEX_BANK 0x5
#define VBE_DISPI_INDEX_VIRT_WIDTH 0x6
#define VBE_DISPI_INDEX_VIRT_HEIGHT 0x7
#define VBE_DISPI_INDEX_X_OFFSET 0x8
#define VBE_DISPI_INDEX_Y_OFFSET 0x9
#define VBE_DISPI_INDEX_CMONITORS 0xa
#define VBE_DISPI_INDEX_NB 0xb
#define VBE_DISPI_ID0 0xB0C0
#define VBE_DISPI_ID1 0xB0C1
#define VBE_DISPI_ID2 0xB0C2
#define VBE_DISPI_DISABLED 0x00
#define VBE_DISPI_ENABLED 0x01
#define VBE_DISPI_GETCAPS 0x02
#define VBE_DISPI_8BIT_DAC 0x20
#define VBE_DISPI_LFB_ENABLED 0x40
#define VBE_DISPI_NOCLEARMEM 0x80
#define VBE_DISPI_LFB_PHYSICAL_ADDRESS 0xE0000000
#ifdef CONFIG_BOCHS_VBE
#define VGA_STATE_COMMON_BOCHS_VBE \
#else
#define VGA_STATE_COMMON_BOCHS_VBE
#endif /* !CONFIG_BOCHS_VBE */
#define VGA_MAX_HEIGHT VBE_DISPI_MAX_YRES
#ifndef VBOX
#define VGA_STATE_COMMON \
unsigned long vram_offset; \
unsigned int vram_size; \
int ar_flip_flop; \
void (*get_offsets)(struct VGAState *s, \
uint32_t *pline_offset, \
uint32_t *pstart_addr, \
uint32_t *pline_compare); \
void (*get_resolution)(struct VGAState *s, \
int *pwidth, \
int *pheight); \
/* display refresh support */ \
DisplayState *ds; \
int graphic_mode; \
unsigned int (*rgb_to_pixel)(unsigned int r, \
unsigned int g, unsigned b); \
/* hardware mouse cursor support */ \
void (*cursor_invalidate)(struct VGAState *s); \
/* tell for each page if it has been updated since the last time */ \
#else /* VBOX */
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);
typedef void FNCURSORINVALIDATE(struct VGAState *s);
/* bird: vram_offset have been remove, function pointers declared external,
some type changes, and some padding have been added. */
#define VGA_STATE_COMMON \
/* display refresh support */ \
/* hardware mouse cursor support */ \
/* tell for each page if it has been updated since the last time */ \
#endif /* VBOX */
typedef struct VGAState {
#ifdef VBOX
/** end-of-common-state-marker */
/** The physical address the VRAM was assigned. */
/** Pointer to GC vram mapping. */
/** @todo r=bird: bool not RTUINT (my fault I guess). */
/** LFB was updated flag. */
/** Indicates if the GC extensions are enabled or not. */
/** Indicates if the R0 extensions are enabled or not. */
/** Pointer to vgaGCLFBAccessHandler(). */
/** Flag indicating that there are dirty bits. This is used to optimize the handler resetting. */
bool fHaveDirtyBits;
/** Bitmap tracking dirty pages. */
/** Pointer to the device instance - HC Ptr. */
/* * Pointer to the device instance - GC Ptr. */
/*GCPTRTYPE(PPDMDEVINS) pDevInsGC;*/
/** The display port base interface. */
/** The display port interface. */
/** Pointer to base interface of the driver. */
/** Pointer to display connector interface of the driver. */
/** Refresh timer handle - HC. */
/** Current refresh timer interval. */
/** Number of virtual monitors */
/** Whether to render the guest VRAM to the framebuffer memory. False only for some LFB modes. */
/** The PCI device. */
#ifdef VBE_BYTEWISE_IO
# ifdef VBE_NEW_DYN_LIST
/** VBE Extra Data write address one byte buffer */
# else
# endif
#endif
#ifdef VBE_NEW_DYN_LIST
/** The VBE BIOS extra data. */
/** The size of the VBE BIOS extra data. */
/** The VBE BIOS current memory address. */
#endif
#endif /* VBOX */
} VGAState;
#ifdef VBOX
/** VGA state. */
/** Pointer to the VGA state. */
#endif
#ifdef VBE_NEW_DYN_LIST
/**
* VBE Bios Extra Data structure.
* @remark duplicated in vbe.h.
*/
typedef struct VBEHeader
{
/** Signature (VBEHEADER_MAGIC). */
/** Data size. */
} VBEHeader;
/** VBE Extra Data. */
/** Pointer to the VBE Extra Data. */
typedef VBEHEADER *PVBEHEADER;
/** The value of the VBEHEADER::u16Signature field.
* @remark duplicated in vbe.h. */
#define VBEHEADER_MAGIC 0x77CC
/** The extra port which is used to read the mode list.
* @remark duplicated in vbe.h. */
#define VBE_EXTRA_PORT 0x3b6
/** The extra port which is used for debug printf.
* @remark duplicated in vbe.h. */
#define VBE_PRINTF_PORT 0x3b7
#endif /* VBE_NEW_DYN_LIST */
static inline int c6_to_8(int v)
{
int b;
v &= 0x3f;
b = v & 1;
return (v << 2) | (b << 1) | b;
}
#endif /* !VBOX || IN_RING3 */
#ifndef VBOX
unsigned long vga_ram_offset, int vga_ram_size);
int poffset, int w,
unsigned int color_xor);
int poffset, int w,
unsigned int color_xor);
int poffset, int w,
unsigned int color_xor);
#endif /* !VBOX */