VirtualBox

Changeset 34686 in vbox for trunk/src


Ignore:
Timestamp:
Dec 3, 2010 11:06:34 AM (14 years ago)
Author:
vboxsync
Message:

Additions/common/VBoxVideo and Additions/WINNT/Graphics: modesetting clean-up

Location:
trunk/src/VBox/Additions
Files:
1 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/WINNT/Graphics/Display/Makefile.kmk

    r34440 r34686  
    4949        $(PATH_ROOT)/src/VBox/Additions/common/VBoxVideo/HGSMIBase.cpp \
    5050        $(PATH_ROOT)/src/VBox/Additions/common/VBoxVideo/VBVABase.cpp \
     51        $(PATH_ROOT)/src/VBox/Additions/common/VBoxVideo/Modesetting.cpp \
    5152        VBoxDisp.def \
    5253        VBoxDisp.rc
  • trunk/src/VBox/Additions/WINNT/Graphics/Miniport/Makefile.kmk

    r34429 r34686  
    4646        VBoxVideo.rc \
    4747        VBoxVideoHGSMI.cpp \
    48         $(PATH_ROOT)/src/VBox/Additions/common/VBoxVideo/HGSMIBase.cpp
     48        $(PATH_ROOT)/src/VBox/Additions/common/VBoxVideo/HGSMIBase.cpp \
     49        $(PATH_ROOT)/src/VBox/Additions/common/VBoxVideo/Modesetting.cpp
    4950VBoxVideo_LIBS.x86    = \
    5051        $(PATH_SDK_W2K3DDK_LIB)/exsup.lib
     
    101102        VBoxVideoHGSMI.cpp \
    102103        $(PATH_ROOT)/src/VBox/Additions/common/VBoxVideo/HGSMIBase.cpp \
     104        $(PATH_ROOT)/src/VBox/Additions/common/VBoxVideo/Modesetting.cpp \
    103105        VBoxVideo.cpp \
    104106    Helper.cpp \
  • trunk/src/VBox/Additions/WINNT/Graphics/Miniport/VBoxVideo.cpp

    r34665 r34686  
    41594159        )
    41604160{
    4161     /* set the mode characteristics */
    4162     VBoxVideoCmnPortWriteUshort(VBE_DISPI_IOPORT_INDEX, VBE_DISPI_INDEX_XRES);
    4163     VBoxVideoCmnPortWriteUshort(VBE_DISPI_IOPORT_DATA, width);
    4164     VBoxVideoCmnPortWriteUshort(VBE_DISPI_IOPORT_INDEX, VBE_DISPI_INDEX_YRES);
    4165     VBoxVideoCmnPortWriteUshort(VBE_DISPI_IOPORT_DATA, height);
    4166     VBoxVideoCmnPortWriteUshort(VBE_DISPI_IOPORT_INDEX, VBE_DISPI_INDEX_BPP);
    4167     VBoxVideoCmnPortWriteUshort(VBE_DISPI_IOPORT_DATA, bpp);
    4168     /* enable the mode */
    4169     VBoxVideoCmnPortWriteUshort(VBE_DISPI_IOPORT_INDEX, VBE_DISPI_INDEX_ENABLE);
    4170     VBoxVideoCmnPortWriteUshort(VBE_DISPI_IOPORT_DATA, VBE_DISPI_ENABLED | VBE_DISPI_LFB_ENABLED);
    41714161#ifdef VBOX_WITH_WDDM
    41724162    /* encode linear offDisplay to xOffset & yOffset to ensure offset fits USHORT */
     
    41854175    Assert(xOffset <= 0xffff);
    41864176    Assert(yOffset <= 0xffff);
    4187     VBoxVideoCmnPortWriteUshort(VBE_DISPI_IOPORT_INDEX, VBE_DISPI_INDEX_X_OFFSET);
    4188     VBoxVideoCmnPortWriteUshort(VBE_DISPI_IOPORT_DATA, (USHORT)xOffset);
    4189     VBoxVideoCmnPortWriteUshort(VBE_DISPI_IOPORT_INDEX, VBE_DISPI_INDEX_Y_OFFSET);
    4190     VBoxVideoCmnPortWriteUshort(VBE_DISPI_IOPORT_DATA, (USHORT)yOffset);
    4191 #endif
     4177#else
     4178    ULONG xOffset = 0, yOffset = 0;
     4179#endif
     4180    VBoxVideoSetModeRegisters(width, height, width, bpp, (uint16_t)xOffset,
     4181                              (uint16_t)yOffset);
    41924182    /** @todo read from the port to see if the mode switch was successful */
    4193 
    4194     /* Tell the host that we now support graphics in the additions.
    4195      * @todo: Keep old behaviour, because VBoxVideoResetDevice is called on every graphics
    4196      *        mode switch and causes an OFF/ON sequence which is not handled by frontends
    4197      *        (for example Qt GUI debug build asserts when seamless is being enabled).
    4198      */
    4199     // VBoxVideoSetGraphicsCap(TRUE);
    42004183
    42014184    return TRUE;
  • trunk/src/VBox/Additions/common/VBoxVideo/HGSMIBase.cpp

    r34665 r34686  
    173173
    174174    return VERR_INVALID_PARAMETER;
    175 }
    176 
    177 
    178 /** Query the host for an HGSMI configuration parameter via an HGSMI command.
    179  */
    180 static int vboxQueryConfHGSMI(PHGSMIGUESTCOMMANDCONTEXT pCtx, uint32_t u32Index,
    181                               uint32_t *pulValue)
    182 {
    183     int rc = VINF_SUCCESS;
    184     VBVACONF32 *p;
    185     LogFunc(("u32Index = %d\n", u32Index));
    186 
    187     /* Allocate the IO buffer. */
    188     p = (VBVACONF32 *)HGSMIHeapAlloc(&pCtx->heapCtx,
    189                                      sizeof(VBVACONF32), HGSMI_CH_VBVA,
    190                                      VBVA_QUERY_CONF32);
    191     if (p)
    192     {
    193         /* Prepare data to be sent to the host. */
    194         p->u32Index = u32Index;
    195         p->u32Value = 0;
    196         rc = VBoxHGSMIBufferSubmit(pCtx, p);
    197         if (RT_SUCCESS(rc))
    198         {
    199             *pulValue = p->u32Value;
    200             LogFunc(("u32Value = %d\n", p->u32Value));
    201         }
    202         /* Free the IO buffer. */
    203         HGSMIHeapFree(&pCtx->heapCtx, p);
    204     }
    205     else
    206         rc = VERR_NO_MEMORY;
    207     LogFunc(("rc = %d\n", rc));
    208     return rc;
    209175}
    210176
     
    291257        /* Free the IO buffer. */
    292258        HGSMIHeapFree(&pCtx->heapCtx, p);
    293     }
    294     else
    295         rc = VERR_NO_MEMORY;
    296     return rc;
    297 }
    298 
    299 
    300 /**
    301  * Tell the host about how VRAM is divided up between each screen via an HGSMI
    302  * command.  It is acceptable to specifiy identical data for each screen if
    303  * they share a single framebuffer.
    304  * @todo confirm that that really is acceptable
    305  *
    306  * @returns iprt status code, either VERR_NO_MEMORY or the status returned by
    307  *          @a pfnFill
    308  * @param  pCtx      the context containing the heap to use
    309  * @param  u32Count  the number of screens we are activating
    310  * @param  pfnFill   a callback which initialises the VBVAINFOVIEW structures
    311  *                   for all screens
    312  * @param  pvData    context data for @a pfnFill
    313  */
    314 RTDECL(int) VBoxHGSMISendViewInfo(PHGSMIGUESTCOMMANDCONTEXT pCtx,
    315                                   uint32_t u32Count,
    316                                   PFNHGSMIFILLVIEWINFO pfnFill,
    317                                   void *pvData)
    318 {
    319     int rc;
    320     /* Issue the screen info command. */
    321     void *p = VBoxHGSMIBufferAlloc(pCtx, sizeof(VBVAINFOVIEW) * u32Count,
    322                                    HGSMI_CH_VBVA, VBVA_INFO_VIEW);
    323     if (p)
    324     {
    325         VBVAINFOVIEW *pInfo = (VBVAINFOVIEW *)p;
    326         rc = pfnFill(pvData, pInfo, u32Count);
    327         if (RT_SUCCESS(rc))
    328             VBoxHGSMIBufferSubmit (pCtx, p);
    329         VBoxHGSMIBufferFree(pCtx, p);
    330259    }
    331260    else
     
    422351    AssertPtrReturnVoid(poffVRAMHostArea);
    423352    AssertPtrReturnVoid(pcbHostArea);
    424     vboxQueryConfHGSMI(pCtx, VBOX_VBVA_CONF32_HOST_HEAP_SIZE, &cbHostArea);
     353    VBoxQueryConfHGSMI(pCtx, VBOX_VBVA_CONF32_HOST_HEAP_SIZE, &cbHostArea);
    425354    if (cbHostArea != 0)
    426355    {
     
    517446
    518447/**
    519  * Gets the count of virtual monitors attached to the guest via an HGSMI
    520  * command
    521  *
    522  * @returns the right count on success or 1 on failure.
    523  * @param  pCtx  the context containing the heap to use
    524  */
    525 RTDECL(uint32_t) VBoxHGSMIGetMonitorCount(PHGSMIGUESTCOMMANDCONTEXT pCtx)
    526 {
    527     /* Query the configured number of displays. */
    528     uint32_t cDisplays = 0;
    529     vboxQueryConfHGSMI(pCtx, VBOX_VBVA_CONF32_MONITOR_COUNT, &cDisplays);
    530     LogFunc(("cDisplays = %d\n", cDisplays));
    531     if (cDisplays == 0 || cDisplays > VBOX_VIDEO_MAX_SCREENS)
    532         /* Host reported some bad value. Continue in the 1 screen mode. */
    533         cDisplays = 1;
    534     return cDisplays;
     448 * Query the host for an HGSMI configuration parameter via an HGSMI command.
     449 * @returns iprt status value
     450 * @param  pCtx      the context containing the heap used
     451 * @param  u32Index  the index of the parameter to query,
     452 *                   @see VBVACONF32::u32Index
     453 * @param  pulValue  where to store the value of the parameter on success
     454 */
     455RTDECL(int) VBoxQueryConfHGSMI(PHGSMIGUESTCOMMANDCONTEXT pCtx,
     456                               uint32_t u32Index, uint32_t *pulValue)
     457{
     458    int rc = VINF_SUCCESS;
     459    VBVACONF32 *p;
     460    LogFunc(("u32Index = %d\n", u32Index));
     461
     462    /* Allocate the IO buffer. */
     463    p = (VBVACONF32 *)HGSMIHeapAlloc(&pCtx->heapCtx,
     464                                     sizeof(VBVACONF32), HGSMI_CH_VBVA,
     465                                     VBVA_QUERY_CONF32);
     466    if (p)
     467    {
     468        /* Prepare data to be sent to the host. */
     469        p->u32Index = u32Index;
     470        p->u32Value = 0;
     471        rc = VBoxHGSMIBufferSubmit(pCtx, p);
     472        if (RT_SUCCESS(rc))
     473        {
     474            *pulValue = p->u32Value;
     475            LogFunc(("u32Value = %d\n", p->u32Value));
     476        }
     477        /* Free the IO buffer. */
     478        HGSMIHeapFree(&pCtx->heapCtx, p);
     479    }
     480    else
     481        rc = VERR_NO_MEMORY;
     482    LogFunc(("rc = %d\n", rc));
     483    return rc;
    535484}
    536485
  • trunk/src/VBox/Additions/common/VBoxVideo/VBVABase.cpp

    r34665 r34686  
    389389    pCtx->cbBuffer      = cbBuffer;
    390390}
    391 
    392 RTDECL(void) VBoxHGSMIProcessDisplayInfo(PHGSMIGUESTCOMMANDCONTEXT pCtx,
    393                                          uint32_t cDisplay,
    394                                          int32_t  cOriginX,
    395                                          int32_t  cOriginY,
    396                                          uint32_t offStart,
    397                                          uint32_t cbPitch,
    398                                          uint32_t cWidth,
    399                                          uint32_t cHeight,
    400                                          uint16_t cBPP)
    401 {
    402     /* Issue the screen info command. */
    403     void *p = VBoxHGSMIBufferAlloc(pCtx,
    404                                    sizeof (VBVAINFOSCREEN),
    405                                    HGSMI_CH_VBVA,
    406                                    VBVA_INFO_SCREEN);
    407     if (!p)
    408     {
    409         LogFunc(("HGSMIHeapAlloc failed\n"));
    410     }
    411     else
    412     {
    413         VBVAINFOSCREEN *pScreen = (VBVAINFOSCREEN *)p;
    414 
    415         pScreen->u32ViewIndex    = cDisplay;
    416         pScreen->i32OriginX      = cOriginX;
    417         pScreen->i32OriginY      = cOriginY;
    418         pScreen->u32StartOffset  = offStart;
    419         pScreen->u32LineSize     = cbPitch;
    420         pScreen->u32Width        = cWidth;
    421         pScreen->u32Height       = cHeight;
    422         pScreen->u16BitsPerPixel = cBPP;
    423         pScreen->u16Flags        = VBVA_SCREEN_F_ACTIVE;
    424 
    425         VBoxHGSMIBufferSubmit(pCtx, p);
    426 
    427         VBoxHGSMIBufferFree(pCtx, p);
    428     }
    429 }
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