README | 7 configure.ac | 17 man/Makefile.am | 1 src/Makefile.am | 6 src/svga_escape.h | 30 + src/svga_overlay.h | 49 ++ src/svga_reg.h | 427 ++++++++++++++++-- src/vmware.c | 184 +++++++- src/vmware.h | 47 ++ src/vmwarectrl.c | 1 src/vmwarevideo.c | 1218 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 11 files changed, 1928 insertions(+), 59 deletions(-)
New commits: commit 6849c0a5fbf10722ca475d2ffcce7d0d95d2377a Author: Vinay Bondhugula <[EMAIL PROTECTED]> Date: Fri Apr 18 18:00:38 2008 -0400 Change // comments to /* This will make it easier to compile the driver against ancient versions of X. diff --git a/src/svga_overlay.h b/src/svga_overlay.h index 58f71e4..b312577 100644 --- a/src/svga_overlay.h +++ b/src/svga_overlay.h @@ -15,8 +15,8 @@ * Video formats we support */ -#define VMWARE_FOURCC_YV12 0x32315659 // 'Y' 'V' '1' '2' -#define VMWARE_FOURCC_YUY2 0x32595559 // 'Y' 'U' 'Y' '2' +#define VMWARE_FOURCC_YV12 0x32315659 /* 'Y' 'V' '1' '2' */ +#define VMWARE_FOURCC_YUY2 0x32595559 /* 'Y' 'U' 'Y' '2' */ #define SVGA_ESCAPE_VMWARE_VIDEO 0x00020000 @@ -34,7 +34,7 @@ typedef struct SVGAEscapeVideoSetRegs { uint32 streamId; } header; - // May include zero or more items. + /* May include zero or more items. */ struct { uint32 registerId; uint32 value; @@ -46,4 +46,4 @@ typedef struct SVGAEscapeVideoFlush { uint32 streamId; } SVGAEscapeVideoFlush; -#endif // _SVGA_OVERLAY_H_ +#endif /* _SVGA_OVERLAY_H_ */ diff --git a/src/svga_reg.h b/src/svga_reg.h index 0f064e1..4fa363a 100644 --- a/src/svga_reg.h +++ b/src/svga_reg.h @@ -320,7 +320,7 @@ enum { SVGA_FIFO_CAPABILITIES = 4, SVGA_FIFO_FLAGS, - // Valid with SVGA_FIFO_CAP_FENCE: + /* Valid with SVGA_FIFO_CAP_FENCE: */ SVGA_FIFO_FENCE, /* @@ -333,17 +333,17 @@ enum { * extended FIFO. */ - // Valid if exists (i.e. if extended FIFO enabled): + /* Valid if exists (i.e. if extended FIFO enabled): */ SVGA_FIFO_3D_HWVERSION, /* See SVGA3dHardwareVersion in svga3d_reg.h */ - // Valid with SVGA_FIFO_CAP_PITCHLOCK: + /* Valid with SVGA_FIFO_CAP_PITCHLOCK: */ SVGA_FIFO_PITCHLOCK, - // Valid with SVGA_FIFO_CAP_CURSOR_BYPASS_3: + /* Valid with SVGA_FIFO_CAP_CURSOR_BYPASS_3: */ SVGA_FIFO_CURSOR_ON, /* Cursor bypass 3 show/hide register */ SVGA_FIFO_CURSOR_X, /* Cursor bypass 3 x register */ SVGA_FIFO_CURSOR_Y, /* Cursor bypass 3 y register */ SVGA_FIFO_CURSOR_COUNT, /* Incremented when any of the other 3 change */ SVGA_FIFO_CURSOR_LAST_UPDATED,/* Last time the host updated the cursor */ - // Valid with SVGA_FIFO_CAP_RESERVE: + /* Valid with SVGA_FIFO_CAP_RESERVE: */ SVGA_FIFO_RESERVED, /* Bytes past NEXT_CMD with real contents */ /* * XXX: The gap here, up until SVGA_FIFO_3D_CAPS, can be used for new @@ -382,7 +382,7 @@ enum { * sets SVGA_FIFO_MIN high enough to leave room for them. */ - // Valid if register exists: + /* Valid if register exists: */ SVGA_FIFO_GUEST_3D_HWVERSION, /* Guest driver's 3D version */ SVGA_FIFO_FENCE_GOAL, /* Matching target for SVGA_IRQFLAG_FENCE_GOAL */ SVGA_FIFO_BUSY, /* See "FIFO Synchronization Registers" */ @@ -553,7 +553,7 @@ enum { #define SVGA_FIFO_FLAG_NONE 0 #define SVGA_FIFO_FLAG_ACCELFRONT (1<<0) -#define SVGA_FIFO_FLAG_RESERVED (1<<31) // Internal use only +#define SVGA_FIFO_FLAG_RESERVED (1<<31) /* Internal use only */ /* * FIFO reservation sentinel value @@ -817,13 +817,13 @@ typedef struct SVGAOverlayUnit { /* * Location and size of SVGA frame buffer and the FIFO. */ -#define SVGA_VRAM_MIN_SIZE (4 * 640 * 480) // bytes +#define SVGA_VRAM_MIN_SIZE (4 * 640 * 480) /* bytes */ #define SVGA_VRAM_MAX_SIZE (128 * 1024 * 1024) -#define SVGA_VRAM_SIZE_WS (16 * 1024 * 1024) // 16 MB -#define SVGA_MEM_SIZE_WS (2 * 1024 * 1024) // 2 MB -#define SVGA_VRAM_SIZE_SERVER (4 * 1024 * 1024) // 4 MB -#define SVGA_MEM_SIZE_SERVER (256 * 1024) // 256 KB +#define SVGA_VRAM_SIZE_WS (16 * 1024 * 1024) /* 16 MB */ +#define SVGA_MEM_SIZE_WS (2 * 1024 * 1024) /* 2 MB */ +#define SVGA_VRAM_SIZE_SERVER (4 * 1024 * 1024) /* 4 MB */ +#define SVGA_MEM_SIZE_SERVER (256 * 1024) /* 256 KB */ #if /* defined(VMX86_WGS) || */ defined(VMX86_SERVER) #define SVGA_VRAM_SIZE SVGA_VRAM_SIZE_SERVER commit b6c59761e2b984be32493f35224db523dd62bcd8 Author: Paulo Cesar Pereira de Andrade <[EMAIL PROTECTED]> Date: Thu Apr 17 23:04:45 2008 -0400 Compile warning fixes Major problem was prototype vmwareInitVideo not matching implementation vmwareVideoInit. Remaining are adding an "ansification" of a function without arguments, and removing/disabling unused variables/functions. diff --git a/src/vmware.c b/src/vmware.c index ebb480b..e4d149d 100644 --- a/src/vmware.c +++ b/src/vmware.c @@ -386,7 +386,7 @@ VMXGetVMwareSvgaId(VMWAREPtr pVMWARE) return SVGA_ID_INVALID; } - +#ifndef XSERVER_LIBPCIACCESS /* *---------------------------------------------------------------------- * @@ -432,6 +432,7 @@ RewriteTagString(const char *istr, char *ostr, int osize) *op++ = chr; } while (chr); } +#endif static void VMWAREIdentify(int flags) @@ -1766,8 +1767,6 @@ static void VMWARELeaveVT(int scrnIndex, int flags) { ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; - VMWAREPtr pVMWARE = VMWAREPTR(pScrn); - VMWARERestore(pScrn); } @@ -1796,8 +1795,6 @@ VMwarePciProbe (DriverPtr drv, { ScrnInfoPtr scrn = NULL; EntityInfoPtr entity; - /*I830EntPtr i830_ent = NULL;*/ - DevUnion *private; scrn = xf86ConfigPciEntity(scrn, 0, entity_num, VMWAREPciChipsets, NULL, NULL, NULL, NULL, NULL); diff --git a/src/vmware.h b/src/vmware.h index ac93706..63bb831 100644 --- a/src/vmware.h +++ b/src/vmware.h @@ -272,7 +272,7 @@ void VMwareCtrl_ExtInit(ScrnInfoPtr pScrn); void VMwareXinerama_ExtInit(ScrnInfoPtr pScrn); /* vmwarevideo.c */ -Bool vmwareInitVideo( +Bool vmwareVideoInit( ScreenPtr pScreen ); void vmwareVideoEnd( diff --git a/src/vmwarectrl.c b/src/vmwarectrl.c index dc9e91f..24865d6 100644 --- a/src/vmwarectrl.c +++ b/src/vmwarectrl.c @@ -311,7 +311,6 @@ VMwareCtrlSetTopology(ClientPtr client) ExtensionEntry *ext; register int n; xXineramaScreenInfo *extents; - size_t i; REQUEST_AT_LEAST_SIZE(xVMwareCtrlSetTopologyReq); diff --git a/src/vmwarevideo.c b/src/vmwarevideo.c index 613991c..d6ff4b7 100644 --- a/src/vmwarevideo.c +++ b/src/vmwarevideo.c @@ -224,7 +224,7 @@ static void vmwareVideoEndStream(ScrnInfoPtr pScrn, VMWAREVideoPtr pVid); /* * Offscreen memory manager functions */ -static void vmwareOffscreenInit(); +static void vmwareOffscreenInit(void); static VMWAREOffscreenPtr vmwareOffscreenAllocate(VMWAREPtr pVMWARE, uint32 size); static void vmwareOffscreenFree(VMWAREOffscreenPtr memptr); @@ -282,7 +282,7 @@ vmwareCheckVideoSanity(ScrnInfoPtr pScrn) */ static void -vmwareOffscreenInit() +vmwareOffscreenInit(void) { offscreenMgr.size = 0; offscreenMgr.offset = 0; @@ -415,7 +415,6 @@ Bool vmwareVideoEnabled(VMWAREPtr pVMWARE) Bool vmwareVideoInit(ScreenPtr pScreen) { ScrnInfoPtr pScrn = infoFromScreen(pScreen); - VMWAREPtr pVMWARE = VMWAREPTR(pScrn); XF86VideoAdaptorPtr *overlayAdaptors, *newAdaptors = NULL; XF86VideoAdaptorPtr newAdaptor = NULL; int numAdaptors; @@ -615,7 +614,6 @@ static int vmwareVideoInitStream(ScrnInfoPtr pScrn, VMWAREVideoPtr pVid, unsigned char *buf, short width, short height) { VMWAREPtr pVMWARE = VMWAREPTR(pScrn); - ScreenPtr pScreen = pScrn->pScreen; int i; TRACEPOINT commit 7870dc715b1efe173af1e2664778e2066508e066 Author: Vinay Bondhugula <[EMAIL PROTECTED]> Date: Thu Apr 17 20:54:23 2008 -0400 Bump version to 10.16.1 in configure.ac The previous change didn't bump up the version in configure.ac. diff --git a/configure.ac b/configure.ac index 878bd02..8d20681 100644 --- a/configure.ac +++ b/configure.ac @@ -22,7 +22,7 @@ AC_PREREQ(2.57) AC_INIT([xf86-video-vmware], - 10.16.0, + 10.16.1, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xf86-video-vmware) commit be75c66fa7933c7dfa86e5514c744f47734c5fc8 Author: Vinay Bondhugula <[EMAIL PROTECTED]> Date: Thu Apr 17 20:39:02 2008 -0400 Prepare for 10.16.1 Update the modinfo section and make a configure.ac fix. diff --git a/configure.ac b/configure.ac index ef6a928..878bd02 100644 --- a/configure.ac +++ b/configure.ac @@ -55,7 +55,7 @@ XORG_DRIVER_CHECK_EXT(XINERAMA, xineramaproto) XORG_DRIVER_CHECK_EXT(XV, videoproto) # Checks for pkg-config packages -PKG_CHECK_MODULES(XORG, [xorg-server >= 1.0.1.0 xproto fontsproto $REQUIRED_MODULES]) +PKG_CHECK_MODULES(XORG, [xorg-server >= 1.0.1 xproto fontsproto $REQUIRED_MODULES]) sdkdir=$(pkg-config --variable=sdkdir xorg-server) # Checks for libraries. diff --git a/src/vmware.c b/src/vmware.c index 1f1312a..ebb480b 100644 --- a/src/vmware.c +++ b/src/vmware.c @@ -82,8 +82,8 @@ char rcsId_vmware[] = #define VMWARE_NAME "VMWARE" #define VMWARE_DRIVER_NAME "vmware" #define VMWARE_MAJOR_VERSION 10 -#define VMWARE_MINOR_VERSION 15 -#define VMWARE_PATCHLEVEL 2 +#define VMWARE_MINOR_VERSION 16 +#define VMWARE_PATCHLEVEL 1 #define VMWARE_DRIVER_VERSION \ (VMWARE_MAJOR_VERSION * 65536 + VMWARE_MINOR_VERSION * 256 + VMWARE_PATCHLEVEL) #define VMWARE_DRIVER_VERSION_STRING \ commit 87e9b32618f037d78d7853b48e40a71533b764d2 Author: Vinay Bondhugula <[EMAIL PROTECTED]> Date: Thu Apr 17 19:16:48 2008 -0400 Fix build for all modular versions of Xorg This change makes the video driver compile with Xorg 7.0. There are a couple of trivial changes that bring down the maximum Xserver version down to 2.0. Hacky, but good enough for now. diff --git a/configure.ac b/configure.ac index e410c65..ef6a928 100644 --- a/configure.ac +++ b/configure.ac @@ -55,7 +55,7 @@ XORG_DRIVER_CHECK_EXT(XINERAMA, xineramaproto) XORG_DRIVER_CHECK_EXT(XV, videoproto) # Checks for pkg-config packages -PKG_CHECK_MODULES(XORG, [xorg-server >= 1.0.99.901 xproto fontsproto $REQUIRED_MODULES]) +PKG_CHECK_MODULES(XORG, [xorg-server >= 1.0.1.0 xproto fontsproto $REQUIRED_MODULES]) sdkdir=$(pkg-config --variable=sdkdir xorg-server) # Checks for libraries. diff --git a/src/vmware.h b/src/vmware.h index 7edefd5..ac93706 100644 --- a/src/vmware.h +++ b/src/vmware.h @@ -8,7 +8,10 @@ #ifndef VMWARE_H #define VMWARE_H +#include "xorgVersion.h" +#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(7, 1, 0, 0, 0) || XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(2, 0, 0, 0, 0) #include <string.h> +#endif #include "xf86.h" #include "xf86_OSproc.h" diff --git a/src/vmwarevideo.c b/src/vmwarevideo.c index 3b8aaa6..613991c 100644 --- a/src/vmwarevideo.c +++ b/src/vmwarevideo.c @@ -170,7 +170,7 @@ typedef VMWAREVideoRec *VMWAREVideoPtr; /* * Callback functions */ -#if XORG_VERSION_CURRENT > XORG_VERSION_NUMERIC(7, 0, 0, 0, 0) || XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(4, 0, 0, 0, 0) +#if XORG_VERSION_CURRENT > XORG_VERSION_NUMERIC(7, 0, 0, 0, 0) || XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(2, 0, 0, 0, 0) static int vmwareXvPutImage(ScrnInfoPtr pScrn, short src_x, short src_y, short drw_x, short drw_y, short src_w, short src_h, short drw_w, short drw_h, int image, commit e4fa13951a7c5dd53005a63392a439e2329fab9c Author: Vinay Bondhugula <[EMAIL PROTECTED]> Date: Wed Mar 26 21:32:47 2008 -0400 Send down guest display topology Send down the Xinerama topology from the guest down to the host, by setting display topology registers in the SVGA device. diff --git a/src/svga_reg.h b/src/svga_reg.h index f5040e6..0f064e1 100644 --- a/src/svga_reg.h +++ b/src/svga_reg.h @@ -138,12 +138,19 @@ enum { SVGA_REG_NUM_DISPLAYS = 31, /* Number of guest displays */ SVGA_REG_PITCHLOCK = 32, /* Fixed pitch for all modes */ SVGA_REG_IRQMASK = 33, /* Interrupt mask */ - SVGA_REG_TOP = 34, /* Must be 1 more than the last register */ - - SVGA_PALETTE_BASE = 1024, /* Base of SVGA color map */ + SVGA_REG_NUM_GUEST_DISPLAYS = 34,/* Number of guest displays in X/Y direction */ + SVGA_REG_DISPLAY_ID = 35, /* The display ID for the following display attributes */ + SVGA_REG_DISPLAY_IS_PRIMARY = 36,/* Whether this is a primary display */ + SVGA_REG_DISPLAY_POSITION_X = 37,/* The display position x */ + SVGA_REG_DISPLAY_POSITION_Y = 38,/* The display position y */ + SVGA_REG_DISPLAY_WIDTH = 39, /* The display's width */ + SVGA_REG_DISPLAY_HEIGHT = 40, /* The display's height */ + SVGA_REG_TOP = 41, /* Must be 1 more than the last register */ + + SVGA_PALETTE_BASE = 1024, /* Base of SVGA color map */ /* Next 768 (== 256*3) registers exist for colormap */ SVGA_SCRATCH_BASE = SVGA_PALETTE_BASE + SVGA_NUM_PALETTE_REGS - /* Base of scratch registers */ + /* Base of scratch registers */ /* Next reg[SVGA_REG_SCRATCH_SIZE] registers exist for scratch usage: First 4 are reserved for VESA BIOS Extension; any remaining are for the use of the current SVGA driver. */ @@ -154,26 +161,28 @@ enum { * Capabilities */ -#define SVGA_CAP_NONE 0x00000 -#define SVGA_CAP_RECT_FILL 0x00001 -#define SVGA_CAP_RECT_COPY 0x00002 -#define SVGA_CAP_RECT_PAT_FILL 0x00004 -#define SVGA_CAP_LEGACY_OFFSCREEN 0x00008 -#define SVGA_CAP_RASTER_OP 0x00010 -#define SVGA_CAP_CURSOR 0x00020 -#define SVGA_CAP_CURSOR_BYPASS 0x00040 -#define SVGA_CAP_CURSOR_BYPASS_2 0x00080 -#define SVGA_CAP_8BIT_EMULATION 0x00100 -#define SVGA_CAP_ALPHA_CURSOR 0x00200 -#define SVGA_CAP_GLYPH 0x00400 -#define SVGA_CAP_GLYPH_CLIPPING 0x00800 -#define SVGA_CAP_OFFSCREEN_1 0x01000 -#define SVGA_CAP_ALPHA_BLEND 0x02000 -#define SVGA_CAP_3D 0x04000 -#define SVGA_CAP_EXTENDED_FIFO 0x08000 -#define SVGA_CAP_MULTIMON 0x10000 -#define SVGA_CAP_PITCHLOCK 0x20000 -#define SVGA_CAP_IRQMASK 0x40000 +#define SVGA_CAP_NONE 0x00000000 +#define SVGA_CAP_RECT_FILL 0x00000001 +#define SVGA_CAP_RECT_COPY 0x00000002 +#define SVGA_CAP_RECT_PAT_FILL 0x00000004 +#define SVGA_CAP_LEGACY_OFFSCREEN 0x00000008 +#define SVGA_CAP_RASTER_OP 0x00000010 +#define SVGA_CAP_CURSOR 0x00000020 +#define SVGA_CAP_CURSOR_BYPASS 0x00000040 +#define SVGA_CAP_CURSOR_BYPASS_2 0x00000080 +#define SVGA_CAP_8BIT_EMULATION 0x00000100 +#define SVGA_CAP_ALPHA_CURSOR 0x00000200 +#define SVGA_CAP_GLYPH 0x00000400 +#define SVGA_CAP_GLYPH_CLIPPING 0x00000800 +#define SVGA_CAP_OFFSCREEN_1 0x00001000 +#define SVGA_CAP_ALPHA_BLEND 0x00002000 +#define SVGA_CAP_3D 0x00004000 +#define SVGA_CAP_EXTENDED_FIFO 0x00008000 +#define SVGA_CAP_MULTIMON 0x00010000 +#define SVGA_CAP_PITCHLOCK 0x00020000 +#define SVGA_CAP_IRQMASK 0x00040000 +#define SVGA_CAP_DISPLAY_TOPOLOGY 0x00080000 + /* * Raster op codes (same encoding as X) used by FIFO drivers. @@ -201,6 +210,8 @@ enum { #define SVGA_ROP_ALL (MASK(SVGA_NUM_SUPPORTED_ROPS)) #define SVGA_IS_VALID_ROP(rop) (rop < SVGA_NUM_SUPPORTED_ROPS) +#define SVGA_INVALID_DISPLAY_ID ((uint32)-1) + /* * Ops * For each pixel, the four channels of the image are computed with: diff --git a/src/vmware.c b/src/vmware.c index 3ea425e..1f1312a 100644 --- a/src/vmware.c +++ b/src/vmware.c @@ -1226,6 +1226,42 @@ VMWAREModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode, Bool rebuildPixmap) } } + /* + * Update host's view of guest topology. + */ + if (pVMWARE->vmwareCapability & SVGA_CAP_DISPLAY_TOPOLOGY) { + if (pVMWARE->xinerama) { + int i = 0; + VMWAREXineramaPtr xineramaState = pVMWARE->xineramaState; + vmwareWriteReg(pVMWARE, SVGA_REG_NUM_GUEST_DISPLAYS, + pVMWARE->xineramaNumOutputs); + + for (i = 0; i < pVMWARE->xineramaNumOutputs; i++) { + vmwareWriteReg(pVMWARE, SVGA_REG_DISPLAY_ID, i); + vmwareWriteReg(pVMWARE, SVGA_REG_DISPLAY_IS_PRIMARY, TRUE); + vmwareWriteReg(pVMWARE, SVGA_REG_DISPLAY_POSITION_X, + xineramaState[i].x_org); + vmwareWriteReg(pVMWARE, SVGA_REG_DISPLAY_POSITION_Y, + xineramaState[i].y_org); + vmwareWriteReg(pVMWARE, SVGA_REG_DISPLAY_WIDTH, + xineramaState[i].width); + vmwareWriteReg(pVMWARE, SVGA_REG_DISPLAY_HEIGHT, + xineramaState[i].height); + } + } else { + vmwareWriteReg(pVMWARE, SVGA_REG_NUM_GUEST_DISPLAYS, 1); + + vmwareWriteReg(pVMWARE, SVGA_REG_DISPLAY_ID, 0); + vmwareWriteReg(pVMWARE, SVGA_REG_DISPLAY_IS_PRIMARY, TRUE); + vmwareWriteReg(pVMWARE, SVGA_REG_DISPLAY_POSITION_X, 0); + vmwareWriteReg(pVMWARE, SVGA_REG_DISPLAY_POSITION_Y, 0); + vmwareWriteReg(pVMWARE, SVGA_REG_DISPLAY_WIDTH, mode->HDisplay); + vmwareWriteReg(pVMWARE, SVGA_REG_DISPLAY_HEIGHT, mode->VDisplay); + } + + vmwareWriteReg(pVMWARE, SVGA_REG_DISPLAY_ID, SVGA_INVALID_DISPLAY_ID); + } + return TRUE; } commit 5aced9e39a0bf7590c841824c0b66060eb7d5e03 Author: Adam Jackson <[EMAIL PROTECTED]> Date: Wed Mar 19 17:03:18 2008 -0400 vmware 10.16.0 diff --git a/configure.ac b/configure.ac index 91b01dc..e410c65 100644 --- a/configure.ac +++ b/configure.ac @@ -22,7 +22,7 @@ AC_PREREQ(2.57) AC_INIT([xf86-video-vmware], - 10.15.2, + 10.16.0, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xf86-video-vmware) commit cd8bb3018946e82b98207984efc26b13ac260e5e Author: Adam Jackson <[EMAIL PROTECTED]> Date: Wed Mar 19 17:00:41 2008 -0400 Fix distcheck. diff --git a/src/Makefile.am b/src/Makefile.am index 0cd746d..cb69a22 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -33,8 +33,10 @@ vmware_drv_la_SOURCES = \ bits2pixels.h \ guest_os.h \ includeCheck.h \ + svga_escape.h \ svga_limits.h \ svga_modes.h \ + svga_overlay.h \ svga_reg.h \ svga_struct.h \ vm_basic_types.h \ commit 1314a1cd22823a5a7202dac4ac04da3801f1ec94 Author: Bankim Bhavsar <[EMAIL PROTECTED]> Date: Fri Mar 14 12:42:40 2008 -0400 Video Overlay: Source video parameters This patch adds parameters to the source video frame. Applications can request only a subset of the source video frame to be displayed. These parameters are srcX, srcY, srcWidth and srcHeight. width and height represent the entire source video frame. diff --git a/src/svga_reg.h b/src/svga_reg.h index 4560fe7..f5040e6 100644 --- a/src/svga_reg.h +++ b/src/svga_reg.h @@ -576,10 +576,14 @@ enum { SVGA_VIDEO_FORMAT, SVGA_VIDEO_COLORKEY, SVGA_VIDEO_SIZE, - SVGA_VIDEO_X, - SVGA_VIDEO_Y, + SVGA_VIDEO_WIDTH, + SVGA_VIDEO_HEIGHT, + SVGA_VIDEO_SRC_X, + SVGA_VIDEO_SRC_Y, SVGA_VIDEO_SRC_WIDTH, SVGA_VIDEO_SRC_HEIGHT, + SVGA_VIDEO_DST_X, + SVGA_VIDEO_DST_Y, SVGA_VIDEO_DST_WIDTH, SVGA_VIDEO_DST_HEIGHT, SVGA_VIDEO_PITCH_1, @@ -591,19 +595,27 @@ enum { /* * SVGA Overlay Units + * + * width and height relate to the entire source video frame. + * srcX, srcY, srcWidth and srcHeight represent subset of the source + * video frame to be displayed. */ typedef struct SVGAOverlayUnit { uint32 enabled; uint32 flags; - uint32 dataOffset; + uint32 dataOffset; uint32 format; uint32 colorKey; uint32 size; - uint32 x; - uint32 y; + uint32 width; + uint32 height; + uint32 srcX; + uint32 srcY; uint32 srcWidth; uint32 srcHeight; + uint32 dstX; + uint32 dstY; uint32 dstWidth; uint32 dstHeight; uint32 pitches[3]; @@ -779,7 +791,7 @@ typedef struct SVGAOverlayUnit { #define SVGA_CMD_VIDEO_PLAY_OBSOLETE 31 /* Obsolete; do not use. */ - + #define SVGA_CMD_VIDEO_END_OBSOLETE 32 /* Obsolete; do not use. */ diff --git a/src/vmwarevideo.c b/src/vmwarevideo.c index 6c081c8..3b8aaa6 100644 --- a/src/vmwarevideo.c +++ b/src/vmwarevideo.c @@ -749,6 +749,7 @@ static int vmwareVideoPlay(ScrnInfoPtr pScrn, VMWAREVideoPtr pVid, }; struct _cmdSetRegs cmdSetRegs; + struct _item *items; memcpy(pVid->bufs[pVid->currBuf].data, buf, pVid->size); @@ -758,26 +759,31 @@ static int vmwareVideoPlay(ScrnInfoPtr pScrn, VMWAREVideoPtr pVid, cmdSetRegs.body.escape = SVGA_ESCAPE_VMWARE_VIDEO_SET_REGS; cmdSetRegs.body.streamId = pVid->streamId; + items = cmdSetRegs.body.items; for (i = SVGA_VIDEO_ENABLED; i < SVGA_VIDEO_NUM_REGS; i++) { - cmdSetRegs.body.items[i].regId = i; + items[i].regId = i; } - cmdSetRegs.body.items[SVGA_VIDEO_ENABLED].value = TRUE; - cmdSetRegs.body.items[SVGA_VIDEO_DATA_OFFSET].value = + items[SVGA_VIDEO_ENABLED].value = TRUE; + items[SVGA_VIDEO_DATA_OFFSET].value = pVid->bufs[pVid->currBuf].dataOffset; - cmdSetRegs.body.items[SVGA_VIDEO_SIZE].value = pVid->size; - cmdSetRegs.body.items[SVGA_VIDEO_FORMAT].value = format; - cmdSetRegs.body.items[SVGA_VIDEO_X].value = drw_x; - cmdSetRegs.body.items[SVGA_VIDEO_Y].value = drw_y; - cmdSetRegs.body.items[SVGA_VIDEO_SRC_WIDTH].value = width; - cmdSetRegs.body.items[SVGA_VIDEO_SRC_HEIGHT].value = height; - cmdSetRegs.body.items[SVGA_VIDEO_DST_WIDTH]. value = drw_w; - cmdSetRegs.body.items[SVGA_VIDEO_DST_HEIGHT].value = drw_h; - cmdSetRegs.body.items[SVGA_VIDEO_COLORKEY].value = pVid->colorKey; - cmdSetRegs.body.items[SVGA_VIDEO_FLAGS].value = pVid->flags; + items[SVGA_VIDEO_SIZE].value = pVid->size; + items[SVGA_VIDEO_FORMAT].value = format; + items[SVGA_VIDEO_WIDTH].value = width; + items[SVGA_VIDEO_HEIGHT].value = height; + items[SVGA_VIDEO_SRC_X].value = src_x; + items[SVGA_VIDEO_SRC_Y].value = src_y; + items[SVGA_VIDEO_SRC_WIDTH].value = src_w; + items[SVGA_VIDEO_SRC_HEIGHT].value = src_h; + items[SVGA_VIDEO_DST_X].value = drw_x; + items[SVGA_VIDEO_DST_Y].value = drw_y; + items[SVGA_VIDEO_DST_WIDTH]. value = drw_w; + items[SVGA_VIDEO_DST_HEIGHT].value = drw_h; + items[SVGA_VIDEO_COLORKEY].value = pVid->colorKey; + items[SVGA_VIDEO_FLAGS].value = pVid->flags; for (i = 0, regId = SVGA_VIDEO_PITCH_1; i < 3; i++, regId++) { - cmdSetRegs.body.items[regId].value = pVid->fmt_priv->pitches[i]; + items[regId].value = pVid->fmt_priv->pitches[i]; } fifoItem = (uint32 *) &cmdSetRegs; @@ -951,10 +957,6 @@ static void vmwareVideoEndStream(ScrnInfoPtr pScrn, VMWAREVideoPtr pVid) * If sync is TRUE the driver should not return from this * function until it is through reading the data from buf. * - * XXX: src_x, src_y, src_w and src_h are used to denote that only - * part of the source image is to be displayed. We ignore as didn't - * find applications that use them. - * * There are two function prototypes to cope with the API change in X.org * 7.1 * commit fdef3fd5ea62a2df6283d48ba18d5c60300534ef Author: Matthieu Herrb <[EMAIL PROTECTED]> Date: Sun Mar 9 00:08:32 2008 +0100 Makefile.am: nuke RCS Id diff --git a/man/Makefile.am b/man/Makefile.am index bf7ec17..f0eb29b 100644 --- a/man/Makefile.am +++ b/man/Makefile.am @@ -1,4 +1,3 @@ -# $Id$ # # Copyright 2005 Sun Microsystems, Inc. All rights reserved. # commit bfd8398dde2d2de238c600eece9374d24d7d8549 Author: Bankim Bhavsar <[EMAIL PROTECTED]> Date: Wed Jan 23 22:13:07 2008 -0800 Xv extension for VMware's video driver This patch implements the Xv extension for VMware's X video driver. The Xv specification can be found here http://www.xfree86.org/current/DESIGN16.html I've written a trivial offscreen memory manager that allocates memory from the bottom part of the Video RAM and it can handle only 1 video-stream. Eventually we intend to support upto 32 video-streams (there is already support for multiple video streams in respective backends). diff --git a/README b/README index 564d57b..0ddbbac 100644 --- a/README +++ b/README @@ -23,6 +23,12 @@ svga_limits.h svga_modes.h A list of default display modes that are built into the driver. +svga_overlay.h + A list of definitions required for Xv extension support. Included by vmwarevideo.c + +svga_escape.h + A list of definitions for the SVGA Escape commands. + guest_os.h Values for the GUEST_ID register. @@ -262,6 +268,7 @@ table shows which capability indicates support for which command. SVGA_CMD_DEFINE_ALPHA_CURSOR SVGA_CAP_ALPHA_CURSOR SVGA_CMD_DRAW_GLYPH SVGA_CAP_GLYPH SVGA_CMD_DRAW_GLYPH_CLIPPED SVGA_CAP_GLYPH_CLIPPING + SVGA_CMD_ESCAPE SVGA_FIFO_CAP_ESCAPE Note: SVGA_CMD_DISPLAY_CURSOR and SVGA_CMD_MOVE_CURSOR should not be used. Drivers wishing hardware cursor support should use cursor bypass (see below). diff --git a/configure.ac b/configure.ac index f33841b..91b01dc 100644 --- a/configure.ac +++ b/configure.ac @@ -52,6 +52,7 @@ XORG_DRIVER_CHECK_EXT(RANDR, randrproto) XORG_DRIVER_CHECK_EXT(RENDER, renderproto) XORG_DRIVER_CHECK_EXT(DPMSExtension, xextproto) XORG_DRIVER_CHECK_EXT(XINERAMA, xineramaproto) +XORG_DRIVER_CHECK_EXT(XV, videoproto) # Checks for pkg-config packages PKG_CHECK_MODULES(XORG, [xorg-server >= 1.0.99.901 xproto fontsproto $REQUIRED_MODULES]) diff --git a/src/Makefile.am b/src/Makefile.am index d6000fc..0cd746d 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -45,4 +45,6 @@ vmware_drv_la_SOURCES = \ vmwarectrl.c \ vmwarectrl.h \ vmwarectrlproto.h \ - vmwarexinerama.c + vmwarexinerama.c \ + vmwarevideo.c + diff --git a/src/svga_escape.h b/src/svga_escape.h new file mode 100644 index 0000000..c9e7b23 --- /dev/null +++ b/src/svga_escape.h @@ -0,0 +1,30 @@ +/* ********************************************************** + * Copyright 2007 VMware, Inc. All rights reserved. + * **********************************************************/ + +/* + * svga_escape.h -- + * + * Definitions for our own (vendor-specific) SVGA Escape commands. + */ + +#ifndef _SVGA_ESCAPE_H_ +#define _SVGA_ESCAPE_H_ + +/* + * Namespace IDs for the escape command + */ + +#define SVGA_ESCAPE_NSID_VMWARE 0x00000000 +#define SVGA_ESCAPE_NSID_DEVEL 0xFFFFFFFF + +/* + * Within SVGA_ESCAPE_NSID_VMWARE, we multiplex commands according to + * the first DWORD of escape data (after the nsID and size). As a + * guideline we're using the high word and low word as a major and + * minor command number, respectively. + */ + +#define SVGA_ESCAPE_VMWARE_MAJOR_MASK 0xFFFF0000 + +#endif /* _SVGA_ESCAPE_H_ */ diff --git a/src/svga_overlay.h b/src/svga_overlay.h new file mode 100644 index 0000000..58f71e4 --- /dev/null +++ b/src/svga_overlay.h @@ -0,0 +1,49 @@ +/* ********************************************************** + * Copyright 2007 VMware, Inc. All rights reserved. + * **********************************************************/ + +/* + * svga_overlay.h -- + * + * Definitions for video-overlay support. + */ + +#ifndef _SVGA_OVERLAY_H_ +#define _SVGA_OVERLAY_H_ + +/* + * Video formats we support + */ + +#define VMWARE_FOURCC_YV12 0x32315659 // 'Y' 'V' '1' '2' +#define VMWARE_FOURCC_YUY2 0x32595559 // 'Y' 'U' 'Y' '2' + +#define SVGA_ESCAPE_VMWARE_VIDEO 0x00020000 + +#define SVGA_ESCAPE_VMWARE_VIDEO_SET_REGS 0x00020001 + /* FIFO escape layout: + * Type, Stream Id, (Register Id, Value) pairs */ + +#define SVGA_ESCAPE_VMWARE_VIDEO_FLUSH 0x00020002 + /* FIFO escape layout: + * Type, Stream Id */ + +typedef struct SVGAEscapeVideoSetRegs { + struct { + uint32 cmdType; + uint32 streamId; + } header; + + // May include zero or more items. + struct { + uint32 registerId; + uint32 value; + } items[1]; +} SVGAEscapeVideoSetRegs; + +typedef struct SVGAEscapeVideoFlush { + uint32 cmdType; + uint32 streamId; +} SVGAEscapeVideoFlush; + +#endif // _SVGA_OVERLAY_H_ diff --git a/src/svga_reg.h b/src/svga_reg.h index 871a8ff..4560fe7 100644 --- a/src/svga_reg.h +++ b/src/svga_reg.h @@ -1,7 +1,5 @@ /* ********************************************************** - * Copyright (C) 1998-2001 VMware, Inc. - * All Rights Reserved - * $Id$ + * Copyright 1998 VMware, Inc. All rights reserved. * **********************************************************/ /* @@ -9,13 +7,13 @@ * * SVGA hardware definitions */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/svga_reg.h,v 1.7 2002/12/10 04:17:19 dawes Exp $ */ #ifndef _SVGA_REG_H_ #define _SVGA_REG_H_ #define INCLUDE_ALLOW_USERLEVEL #define INCLUDE_ALLOW_VMMEXT +#define INCLUDE_ALLOW_VMCORE #include "includeCheck.h" /* @@ -30,7 +28,17 @@ #define SVGA_MAX_HEIGHT 1770 #define SVGA_MAX_BITS_PER_PIXEL 32 #define SVGA_MAX_DEPTH 24 +#define SVGA_MAX_DISPLAYS 10 +/* + * The maximum size of the onscreen framebuffer. The size of the + * changeMap in the monitor is proportional to this number since it's + * the amount of memory we need to trace in VESA mode. Therefore, we'd + * like to keep it as small as possible to reduce monitor overhead (using + * SVGA_VRAM_MAX_SIZE for this increases the size of the shared area + * by over 4k!). + */ + #define SVGA_FB_MAX_SIZE \ ((((SVGA_MAX_WIDTH * SVGA_MAX_HEIGHT * \ SVGA_MAX_BITS_PER_PIXEL / 8) >> PAGE_SHIFT) + 1) << PAGE_SHIFT) @@ -67,6 +75,17 @@ #define SVGA_VALUE_PORT 0x1 #define SVGA_BIOS_PORT 0x2 #define SVGA_NUM_PORTS 0x3 +#define SVGA_IRQSTATUS_PORT 0x8 + +/* + * Interrupt source flags for IRQSTATUS_PORT and IRQMASK. + * + * Interrupts are only supported when the + * SVGA_CAP_IRQMASK capability is present. + */ +#define SVGA_IRQFLAG_ANY_FENCE 0x1 /* Any fence was passed */ +#define SVGA_IRQFLAG_FIFO_PROGRESS 0x2 /* Made forward progress in the FIFO */ +#define SVGA_IRQFLAG_FENCE_GOAL 0x4 /* SVGA_FIFO_FENCE_GOAL reached */ /* This port is deprecated, but retained because of old drivers. */ #define SVGA_LEGACY_ACCEL_PORT 0x3 @@ -106,8 +125,8 @@ enum { SVGA_REG_MEM_START = 18, /* Memory for command FIFO and bitmaps */ SVGA_REG_MEM_SIZE = 19, SVGA_REG_CONFIG_DONE = 20, /* Set when memory area configured */ - SVGA_REG_SYNC = 21, /* Write to force synchronization */ - SVGA_REG_BUSY = 22, /* Read to check if sync is done */ + SVGA_REG_SYNC = 21, /* See "FIFO Synchronization Registers" */ + SVGA_REG_BUSY = 22, /* See "FIFO Synchronization Registers" */ SVGA_REG_GUEST_ID = 23, /* Set guest OS identifier */ SVGA_REG_CURSOR_ID = 24, /* ID of cursor */ SVGA_REG_CURSOR_X = 25, /* Set cursor X position */ @@ -118,7 +137,8 @@ enum { SVGA_REG_MEM_REGS = 30, /* Number of FIFO registers */ SVGA_REG_NUM_DISPLAYS = 31, /* Number of guest displays */ SVGA_REG_PITCHLOCK = 32, /* Fixed pitch for all modes */ - SVGA_REG_TOP = 33, /* Must be 1 more than the last register */ + SVGA_REG_IRQMASK = 33, /* Interrupt mask */ + SVGA_REG_TOP = 34, /* Must be 1 more than the last register */ SVGA_PALETTE_BASE = 1024, /* Base of SVGA color map */ /* Next 768 (== 256*3) registers exist for colormap */ @@ -153,6 +173,7 @@ enum { #define SVGA_CAP_EXTENDED_FIFO 0x08000 #define SVGA_CAP_MULTIMON 0x10000 #define SVGA_CAP_PITCHLOCK 0x20000 +#define SVGA_CAP_IRQMASK 0x40000 /* * Raster op codes (same encoding as X) used by FIFO drivers. @@ -247,12 +268,24 @@ enum { /* - * FIFO offsets (viewed as an array of 32-bit words) + * FIFO register indices. + * + * The FIFO is a chunk of device memory mapped into guest physmem. It + * is always treated as 32-bit words. + * + * The guest driver gets to decide how to partition it between + * - FIFO registers (there are always at least 4, specifying where the + * following data area is and how much data it contains; there may be + * more registers following these, depending on the FIFO protocol + * version in use) + * - FIFO data, written by the guest and slurped out by the VMX. + * These indices are 32-bit word offsets into the FIFO. */ enum { /* - * The original defined FIFO offsets + * Block 1 (basic registers): The originally defined FIFO registers. + * These exist and are valid for all versions of the FIFO protocol. */ SVGA_FIFO_MIN = 0, @@ -261,35 +294,244 @@ enum { SVGA_FIFO_STOP, /* - * Additional offsets added as of SVGA_CAP_EXTENDED_FIFO + * Block 2 (extended registers): Mandatory registers for the extended + * FIFO. These exist if the SVGA caps register includes + * SVGA_CAP_EXTENDED_FIFO; some of them are valid only if their + * associated capability bit is enabled. + * + * Note that when originally defined, SVGA_CAP_EXTENDED_FIFO implied + * support only for (FIFO registers) CAPABILITIES, FLAGS, and FENCE. + * This means that the guest has to test individually (in most cases + * using FIFO caps) for the presence of registers after this; the VMX + * can define "extended FIFO" to mean whatever it wants, and currently + * won't enable it unless there's room for that set and much more. */ SVGA_FIFO_CAPABILITIES = 4, SVGA_FIFO_FLAGS, + // Valid with SVGA_FIFO_CAP_FENCE: SVGA_FIFO_FENCE, - SVGA_FIFO_3D_HWVERSION, /* Check SVGA3dHardwareVersion in svga3d_reg.h */ + + /* + * Block 3a (optional extended registers): Additional registers for the + * extended FIFO, whose presence isn't actually implied by + * SVGA_CAP_EXTENDED_FIFO; these exist if SVGA_FIFO_MIN is high enough to + * leave room for them. + * + * These in block 3a, the VMX currently considers mandatory for the + * extended FIFO. -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]