VirtualBox

Changeset 25583 in vbox


Ignore:
Timestamp:
Dec 25, 2009 11:10:46 AM (15 years ago)
Author:
vboxsync
Message:

2d: linear stretch & supported pixel formats settings in extradata

Location:
trunk/src/VBox/Frontends/VirtualBox/src
Files:
7 edited

Legend:

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

    r25526 r25583  
    782782    {
    783783        case VBoxDefs::QGLMode:
    784             pViewport = new VBoxGLWidget (this, this);
     784            pViewport = new VBoxGLWidget (this, this, NULL);
    785785            break;
    786786        default:
     
    839839            mFrameBuf =
    840840#ifdef VBOX_WITH_VIDEOHWACCEL
    841                     mAccelerate2DVideo ? new VBoxOverlayFrameBuffer<VBoxQImageFrameBuffer>(this) :
     841                    mAccelerate2DVideo ? new VBoxOverlayFrameBuffer<VBoxQImageFrameBuffer> (this, &mainWnd->session()) :
    842842#endif
    843843                    new VBoxQImageFrameBuffer (this);
     
    856856            mFrameBuf =
    857857#if defined(VBOX_WITH_VIDEOHWACCEL) && defined(DEBUG_misha) /* not tested yet */
    858                     mAccelerate2DVideo ? new VBoxOverlayFrameBuffer<VBoxSDLFrameBuffer> (this) :
     858                    mAccelerate2DVideo ? new VBoxOverlayFrameBuffer<VBoxSDLFrameBuffer> (this, &mainWnd->session()) :
    859859#endif
    860860                    new VBoxSDLFrameBuffer (this);
     
    879879            mFrameBuf =
    880880#ifdef VBOX_WITH_VIDEOHWACCEL
    881                     mAccelerate2DVideo ? new VBoxOverlayFrameBuffer<VBoxQuartz2DFrameBuffer> (this) :
     881                    mAccelerate2DVideo ? new VBoxOverlayFrameBuffer<VBoxQuartz2DFrameBuffer> (this, &mainWnd->session()) :
    882882#endif
    883883                    new VBoxQuartz2DFrameBuffer (this);
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleWnd.h

    r25505 r25583  
    115115    void onDisplayResize (ulong aHeight, ulong aWidth);
    116116
     117#ifdef VBOX_WITH_VIDEOHWACCEL
     118    /* used for obtaining the extradata settings */
     119    CSession &session() { return mSession; }
     120#endif
    117121signals:
    118122
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxFBOverlay.cpp

    r25526 r25583  
    11881188        VBoxVHWAColorKey * pSrcBltCKey, VBoxVHWAColorKey * pDstBltCKey,
    11891189                    VBoxVHWAColorKey * pSrcOverlayCKey, VBoxVHWAColorKey * pDstOverlayCKey,
    1190 #ifdef VBOXVHWA_USE_TEXGROUP
    1191                     uint32_t cBackTex,
    1192 #endif
    1193                     bool bVGA) :
     1190                    VBOXVHWAIMG_TYPE aImgFlags) :
    11941191                mRect(0,0,aSize.width(),aSize.height()),
    11951192                mAddress(NULL),
     
    12221219    resetDefaultSrcOverlayCKey();
    12231220
    1224     mImage = vboxVHWAImageCreate(QRect(0,0,aSize.width(),aSize.height()), aColorFormat, getGlProgramMngr(), bVGA ? 0 : (VBOXVHWAIMG_PBO | VBOXVHWAIMG_PBOIMG | VBOXVHWAIMG_FBO));
     1221    mImage = vboxVHWAImageCreate(QRect(0,0,aSize.width(),aSize.height()), aColorFormat, getGlProgramMngr(), aImgFlags);
    12251222
    12261223    setRectValues(aTargRect, aSrcRect);
     
    19191916};
    19201917
    1921 VBoxGLWidget::VBoxGLWidget (VBoxConsoleView *aView, QWidget *aParent)
     1918VBoxGLWidget::VBoxGLWidget (VBoxConsoleView *aView, QWidget *aParent, VBoxVHWASettings *aSettings)
    19221919    : QGLWidget (new VBoxGLContext(VBoxGLWidget::vboxGLFormat()), aParent),
    19231920    mSurfHandleTable(128), /* 128 should be enough */
     
    19301927    mView(aView),
    19311928    mConstructingList(NULL),
    1932     mcRemaining2Contruct(0)
     1929    mcRemaining2Contruct(0),
     1930    mSettings(aSettings)
    19331931#ifdef VBOXVHWA_PROFILE_FPS
    19341932    ,
     
    22552253
    22562254#ifdef VBOXVHWA_ALLOW_PRIMARY_AND_OVERLAY_ONLY
    2257     if((pCmd->SurfInfo.surfCaps & VBOXVHWA_SCAPS_OVERLAY) == 0)
     2255    if ((pCmd->SurfInfo.surfCaps & VBOXVHWA_SCAPS_OVERLAY) == 0)
    22582256    {
    22592257#ifdef DEBUGVHWASTRICT
    2260         Assert(0);
     2258        Assert (0);
    22612259#endif
    22622260        pCmd->u.out.ErrInfo = -1;
     
    22652263#endif
    22662264
    2267     if(pCmd->u.in.bIsDifferentPixelFormat)
    2268     {
    2269         if(!(pCmd->SurfInfo.flags & VBOXVHWA_SD_PIXELFORMAT))
    2270         {
    2271             Assert(0);
     2265    if (pCmd->u.in.bIsDifferentPixelFormat)
     2266    {
     2267        if (!(pCmd->SurfInfo.flags & VBOXVHWA_SD_PIXELFORMAT))
     2268        {
     2269            Assert (0);
    22722270            pCmd->u.out.ErrInfo = -1;
    22732271            return VINF_SUCCESS;
    22742272        }
    22752273
    2276         if(pCmd->SurfInfo.PixelFormat.flags & VBOXVHWA_PF_RGB)
    2277         {
    2278             if(pCmd->SurfInfo.PixelFormat.c.rgbBitCount != 32
     2274        if (pCmd->SurfInfo.PixelFormat.flags & VBOXVHWA_PF_RGB)
     2275        {
     2276            if (pCmd->SurfInfo.PixelFormat.c.rgbBitCount != 32
    22792277                    || pCmd->SurfInfo.PixelFormat.c.rgbBitCount != 24)
    22802278            {
    2281                 Assert(0);
     2279                Assert (0);
    22822280                pCmd->u.out.ErrInfo = -1;
    22832281                return VINF_SUCCESS;
    22842282            }
    22852283        }
    2286         else if(pCmd->SurfInfo.PixelFormat.flags & VBOXVHWA_PF_FOURCC)
     2284        else if (pCmd->SurfInfo.PixelFormat.flags & VBOXVHWA_PF_FOURCC)
    22872285        {
    22882286            /* detect whether we support this format */
    2289             bool bFound = false;
    2290             for(int i = 0; i < info.getFourccSupportedCount(); i++)
     2287            bool bFound = mSettings->isSupported (info, pCmd->SurfInfo.PixelFormat.fourCC);
     2288
     2289            if (!bFound)
    22912290            {
    2292                 if(info.getFourccSupportedList()[i] == pCmd->SurfInfo.PixelFormat.fourCC)
    2293                 {
    2294                     bFound = true;
    2295                     break;
    2296                 }
    2297             }
    2298 
    2299             if(!bFound)
    2300             {
    2301                 VBOXQGLLOG(("!!unsupported fourcc!!!: %c%c%c%c\n",
     2291                VBOXQGLLOG (("!!unsupported fourcc!!!: %c%c%c%c\n",
    23022292                        (pCmd->SurfInfo.PixelFormat.fourCC & 0x000000ff),
    23032293                                (pCmd->SurfInfo.PixelFormat.fourCC & 0x0000ff00) >> 8,
     
    23112301        else
    23122302        {
    2313             Assert(0);
     2303            Assert (0);
    23142304            pCmd->u.out.ErrInfo = -1;
    23152305            return VINF_SUCCESS;
     
    23212311}
    23222312
    2323 int VBoxGLWidget::vhwaSurfaceCreate(struct _VBOXVHWACMD_SURF_CREATE *pCmd)
    2324 {
    2325     VBOXQGLLOG_ENTER(("\n"));
     2313int VBoxGLWidget::vhwaSurfaceCreate (struct _VBOXVHWACMD_SURF_CREATE *pCmd)
     2314{
     2315    VBOXQGLLOG_ENTER (("\n"));
    23262316
    23272317    uint32_t handle = VBOXVHWA_SURFHANDLE_INVALID;
     
    24132403    if(!surf)
    24142404    {
     2405        VBOXVHWAIMG_TYPE fFlags = 0;
     2406        if(!bNoPBO)
     2407        {
     2408            fFlags |= VBOXVHWAIMG_PBO | VBOXVHWAIMG_PBOIMG;
     2409            if(mSettings->isStretchLinearEnabled())
     2410                fFlags |= VBOXVHWAIMG_FBO;
     2411        }
     2412
    24152413        if(pCmd->SurfInfo.PixelFormat.flags & VBOXVHWA_PF_RGB)
    24162414        {
     
    24312429                        0,
    24322430#endif
    2433                         bNoPBO);
     2431                        fFlags);
    24342432        }
    24352433        else if(pCmd->SurfInfo.PixelFormat.flags & VBOXVHWA_PF_FOURCC)
     
    24492447                                    0,
    24502448#endif
    2451                                     bNoPBO);
     2449                                    fFlags);
    24522450        }
    24532451        else
     
    30002998//              pCmd->u.out.caps2 |= VBOXVHWA_CAPS2_COPYFOURCC;
    30012999
    3002                 pCmd->u.out.numFourCC = info.getFourccSupportedCount();
     3000                pCmd->u.out.numFourCC = mSettings->getIntersection(info, 0, NULL);
    30033001            }
    30043002        }
     
    30133011
    30143012    const VBoxVHWAInfo & info = vboxVHWAGetSupportInfo(context());
    3015 
    3016     Assert(pCmd->numFourCC >= (uint32_t)info.getFourccSupportedCount());
    3017     if(pCmd->numFourCC < (uint32_t)info.getFourccSupportedCount())
     3013    uint32_t aFourcc[VBOXVHWA_NUMFOURCC];
     3014    int num = mSettings->getIntersection(info, VBOXVHWA_NUMFOURCC, aFourcc);
     3015    Assert(pCmd->numFourCC >= (uint32_t)num);
     3016    if(pCmd->numFourCC < (uint32_t)num)
    30183017        return VERR_GENERAL_FAILURE;
    30193018
    3020     pCmd->numFourCC = (uint32_t)info.getFourccSupportedCount();
    3021     for(int i = 0; i < info.getFourccSupportedCount(); i++)
    3022     {
    3023         pCmd->FourCC[i] = info.getFourccSupportedList()[i];
    3024     }
     3019    pCmd->numFourCC = (uint32_t)num;
     3020    memcpy(pCmd->FourCC, aFourcc, num*sizeof(aFourcc[0]));
    30253021    return VINF_SUCCESS;
    30263022}
     
    38573853            0,
    38583854#endif
    3859             true);
     3855            0);
    38603856    pDisplay->init(NULL, mUsesGuestVRAM ? re->VRAM() : NULL);
    38613857    mDisplay.setVGA(pDisplay);
     
    39603956}
    39613957
    3962 VBoxVHWAColorFormat::VBoxVHWAColorFormat(uint32_t bitsPerPixel, uint32_t r, uint32_t g, uint32_t b) :
    3963     mWidthCompression(1),
    3964     mHeightCompression(1)
    3965 {
    3966     init(bitsPerPixel, r, g, b);
    3967 }
    3968 
    3969 VBoxVHWAColorFormat::VBoxVHWAColorFormat(uint32_t fourcc) :
    3970     mWidthCompression(1),
    3971     mHeightCompression(1)
    3972 {
    3973     init(fourcc);
    3974 }
    3975 
    3976 void VBoxVHWAColorFormat::init(uint32_t fourcc)
     3958VBoxVHWAColorFormat::VBoxVHWAColorFormat (uint32_t bitsPerPixel, uint32_t r, uint32_t g, uint32_t b) :
     3959    mWidthCompression (1),
     3960    mHeightCompression (1)
     3961{
     3962    init (bitsPerPixel, r, g, b);
     3963}
     3964
     3965VBoxVHWAColorFormat::VBoxVHWAColorFormat (uint32_t fourcc) :
     3966    mWidthCompression (1),
     3967    mHeightCompression (1)
     3968{
     3969    init (fourcc);
     3970}
     3971
     3972void VBoxVHWAColorFormat::init (uint32_t fourcc)
    39773973{
    39783974    mDataFormat = fourcc;
     
    39803976    mFormat = GL_BGRA_EXT;//GL_RGBA;
    39813977    mType = GL_UNSIGNED_BYTE;
    3982     mR = VBoxVHWAColorComponent(0xff);
    3983     mG = VBoxVHWAColorComponent(0xff);
    3984     mB = VBoxVHWAColorComponent(0xff);
    3985     mA = VBoxVHWAColorComponent(0xff);
     3978    mR = VBoxVHWAColorComponent (0xff);
     3979    mG = VBoxVHWAColorComponent (0xff);
     3980    mB = VBoxVHWAColorComponent (0xff);
     3981    mA = VBoxVHWAColorComponent (0xff);
    39863982    mBitsPerPixelTex = 32;
    39873983
     
    40104006}
    40114007
    4012 void VBoxVHWAColorFormat::init(uint32_t bitsPerPixel, uint32_t r, uint32_t g, uint32_t b)
     4008void VBoxVHWAColorFormat::init (uint32_t bitsPerPixel, uint32_t r, uint32_t g, uint32_t b)
    40134009{
    40144010    mBitsPerPixel = bitsPerPixel;
     
    40214017            mFormat = GL_BGRA_EXT;//GL_RGBA;
    40224018            mType = GL_UNSIGNED_BYTE;
    4023             mR = VBoxVHWAColorComponent(r);
    4024             mG = VBoxVHWAColorComponent(g);
    4025             mB = VBoxVHWAColorComponent(b);
     4019            mR = VBoxVHWAColorComponent (r);
     4020            mG = VBoxVHWAColorComponent (g);
     4021            mB = VBoxVHWAColorComponent (b);
    40264022            break;
    40274023        case 24:
     
    40324028            mFormat = GL_BGR_EXT;
    40334029            mType = GL_UNSIGNED_BYTE;
    4034             mR = VBoxVHWAColorComponent(r);
    4035             mG = VBoxVHWAColorComponent(g);
    4036             mB = VBoxVHWAColorComponent(b);
     4030            mR = VBoxVHWAColorComponent (r);
     4031            mG = VBoxVHWAColorComponent (g);
     4032            mB = VBoxVHWAColorComponent (b);
    40374033            break;
    40384034        case 16:
     
    40434039            mFormat = GL_BGR_EXT;
    40444040            mType = GL_UNSIGNED_BYTE; /* TODO" ??? */
    4045             mR = VBoxVHWAColorComponent(r);
    4046             mG = VBoxVHWAColorComponent(g);
    4047             mB = VBoxVHWAColorComponent(b);
     4041            mR = VBoxVHWAColorComponent (r);
     4042            mG = VBoxVHWAColorComponent (g);
     4043            mB = VBoxVHWAColorComponent (b);
    40484044            break;
    40494045        case 8:
     
    40544050            mFormat = GL_RED;//GL_RGB;
    40554051            mType = GL_UNSIGNED_BYTE;
    4056             mR = VBoxVHWAColorComponent(0xff);
     4052            mR = VBoxVHWAColorComponent (0xff);
    40574053            break;
    40584054        case 1:
     
    40634059            mFormat = GL_COLOR_INDEX;
    40644060            mType = GL_BITMAP;
    4065             mR = VBoxVHWAColorComponent(0x1);
     4061            mR = VBoxVHWAColorComponent (0x1);
    40664062            break;
    40674063        default:
     
    40854081}
    40864082
    4087 VBoxVHWAColorComponent::VBoxVHWAColorComponent(uint32_t aMask)
    4088 {
    4089     unsigned f = ASMBitFirstSetU32(aMask);
     4083VBoxVHWAColorComponent::VBoxVHWAColorComponent (uint32_t aMask)
     4084{
     4085    unsigned f = ASMBitFirstSetU32 (aMask);
    40904086    if(f)
    40914087    {
    40924088        mOffset = f - 1;
    4093         f = ASMBitFirstSetU32(~(aMask >> mOffset));
     4089        f = ASMBitFirstSetU32 (~(aMask >> mOffset));
    40944090        if(f)
    40954091        {
     
    41014097        }
    41024098
    4103         Assert(mcBits);
     4099        Assert (mcBits);
    41044100        mMask = (((uint32_t)0xffffffff) >> (32 - mcBits)) << mOffset;
    4105         Assert(mMask == aMask);
     4101        Assert (mMask == aMask);
    41064102
    41074103        mRange = (mMask >> mOffset) + 1;
     
    41184114void VBoxVHWAColorFormat::pixel2Normalized (uint32_t pix, float *r, float *g, float *b) const
    41194115{
    4120     *r = mR.colorValNorm(pix);
    4121     *g = mG.colorValNorm(pix);
    4122     *b = mB.colorValNorm(pix);
    4123 }
    4124 
    4125 VBoxQGLOverlay::VBoxQGLOverlay (VBoxConsoleView *aView, VBoxFrameBuffer * aContainer)
    4126     : mpOverlayWidget(NULL),
    4127       mView(aView),
    4128       mContainer(aContainer),
    4129       mGlOn(false),
    4130       mOverlayWidgetVisible(false),
    4131       mOverlayVisible(false),
    4132       mGlCurrent(false),
    4133       mProcessingCommands(false),
    4134       mNeedOverlayRepaint(false),
    4135       mNeedSetVisible(false),
    4136       mCmdPipe(aView)
     4116    *r = mR.colorValNorm (pix);
     4117    *g = mG.colorValNorm (pix);
     4118    *b = mB.colorValNorm (pix);
     4119}
     4120
     4121VBoxQGLOverlay::VBoxQGLOverlay (VBoxConsoleView *aView, VBoxFrameBuffer * aContainer, CSession * aSession)
     4122    : mpOverlayWidget (NULL),
     4123      mView (aView),
     4124      mContainer (aContainer),
     4125      mGlOn (false),
     4126      mOverlayWidgetVisible (false),
     4127      mOverlayVisible (false),
     4128      mGlCurrent (false),
     4129      mProcessingCommands (false),
     4130      mNeedOverlayRepaint (false),
     4131      mNeedSetVisible (false),
     4132      mCmdPipe (aView),
     4133      mSettings (*aSession)
    41374134{
    41384135    /* postpone the gl widget initialization to avoid conflict with 3D on Mac */
     
    41444141                return;
    41454142
    4146     mpOverlayWidget = new VBoxGLWidget (mView, mView->viewport());
     4143    mpOverlayWidget = new VBoxGLWidget (mView, mView->viewport(), &mSettings);
    41474144
    41484145    VBoxGLContext *pc = (VBoxGLContext*)mpOverlayWidget->context();
    4149     pc->allowDoneCurrent(false);
     4146    pc->allowDoneCurrent (false);
    41504147
    41514148    mOverlayWidgetVisible = true; /* to ensure it is set hidden with vboxShowOverlay */
    4152     vboxShowOverlay(false);
    4153 
    4154     mpOverlayWidget->setMouseTracking(true);
     4149    vboxShowOverlay (false);
     4150
     4151    mpOverlayWidget->setMouseTracking (true);
    41554152}
    41564153
     
    53485345}
    53495346
    5350 //int VBoxVHWATextureImage::updateDstCKeyInfo(const VBoxVHWAColorKey * pDstCKey)
    5351 //{
    5352 //    if(mpProgram)
    5353 //    {
    5354 //        pProgram->start();
    5355 //        int rc = setCKey(mpProgram, &mColorFormat, pDstCKey, true);
    5356 //        pProgram->stop();
    5357 //        return rc;
    5358 //    }
    5359 //    return VERR_INVALID_STATE;
    5360 //}
    5361 //
    5362 //int VBoxVHWATextureImage::updateSrcCKeyInfo(const VBoxVHWAColorKey * pSrcCKey)
    5363 //{
    5364 //    if(mpProgram)
    5365 //    {
    5366 //        pProgram->start();
    5367 //        int rc = setCKey(mpProgram, &mColorFormat, pSrcCKey, false);
    5368 //        pProgram->stop();
    5369 //        return rc;
    5370 //    }
    5371 //    return VERR_INVALID_STATE;
    5372 //}
    5373 
    5374 int VBoxVHWATextureImage::setCKey(VBoxVHWAGlProgramVHWA * pProgram, const VBoxVHWAColorFormat * pFormat, const VBoxVHWAColorKey * pCKey, bool bDst)
     5347int VBoxVHWATextureImage::setCKey (VBoxVHWAGlProgramVHWA * pProgram, const VBoxVHWAColorFormat * pFormat, const VBoxVHWAColorKey * pCKey, bool bDst)
    53755348{
    53765349    float r,g,b;
    5377     pFormat->pixel2Normalized(pCKey->lower(), &r, &g, &b);
    5378     int rcL = bDst ? pProgram->setDstCKeyLowerRange(r, g, b) : pProgram->setSrcCKeyLowerRange(r, g, b);
     5350    pFormat->pixel2Normalized (pCKey->lower(), &r, &g, &b);
     5351    int rcL = bDst ? pProgram->setDstCKeyLowerRange (r, g, b) : pProgram->setSrcCKeyLowerRange (r, g, b);
    53795352    Assert(RT_SUCCESS(rcL));
    53805353
     
    53825355}
    53835356
    5384 
     5357VBoxVHWASettings::VBoxVHWASettings (CSession &session)
     5358{
     5359    CMachine machine = session.GetMachine();
     5360
     5361    QString str = machine.GetExtraData (VBoxDefs::GUI_Accelerate2D_StretchLinear);
     5362    mStretchLinearEnabled = str != "off";
     5363
     5364    uint32_t aFourccs[VBOXVHWA_NUMFOURCC];
     5365    int num = 0;
     5366    str = machine.GetExtraData (VBoxDefs::GUI_Accelerate2D_PixformatAYUV);
     5367    if (str != "off")
     5368        aFourccs[num++] = FOURCC_AYUV;
     5369    str = machine.GetExtraData (VBoxDefs::GUI_Accelerate2D_PixformatUYVY);
     5370    if (str != "off")
     5371        aFourccs[num++] = FOURCC_UYVY;
     5372    str = machine.GetExtraData (VBoxDefs::GUI_Accelerate2D_PixformatYUY2);
     5373    if (str != "off")
     5374        aFourccs[num++] = FOURCC_YUY2;
     5375    str = machine.GetExtraData (VBoxDefs::GUI_Accelerate2D_PixformatYV12);
     5376    if (str != "off")
     5377        aFourccs[num++] = FOURCC_YV12;
     5378
     5379    mFourccEnabledCount = num;
     5380    memcpy(mFourccEnabledList, aFourccs, num* sizeof (aFourccs[0]));
     5381}
     5382
     5383int VBoxVHWASettings::calcIntersection (int c1, const uint32_t *a1, int c2, const uint32_t *a2, int cOut, uint32_t *aOut)
     5384{
     5385    /* fourcc arrays are not big, so linear search is enough,
     5386     * also no need to check for duplicates */
     5387    int cMatch = 0;
     5388    for (int i = 0; i < c1; ++i)
     5389    {
     5390        uint32_t cur1 = a1[i];
     5391        for (int j = 0; j < c2; ++j)
     5392        {
     5393            uint32_t cur2 = a2[j];
     5394            if(cur1 == cur2)
     5395            {
     5396                if(cOut > cMatch && aOut)
     5397                    aOut[cMatch] = cur1;
     5398                ++cMatch;
     5399                break;
     5400            }
     5401        }
     5402    }
     5403
     5404    return cMatch;
     5405}
    53855406
    53865407#endif
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxFBOverlay.h

    r25470 r25583  
    6363
    6464#endif
     65
     66class VBoxVHWASettings
     67{
     68public:
     69    VBoxVHWASettings (CSession &session);
     70
     71    int fourccEnabledCount() const { return mFourccEnabledCount; }
     72    const uint32_t * fourccEnabledList() const { return mFourccEnabledList; }
     73
     74    bool isStretchLinearEnabled() const { return mStretchLinearEnabled; }
     75
     76    static int calcIntersection (int c1, const uint32_t *a1, int c2, const uint32_t *a2, int cOut, uint32_t *aOut);
     77
     78    int getIntersection (const VBoxVHWAInfo &aInfo, int cOut, uint32_t *aOut)
     79    {
     80        return calcIntersection (mFourccEnabledCount, mFourccEnabledList, aInfo.getFourccSupportedCount(), aInfo.getFourccSupportedList(), cOut, aOut);
     81    }
     82
     83    bool isSupported(const VBoxVHWAInfo &aInfo, uint32_t format)
     84    {
     85        return calcIntersection (mFourccEnabledCount, mFourccEnabledList, 1, &format, 0, NULL)
     86                && calcIntersection (aInfo.getFourccSupportedCount(), aInfo.getFourccSupportedList(), 1, &format, 0, NULL);
     87    }
     88private:
     89    uint32_t mFourccEnabledList[VBOXVHWA_NUMFOURCC];
     90    int mFourccEnabledCount;
     91    bool mStretchLinearEnabled;
     92};
    6593
    6694class VBoxVHWADirtyRect
     
    709737{
    710738public:
    711     VBoxVHWASurfaceBase(
     739    VBoxVHWASurfaceBase (
    712740            class VBoxGLWidget *aWidget,
    713741            const QSize & aSize,
     
    718746            VBoxVHWAColorKey * pSrcBltCKey, VBoxVHWAColorKey * pDstBltCKey,
    719747            VBoxVHWAColorKey * pSrcOverlayCKey, VBoxVHWAColorKey * pDstOverlayCKey,
    720             bool bVGA);
     748            VBOXVHWAIMG_TYPE aImgFlags);
    721749
    722750    virtual ~VBoxVHWASurfaceBase();
    723751
    724     void init(VBoxVHWASurfaceBase * pPrimary, uchar *pvMem);
     752    void init (VBoxVHWASurfaceBase * pPrimary, uchar *pvMem);
    725753
    726754    void uninit();
     
    728756    static void globalInit();
    729757
    730 //    int blt(const QRect * aDstRect, VBoxVHWASurfaceBase * aSrtSurface, const QRect * aSrcRect, const VBoxVHWAColorKey * pDstCKeyOverride, const VBoxVHWAColorKey * pSrcCKeyOverride);
    731 
    732     int lock(const QRect * pRect, uint32_t flags);
     758    int lock (const QRect * pRect, uint32_t flags);
    733759
    734760    int unlock();
    735761
    736     void updatedMem(const QRect * aRect);
    737 
    738     bool performDisplay(VBoxVHWASurfaceBase *pPrimary, bool bForce);
     762    void updatedMem (const QRect * aRect);
     763
     764    bool performDisplay (VBoxVHWASurfaceBase *pPrimary, bool bForce);
    739765
    740766    void setRects (const QRect & aTargRect, const QRect & aSrcRect);
     
    743769    void updateVisibility (VBoxVHWASurfaceBase *pPrimary, const QRect & aVisibleTargRect, bool bNotIntersected, bool bForce);
    744770
    745     static ulong calcBytesPerPixel(GLenum format, GLenum type);
    746 
    747     static GLsizei makePowerOf2(GLsizei val);
     771    static ulong calcBytesPerPixel (GLenum format, GLenum type);
     772
     773    static GLsizei makePowerOf2 (GLsizei val);
    748774
    749775    bool    addressAlocated() const { return mFreeAddress; }
    750     uchar * address(){ return mAddress; }
     776    uchar * address() { return mAddress; }
    751777
    752778    ulong   memSize();
     
    756782    const QSize size() {return mRect.size();}
    757783
    758 //    GLenum format() {return mImage->colorFormat().format(); }
    759 //    GLint  internalFormat() { return mImage->colorFormat().internalFormat(); }
    760 //    GLenum type() { return mImage->colorFormat().type(); }
    761784    uint32_t fourcc() {return mImage->colorFormat().fourcc(); }
    762785
     
    773796    void resetDefaultDstOverlayCKey() { mpDstOverlayCKey = mpDefaultDstOverlayCKey; }
    774797
    775     void setDstBltCKey(const VBoxVHWAColorKey * ckey)
     798    void setDstBltCKey (const VBoxVHWAColorKey * ckey)
    776799    {
    777800        if(ckey)
     
    786809    }
    787810
    788     void setSrcBltCKey(const VBoxVHWAColorKey * ckey)
     811    void setSrcBltCKey (const VBoxVHWAColorKey * ckey)
    789812    {
    790813        if(ckey)
     
    799822    }
    800823
    801     void setDefaultDstOverlayCKey(const VBoxVHWAColorKey * ckey)
     824    void setDefaultDstOverlayCKey (const VBoxVHWAColorKey * ckey)
    802825    {
    803826        if(ckey)
     
    812835    }
    813836
    814     void setDefaultSrcOverlayCKey(const VBoxVHWAColorKey * ckey)
     837    void setDefaultSrcOverlayCKey (const VBoxVHWAColorKey * ckey)
    815838    {
    816839        if(ckey)
     
    825848    }
    826849
    827     void setOverriddenDstOverlayCKey(const VBoxVHWAColorKey * ckey)
     850    void setOverriddenDstOverlayCKey (const VBoxVHWAColorKey * ckey)
    828851    {
    829852        if(ckey)
     
    838861    }
    839862
    840     void setOverriddenSrcOverlayCKey(const VBoxVHWAColorKey * ckey)
     863    void setOverriddenSrcOverlayCKey (const VBoxVHWAColorKey * ckey)
    841864    {
    842865        if(ckey)
     
    856879    }
    857880
    858     const VBoxVHWAColorKey * getActiveDstOverlayCKey(VBoxVHWASurfaceBase * pPrimary)
     881    const VBoxVHWAColorKey * getActiveDstOverlayCKey (VBoxVHWASurfaceBase * pPrimary)
    859882    {
    860883        return mpDstOverlayCKey ? mpDefaultDstOverlayCKey : (pPrimary ? pPrimary->mpDstOverlayCKey : NULL);
     
    883906    void setVisibleRectValues (const QRect & aVisTargRect);
    884907
    885     void setComplexList(VBoxVHWASurfList *aComplexList) { mComplexList = aComplexList; }
     908    void setComplexList (VBoxVHWASurfList *aComplexList) { mComplexList = aComplexList; }
    886909    void initDisplay();
    887910
    888     bool synchTexMem(const QRect * aRect);
    889 
    890     int performBlt(const QRect * pDstRect, VBoxVHWASurfaceBase * pSrcSurface, const QRect * pSrcRect, const VBoxVHWAColorKey * pDstCKey, const VBoxVHWAColorKey * pSrcCKey, bool blt);
     911    bool synchTexMem (const QRect * aRect);
     912
     913    int performBlt (const QRect * pDstRect, VBoxVHWASurfaceBase * pSrcSurface, const QRect * pSrcRect, const VBoxVHWAColorKey * pDstCKey, const VBoxVHWAColorKey * pSrcCKey, bool blt);
    891914
    892915    QRect mRect; /* == Inv FB size */
     
    13151338{
    13161339public:
    1317     VBoxGLWidget (class VBoxConsoleView *aView, QWidget *aParent);
     1340    VBoxGLWidget (class VBoxConsoleView *aView, QWidget *aParent, VBoxVHWASettings *aSettings);
    13181341    ~VBoxGLWidget();
    13191342
     
    15231546    class VBoxVHWAGlProgramMngr *mpMngr;
    15241547
     1548    VBoxVHWASettings *mSettings;
     1549
    15251550#ifdef VBOXVHWA_PROFILE_FPS
    15261551    VBoxVHWADbgTimer mFPSCounter;
     
    16481673{
    16491674public:
    1650     VBoxQGLOverlay (class VBoxConsoleView *aView, class VBoxFrameBuffer * aContainer);
    1651 
    1652     int onVHWACommand(struct _VBOXVHWACMD * pCommand);
    1653 
    1654     void onVHWACommandEvent(QEvent * pEvent);
     1675    VBoxQGLOverlay (class VBoxConsoleView *aView, class VBoxFrameBuffer * aContainer, CSession * aSession);
     1676
     1677    int onVHWACommand (struct _VBOXVHWACMD * pCommand);
     1678
     1679    void onVHWACommandEvent (QEvent * pEvent);
    16551680
    16561681    /**
     
    16771702    void onResizeEventPostprocess (const class VBoxResizeEvent *re);
    16781703
    1679     void onViewportResized(QResizeEvent * /*re*/)
     1704    void onViewportResized (QResizeEvent * /*re*/)
    16801705    {
    16811706        vboxDoCheckUpdateViewport();
     
    16831708    }
    16841709
    1685     void onViewportScrolled(int /*dx*/, int /*dy*/)
     1710    void onViewportScrolled (int /*dx*/, int /*dy*/)
    16861711    {
    16871712        vboxDoCheckUpdateViewport();
     
    16961721
    16971722    /* not supposed to be called by clients */
    1698     int vhwaLoadExec(struct SSMHANDLE * pSSM, uint32_t u32Version);
    1699     void vhwaSaveExec(struct SSMHANDLE * pSSM);
    1700 private:
    1701     int vhwaSurfaceUnlock(struct _VBOXVHWACMD_SURF_UNLOCK *pCmd);
     1723    int vhwaLoadExec (struct SSMHANDLE * pSSM, uint32_t u32Version);
     1724    void vhwaSaveExec (struct SSMHANDLE * pSSM);
     1725private:
     1726    int vhwaSurfaceUnlock (struct _VBOXVHWACMD_SURF_UNLOCK *pCmd);
    17021727
    17031728    void repaintMain();
     
    17121737        {
    17131738            mNeedSetVisible = false;
    1714             mpOverlayWidget->setVisible(true);
     1739            mpOverlayWidget->setVisible (true);
    17151740        }
    17161741    }
     
    17351760        {
    17361761            makeCurrent();
    1737             mpOverlayWidget->performDisplayAndSwap(false);
    1738         }
    1739     }
    1740 
    1741     void vboxSetGlOn(bool on);
     1762            mpOverlayWidget->performDisplayAndSwap (false);
     1763        }
     1764    }
     1765
     1766    void vboxSetGlOn (bool on);
    17421767    bool vboxGetGlOn() { return mGlOn; }
    17431768    bool vboxSynchGl();
    17441769    void vboxDoVHWACmdExec(void *cmd);
    1745     void vboxShowOverlay(bool show);
     1770    void vboxShowOverlay (bool show);
    17461771    void vboxDoCheckUpdateViewport();
    1747     void vboxDoVHWACmd(void *cmd);
    1748     void addMainDirtyRect(const QRect & aRect);
    1749     void vboxCheckUpdateOverlay(const QRect & rect);
    1750     VBoxVHWACommandElement * processCmdList(VBoxVHWACommandElement * pCmd);
    1751 
    1752     int vhwaConstruct(struct _VBOXVHWACMD_HH_CONSTRUCT *pCmd);
     1772    void vboxDoVHWACmd (void *cmd);
     1773    void addMainDirtyRect (const QRect & aRect);
     1774    void vboxCheckUpdateOverlay (const QRect & rect);
     1775    VBoxVHWACommandElement * processCmdList (VBoxVHWACommandElement * pCmd);
     1776
     1777    int vhwaConstruct (struct _VBOXVHWACMD_HH_CONSTRUCT *pCmd);
    17531778
    17541779    int reset();
     
    17761801     * till the framebuffer size is restored */
    17771802    VHWACommandList mOnResizeCmdList;
     1803
     1804    VBoxVHWASettings mSettings;
    17781805};
    17791806
     
    17831810{
    17841811public:
    1785     VBoxOverlayFrameBuffer (class VBoxConsoleView *aView)
    1786         : T(aView),
    1787           mOverlay(aView, this)
     1812    VBoxOverlayFrameBuffer (class VBoxConsoleView *aView, CSession * aSession)
     1813        : T (aView),
     1814          mOverlay (aView, this, aSession)
    17881815    {}
    17891816
     
    17911818    STDMETHOD(ProcessVHWACommand)(BYTE *pCommand)
    17921819    {
    1793         return mOverlay.onVHWACommand((struct _VBOXVHWACMD*)pCommand);
    1794     }
    1795 
    1796     void doProcessVHWACommand(QEvent * pEvent)
    1797     {
    1798         mOverlay.onVHWACommandEvent(pEvent);
     1820        return mOverlay.onVHWACommand ((struct _VBOXVHWACMD*)pCommand);
     1821    }
     1822
     1823    void doProcessVHWACommand (QEvent * pEvent)
     1824    {
     1825        mOverlay.onVHWACommandEvent (pEvent);
    17991826    }
    18001827
     
    18041831                              BOOL *aFinished)
    18051832   {
    1806         if(mOverlay.onRequestResize (aScreenId, aPixelFormat,
     1833        if (mOverlay.onRequestResize (aScreenId, aPixelFormat,
    18071834                aVRAM, aBitsPerPixel, aBytesPerLine,
    18081835                aWidth, aHeight,
     
    18201847                             ULONG aW, ULONG aH)
    18211848    {
    1822         if(mOverlay.onNotifyUpdate (aX, aY, aW, aH))
     1849        if (mOverlay.onNotifyUpdate (aX, aY, aW, aH))
    18231850            return S_OK;
    18241851        return T::NotifyUpdate (aX, aY, aW, aH);
     
    18341861    void viewportResized (QResizeEvent * re)
    18351862    {
    1836         mOverlay.onViewportResized(re);
    1837         T::viewportResized(re);
     1863        mOverlay.onViewportResized (re);
     1864        T::viewportResized (re);
    18381865    }
    18391866
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxGLSupportInfo.cpp

    r25526 r25583  
    278278        VBOXQGLLOGREL (("gl version string: 0%s\n", str));
    279279
    280         mGLVersion = parseVersion(str);
     280        mGLVersion = parseVersion (str);
    281281        Assert(mGLVersion > 0);
    282282        if(mGLVersion < 0)
     
    288288            VBOXQGLLOGREL (("gl version: 0x%x\n", mGLVersion));
    289289            VBOXQGL_CHECKERR(
    290                     str = glGetString(GL_EXTENSIONS);
     290                    str = glGetString (GL_EXTENSIONS);
    291291                    );
     292
     293            VBOXQGLLOGREL (("gl extensions: %s\n", str));
    292294
    293295            const char * pos = strstr((const char *)str, "GL_ARB_multitexture");
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxDefs.cpp

    r25318 r25583  
    6363const char* VBoxDefs::GUI_Export_Bucket = "GUI/Export/Bucket";
    6464const char* VBoxDefs::GUI_PreventBetaWarning = "GUI/PreventBetaWarning";
     65#ifdef VBOX_WITH_VIDEOHWACCEL
     66const char* VBoxDefs::GUI_Accelerate2D_StretchLinear = "GUI/Accelerate2D/StretchLinear";
     67const char* VBoxDefs::GUI_Accelerate2D_PixformatYV12 = "GUI/Accelerate2D/PixformatYV12";
     68const char* VBoxDefs::GUI_Accelerate2D_PixformatUYVY = "GUI/Accelerate2D/PixformatUYVY";
     69const char* VBoxDefs::GUI_Accelerate2D_PixformatYUY2 = "GUI/Accelerate2D/PixformatYUY2";
     70const char* VBoxDefs::GUI_Accelerate2D_PixformatAYUV = "GUI/Accelerate2D/PixformatAYUV";
     71#endif
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxDefs.h

    r25318 r25583  
    181181    static const char* GUI_Export_Bucket;
    182182    static const char* GUI_PreventBetaWarning;
     183
     184#ifdef VBOX_WITH_VIDEOHWACCEL
     185    static const char* GUI_Accelerate2D_StretchLinear;
     186    static const char* GUI_Accelerate2D_PixformatYV12;
     187    static const char* GUI_Accelerate2D_PixformatUYVY;
     188    static const char* GUI_Accelerate2D_PixformatYUY2;
     189    static const char* GUI_Accelerate2D_PixformatAYUV;
     190#endif
    183191};
    184192
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