VirtualBox

Ignore:
Timestamp:
Apr 2, 2010 9:12:26 AM (15 years ago)
Author:
vboxsync
Message:

wddm: vboxtray: abstraction display driver API for passing escape codes (using ExtEscape for XPDM & PFND3DKMT stugg for WDDM); WDDM miniport driver: basics for handling autoresize & seamles

Location:
trunk/src/VBox/Additions/WINNT/Graphics/Miniport
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/WINNT/Graphics/Miniport/VBoxVideo.cpp

    r27887 r27955  
    12311231
    12321232#ifdef VBOXWDDM
     1233static bool g_bModesTableInitialized = false;
    12331234/**
    12341235 * Helper function to dynamically build our table of standard video
     
    12411242        D3DKMDT_2DREGION **ppResolutions, uint32_t * pcResolutions)
    12421243{
    1243     static bool bTableInitialized = false;
    1244     if(bRebuildTable || !bTableInitialized)
     1244    if(bRebuildTable || !g_bModesTableInitialized)
    12451245    {
    12461246        VBoxBuildModesTable(DeviceExtension);
    1247         bTableInitialized = true;
     1247        g_bModesTableInitialized = true;
    12481248    }
    12491249
     
    12531253    *ppResolutions = g_VBoxWddmVideoResolutions;
    12541254    *pcResolutions = g_VBoxWddmNumResolutions;
     1255}
     1256
     1257VOID VBoxWddmInvalidateModesTable(PDEVICE_EXTENSION DeviceExtension)
     1258{
     1259    g_bModesTableInitialized = false;
    12551260}
    12561261
  • trunk/src/VBox/Additions/WINNT/Graphics/Miniport/VBoxVideo.h

    r27606 r27955  
    587587        D3DKMDT_2DREGION **ppResolutions, uint32_t * pcResolutions);
    588588
     589VOID VBoxWddmInvalidateModesTable(PDEVICE_EXTENSION DeviceExtension);
     590
    589591D3DDDIFORMAT vboxWddmCalcPixelFormat(VIDEO_MODE_INFORMATION *pInfo);
    590592UINT vboxWddmCalcBitsPerPixel(D3DDDIFORMAT format);
  • trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoWddm.cpp

    r27641 r27955  
    2020#include <VBox/VBoxGuestLib.h>
    2121#include <VBox/VBoxVideo.h>
     22#include <wingdi.h> /* needed for RGNDATA definition */
     23#include <VBoxDisplay.h> /* this is from Additions/WINNT/include/ to include escape codes */
    2224
    2325#define VBOXWDDM_MEMTAG 'MDBV'
     
    21662168    dfprintf(("==> "__FUNCTION__ ", hAdapter(0x%x)\n", hAdapter));
    21672169
    2168     AssertBreakpoint();
     2170    NTSTATUS Status = STATUS_NOT_SUPPORTED;
     2171    PDEVICE_EXTENSION pDevExt = (PDEVICE_EXTENSION)hAdapter;
     2172    if (pEscape->PrivateDriverDataSize >= sizeof (VBOXDISPIFESCAPE))
     2173    {
     2174        PVBOXDISPIFESCAPE pEscapeHdr = (PVBOXDISPIFESCAPE)pEscape->pPrivateDriverData;
     2175        switch (pEscapeHdr->escapeCode)
     2176        {
     2177            case VBOXESC_SETVISIBLEREGION:
     2178            {
     2179                LPRGNDATA lpRgnData = VBOXDISPIFESCAPE_DATA(pEscapeHdr, RGNDATA);
     2180                uint32_t cbData = VBOXDISPIFESCAPE_DATA_SIZE(pEscape->PrivateDriverDataSize);
     2181                uint32_t cbRects = cbData - RT_OFFSETOF(RGNDATA, Buffer);
     2182                /* the lpRgnData->Buffer comes to us as RECT
     2183                 * to avoid extra memcpy we cast it to PRTRECT assuming
     2184                 * they are identical */
     2185                AssertCompile(sizeof(RECT) == sizeof(RTRECT));
     2186                AssertCompile(RT_OFFSETOF(RECT, left) == RT_OFFSETOF(RTRECT, xLeft));
     2187                AssertCompile(RT_OFFSETOF(RECT, bottom) == RT_OFFSETOF(RTRECT, yBottom));
     2188                AssertCompile(RT_OFFSETOF(RECT, right) == RT_OFFSETOF(RTRECT, xRight));
     2189                AssertCompile(RT_OFFSETOF(RECT, top) == RT_OFFSETOF(RTRECT, yTop));
     2190                RTRECT   *pRect = (RTRECT *)&lpRgnData->Buffer;
     2191
     2192                uint32_t cRects = cbRects/sizeof(RTRECT);
     2193                int      rc;
     2194
     2195                dprintf(("IOCTL_VIDEO_VBOX_SETVISIBLEREGION cRects=%d\n", cRects));
     2196                Assert(cbRects >= sizeof(RTRECT)
     2197                    &&  cbRects == cRects*sizeof(RTRECT)
     2198                    &&  cRects == lpRgnData->rdh.nCount);
     2199                if (    cbRects >= sizeof(RTRECT)
     2200                    &&  cbRects == cRects*sizeof(RTRECT)
     2201                    &&  cRects == lpRgnData->rdh.nCount)
     2202                {
     2203                    /*
     2204                     * Inform the host about the visible region
     2205                     */
     2206                    VMMDevVideoSetVisibleRegion *req = NULL;
     2207
     2208                    rc = VbglGRAlloc ((VMMDevRequestHeader **)&req,
     2209                                      sizeof (VMMDevVideoSetVisibleRegion) + (cRects-1)*sizeof(RTRECT),
     2210                                      VMMDevReq_VideoSetVisibleRegion);
     2211                    AssertRC(rc);
     2212                    if (RT_SUCCESS(rc))
     2213                    {
     2214                        req->cRect = cRects;
     2215                        memcpy(&req->Rect, pRect, cRects*sizeof(RTRECT));
     2216
     2217                        rc = VbglGRPerform (&req->header);
     2218                        AssertRC(rc);
     2219                        if (!RT_SUCCESS(rc))
     2220                        {
     2221                            drprintf((__FUNCTION__": VbglGRPerform failed rc (%d)", rc));
     2222                            Status = STATUS_UNSUCCESSFUL;
     2223                        }
     2224                    }
     2225                    else
     2226                    {
     2227                        drprintf((__FUNCTION__": VbglGRAlloc failed rc (%d)", rc));
     2228                        Status = STATUS_UNSUCCESSFUL;
     2229                    }
     2230                }
     2231                else
     2232                {
     2233                    drprintf((__FUNCTION__": VBOXESC_SETVISIBLEREGION: incorrect buffer size (%d), reported count (%d)\n", cbRects, lpRgnData->rdh.nCount));
     2234                    AssertBreakpoint();
     2235                    Status = STATUS_INVALID_PARAMETER;
     2236                }
     2237                break;
     2238            }
     2239            case VBOXESC_ISVRDPACTIVE:
     2240                /* @todo: implement */
     2241                Status = STATUS_SUCCESS;
     2242                break;
     2243            case VBOXESC_REINITVIDEOMODES:
     2244                VBoxWddmInvalidateModesTable(pDevExt);
     2245                Status = STATUS_SUCCESS;
     2246                break;
     2247            default:
     2248                drprintf((__FUNCTION__": unsupported escape code (0x%x)\n", pEscapeHdr->escapeCode));
     2249                break;
     2250        }
     2251    }
     2252    else
     2253    {
     2254        drprintf((__FUNCTION__": pEscape->PrivateDriverDataSize(%d) < (%d)\n", pEscape->PrivateDriverDataSize, sizeof (VBOXDISPIFESCAPE)));
     2255        Status = STATUS_INVALID_PARAMETER;
     2256        AssertBreakpoint();
     2257    }
    21692258
    21702259    dfprintf(("<== "__FUNCTION__ ", hAdapter(0x%x)\n", hAdapter));
    21712260
    2172     return STATUS_INVALID_PARAMETER;
     2261    return Status;
    21732262}
    21742263
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette