Author: tkreuzer
Date: Mon Mar 5 13:30:37 2012
New Revision: 56032
URL:
http://svn.reactos.org/svn/reactos?rev=56032&view=rev
Log:
[WIN32K]
- Don't check for presence of driver functions that are not mandatory
- Pass graphics device, devmode and log address to PDEVOBJ_CreatePDEV to make it work
Modified:
branches/GSoC_2011/GdiFontDriver/subsystems/win32/win32k/eng/ldevobj.c
branches/GSoC_2011/GdiFontDriver/subsystems/win32/win32k/eng/pdevobj.c
branches/GSoC_2011/GdiFontDriver/subsystems/win32/win32k/font/fntdrvsup.c
branches/GSoC_2011/GdiFontDriver/subsystems/win32/win32k/include/pdevobj.h
Modified: branches/GSoC_2011/GdiFontDriver/subsystems/win32/win32k/eng/ldevobj.c
URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/GdiFontDriver/subsyst…
==============================================================================
--- branches/GSoC_2011/GdiFontDriver/subsystems/win32/win32k/eng/ldevobj.c [iso-8859-1]
(original)
+++ branches/GSoC_2011/GdiFontDriver/subsystems/win32/win32k/eng/ldevobj.c [iso-8859-1]
Mon Mar 5 13:30:37 2012
@@ -264,8 +264,7 @@
/* Check if the neccessary functions are there */
if ((!pldev->pfn.EnablePDEV) ||
- (!pldev->pfn.CompletePDEV) ||
- (!pldev->pfn.UnloadFontFile))
+ (!pldev->pfn.CompletePDEV))
{
DPRINT1("Missing function for gdi driver\n");
return FALSE;
@@ -276,7 +275,6 @@
if ((!pldev->pfn.AssertMode) ||
(!pldev->pfn.EnableSurface) ||
(!pldev->pfn.DisableSurface) ||
- (!pldev->pfn.DisableDriver) ||
(!pldev->pfn.DisablePDEV) ||
(!pldev->pfn.GetModes))
{
Modified: branches/GSoC_2011/GdiFontDriver/subsystems/win32/win32k/eng/pdevobj.c
URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/GdiFontDriver/subsyst…
==============================================================================
--- branches/GSoC_2011/GdiFontDriver/subsystems/win32/win32k/eng/pdevobj.c [iso-8859-1]
(original)
+++ branches/GSoC_2011/GdiFontDriver/subsystems/win32/win32k/eng/pdevobj.c [iso-8859-1]
Mon Mar 5 13:30:37 2012
@@ -7,8 +7,7 @@
*/
#include <win32k.h>
-#define NDEBUG
-#include <debug.h>
+DBG_DEFAULT_CHANNEL(EngPDev);
PPDEVOBJ gppdevPrimary = NULL;
@@ -104,8 +103,7 @@
PWSTR pwszLogAddress)
{
PFN_DrvEnablePDEV pfnEnablePDEV;
-
- DPRINT("PDEVOBJ_bEnablePDEV()\n");
+ TRACE("PDEVOBJ_bEnablePDEV()\n");
/* Get the DrvEnablePDEV function */
pfnEnablePDEV = ppdev->pldev->pfn.EnablePDEV;
@@ -136,8 +134,7 @@
/* Setup Palette */
ppdev->ppalSurf = PALETTE_ShareLockPalette(ppdev->devinfo.hpalDefault);
- DPRINT("PDEVOBJ_bEnablePDEV - dhpdev = %p\n", ppdev->dhpdev);
-
+ TRACE("PDEVOBJ_bEnablePDEV - dhpdev = %p\n", ppdev->dhpdev);
return TRUE;
}
@@ -153,16 +150,18 @@
PPDEVOBJ
NTAPI
PDEVOBJ_CreatePDEV(
- PLDEVOBJ pldev)
+ PLDEVOBJ pldev,
+ PGRAPHICS_DEVICE pGraphicsDevice,
+ PDEVMODEW pdevmode,
+ PWSTR pwszLogAddress)
{
PPDEVOBJ ppdev;
- LDEVTYPE ldevtype;
/* Allocate a new PDEVOBJ */
ppdev = ExAllocatePoolWithTag(PagedPool, sizeof(PDEVOBJ), GDITAG_PDEV);
if (!ppdev)
{
- DPRINT1("failed to allocate a PDEV\n");
+ ERR("failed to allocate a PDEV\n");
return FALSE;
}
@@ -177,37 +176,61 @@
/* Copy the function table from the LDEVOBJ */
ppdev->pfn = ppdev->pldev->pfn;
+ /* Set the graphics device */
+ ppdev->pGraphicsDevice = pGraphicsDevice;
+
/* Allocate the device lock semaphore */
ppdev->hsemDevLock = EngCreateSemaphore();
if (!ppdev->hsemDevLock)
{
- DPRINT1("Failed to create semaphore\n");
+ ERR("Failed to create semaphore\n");
ExFreePoolWithTag(ppdev, GDITAG_PDEV);
return FALSE;
}
/* Call the drivers DrvEnablePDEV function */
- if (!PDEVOBJ_bEnablePDEV(ppdev, NULL, NULL))
- {
- DPRINT1("Failed to enable PDEV\n");
+ if (!PDEVOBJ_bEnablePDEV(ppdev, pdevmode, NULL))
+ {
+ ERR("Failed to enable PDEV\n");
EngDeleteSemaphore(ppdev->hsemDevLock);
ExFreePoolWithTag(ppdev, GDITAG_PDEV);
return FALSE;
}
- /* Set flags based on the LDEV type */
- ldevtype = pldev->ldevtype;
- if (ldevtype == LDEV_DEVICE_MIRROR) ppdev->flFlags |= PDEV_CLONE_DEVICE;
- else if (ldevtype == LDEV_DEVICE_DISPLAY) ppdev->flFlags |= PDEV_DISPLAY;
- else if (ldevtype == LDEV_DEVICE_PRINTER) ppdev->flFlags |= PDEV_PRINTER;
- else if (ldevtype == LDEV_DEVICE_META) ppdev->flFlags |= PDEV_META_DEVICE;
- else if (ldevtype == LDEV_FONT) ppdev->flFlags |= PDEV_FONTDRIVER;
+ /* Check what type of driver this is */
+ if (pldev->ldevtype == LDEV_DEVICE_DISPLAY)
+ {
+ /* This is a display device */
+ ppdev->flFlags |= PDEV_DISPLAY;
+
+ /* Check if the driver supports a hardware pointer */
+ if (ppdev->pfn.SetPointerShape && ppdev->pfn.MovePointer)
+ {
+ ppdev->flFlags |= PDEV_HARDWARE_POINTER;
+ //ppdev->pfnDrvSetPointerShape = ppdev->pfn.SetPointerShape;
+ ppdev->pfnMovePointer = ppdev->pfn.MovePointer;
+ }
+ else
+ {
+ ppdev->flFlags |= PDEV_SOFTWARE_POINTER;
+ //ppdev->pfnDrvSetPointerShape = EngSetPointerShape;
+ ppdev->pfnMovePointer = EngMovePointer;
+ }
+
+ }
+ else if (pldev->ldevtype == LDEV_DEVICE_MIRROR)
+ ppdev->flFlags |= PDEV_CLONE_DEVICE;
+ else if (pldev->ldevtype == LDEV_DEVICE_PRINTER)
+ ppdev->flFlags |= PDEV_PRINTER;
+ else if (pldev->ldevtype == LDEV_DEVICE_META)
+ ppdev->flFlags |= PDEV_META_DEVICE;
+ else if (pldev->ldevtype == LDEV_FONT)
+ ppdev->flFlags |= PDEV_FONTDRIVER;
/* Check if the driver supports fonts */
if (ppdev->devinfo.cFonts != 0) ppdev->flFlags |= PDEV_GOTFONTS;
- if (ppdev->pfn.MovePointer) ppdev->flFlags |= PDEV_HARDWARE_POINTER;
-
+ /* Check for a gamma ramp table */
if (ppdev->pvGammaRamp) ppdev->flFlags |= PDEV_GAMMARAMP_TABLE;
/* Call the drivers DrvCompletePDEV function */
@@ -238,7 +261,7 @@
ppdev->pSurface = SURFACE_ShareLockSurface(hsurf);
}
- DPRINT("PDEVOBJ_pSurface() returning %p\n", ppdev->pSurface);
+ TRACE("PDEVOBJ_pSurface() returning %p\n", ppdev->pSurface);
return ppdev->pSurface;
}
@@ -290,7 +313,7 @@
PGRAPHICS_DEVICE pGraphicsDevice;
PLDEVOBJ pldev;
PPDEVOBJ ppdev;
- DPRINT("EngCreateDisplayPDEV(%wZ, %p)\n", pustrDeviceName, pdm);
+ TRACE("EngCreateDisplayPDEV(%wZ, %p)\n", pustrDeviceName, pdm);
/* Try to find the GRAPHICS_DEVICE */
if (pustrDeviceName)
@@ -298,8 +321,8 @@
pGraphicsDevice = EngpFindGraphicsDevice(pustrDeviceName, 0, 0);
if (!pGraphicsDevice)
{
- DPRINT1("No GRAPHICS_DEVICE found for %ls!\n",
- pustrDeviceName ? pustrDeviceName->Buffer : 0);
+ ERR("No GRAPHICS_DEVICE found for %ls!\n",
+ pustrDeviceName ? pustrDeviceName->Buffer : 0);
return NULL;
}
}
@@ -313,34 +336,27 @@
{
/* ... use the device's default one */
pdm = pGraphicsDevice->pDevModeList[pGraphicsDevice->iDefaultMode].pdm;
- DPRINT("Using iDefaultMode = %ld\n",
pGraphicsDevice->iDefaultMode);
+ TRACE("Using iDefaultMode = %ld\n", pGraphicsDevice->iDefaultMode);
}
/* Try to get a diplay driver */
pldev = EngLoadImageEx(pdm->dmDeviceName, LDEV_DEVICE_DISPLAY);
if (!pldev)
{
- DPRINT1("Could not load display driver '%ls', '%s'\n",
- pGraphicsDevice->pDiplayDrivers,
- pdm->dmDeviceName);
+ ERR("Could not load display driver '%ls', '%s'\n",
+ pGraphicsDevice->pDiplayDrivers, pdm->dmDeviceName);
return NULL;
}
/* Create a new PDEVOBJ */
- ppdev = PDEVOBJ_CreatePDEV(pldev);
+ ppdev = PDEVOBJ_CreatePDEV(pldev, pGraphicsDevice, pdm, NULL);
if (!ppdev)
{
- DPRINT1("failed to allocate a PDEV\n");
+ ERR("failed to create a PDEV\n");
EngUnloadImage(pldev);
return FALSE;
}
- /* Set MovePointer function */
- ppdev->pfnMovePointer = ppdev->pfn.MovePointer;
- if (!ppdev->pfnMovePointer)
- ppdev->pfnMovePointer = EngMovePointer;
-
- ppdev->pGraphicsDevice = pGraphicsDevice;
// Should we change the ative mode of pGraphicsDevice ?
ppdev->pdmwDev = PDEVOBJ_pdmMatchDevMode(ppdev, pdm) ;
@@ -417,21 +433,21 @@
PPDEVOBJ ppdevTmp;
PSURFACE pSurface;
BOOL retval = FALSE;
+ TRACE("PDEVOBJ_bSwitchMode, ppdev = %p, pSurface = %p\n", ppdev,
ppdev->pSurface);
/* Lock the PDEV */
EngAcquireSemaphore(ppdev->hsemDevLock);
+
/* And everything else */
EngAcquireSemaphore(ghsemPDEV);
- DPRINT1("PDEVOBJ_bSwitchMode, ppdev = %p, pSurface = %p\n", ppdev,
ppdev->pSurface);
-
// Lookup the GraphicsDevice + select DEVMODE
// pdm = PDEVOBJ_pdmMatchDevMode(ppdev, pdm);
/* 1. Temporarily disable the current PDEV */
if (!ppdev->pfn.AssertMode(ppdev->dhpdev, FALSE))
{
- DPRINT1("DrvAssertMode failed\n");
+ ERR("DrvAssertMode failed\n");
goto leave;
}
@@ -440,7 +456,7 @@
ppdevTmp = EngCreateDisplayPDEV(&ustrDevice, pdm);
if (!ppdevTmp)
{
- DPRINT1("Failed to create a new PDEV\n");
+ ERR("Failed to create a new PDEV\n");
goto leave;
}
@@ -448,7 +464,7 @@
pSurface = PDEVOBJ_pSurface(ppdevTmp);
if (!pSurface)
{
- DPRINT1("DrvEnableSurface failed\n");
+ ERR("DrvEnableSurface failed\n");
goto leave;
}
@@ -476,8 +492,7 @@
EngReleaseSemaphore(ppdev->hsemDevLock);
EngReleaseSemaphore(ghsemPDEV);
- DPRINT1("leave, ppdev = %p, pSurface = %p\n", ppdev, ppdev->pSurface);
-
+ TRACE("leave, ppdev = %p, pSurface = %p\n", ppdev, ppdev->pSurface);
return retval;
}
Modified: branches/GSoC_2011/GdiFontDriver/subsystems/win32/win32k/font/fntdrvsup.c
URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/GdiFontDriver/subsyst…
==============================================================================
--- branches/GSoC_2011/GdiFontDriver/subsystems/win32/win32k/font/fntdrvsup.c [iso-8859-1]
(original)
+++ branches/GSoC_2011/GdiFontDriver/subsystems/win32/win32k/font/fntdrvsup.c [iso-8859-1]
Mon Mar 5 13:30:37 2012
@@ -278,7 +278,7 @@
}
/* Create a new PDEVOBJ */
- ppdev = PDEVOBJ_CreatePDEV(pldev);
+ ppdev = PDEVOBJ_CreatePDEV(pldev, NULL, NULL, NULL);
if (!ppdev)
{
DPRINT1("failed to allocate a PDEV\n");
Modified: branches/GSoC_2011/GdiFontDriver/subsystems/win32/win32k/include/pdevobj.h
URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/GdiFontDriver/subsyst…
==============================================================================
--- branches/GSoC_2011/GdiFontDriver/subsystems/win32/win32k/include/pdevobj.h
[iso-8859-1] (original)
+++ branches/GSoC_2011/GdiFontDriver/subsystems/win32/win32k/include/pdevobj.h
[iso-8859-1] Mon Mar 5 13:30:37 2012
@@ -183,7 +183,10 @@
PPDEVOBJ
NTAPI
PDEVOBJ_CreatePDEV(
- struct _LDEVOBJ *pldev);
+ struct _LDEVOBJ *pldev,
+ PGRAPHICS_DEVICE pGraphicsDevice,
+ PDEVMODEW pdevmode,
+ PWSTR pwszLogAddress);
BOOL
NTAPI