VirtualBox

Changeset 3611 in vbox for trunk


Ignore:
Timestamp:
Jul 13, 2007 1:02:30 PM (18 years ago)
Author:
vboxsync
Message:

Main: Improved IFramebuffer::resizeCompleted() docs; Renamed PixelFormatDefault => PixelFormatOpaque.

Location:
trunk/src/VBox
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxFBDDRAW.cpp

    r2981 r3611  
    138138    mSurface (NULL),
    139139    mPrimarySurface (NULL),
    140     mPixelFormat (FramebufferPixelFormat_PixelFormatDefault),
     140    mPixelFormat (FramebufferPixelFormat_PixelFormatOpaque),
    141141    mGuestVRAMSurface (FALSE),
    142142    mWndX (0),
     
    166166
    167167                VBoxResizeEvent *re =
    168                     new VBoxResizeEvent (FramebufferPixelFormat_PixelFormatDefault,
     168                    new VBoxResizeEvent (FramebufferPixelFormat_PixelFormatOpaque,
    169169                                         NULL, 0, 640, 480);
    170170
     
    295295        {
    296296            /* Unsupported format leads to use of the default format. */
    297             pixelFormat = FramebufferPixelFormat_PixelFormatDefault;
     297            pixelFormat = FramebufferPixelFormat_PixelFormatOpaque;
    298298        }
    299299    }
     
    301301    recreateSurface (pixelFormat, pvVRAM, lineSize, w, h);
    302302
    303     if (!mSurface && pixelFormat != FramebufferPixelFormat_PixelFormatDefault)
     303    if (!mSurface && pixelFormat != FramebufferPixelFormat_PixelFormatOpaque)
    304304    {
    305305        /* Unable to create a new surface. Try to create a default format surface. */
    306         pixelFormat = FramebufferPixelFormat_PixelFormatDefault;
     306        pixelFormat = FramebufferPixelFormat_PixelFormatOpaque;
    307307        recreateSurface (pixelFormat, NULL, 0, w, h);
    308308    }
     
    334334    sd.dwHeight = h;
    335335
    336     if (pixelFormat == FramebufferPixelFormat_PixelFormatDefault)
     336    if (pixelFormat == FramebufferPixelFormat_PixelFormatOpaque)
    337337    {
    338338        /* Default format is a 32 bpp surface. */
     
    351351    switch (pixelFormat)
    352352    {
    353         case FramebufferPixelFormat_PixelFormatDefault:
     353        case FramebufferPixelFormat_PixelFormatOpaque:
    354354        case FramebufferPixelFormat_PixelFormatRGB32:
    355355        {
     
    378378
    379379    /* Allocate surface memory. */
    380     if (pvVRAM != NULL && pixelFormat != FramebufferPixelFormat_PixelFormatDefault)
     380    if (pvVRAM != NULL && pixelFormat != FramebufferPixelFormat_PixelFormatOpaque)
    381381    {
    382382        sd.lpSurface = pvVRAM;
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxFrameBuffer.cpp

    r3578 r3611  
    305305    VBoxFrameBuffer (aView)
    306306{
    307     resizeEvent (new VBoxResizeEvent (FramebufferPixelFormat_PixelFormatDefault,
     307    resizeEvent (new VBoxResizeEvent (FramebufferPixelFormat_PixelFormatOpaque,
    308308                                      NULL, 0, 640, 480));
    309309}
     
    399399{
    400400    mScreen = NULL;
    401     mPixelFormat = FramebufferPixelFormat_PixelFormatDefault;
     401    mPixelFormat = FramebufferPixelFormat_PixelFormatOpaque;
    402402    mPtrVRAM = NULL;
    403403    mSurfVRAM = NULL;
    404404    mLineSize = 0;
    405405
    406     resizeEvent (new VBoxResizeEvent (FramebufferPixelFormat_PixelFormatDefault,
     406    resizeEvent (new VBoxResizeEvent (FramebufferPixelFormat_PixelFormatOpaque,
    407407                                      NULL, 0, 640, 480));
    408408}
     
    536536        {
    537537            /* Unsupported format leads to use of the default format. */
    538             mPixelFormat = FramebufferPixelFormat_PixelFormatDefault;
     538            mPixelFormat = FramebufferPixelFormat_PixelFormatOpaque;
    539539        }
    540540    }
    541541
    542     if (mPixelFormat != FramebufferPixelFormat_PixelFormatDefault)
     542    if (mPixelFormat != FramebufferPixelFormat_PixelFormatOpaque)
    543543    {
    544544        /* Create a source surface from guest VRAM. */
  • trunk/src/VBox/Main/DisplayImpl.cpp

    r3576 r3611  
    277277        case 24:  pixelFormat = FramebufferPixelFormat_PixelFormatRGB24; break;
    278278        case 16:  pixelFormat = FramebufferPixelFormat_PixelFormatRGB16; break;
    279         default:  pixelFormat = FramebufferPixelFormat_PixelFormatDefault; cbLine = 0;
     279        default:  pixelFormat = FramebufferPixelFormat_PixelFormatOpaque; cbLine = 0;
    280280    }
    281281
     
    345345            pFBInfo->pFramebuffer->COMGETTER(PixelFormat) (&newPixelFormat);
    346346
    347             pFBInfo->fDefaultFormat = (newPixelFormat == FramebufferPixelFormat_PixelFormatDefault);
     347            pFBInfo->fDefaultFormat = (newPixelFormat == FramebufferPixelFormat_PixelFormatOpaque);
    348348
    349349            mpDrv->pUpPort->pfnSetRenderVRAM (mpDrv->pUpPort, pFBInfo->fDefaultFormat);
  • trunk/src/VBox/Main/FramebufferImpl.cpp

    r3578 r3611  
    101101    if (!pixelFormat)
    102102        return E_POINTER;
    103     *pixelFormat = FramebufferPixelFormat_PixelFormatDefault;
     103    *pixelFormat = FramebufferPixelFormat_PixelFormatOpaque;
    104104    return S_OK;
    105105}
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r3599 r3611  
    61236123  <enum
    61246124     name="FramebufferPixelFormat"
    6125      uuid="0389bf8d-3b41-476c-94be-53f5c84be9b5"
     6125     uuid="3bd87520-2b5f-4786-a891-f8c6aeb19a1f"
    61266126     >
    6127     <const name="PixelFormatDefault"      value="0"/>
     6127    <desc>
     6128      Format of the virtual video card's memory buffer.  See
     6129      <link to="IFramebuffer::requestResize()"/> for more information.
     6130    </desc>
     6131    <const name="PixelFormatOpaque"       value="0"/>
    61286132    <const name="PixelFormatRGB16"        value="1"/>
    61296133    <const name="PixelFormatRGB24"        value="2"/>
     
    61886192      <desc>
    61896193        Locks the framebuffer.
    6190         Gets called by the display object where this buffer is
    6191         registered.
     6194        Gets called by the IDisplay object where this framebuffer is
     6195        bound to.
    61926196      </desc>
    61936197    </method>
     
    61966200      <desc>
    61976201        Unlocks the framebuffer.
    6198         Gets called by the display object where this buffer is
    6199         registered.
     6202        Gets called by the IDisplay object where this framebuffer is
     6203        bound to.
    62006204      </desc>
    62016205    </method>
     
    62186222        Requests a size and pixel format change.
    62196223
    6220         The IFramebuffer implementation should try to setup
    6221         a memory buffer suitable for the given pixel format
    6222         and line size.
    6223 
    6224         If the requested pixel format is not supported,
    6225         or a PixelFormatDefault is requested,
    6226         a default format is set.
    6227 
    6228         The callee is allowed to use the guest video memory
    6229         buffer (pointed to by the @a vram parameter) directly instead
    6230         of allocating its own buffer. To indicate that the framebuffer
    6231         uses the guest video memory, its <link to="#address"/>
    6232         implementation must return the same address as it gets in
    6233         the @a vram parameter of this method.
    6234 
    6235         For non linear modes (such as text and standard VGA), the @a
    6236         vram parameter is @c NULL and must not be used. When it's not
    6237         NULL, it is recommended to use it to access the guest video
    6238         memory instead of creating a separate buffer as it will at
    6239         least remove one copy operation.
    6240 
    6241         The caller checks if the call was successful
    6242         via the <link to="#pixelFormat"/> property.
    6243 
    6244         <note>
    6245           This method is called by IDisplay under the IFramebuffer
    6246           lock.
     6224        There are two strategies of working with the video buffer of the
     6225        virtual machine. The first strategy implies that the IFramebuffer
     6226        implementation allocates a memory buffer for the requested display mode
     6227        and provides it to the virtual machine. In the second strategy, the
     6228        IFramebuffer implementation uses the memory buffer allocated and owned
     6229        by the virtual machine. The second strategy is usually faster because
     6230        the implementation gets a pointer to the virtual machine video card's
     6231        memory which it can directly use for visualising the contents of the
     6232        virtual display, as opposed to the first strategy where the video
     6233        card's memory contents are copied to the memory buffer provided by the
     6234        implementation every time a display update occurs.
     6235
     6236        It is important to note that the second strategy is really fast only
     6237        when the implementation uses the provided video buffer directly, for
     6238        example, by blitting it to the window representing the virtual
     6239        machine's display, which saves at least one copy operation comparing
     6240        to the first strategy. However, using the video card's memory directly
     6241        is not always possible: for example, the format and the color depth of
     6242        the window representing the virtual display may differ from the format
     6243        or the color depth of the virtual video buffer, or the format of the
     6244        latter may be unknown or unsupported. In this case, the first strategy
     6245        (that is always available) is used as a fallback: when the virtual
     6246        video card's memory contents are copied to the implementation-provided
     6247        memory buffer, color and format conversion is done authomatically by
     6248        the underlying code.
     6249
     6250        The @a pixelFormat and @a VRAM parameters define whether the second
     6251        strategy is available or not. If @a pixelFormat is
     6252        <link to="PixelFormat::PixelFormatOpaque"/> (which usually indicates a
     6253        text mode of the virtual display) or if @a VRAM is <tt>null</tt>
     6254        (which means a non-linear graphical mode), then direct access to the
     6255        virtual card's video memory buffer is not available, the @a VRAM
     6256        parameter must be ignored and the implementation must use the first
     6257        strategy. In all other cases, @a pixelFormat together with @a lineSize
     6258        define the format of the video memory buffer pointed to by the @a VRAM
     6259        parameter and the implementation is free to choose which strategy to
     6260        use. To indicate that this framebuffer uses the second strategy, its
     6261        implementation of the <link to="#address()"/> method must return the
     6262        same address as it gets in the @a VRAM parameter of this method;
     6263        otherwise it is assumed that the first strategy is chosen.
     6264
     6265        The @a width and @a height parameters represent the size of the
     6266        requested display mode in both cases. In case of the first strategy,
     6267        the provided memory buffer should be enough to store data of the given
     6268        display mode. In case of the second strategy, it is guaranteed that
     6269        the given @a VRAM buffer contains enough space to represent the
     6270        display mode of the given size. Note that this framebuffer's
     6271        <link to="#width()"/> and <link to="#height()"/> properties must
     6272        return exactly the same values as passed to this method after the
     6273        resize is completed (see below).
     6274
     6275        The @a finished output parameter determines if the implementation has
     6276        finished resizing the framebuffer or not. If, for some reason, the
     6277        resize cannot be finished immediately during this call, @a finished
     6278        must be set to @c false, and the implementation must call
     6279        <link to="IDisplay::resizeCompleted()"/> after it has returned from
     6280        this method as soon as possible. If @a finished is @c false, the
     6281        machine will not call any framebuffer methods until
     6282        <link to="IDisplay::resizeCompleted()"/> is called.
     6283
     6284        Note that if the second strategy is choosen, the
     6285        <link to="#colorDepth()"/>, <link to="#lineSize()"/> and
     6286        <link to="#pixelFormat()"/> properties of this framebuffer must return
     6287        exactly the same values as specified in the parameters of this method
     6288        after the resize is completed. In case of the first strategy these
     6289        properties must return values describing the format of the
     6290        implementation's own memory buffer <link to="#address()"/> points
     6291        to. Note also that the <link to="#colorDepth()"/> value must always
     6292        correlate with <link to="#pixelFormat()"/> when the latter returns any
     6293        value other than <link to="PixelFormat::PixelFormatOpaque"/>.
     6294
     6295        <note>
     6296          This method is called by the IDisplay object under the
     6297          <link to="#lock()"/> provided by this IFramebuffer
     6298          implementation. If this method returns @c false in @a finished, then
     6299          this lock is not released until
     6300          <link to="IDisplay::resizeCompleted()"/> is called.
    62476301        </note>
    62486302      </desc>
    62496303      <param name="screenId" type="unsigned long" dir="in">
    6250         <desc>The value to be used in the <link to="IDisplay::resizeCompleted()"/> call.</desc>
     6304        <desc>
     6305          Logical screen number. Must be used in the corresponding call to
     6306          <link to="IDisplay::resizeCompleted()"/> if this call is made.
     6307        </desc>
    62516308      </param>
    62526309      <param name="pixelFormat" type="FramebufferPixelFormat" dir="in">
    6253         <desc>Pixel format of the surface (BPP and layout)</desc>
    6254       </param>
    6255       <param name="vram" type="octet" mod="ptr" dir="in">
    6256         <desc>Pointer to the guest VRAM (NULL for non linear modes)</desc>
     6310        <desc>Pixel format of the memory buffer pointed to by @a VRAM.</desc>
     6311      </param>
     6312      <param name="VRAM" type="octet" mod="ptr" dir="in">
     6313        <desc>Pointer to the virtual video card's VRAM (may be @c null).</desc>
    62576314      </param>
    62586315      <param name="lineSize" type="unsigned long" dir="in">
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