Author: greatlrd
Date: Tue Dec 7 15:38:51 2010
New Revision: 49971
URL:
http://svn.reactos.org/svn/reactos?rev=49971&view=rev
Log:
Start cleanup the old dx code for 2d
add DdMapMemory not yet finish.
The code are not mapped out yet.
Plan to add hw support for DdLock and DdUnlock
Modified:
branches/reactx/reactos/drivers/video/displays/framebuf/dd.c
branches/reactx/reactos/drivers/video/displays/framebuf/ddenable.c
branches/reactx/reactos/drivers/video/displays/framebuf/enable.c
branches/reactx/reactos/drivers/video/displays/framebuf/framebuf.h
branches/reactx/reactos/drivers/video/displays/framebuf/framebuf.rbuild
Modified: branches/reactx/reactos/drivers/video/displays/framebuf/dd.c
URL:
http://svn.reactos.org/svn/reactos/branches/reactx/reactos/drivers/video/di…
==============================================================================
--- branches/reactx/reactos/drivers/video/displays/framebuf/dd.c [iso-8859-1] (original)
+++ branches/reactx/reactos/drivers/video/displays/framebuf/dd.c [iso-8859-1] Tue Dec 7
15:38:51 2010
@@ -24,93 +24,169 @@
DWORD CALLBACK
-DdCanCreateSurface(LPDDHAL_CANCREATESURFACEDATA pccsd)
+DdCanCreateSurface( LPDDHAL_CANCREATESURFACEDATA pccsd)
{
+ /* We do not needit if we need it here it is
+ PPDEV ppdev=(PPDEV)pccsd->lpDD->dhpdev;
+ */
- /* We do not support 3d buffer so we fail here */
- if ((pccsd->lpDDSurfaceDesc->ddsCaps.dwCaps & DDSCAPS_ZBUFFER) &&
- (pccsd->lpDDSurfaceDesc->ddsCaps.dwCaps & DDSCAPS_VIDEOMEMORY))
- {
- pccsd->ddRVal = DDERR_INVALIDPIXELFORMAT;
- return DDHAL_DRIVER_HANDLED;
- }
-
-
- /* Check if another pixel format or not, we fail for now */
- if (pccsd->bIsDifferentPixelFormat)
- {
- /* check the fourcc diffent FOURCC, but we only support BMP for now */
- //if(pccsd->lpDDSurfaceDesc->ddpfPixelFormat.dwFlags & DDPF_FOURCC)
- //{
- // /* We do not support other pixel format */
- // switch (pccsd->lpDDSurfaceDesc->ddpfPixelFormat.dwFourCC)
- // {
- // default:
- // pccsd->ddRVal = DDERR_INVALIDPIXELFORMAT;
- // return DDHAL_DRIVER_HANDLED;
- // }
- //}
- // /* check the texture support, we do not support testure for now */
- //else if((pccsd->lpDDSurfaceDesc->ddsCaps.dwCaps & DDSCAPS_TEXTURE))
- //{
- // /* We do not support texture surface */
- // pccsd->ddRVal = DDERR_INVALIDPIXELFORMAT;
- // return DDHAL_DRIVER_HANDLED;
- //}
-
- /* Fail */
- pccsd->ddRVal = DDERR_INVALIDPIXELFORMAT;
- return DDHAL_DRIVER_HANDLED;
+ pccsd->ddRVal = DD_OK;
+ /* We do not support 3d buffer in video ram so we fail here */
+ if (pccsd->lpDDSurfaceDesc->ddsCaps.dwCaps & DDSCAPS_ZBUFFER)
+ {
+ pccsd->ddRVal = DDERR_INVALIDPIXELFORMAT;
}
- pccsd->ddRVal = DD_OK;
- return DDHAL_DRIVER_HANDLED;
+ /* We do not support texture yet so we fail here */
+ if (pccsd->lplpSList[0]->lpSurfMore->ddsCapsEx.dwCaps2 &
DDSCAPS2_TEXTUREMANAGE)
+ {
+ pccsd->ddRVal = DDERR_INVALIDPIXELFORMAT;
+ }
+
+ /* Check if another pixel format or not, we fail for now */
+ if (pccsd->bIsDifferentPixelFormat)
+ {
+ /* We do not support FOUR_CC */
+ pccsd->ddRVal = DDERR_INVALIDPIXELFORMAT;
+ }
+
+ return DDHAL_DRIVER_HANDLED;
}
DWORD CALLBACK
-DdCreateSurface(PDD_CREATESURFACEDATA pcsd)
+DdCreateSurface( LPDDHAL_CREATESURFACEDATA pcsd )
{
- int i;
+ PPDEV pDev = (PPDEV)pcsd->lpDD->dhpdev;
+ DD_SURFACE_LOCAL* lpSurfaceLocal;
+ DD_SURFACE_GLOBAL* lpSurfaceGlobal;
+ LPDDSURFACEDESC lpSurfaceDesc;
- if (pcsd->dwSCnt < 1)
- {
- pcsd->ddRVal = DDERR_GENERIC;
- return DDHAL_DRIVER_NOTHANDLED;
- }
+ /* Driver DdCreateSurface should only support to create one surface not more that */
+ if (pcsd->dwSCnt != 1)
+ {
+ pcsd->ddRVal = DDERR_GENERIC;
+ return DDHAL_DRIVER_HANDLED;
+ }
+
+ lpSurfaceLocal = pcsd->lplpSList[0];
+ lpSurfaceGlobal = lpSurfaceLocal->lpGbl;
+ lpSurfaceDesc = pcsd->lpDDSurfaceDesc;
- for (i=0; i<(int)pcsd->dwSCnt; i++)
+ /* ReactOS / Windows NT is supposed to guarantee that ddpfSurface.dwSize is valid */
+ if ( lpSurfaceGlobal->ddpfSurface.dwSize == sizeof(DDPIXELFORMAT) )
{
- pcsd->lplpSList[i]->lpGbl->lPitch =
(DWORD)(pcsd->lplpSList[i]->lpGbl->wWidth *
-
(pcsd->lplpSList[i]->lpGbl->ddpfSurface.dwRGBBitCount / 8));
+ pcsd->ddRVal = DDERR_GENERIC;
+ return DDHAL_DRIVER_HANDLED;
+ }
- pcsd->lplpSList[i]->lpGbl->dwBlockSizeX =
pcsd->lplpSList[i]->lpGbl->lPitch *
-
(DWORD)(pcsd->lplpSList[i]->lpGbl->wHeight);
+ /* We do not have any private surface data for dx */
+ lpSurfaceGlobal->dwReserved1 = 0;
- pcsd->lplpSList[i]->lpGbl->dwBlockSizeY = 1;
- if ( pcsd->lplpSList[i] ->ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE)
+ /* Support diffent Bpp deep */
+ if (lpSurfaceDesc->ddpfPixelFormat.dwFlags & DDPF_PALETTEINDEXED4)
+ {
+ lpSurfaceGlobal->lPitch = ((lpSurfaceGlobal->wWidth/2) + 31) & ~31;
+ }
+ else if (lpSurfaceDesc->ddpfPixelFormat.dwFlags & DDPF_PALETTEINDEXED8)
+ {
+ lpSurfaceGlobal->lPitch = (lpSurfaceGlobal->wWidth + 31) & ~31;
+ }
+ else
+ {
+ lpSurfaceGlobal->lPitch =
lpSurfaceGlobal->wWidth*(lpSurfaceDesc->ddpfPixelFormat.dwRGBBitCount/8);
+ }
+
+ if ( lpSurfaceDesc->ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE)
+ {
+ /* We maybe should alloc it with EngAlloc
+ for now we trusting ddraw alloc it */
+ lpSurfaceGlobal->lpGbl->fpVidMem = 0;
+ }
+ else
+ {
+ /* We maybe should alloc it with EngAlloc
+ for now we trusting ddraw alloc it */
+
+ lpSurfaceGlobal->lpGbl->fpVidMem = 0;
+
+ if ( (lpSurfaceLocal->lpSurfMore->ddsCapsEx.dwCaps2 &
DDSCAPS2_TEXTUREMANAGE) &&
{
- /* We maybe should alloc it with EngAlloc
- for now we trusting ddraw alloc it */
- pcsd->lplpSList[i]->lpGbl->fpVidMem = 0;
+ if (lpSurfaceDesc->dwFlags & DDSD_PIXELFORMAT)
+ {
+ lpSurfaceGlobal->lPitch =
((lpSurfaceDesc->ddpfPixelFormat.dwRGBBitCount * lpSurfaceGlobal->wWidth+31)/32)*4;
//make it DWORD aligned
+ lpSurfaceGlobal->dwUserMemSize = lpSurfaceGlobal->wWidth *
lpSurfaceGlobal->wHeight * lpSurfaceGlobal->lPitch;
+ lpSurfaceGlobal->fpVidMem = DDHAL_PLEASEALLOC_USERMEM;
+ }
+ }
+ else
+ {
+ lpSurfaceGlobal->dwBlockSizeX = lpSurfaceGlobal->wWidth;
+ lpSurfaceGlobal->dwBlockSizeY = lpSurfaceGlobal->wHeight;
+ lpSurfaceGlobal->fpVidMem = DDHAL_PLEASEALLOC_BLOCKSIZE;
+ }
+ }
+
+ pcsd->lpDDSurfaceDesc->lPitch = lpSurfaceGlobal->lPitch;
+ pcsd->lpDDSurfaceDesc->dwFlags |= DDSD_PITCH;
+
+ pcsd->ddRVal = DD_OK;
+ return DDHAL_DRIVER_HANDLED;
+}
+
+DWORD CALLBACK
+DdMapMemory(PDD_MAPMEMORYDATA lpMapMemory)
+{
+
+ VIDEO_SHARE_MEMORY ShareMemory;
+ VIDEO_SHARE_MEMORY_INFORMATION ShareMemoryInformation;
+ DWORD ReturnedDataLength;
+ PPDEV ppdev = (PPDEV) lpMapMemory->lpDD->dhpdev;
+
+ lpMapMemory->ddRVal = DD_OK;
+
+ if (lpMapMemory->bMap)
+ {
+ ShareMemory.ProcessHandle = lpMapMemory->hProcess;
+ ShareMemory.RequestedVirtualAddress = 0;
+ ShareMemory.ViewOffset = 0;
+ ShareMemory.ViewSize = ppdev->ScreenHeight * ppdev->ScreenDelta;
+
+ if (EngDeviceIoControl(ppdev->hDriver,
+ IOCTL_VIDEO_SHARE_VIDEO_MEMORY,
+ &ShareMemory,
+ sizeof(VIDEO_SHARE_MEMORY),
+ &ShareMemoryInformation,
+ sizeof(VIDEO_SHARE_MEMORY_INFORMATION),
+ &ReturnedDataLength))
+ {
+ lpMapMemory->ddRVal = DDERR_GENERIC;
}
else
{
+ lpMapMemory->fpProcess = (FLATPTR) ShareMemoryInformation.VirtualAddress;
+ }
+ }
+ else
+ {
+ ShareMemory.ProcessHandle = lpMapMemory->hProcess;
+ ShareMemory.ViewOffset = 0;
+ ShareMemory.ViewSize = 0;
+ ShareMemory.RequestedVirtualAddress = (VOID*) lpMapMemory->fpProcess;
- /* We maybe should alloc it with EngAlloc
- for now we trusting ddraw alloc it */
- pcsd->lplpSList[i]->lpGbl->fpVidMem = DDHAL_PLEASEALLOC_BLOCKSIZE;
+ if (EngDeviceIoControl(ppdev->hDriver,
+ IOCTL_VIDEO_UNSHARE_VIDEO_MEMORY,
+ &ShareMemory,
+ sizeof(VIDEO_SHARE_MEMORY),
+ NULL,
+ 0,
+ &ReturnedDataLength))
+ {
+ lpMapMemory->ddRVal = DDERR_GENERIC;
}
+ }
- pcsd->lpDDSurfaceDesc->lPitch =
pcsd->lplpSList[i]->lpGbl->lPitch;
- pcsd->lpDDSurfaceDesc->dwFlags |= DDSD_PITCH;
-
- } // for i
-
-
-
- pcsd->ddRVal = DD_OK;
- return DDHAL_DRIVER_HANDLED;
+
+ return(DDHAL_DRIVER_HANDLED);
}
-
Modified: branches/reactx/reactos/drivers/video/displays/framebuf/ddenable.c
URL:
http://svn.reactos.org/svn/reactos/branches/reactx/reactos/drivers/video/di…
==============================================================================
--- branches/reactx/reactos/drivers/video/displays/framebuf/ddenable.c [iso-8859-1]
(original)
+++ branches/reactx/reactos/drivers/video/displays/framebuf/ddenable.c [iso-8859-1] Tue
Dec 7 15:38:51 2010
@@ -36,95 +36,79 @@
OUT DD_SURFACECALLBACKS *pSurfaceCallBacks,
OUT DD_PALETTECALLBACKS *pPaletteCallBacks)
{
- PPDEV ppdev = (PPDEV)dhpdev;
-
- if (ppdev->bDDInitialized == TRUE)
- {
- return TRUE;
- }
-
- /* Setup pixel format */
- ppdev->ddpfDisplay.dwSize = sizeof( DDPIXELFORMAT );
- ppdev->ddpfDisplay.dwFourCC = 0;
-
- ppdev->ddpfDisplay.dwRBitMask = ppdev->RedMask;
- ppdev->ddpfDisplay.dwGBitMask = ppdev->GreenMask;
- ppdev->ddpfDisplay.dwBBitMask = ppdev->BlueMask;
-
- ppdev->ddpfDisplay.dwRGBBitCount=ppdev->BitsPerPixel;
- ppdev->ddpfDisplay.dwRGBAlphaBitMask = 0;
- ppdev->ddpfDisplay.dwFlags = DDPF_RGB;
-
- ppdev->pvmList = NULL;
-
- switch(ppdev->iDitherFormat)
- {
- case BMF_8BPP:
- ppdev->ddpfDisplay.dwFlags |= DDPF_PALETTEINDEXED8;
- break;
-
- case BMF_16BPP:
- switch(ppdev->RedMask)
- {
- case 0x7C00:
- ppdev->ddpfDisplay.dwRGBAlphaBitMask = 0x8000;
- break;
-
- default:
- break;
- }
- break;
-
- case BMF_24BPP:
- break;
-
- case BMF_32BPP:
- ppdev->ddpfDisplay.dwRGBAlphaBitMask = 0xff000000;
- break;
-
- default:
- /* FIXME unknown pixel bits */
- ppdev->ddpfDisplay.dwRGBBitCount=0;
- break;
- }
-
- if (pCallBacks !=NULL)
- {
- memset(pCallBacks,0,sizeof(DD_CALLBACKS));
-
- /* FILL pCallBacks with hal stuff */
- pCallBacks->dwSize = sizeof(DDHAL_DDCALLBACKS);
- pCallBacks->CanCreateSurface = (PDD_CANCREATESURFACE)DdCanCreateSurface;
- pCallBacks->CreateSurface = (PDD_CREATESURFACE)DdCreateSurface;
-
- /* Fill in the HAL Callback flags */
- pCallBacks->dwFlags = DDHAL_CB32_CANCREATESURFACE |
DDHAL_CB32_CREATESURFACE;
- }
-
- if (pSurfaceCallBacks !=NULL)
- {
- memset(pSurfaceCallBacks,0,sizeof(DD_SURFACECALLBACKS));
-
- /* FILL pSurfaceCallBacks with hal stuff */
- // pSurfaceCallBacks.dwSize = sizeof(DDHAL_DDSURFACECALLBACKS);
- // pSurfaceCallBacks.DestroySurface = DdDestroySurface;
- // pSurfaceCallBacks.Lock = DdLock;
- // pSurfaceCallBacks.Blt = DdBlt;
-
- // pSurfaceCallBacks->dwFlags = DDHAL_SURFCB32_DESTROYSURFACE |
DDHAL_SURFCB32_LOCK | DDHAL_SURFCB32_BLT ;
- }
-
- if (pPaletteCallBacks !=NULL)
- {
- memset(pPaletteCallBacks,0,sizeof(DD_PALETTECALLBACKS));
- /* FILL pPaletteCallBacks with hal stuff */
- /* We will not support this callback in the framebuf.dll */
- }
-
-
- /* Fixme fill the ppdev->dxHalInfo with the info we need */
- ppdev->bDDInitialized = TRUE;
- return ppdev->bDDInitialized;
+ PPDEV ppdev = (PPDEV)dhpdev;
+
+ if (ppdev->bDDInitialized == TRUE)
+ {
+ return TRUE;
+ }
+
+ if (pCallBacks !=NULL)
+ {
+ memset(pCallBacks,0,sizeof(DD_CALLBACKS));
+ /* Fill in the HAL Callback pointers */
+
+ pCallBacks->dwSize = sizeof(DD_CALLBACKS);
+ pCallBacks->dwFlags = DDHAL_CB32_CANCREATESURFACE |
+ DDHAL_CB32_CREATESURFACE ;
+ // = DDHAL_CB32_WAITFORVERTICALBLANK |
+ // DDHAL_CB32_MAPMEMORY |
+ // DDHAL_CB32_GETSCANLINE |
+
+ pCallBacks->CreateSurface = DdCreateSurface;
+ // pCallBacks->SetColorKey = DdSetColorKey;
+ // pCallBacks->WaitForVerticalBlank = DdWaitForVerticalBlank;
+ pCallBacks->CanCreateSurface = DdCanCreateSurface;
+ // pCallBacks->CreatePalette = DdCreatePalette;
+ // pCallBacks->GetScanLine = DdGetScanLine;
+ // pCallBacks->MapMemory = DdMapMemory;
+
+ /* Unused on Microsoft Windows 2000 and later and should be ignored by the
driver. '
+ pCallBacks->DestroyDriver
+ pCallBacks->SetMode
+ */
+
+ }
+
+ if (pSurfaceCallBacks !=NULL)
+ {
+ memset(pSurfaceCallBacks,0,sizeof(DD_SURFACECALLBACKS));
+
+ /* FILL pSurfaceCallBacks with hal stuff */
+ // pSurfaceCallBacks->dwSize = sizeof(DDHAL_DDSURFACECALLBACKS);
+ // DDHAL_SURFCB32_DESTROYSURFACE |
+ // DDHAL_SURFCB32_FLIP |
+ // DDHAL_SURFCB32_LOCK |
+ // DDHAL_SURFCB32_BLT |
+ // DDHAL_SURFCB32_GETBLTSTATUS |
+ // DDHAL_SURFCB32_GETFLIPSTATUS;
+ // pSurfaceCallBacks->DestroySurface = DdDestroySurface;
+ // pSurfaceCallBacks->Flip = DdFlip;
+ // pSurfaceCallBacks->SetClipList = DdSetClipList;
+ // pSurfaceCallBacks->Lock = DdLock;
+ // pSurfaceCallBacks->Unlock = DdUnlock;
+ // pSurfaceCallBacks->Blt = DdBlt;
+ // pSurfaceCallBacks->SetColorKey = DdSetColorKey;
+ // pSurfaceCallBacks->AddAttachedSurface = DdAddAttachedSurface;
+ // pSurfaceCallBacks->GetBltStatus = DdGetBltStatus;
+ // pSurfaceCallBacks->GetFlipStatus = DdGetFlipStatus;
+ // pSurfaceCallBacks->UpdateOverlay = DdUpdateOverlay;
+ // pSurfaceCallBacks->SetOverlayPosition = DdSetOverlayPosition;
+ // pSurfaceCallBacks->SetPalette = DdSetPalette;
+ }
+
+ if (pPaletteCallBacks !=NULL)
+ {
+ memset(pPaletteCallBacks,0,sizeof(DD_PALETTECALLBACKS));
+ /* FILL pPaletteCallBacks with hal stuff */
+ pPaletteCallBacks->dwSize = sizeof(DD_PALETTECALLBACKS);
+ pPaletteCallBacks->dwFlags = 0;
+ // pPaletteCallBacks->DestroyPalette;
+ // pPaletteCallBacks->SetEntries;
+ }
+
+ ppdev->bDDInitialized = TRUE;
+ return ppdev->bDDInitialized;
}
BOOL APIENTRY
@@ -136,29 +120,17 @@
OUT DWORD *pdwNumFourCCCodes,
OUT DWORD *pdwFourCC)
{
- PPDEV ppdev = (PPDEV)dhpdev;
- LONG i;
- DWORD heap = 1; /* we always alloc one heap */
- BOOL bDDrawHeap = FALSE;
-
- if (ppdev == NULL)
+ PPDEV ppdev = (PPDEV)dhpdev;
+ DWORD heap = 1; /* we always alloc one heap */
+ BOOL bDDrawHeap = FALSE;
+
+ if (ppdev->bDDInitialized == FALSE);
+ {
return FALSE;
-
- /* check so pHalInfo, pdwNumHeaps, pdwNumFourCCCodes is not NULL
- pdwFourCC and pvmList can be null
- */
-
- if (pHalInfo == NULL)
- return FALSE;
-
- if (pdwNumHeaps == NULL)
- return FALSE;
-
- if (pdwNumFourCCCodes == NULL)
- return FALSE;
-
- /* Setup heap */
- if ( (ppdev->ScreenWidth < ppdev->MemWidth) || (ppdev->ScreenHeight <
ppdev->MemHeight))
+ }
+
+ /* Setup heap */
+ if ( (ppdev->ScreenWidth < ppdev->MemWidth) || (ppdev->ScreenHeight <
ppdev->MemHeight))
{
bDDrawHeap = TRUE;
heap++;
@@ -167,41 +139,45 @@
ppdev->dwHeap = heap;
*pdwNumHeaps = heap;
- /* We do not support other fourcc */
+ /* We do not support other fourcc */
*pdwNumFourCCCodes = 0;
- /*
- check see if pvmList and pdwFourCC are frist call
- or frist. Secon call we fill in pHalInfo info
+ /*
+ check see if pvmList and pdwFourCC are frist call
+ or frist. Secon call we fill in pHalInfo info
*/
- if(!(pvmList && pdwFourCC))
- {
-
- RtlZeroMemory(pHalInfo, sizeof(DD_HALINFO));
- pHalInfo->dwSize = sizeof(DD_HALINFO);
-
- pHalInfo->ddCaps.dwCaps = DDCAPS_BLT | DDCAPS_BLTQUEUE |
DDCAPS_BLTCOLORFILL | DDCAPS_READSCANLINE |
- DDCAPS_BLTSTRETCH | DDCAPS_COLORKEY | DDCAPS_CANBLTSYSMEM;
-
- pHalInfo->ddCaps.dwFXCaps = DDFXCAPS_BLTSTRETCHY | DDFXCAPS_BLTSTRETCHX
|
- DDFXCAPS_BLTSTRETCHYN | DDFXCAPS_BLTSTRETCHXN |
- DDFXCAPS_BLTSHRINKY | DDFXCAPS_BLTSHRINKX |
- DDFXCAPS_BLTSHRINKYN | DDFXCAPS_BLTSHRINKXN
|
- DDFXCAPS_BLTMIRRORUPDOWN | DDFXCAPS_BLTMIRRORLEFTRIGHT;
-
- pHalInfo->ddCaps.dwCaps2 = DDCAPS2_NONLOCALVIDMEM | DDCAPS2_NONLOCALVIDMEMCAPS;
-
- pHalInfo->ddCaps.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_PRIMARYSURFACE |
DDSCAPS_FLIP;
-
- pHalInfo->ddCaps.dwCKeyCaps = DDCKEYCAPS_SRCBLT | DDCKEYCAPS_SRCBLTCLRSPACE;
-
- pHalInfo->ddCaps.dwSVBCaps = DDCAPS_BLT;
- pHalInfo->ddCaps.ddsCaps.dwCaps |= DDSCAPS_LOCALVIDMEM | DDSCAPS_NONLOCALVIDMEM;
-
- /* Calc how much memmory is left on the video cards memmory */
- pHalInfo->ddCaps.dwVidMemTotal = (ppdev->MemHeight - ppdev->ScreenHeight) *
ppdev->ScreenDelta;
+ if(!(pvmList && pdwFourCC))
+ {
+ RtlZeroMemory(pHalInfo, sizeof(DD_HALINFO));
+ pHalInfo->dwSize = sizeof(DD_HALINFO);
+
+ pHalInfo->ddCaps.dwCaps = DDCAPS_NOHARDWARE;
+ /* we do not support all this caps
+ pHalInfo->ddCaps.dwCaps = DDCAPS_BLT | DDCAPS_BLTQUEUE |
DDCAPS_BLTCOLORFILL | DDCAPS_READSCANLINE |
+ DDCAPS_BLTSTRETCH | DDCAPS_COLORKEY |
DDCAPS_CANBLTSYSMEM;
+
+ pHalInfo->ddCaps.dwFXCaps = DDFXCAPS_BLTSTRETCHY | DDFXCAPS_BLTSTRETCHX
|
+ DDFXCAPS_BLTSTRETCHYN | DDFXCAPS_BLTSTRETCHXN
|
+ DDFXCAPS_BLTSHRINKY | DDFXCAPS_BLTSHRINKX
|
+ DDFXCAPS_BLTSHRINKYN | DDFXCAPS_BLTSHRINKXN
|
+ DDFXCAPS_BLTMIRRORUPDOWN |
DDFXCAPS_BLTMIRRORLEFTRIGHT;
+
+ pHalInfo->ddCaps.dwCaps2 = DDCAPS2_NONLOCALVIDMEM |
DDCAPS2_NONLOCALVIDMEMCAPS;
+
+ pHalInfo->ddCaps.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN |
DDSCAPS_PRIMARYSURFACE | DDSCAPS_FLIP;
+
+ pHalInfo->ddCaps.dwCKeyCaps = DDCKEYCAPS_SRCBLT | DDCKEYCAPS_SRCBLTCLRSPACE;
+
+ pHalInfo->ddCaps.dwSVBCaps = DDCAPS_BLT;
+ pHalInfo->ddCaps.ddsCaps.dwCaps |= DDSCAPS_LOCALVIDMEM |
DDSCAPS_NONLOCALVIDMEM;
+ */
+
+ pHalInfo->ddCaps.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN |
DDSCAPS_PRIMARYSURFACE | DDSCAPS_FLIP;
+
+ /* Calc how much memmory is left on the video cards memmory */
+ pHalInfo->ddCaps.dwVidMemTotal = (ppdev->MemHeight -
ppdev->ScreenHeight) * ppdev->ScreenDelta;
/* fill in some basic info that we need */
pHalInfo->vmiData.pvPrimary = ppdev->ScreenPtr;
@@ -211,50 +187,45 @@
pHalInfo->vmiData.ddpfDisplay.dwSize = sizeof(DDPIXELFORMAT);
pHalInfo->vmiData.ddpfDisplay.dwFlags = DDPF_RGB;
pHalInfo->vmiData.ddpfDisplay.dwRGBBitCount = ppdev->BitsPerPixel;
- pHalInfo->vmiData.ddpfDisplay.dwRBitMask = ppdev->RedMask;
+ pHalInfo->vmiData.ddpfDisplay.dwRBitMask = ppdev->RedMask;
pHalInfo->vmiData.ddpfDisplay.dwGBitMask = ppdev->GreenMask;
pHalInfo->vmiData.ddpfDisplay.dwBBitMask = ppdev->BlueMask;
pHalInfo->vmiData.dwOffscreenAlign = 4;
- if ( ppdev->BitsPerPixel == 8 )
- {
+ if ( ppdev->BitsPerPixel == 8 )
+ {
pHalInfo->vmiData.ddpfDisplay.dwFlags |= DDPF_PALETTEINDEXED8;
}
- /* FIXME
- Config the rops we do not doing that yet
- for we need write the rops table
- */
- for(i=0;i<DD_ROP_SPACE;i++ )
+ if ( ppdev->BitsPerPixel == 4 )
{
- // pHALInfo->ddCaps.dwSVBRops[i] = rops[i];
- // pHALInfo->ddCaps.dwRops[i] = rops[i];
+ pHalInfo->vmiData.ddpfDisplay.dwFlags |= DDPF_PALETTEINDEXED4;
}
- }
-
- /* Now build pvmList info */
- if(pvmList)
- {
- ppdev->pvmList = pvmList;
-
- if ( bDDrawHeap == TRUE)
- {
- pvmList->dwFlags = VIDMEM_ISLINEAR ;
+ }
+
+ /* Now build pvmList info */
+ if(pvmList)
+ {
+ ppdev->pvmList = pvmList;
+
+ if ( bDDrawHeap == TRUE)
+ {
+ pvmList->dwFlags = VIDMEM_ISLINEAR ;
pvmList->fpStart = ppdev->ScreenHeight * ppdev->ScreenDelta;
pvmList->fpEnd = ppdev->MemHeight * ppdev->ScreenDelta -
1;
- pvmList->ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN;
- pvmList++;
- }
-
- pvmList->fpStart = 0;
- pvmList->fpEnd = (ppdev->MemHeight * ppdev->ScreenDelta) - 1;
- pvmList->dwFlags = VIDMEM_ISNONLOCAL | VIDMEM_ISLINEAR | VIDMEM_ISWC;
- pvmList->ddsCaps.dwCaps = DDSCAPS_FRONTBUFFER | DDSCAPS_BACKBUFFER ;
- pvmList->ddsCapsAlt.dwCaps = DDSCAPS_FRONTBUFFER | DDSCAPS_BACKBUFFER;
-
- pvmList = ppdev->pvmList;
- }
-
- return TRUE;
+ pvmList->ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN;
+ pvmList++;
+ }
+
+ pvmList->fpStart = 0;
+ pvmList->fpEnd = (ppdev->MemHeight * ppdev->ScreenDelta) - 1;
+ pvmList->dwFlags = VIDMEM_ISNONLOCAL | VIDMEM_ISLINEAR | VIDMEM_ISWC;
+ pvmList->ddsCaps.dwCaps = DDSCAPS_FRONTBUFFER | DDSCAPS_BACKBUFFER ;
+ pvmList->ddsCapsAlt.dwCaps = DDSCAPS_FRONTBUFFER | DDSCAPS_BACKBUFFER;
+
+ pvmList = ppdev->pvmList;
+ }
+
+ return TRUE;
}
Modified: branches/reactx/reactos/drivers/video/displays/framebuf/enable.c
URL:
http://svn.reactos.org/svn/reactos/branches/reactx/reactos/drivers/video/di…
==============================================================================
--- branches/reactx/reactos/drivers/video/displays/framebuf/enable.c [iso-8859-1]
(original)
+++ branches/reactx/reactos/drivers/video/displays/framebuf/enable.c [iso-8859-1] Tue Dec
7 15:38:51 2010
@@ -19,6 +19,8 @@
*/
#include "framebuf.h"
+
+HSEMAPHORE g_cs = (HSEMAPHORE)0;
static DRVFN DrvFunctionTable[] =
{
@@ -52,17 +54,39 @@
ULONG cj,
PDRVENABLEDATA pded)
{
+ ULONG i;
+ BOOL status = FALSE;
+ ULONG SupportedVersions[] =
+ {
+ DDI_DRIVER_VERSION_NT5, // win2000
+ DDI_DRIVER_VERSION_NT5_01, // win xp
+ DDI_DRIVER_VERSION_NT5_01_SP1, // win xp sp1
+ };
+
if (cj >= sizeof(DRVENABLEDATA))
{
pded->c = sizeof(DrvFunctionTable) / sizeof(DRVFN);
pded->pdrvfn = DrvFunctionTable;
- pded->iDriverVersion = DDI_DRIVER_VERSION_NT5;
- return TRUE;
+
+ // check see if it win2000/win xp or reactos, if no version found return false
+ for (i=0; i < sizeof(SupportedVersions) / sizeof(ULONG) ; i++)
+ {
+ if (SupportedVersions[i] == iEngineVersion )
+ {
+ pded->iDriverVersion = SupportedVersions[i];
+
+ // Initialize sync semaphore.
+ g_cs = EngCreateSemaphore();
+ if (g_cs)
+ {
+ status = TRUE;
+ }
+ break;
+ }
+ }
+
}
- else
- {
- return FALSE;
- }
+ return status;
}
/*
Modified: branches/reactx/reactos/drivers/video/displays/framebuf/framebuf.h
URL:
http://svn.reactos.org/svn/reactos/branches/reactx/reactos/drivers/video/di…
==============================================================================
--- branches/reactx/reactos/drivers/video/displays/framebuf/framebuf.h [iso-8859-1]
(original)
+++ branches/reactx/reactos/drivers/video/displays/framebuf/framebuf.h [iso-8859-1] Tue
Dec 7 15:38:51 2010
@@ -27,6 +27,7 @@
#include <winddi.h>
#include <winioctl.h>
#include <ntddvdeo.h>
+#include <ddrawi.h>
//#define EXPERIMENTAL_MOUSE_CURSOR_SUPPORT
@@ -69,6 +70,15 @@
#define DEVICE_NAME L"framebuf"
#define ALLOC_TAG 'FUBF'
+
+DWORD CALLBACK
+DdCanCreateSurface( LPDDHAL_CANCREATESURFACEDATA pccsd );
+
+DWORD CALLBACK
+DdCreateSurface( LPDDHAL_CREATESURFACEDATA pcsd);
+
+DWORD CALLBACK
+DdMapMemory(PDD_MAPMEMORYDATA lpMapMemory);
DHPDEV APIENTRY
@@ -159,3 +169,24 @@
IN PPALETTEENTRY ppalent,
IN ULONG iStart,
IN ULONG cColors);
+
+VOID APIENTRY
+DrvDisableDirectDraw(
+ IN DHPDEV dhpdev);
+
+BOOL APIENTRY
+DrvEnableDirectDraw(
+ IN DHPDEV dhpdev,
+ OUT DD_CALLBACKS *pCallBacks,
+ OUT DD_SURFACECALLBACKS *pSurfaceCallBacks,
+ OUT DD_PALETTECALLBACKS *pPaletteCallBacks);
+
+BOOL APIENTRY
+DrvGetDirectDrawInfo(
+ IN DHPDEV dhpdev,
+ OUT DD_HALINFO *pHalInfo,
+ OUT DWORD *pdwNumHeaps,
+ OUT VIDEOMEMORY *pvmList,
+ OUT DWORD *pdwNumFourCCCodes,
+ OUT DWORD *pdwFourCC);
+
Modified: branches/reactx/reactos/drivers/video/displays/framebuf/framebuf.rbuild
URL:
http://svn.reactos.org/svn/reactos/branches/reactx/reactos/drivers/video/di…
==============================================================================
--- branches/reactx/reactos/drivers/video/displays/framebuf/framebuf.rbuild [iso-8859-1]
(original)
+++ branches/reactx/reactos/drivers/video/displays/framebuf/framebuf.rbuild [iso-8859-1]
Tue Dec 7 15:38:51 2010
@@ -9,5 +9,7 @@
<file>pointer.c</file>
<file>screen.c</file>
<file>surface.c</file>
+ <file>ddenable.c</file>
+ <file>dd.c</file>
<file>framebuf.rc</file>
</module>