VirtualBox

Ignore:
Timestamp:
May 28, 2014 9:12:15 AM (11 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
93991
Message:

Main,Frontends: IDisplay provides the guest screen bitmap to frontends.

Location:
trunk/src/VBox/Frontends/VBoxHeadless
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VBoxHeadless/Framebuffer.cpp

    r49980 r51436  
    4242
    4343    RTCritSectInit (&m_CritSect);
    44 
    45     // start with a standard size
    46     RequestResize(0, FramebufferPixelFormat_Opaque,
    47                   NULL, 0, 0, 640, 480, NULL);
    4844}
    4945
     
    241237
    242238    return S_OK;
     239}
     240
     241extern ComPtr<IDisplay> display;
     242
     243STDMETHODIMP VRDPFramebuffer::NotifyChange(ULONG aScreenId,
     244                                           ULONG aXOrigin,
     245                                           ULONG aYOrigin,
     246                                           ULONG aWidth,
     247                                           ULONG aHeight)
     248{
     249    LogRelFlow(("NotifyChange: %d %d,%d %dx%d\n",
     250                aScreenId, aXOrigin, aYOrigin, aWidth, aHeight));
     251
     252    HRESULT hr = S_OK;
     253
     254    hr = display->QuerySourceBitmap(aScreenId, mpSourceBitmap.asOutParam());
     255    if (SUCCEEDED(hr))
     256    {
     257        BYTE *pAddress = NULL;
     258        ULONG ulWidth = 0;
     259        ULONG ulHeight = 0;
     260        ULONG ulBitsPerPixel = 0;
     261        ULONG ulBytesPerLine = 0;
     262        ULONG ulPixelFormat = 0;
     263
     264        hr = mpSourceBitmap->QueryBitmapInfo(&pAddress,
     265                                        &ulWidth,
     266                                        &ulHeight,
     267                                        &ulBitsPerPixel,
     268                                        &ulBytesPerLine,
     269                                        &ulPixelFormat);
     270
     271        if (SUCCEEDED(hr))
     272        {
     273            mScreen = pAddress;
     274            mWidth = ulWidth;
     275            mHeight = ulHeight;
     276            mBitsPerPixel = ulBitsPerPixel;
     277            mBytesPerLine = ulBytesPerLine;
     278            mPixelFormat = FramebufferPixelFormat_FOURCC_RGB;
     279            mUsesGuestVRAM = TRUE;
     280
     281            Log(("Using screen bitmap, %d BPP\n", mBitsPerPixel));
     282        }
     283    }
     284
     285    if (FAILED(hr))
     286    {
     287        /* Just reset everything. */
     288        mScreen = NULL;
     289        mWidth = 0;
     290        mHeight = 0;
     291        mBitsPerPixel = 0;
     292        mBytesPerLine = 0;
     293        mPixelFormat = FramebufferPixelFormat_Opaque;
     294        mUsesGuestVRAM = FALSE;
     295
     296        Log(("No screen w = %d, h = %d!!!\n", aWidth, aHeight));
     297    }
     298
     299    return hr;
    243300}
    244301
  • trunk/src/VBox/Frontends/VBoxHeadless/Framebuffer.h

    r45940 r51436  
    6363                             ULONG bitsPerPixel, ULONG bytesPerLine, ULONG w, ULONG h,
    6464                             BOOL *finished);
     65    STDMETHOD(NotifyChange)(ULONG aScreenId,
     66                            ULONG aXOrigin,
     67                            ULONG aYOrigin,
     68                            ULONG aWidth,
     69                            ULONG aHeight);
    6570    STDMETHOD(VideoModeSupported)(ULONG width, ULONG height, ULONG bpp, BOOL *supported);
    6671
     
    9297    long refcnt;
    9398#endif
     99
     100    ComPtr<IDisplaySourceBitmap> mpSourceBitmap;
    94101};
    95102
  • trunk/src/VBox/Frontends/VBoxHeadless/NullFramebuffer.h

    r45940 r51436  
    180180        return S_OK;
    181181    }
     182    STDMETHOD(NotifyChange)(ULONG aScreenId,
     183                            ULONG aXOrigin,
     184                            ULONG aYOrigin,
     185                            ULONG aWidth,
     186                            ULONG aHeight)
     187    {
     188        /* Do nothing. */
     189        return S_OK;
     190    }
    182191    STDMETHOD(VideoModeSupported)(ULONG width, ULONG height, ULONG bpp, BOOL *supported)
    183192    {
  • trunk/src/VBox/Frontends/VBoxHeadless/VBoxHeadless.cpp

    r50406 r51436  
    639639static CComModule _Module;
    640640#endif
     641
     642ComPtr<IDisplay> display;
    641643
    642644/**
     
    968970        CHECK_ERROR_BREAK(console, COMGETTER(Machine)(machine.asOutParam()));
    969971
    970         ComPtr<IDisplay> display;
    971972        CHECK_ERROR_BREAK(console, COMGETTER(Display)(display.asOutParam()));
    972973
     
    10091010                Log2(("VBoxHeadless: Registering framebuffer\n"));
    10101011                pFramebuffer->AddRef();
    1011                 display->SetFramebuffer(VBOX_VIDEO_PRIMARY_SCREEN, pFramebuffer);
     1012                display->AttachFramebuffer(VBOX_VIDEO_PRIMARY_SCREEN, pFramebuffer);
    10121013            }
    10131014            if (!RT_SUCCESS(rrc) || rcc != S_OK)
     
    10391040            }
    10401041            pVRDPFramebuffer->AddRef();
    1041             display->SetFramebuffer(uScreenId, pVRDPFramebuffer);
     1042            display->AttachFramebuffer(uScreenId, pVRDPFramebuffer);
    10421043        }
    10431044        if (uScreenId < cMonitors)
     
    10501051        {
    10511052            ComPtr<IFramebuffer> fb;
    1052             LONG xOrigin, yOrigin;
    1053             HRESULT hrc2 = display->GetFramebuffer(uScreenId,
    1054                                                    fb.asOutParam(),
    1055                                                    &xOrigin, &yOrigin);
     1053            HRESULT hrc2 = display->QueryFramebuffer(uScreenId,
     1054                                                     fb.asOutParam());
    10561055            if (hrc2 == S_OK && fb.isNull())
    10571056            {
     
    10591058                pNullFB->AddRef();
    10601059                pNullFB->init();
    1061                 display->SetFramebuffer(uScreenId, pNullFB);
     1060                display->AttachFramebuffer(uScreenId, pNullFB);
    10621061            }
    10631062        }
     
    13301329    while (0);
    13311330
     1331    display.setNull();
     1332
    13321333    /*
    13331334     * Get the machine state.
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