Author: dreimer
Date: Tue Mar 17 21:23:11 2015
New Revision: 66764
URL:
http://svn.reactos.org/svn/reactos?rev=66764&view=rev
Log:
[WIN32K]
Can't resize in VirtualBox by swyter
CORE-6742 #comment Added to CLT-2015 branch. Let's see how it behaves ^^
Modified:
branches/ReactOS-0.3.17-CLT2015/reactos/win32ss/gdi/eng/device.h
branches/ReactOS-0.3.17-CLT2015/reactos/win32ss/gdi/eng/pdevobj.c
branches/ReactOS-0.3.17-CLT2015/reactos/win32ss/user/ntuser/display.c
Modified: branches/ReactOS-0.3.17-CLT2015/reactos/win32ss/gdi/eng/device.h
URL:
http://svn.reactos.org/svn/reactos/branches/ReactOS-0.3.17-CLT2015/reactos/…
==============================================================================
--- branches/ReactOS-0.3.17-CLT2015/reactos/win32ss/gdi/eng/device.h [iso-8859-1]
(original)
+++ branches/ReactOS-0.3.17-CLT2015/reactos/win32ss/gdi/eng/device.h [iso-8859-1] Tue Mar
17 21:23:11 2015
@@ -2,6 +2,11 @@
#pragma once
#define TAG_GDEV 'gdev'
+
+VOID
+NTAPI
+PDEVOBJ_vRefreshModeList(
+ PPDEVOBJ ppdev);
extern PGRAPHICS_DEVICE gpPrimaryGraphicsDevice;
extern PGRAPHICS_DEVICE gpVgaGraphicsDevice;
Modified: branches/ReactOS-0.3.17-CLT2015/reactos/win32ss/gdi/eng/pdevobj.c
URL:
http://svn.reactos.org/svn/reactos/branches/ReactOS-0.3.17-CLT2015/reactos/…
==============================================================================
--- branches/ReactOS-0.3.17-CLT2015/reactos/win32ss/gdi/eng/pdevobj.c [iso-8859-1]
(original)
+++ branches/ReactOS-0.3.17-CLT2015/reactos/win32ss/gdi/eng/pdevobj.c [iso-8859-1] Tue Mar
17 21:23:11 2015
@@ -9,6 +9,8 @@
#include <win32k.h>
#define NDEBUG
#include <debug.h>
+
+DBG_DEFAULT_CHANNEL(UserDisplay);
PPDEVOBJ gppdevPrimary = NULL;
@@ -225,8 +227,109 @@
/* Increment reference count */
GDIOBJ_vReferenceObjectByPointer(&ppdev->pSurface->BaseObject);
- DPRINT("PDEVOBJ_pSurface() returning %p\n", ppdev->pSurface);
+ TRACE("PDEVOBJ_pSurface() returning %p\n", ppdev->pSurface);
return ppdev->pSurface;
+}
+
+VOID
+NTAPI
+PDEVOBJ_vRefreshModeList(
+ PPDEVOBJ ppdev)
+{
+ PGRAPHICS_DEVICE pGraphicsDevice;
+ PDEVMODEENTRY pTmpDevModeList, pOldDevModeList;
+ PDEVMODEINFO pdminfo;
+ PDEVMODEW pdm, pdmEnd;
+ UINT cModes = 0;
+ UINT j = 0;
+
+ /* Lock the PDEV */
+ EngAcquireSemaphore(ppdev->hsemDevLock);
+
+ pGraphicsDevice = ppdev->pGraphicsDevice;
+
+ TRACE("Enter PDEVOBJ_vRefreshModeList('%ws'/'%ws')\n",
+ pGraphicsDevice->szNtDeviceName,
+ pGraphicsDevice->szWinDeviceName);
+
+ pdminfo = LDEVOBJ_pdmiGetModes(ppdev->pldev, pGraphicsDevice->DeviceObject);
+
+ if (!pdminfo || pdminfo->cbdevmode == 0)
+ {
+ ERR("Could not get an updated mode list for '%ls'\n",
pGraphicsDevice->szWinDeviceName);
+ }
+ else
+ {
+ TRACE("Bingo! We've just got some (%lu) new modes for
'%ls'.\n", pdminfo->cbdevmode/sizeof(DEVMODEW),
pGraphicsDevice->szWinDeviceName);
+
+ /* Loop all DEVMODEs */
+ pdmEnd = (DEVMODEW*)((PCHAR)pdminfo->adevmode + pdminfo->cbdevmode);
+ for (pdm = pdminfo->adevmode;
+ (pdm + 1 <= pdmEnd) && (pdm->dmSize != 0);
+ pdm = (DEVMODEW*)((PCHAR)pdm + pdm->dmSize + pdm->dmDriverExtra))
+ {
+ TRACE("mode %lu -- %lux%lux%lu (%lu hz)\n", cModes,
pdminfo->adevmode[cModes].dmPelsWidth,
+
pdminfo->adevmode[cModes].dmPelsHeight,
+
pdminfo->adevmode[cModes].dmBitsPerPel,
+
pdminfo->adevmode[cModes].dmDisplayFrequency);
+
+ /* Some drivers like the VBox driver don't fill the dmDeviceName
+ with the name of the display driver. So fix that here. */
+ wcsncpy(pdminfo->adevmode[cModes].dmDeviceName,
pGraphicsDevice->pDiplayDrivers, CCHDEVICENAME);
+ pdminfo->adevmode[cModes].dmDeviceName[CCHDEVICENAME - 1] = 0;
+
+ /* Count this DEVMODE */
+ cModes++;
+ }
+
+ if (cModes == 0)
+ {
+ ERR("No valid devmodes returned by the driver on mode list
refresh!\n");
+ ExFreePoolWithTag(pdminfo, GDITAG_DEVMODE);
+ return;
+ }
+
+ /* Allocate an index buffer early on, even before trying to change the graphics
device struct */
+ pTmpDevModeList = ExAllocatePoolWithTag(PagedPool,
+ cModes * sizeof(DEVMODEENTRY),
+ GDITAG_GDEVICE);
+
+ if (!pTmpDevModeList)
+ {
+ ERR("Bummer! Not enough memory to alloc a new DevModeList\n");
+ return;
+ }
+
+ /* Save a reference to the old thing */
+ pOldDevModeList = pGraphicsDevice->pDevModeList;
+
+ /* Attach the new mode info and company to the device,
+ the GraphicsDevice could potentially use additional synchonisation mechanisms
*/
+ pdminfo->pdmiNext = pGraphicsDevice->pdevmodeInfo;
+ pGraphicsDevice->pdevmodeInfo = pdminfo;
+
+ pGraphicsDevice->cDevModes = cModes;
+ pGraphicsDevice->pDevModeList = pTmpDevModeList;
+
+ /* Don't leak the previous DevModeList, please! */
+ ExFreePoolWithTag(pOldDevModeList, GDITAG_GDEVICE);
+
+ /* Loop through the DEVMODEs */
+ for (pdm = pdminfo->adevmode;
+ (pdm + 1 <= pdmEnd) && (pdm->dmSize != 0);
+ pdm = (PDEVMODEW)((PCHAR)pdm + pdm->dmSize + pdm->dmDriverExtra))
+ {
+ /* Initialize the entry */
+ pGraphicsDevice->pDevModeList[j].dwFlags = 0;
+ pGraphicsDevice->pDevModeList[j].pdm = &pdminfo->adevmode[j];
+
+ j++;
+ }
+
+ }
+
+ /* Unlock PDEV */
+ EngReleaseSemaphore(ppdev->hsemDevLock);
}
PDEVMODEW
@@ -242,13 +345,32 @@
pGraphicsDevice = ppdev->pGraphicsDevice;
+ TRACE("looking for mode -- %lux%lux%lu (%lu hz) (%ls)\n",
pdm->dmPelsWidth,
+ pdm->dmPelsHeight,
+ pdm->dmBitsPerPel,
+
pdm->dmDisplayFrequency,
+ pdm->dmDeviceName);
+
+ for (i = 0; i < pGraphicsDevice->cDevModes; i++)
+ {
+ pdmCurrent = pGraphicsDevice->pDevModeList[i].pdm;
+
+ TRACE("mode %lu -- %lux%lux%lu (%lu hz) (%ls)\n", i,
pdmCurrent->dmPelsWidth,
+
pdmCurrent->dmPelsHeight,
+
pdmCurrent->dmBitsPerPel,
+
pdmCurrent->dmDisplayFrequency,
+
pdmCurrent->dmDeviceName);
+ }
+
+ TRACE("---\n");
+
for (i = 0; i < pGraphicsDevice->cDevModes; i++)
{
pdmCurrent = pGraphicsDevice->pDevModeList[i].pdm;
/* Compare asked DEVMODE fields
* Only compare those that are valid in both DEVMODE structs */
- dwFields = pdmCurrent->dmFields & pdm->dmFields ;
+ dwFields = pdmCurrent->dmFields & pdm->dmFields;
/* For now, we only need those */
if ((dwFields & DM_BITSPERPEL) &&
@@ -260,6 +382,12 @@
if ((dwFields & DM_DISPLAYFREQUENCY) &&
(pdmCurrent->dmDisplayFrequency != pdm->dmDisplayFrequency)) continue;
+ TRACE("chosen mode %lu -- %lux%lux%lu (%lu hz) (%ls)\n", i,
pdmCurrent->dmPelsWidth,
+
pdmCurrent->dmPelsHeight,
+
pdmCurrent->dmBitsPerPel,
+
pdmCurrent->dmDisplayFrequency,
+
pdmCurrent->dmDeviceName);
+
/* Match! Return the DEVMODE */
return pdmCurrent;
}
@@ -331,7 +459,7 @@
ppdev->pGraphicsDevice = pGraphicsDevice;
ppdev->hsemDevLock = EngCreateSemaphore();
- // Should we change the ative mode of pGraphicsDevice ?
+ // Should we change the active mode of pGraphicsDevice ?
ppdev->pdmwDev = PDEVOBJ_pdmMatchDevMode(ppdev, pdm) ;
/* FIXME! */
Modified: branches/ReactOS-0.3.17-CLT2015/reactos/win32ss/user/ntuser/display.c
URL:
http://svn.reactos.org/svn/reactos/branches/ReactOS-0.3.17-CLT2015/reactos/…
==============================================================================
--- branches/ReactOS-0.3.17-CLT2015/reactos/win32ss/user/ntuser/display.c [iso-8859-1]
(original)
+++ branches/ReactOS-0.3.17-CLT2015/reactos/win32ss/user/ntuser/display.c [iso-8859-1] Tue
Mar 17 21:23:11 2015
@@ -462,22 +462,34 @@
PGRAPHICS_DEVICE pGraphicsDevice;
PDEVMODEENTRY pdmentry;
ULONG i, iFoundMode;
+ PPDEVOBJ ppdev;
TRACE("Enter UserEnumDisplaySettings('%wZ', %lu)\n",
pustrDevice, iModeNum);
/* Ask GDI for the GRAPHICS_DEVICE */
pGraphicsDevice = EngpFindGraphicsDevice(pustrDevice, 0, 0);
-
- if (!pGraphicsDevice)
+ ppdev = EngpGetPDEV(pustrDevice);
+
+ if (!pGraphicsDevice || !ppdev)
{
/* No device found */
ERR("No device found!\n");
return STATUS_UNSUCCESSFUL;
}
+ /* let's politely ask the driver for an updated mode list,
+ just in case there's something new in there (vbox) */
+
+ PDEVOBJ_vRefreshModeList(ppdev);
+ PDEVOBJ_vRelease(ppdev);
+
+ /* FIXME: maybe only refresh when iModeNum is bigger than cDevModes? */
if (iModeNum >= pGraphicsDevice->cDevModes)
+ {
+ ERR("STATUS_NO_MORE_ENTRIES!\n");
return STATUS_NO_MORE_ENTRIES;
+ }
iFoundMode = 0;
for (i = 0; i < pGraphicsDevice->cDevModes; i++)