VirtualBox

Changeset 81755 in vbox


Ignore:
Timestamp:
Nov 10, 2019 7:19:50 PM (5 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
134543
Message:

Reverted r134542, wrong files

Location:
trunk/src/VBox/Devices/Graphics
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Graphics/DevVGA-SVGA.cpp

    r81754 r81755  
    99 *  - Log3 for hex dump of shader code.
    1010 *  - Log4 for hex dumps of 3D data.
    11  *  - Log5 for info about GMR pages.
    1211 */
    1312
     
    39343933                    break;
    39353934
    3936                 /** @todo Move to a separate function vmsvgaGMRRemap() */
    3937 
    39383935                /* Calc new total page count so we can use it instead of cMaxPages for allocations below. */
    39393936                uint32_t const cNewTotalPages = RT_MAX(pGMR->cbTotal >> X86_PAGE_SHIFT, pCmd->offsetPages + pCmd->numPages);
     
    40244021                            Assert(paDescs[iDescriptor].numPages);
    40254022                            paDescs[iDescriptor].numPages++;
    4026                             Log5Func(("Page %x GCPhys=%RGp successor\n", i, GCPhys));
     4023                            LogFlow(("Page %x GCPhys=%RGp successor\n", i, GCPhys));
    40274024                        }
    40284025                        else
     
    40314028                            paDescs[iDescriptor].GCPhys   = GCPhys;
    40324029                            paDescs[iDescriptor].numPages = 1;
    4033                             Log5Func(("Page %x GCPhys=%RGp\n", i, paDescs[iDescriptor].GCPhys));
     4030                            LogFlow(("Page %x GCPhys=%RGp\n", i, paDescs[iDescriptor].GCPhys));
    40344031                        }
    40354032                    }
    40364033
    40374034                    pGMR->cbTotal = cNewTotalPages << X86_PAGE_SHIFT;
    4038                     Log5Func(("Nr of descriptors %x; cbTotal=%#x\n", iDescriptor + 1, cNewTotalPages));
     4035                    LogFlow(("Nr of descriptors %x; cbTotal=%#x\n", iDescriptor + 1, cNewTotalPages));
    40394036                    pGMR->numDescriptors = iDescriptor + 1;
    40404037                }
     
    50445041            RTGCPHYS const GCPhys = paDesc[iDesc].GCPhys + offGmrCurrent - offDesc;
    50455042
    5046             Log5Func(("%s phys=%RGp\n", (enmTransferType == SVGA3D_WRITE_HOST_VRAM) ? "READ" : "WRITE", GCPhys));
     5043            LogFlowFunc(("%s phys=%RGp\n", (enmTransferType == SVGA3D_WRITE_HOST_VRAM) ? "READ" : "WRITE", GCPhys));
    50475044
    50485045            if (enmTransferType == SVGA3D_WRITE_HOST_VRAM)
  • trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-internal.h

    r81754 r81755  
    357357 *          release builds.
    358358 */
    359 /** @todo Rename to VMSVGA3D_CHECK_LAST_ERROR_RETURN */
    360359# ifdef VBOX_STRICT
    361360#  define VMSVGA3D_CHECK_LAST_ERROR(pState, pContext) do {                   \
     
    562561    GLenum                  targetGL;  /* GL_TEXTURE_* */
    563562    GLenum                  bindingGL; /* GL_TEXTURE_BINDING_* */
    564     /* Emulated formats */
    565     bool                    fEmulated; /* Whether the texture format is emulated. */
    566     GLuint                  idEmulated; /* GL name of the intermediate texture. */
    567563#endif
    568564    SVGA3dSurfaceFace       faces[SVGA3D_MAX_SURFACE_FACES];
     
    944940
    945941
    946 #ifdef VMSVGA3D_OPENGL
    947 typedef struct VMSVGA3DFORMATCONVERTOR *PVMSVGA3DFORMATCONVERTOR;
    948 #endif
    949 
    950942/**
    951943 * VMSVGA3d state data.
     
    10601052        PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC                glCompressedTexSubImage2D;
    10611053        PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC                glCompressedTexSubImage3D;
    1062         PFNGLDRAWBUFFERSPROC                            glDrawBuffers;
    1063         PFNGLCREATESHADERPROC                           glCreateShader;
    1064         PFNGLSHADERSOURCEPROC                           glShaderSource;
    1065         PFNGLCOMPILESHADERPROC                          glCompileShader;
    1066         PFNGLGETSHADERIVPROC                            glGetShaderiv;
    1067         PFNGLGETSHADERINFOLOGPROC                       glGetShaderInfoLog;
    1068         PFNGLCREATEPROGRAMPROC                          glCreateProgram;
    1069         PFNGLATTACHSHADERPROC                           glAttachShader;
    1070         PFNGLLINKPROGRAMPROC                            glLinkProgram;
    1071         PFNGLGETPROGRAMIVPROC                           glGetProgramiv;
    1072         PFNGLGETPROGRAMINFOLOGPROC                      glGetProgramInfoLog;
    1073         PFNGLUSEPROGRAMPROC                             glUseProgram;
    1074         PFNGLGETUNIFORMLOCATIONPROC                     glGetUniformLocation;
    1075         PFNGLUNIFORM1IPROC                              glUniform1i;
    1076         PFNGLUNIFORM4FVPROC                             glUniform4fv;
    1077         PFNGLDETACHSHADERPROC                           glDetachShader;
    1078         PFNGLDELETESHADERPROC                           glDeleteShader;
    1079         PFNGLDELETEPROGRAMPROC                          glDeleteProgram;
    10801054    } ext;
    10811055
     
    11181092    /** The shared context. */
    11191093    VMSVGA3DCONTEXT         SharedCtx;
    1120 
    1121     /** Conversion of emulated formats. Resources are created on the SharedCtx. */
    1122     PVMSVGA3DFORMATCONVERTOR pConv;
    11231094# endif
    11241095#endif /* VMSVGA3D_OPENGL */
     
    13341305#endif
    13351306
    1336 #ifdef VMSVGA3D_OPENGL
    1337 void vmsvga3dOnSharedContextDefine(PVMSVGA3DSTATE pState);
    1338 void vmsvga3dOnSharedContextDestroy(PVMSVGA3DSTATE pState);
    1339 
    1340 DECLINLINE(GLuint) GLTextureId(PVMSVGA3DSURFACE pSurface)
    1341 {
    1342     return pSurface->fEmulated ? pSurface->idEmulated : pSurface->oglId.texture;
    1343 }
    1344 
    1345 void FormatConvUpdateTexture(PVMSVGA3DSTATE pState,
    1346                              PVMSVGA3DCONTEXT pCurrentContext,
    1347                              PVMSVGA3DSURFACE pSurface,
    1348                              uint32_t iMipmap);
    1349 void FormatConvReadTexture(PVMSVGA3DSTATE pState,
    1350                            PVMSVGA3DCONTEXT pCurrentContext,
    1351                            PVMSVGA3DSURFACE pSurface,
    1352                            uint32_t iMipmap);
    1353 #endif
    1354 
    13551307#endif /* !VBOX_INCLUDED_SRC_Graphics_DevVGA_SVGA3d_internal_h */
    13561308
  • trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-ogl.cpp

    r81754 r81755  
    714714    GLGETPROC_(PFNGLCLIENTACTIVETEXTUREPROC              , glClientActiveTexture, "");
    715715#endif
    716     GLGETPROC_(PFNGLDRAWBUFFERSPROC                      , glDrawBuffers, "");
    717     GLGETPROC_(PFNGLCREATESHADERPROC                     , glCreateShader, "");
    718     GLGETPROC_(PFNGLSHADERSOURCEPROC                     , glShaderSource, "");
    719     GLGETPROC_(PFNGLCOMPILESHADERPROC                    , glCompileShader, "");
    720     GLGETPROC_(PFNGLGETSHADERIVPROC                      , glGetShaderiv, "");
    721     GLGETPROC_(PFNGLGETSHADERINFOLOGPROC                 , glGetShaderInfoLog, "");
    722     GLGETPROC_(PFNGLCREATEPROGRAMPROC                    , glCreateProgram, "");
    723     GLGETPROC_(PFNGLATTACHSHADERPROC                     , glAttachShader, "");
    724     GLGETPROC_(PFNGLLINKPROGRAMPROC                      , glLinkProgram, "");
    725     GLGETPROC_(PFNGLGETPROGRAMIVPROC                     , glGetProgramiv, "");
    726     GLGETPROC_(PFNGLGETPROGRAMINFOLOGPROC                , glGetProgramInfoLog, "");
    727     GLGETPROC_(PFNGLUSEPROGRAMPROC                       , glUseProgram, "");
    728     GLGETPROC_(PFNGLGETUNIFORMLOCATIONPROC               , glGetUniformLocation, "");
    729     GLGETPROC_(PFNGLUNIFORM1IPROC                        , glUniform1i, "");
    730     GLGETPROC_(PFNGLUNIFORM4FVPROC                       , glUniform4fv, "");
    731     GLGETPROC_(PFNGLDETACHSHADERPROC                     , glDetachShader, "");
    732     GLGETPROC_(PFNGLDELETESHADERPROC                     , glDeleteShader, "");
    733     GLGETPROC_(PFNGLDELETEPROGRAMPROC                    , glDeleteProgram, "");
    734716
    735717    /* OpenGL 3.0 core, GL_ARB_instanced_arrays. Same functions names in the ARB and core specs. */
     
    13291311    case SVGA3D_DEVCAP_SURFACEFMT_UYVY:
    13301312    case SVGA3D_DEVCAP_SURFACEFMT_YUY2:
    1331         result |= SVGA3DFORMAT_OP_OFFSCREENPLAIN
    1332                |  SVGA3DFORMAT_OP_CONVERT_TO_ARGB
    1333                |  SVGA3DFORMAT_OP_TEXTURE;
    1334         break;
    1335 
    13361313    case SVGA3D_DEVCAP_SURFACEFMT_NV12:
    13371314    case SVGA3D_DEVCAP_SURFACEFMT_AYUV:
     
    19221899        break;
    19231900
     1901#if 0
    19241902    /* Packed Video formats */
    19251903    case SVGA3D_UYVY:
     1904        return D3DFMT_UYVY;
    19261905    case SVGA3D_YUY2:
    1927         /* Use a BRGA texture to hold the data and convert it to an actual BGRA. */
    1928         pSurface->fEmulated = true;
    1929         pSurface->internalFormatGL = GL_RGBA8;
    1930         pSurface->formatGL = GL_BGRA;
    1931         pSurface->typeGL = GL_UNSIGNED_INT_8_8_8_8_REV;
    1932         break;
    1933 
    1934 #if 0
     1906        return D3DFMT_YUY2;
     1907
    19351908    /* Planar video formats */
    19361909    case SVGA3D_NV12:
     
    19941967            glDeleteTextures(1, &pSurface->oglId.texture);
    19951968            VMSVGA3D_CHECK_LAST_ERROR_WARN(pState, pContext);
    1996             if (pSurface->fEmulated)
    1997             {
    1998                 if (pSurface->idEmulated)
    1999                 {
    2000                     glDeleteTextures(1, &pSurface->idEmulated);
    2001                     VMSVGA3D_CHECK_LAST_ERROR_WARN(pState, pContext);
    2002                 }
    2003             }
    2004             else
    2005             {
    2006                 Assert(!pSurface->idEmulated);
    2007             }
    20081969            break;
    20091970
     
    22142175    glGenTextures(1, &pSurface->oglId.texture);
    22152176    VMSVGA3D_CHECK_LAST_ERROR(pState, pContext);
    2216     if (pSurface->fEmulated)
    2217     {
    2218         glGenTextures(1, &pSurface->idEmulated);
    2219         VMSVGA3D_CHECK_LAST_ERROR_WARN(pState, pContext);
    2220     }
    22212177    pSurface->enmOGLResType = VMSVGA3D_OGLRESTYPE_TEXTURE;
    22222178
     
    23652321            else
    23662322            {
    2367                 /* Initialize the texture. */
    23682323                glTexImage2D(GL_TEXTURE_2D,
    23692324                             i,
     
    23742329                             pSurface->formatGL,
    23752330                             pSurface->typeGL,
    2376                              NULL);
    2377                 VMSVGA3D_CHECK_LAST_ERROR_WARN(pState, pContext);
    2378 
    2379                 /* Fetch texture data. The pSurfaceData buffer may be smaller than the entire texture
    2380                  * for emulated formats, in which case only part of the texture is synched.
    2381                  */
    2382                 uint32_t cBlocksX = pMipLevel->mipmapSize.width / pSurface->cxBlock;
    2383                 uint32_t cBlocksY = pMipLevel->mipmapSize.height / pSurface->cyBlock;
    2384                 glTexSubImage2D(GL_TEXTURE_2D,
    2385                                 i,
    2386                                 0,
    2387                                 0,
    2388                                 cBlocksX,
    2389                                 cBlocksY,
    2390                                 pSurface->formatGL,
    2391                                 pSurface->typeGL,
    2392                                 pMipLevel->pSurfaceData);
    2393                 VMSVGA3D_CHECK_LAST_ERROR_WARN(pState, pContext);
    2394 
    2395                 if (pSurface->fEmulated)
    2396                 {
    2397                     /** @todo Update texture yusing the format converter. */
    2398                     glBindTexture(GL_TEXTURE_2D, pSurface->idEmulated);
    2399                     VMSVGA3D_CHECK_LAST_ERROR_WARN(pState, pContext);
    2400 
    2401                     glTexImage2D(GL_TEXTURE_2D,
    2402                                  i,
    2403                                  pSurface->internalFormatGL,
    2404                                  pMipLevel->mipmapSize.width,
    2405                                  pMipLevel->mipmapSize.height,
    2406                                  0,
    2407                                  pSurface->formatGL,
    2408                                  pSurface->typeGL,
    2409                                  NULL);
    2410                     VMSVGA3D_CHECK_LAST_ERROR_WARN(pState, pContext);
    2411 
    2412                     glBindTexture(GL_TEXTURE_2D, pSurface->oglId.texture);
    2413                     VMSVGA3D_CHECK_LAST_ERROR_WARN(pState, pContext);
    2414                 }
     2331                             pMipLevel->pSurfaceData);
    24152332            }
    2416             VMSVGA3D_CHECK_LAST_ERROR_WARN(pState, pContext);
     2333            VMSVGA3D_CHECK_LAST_ERROR(pState, pContext);
    24172334
    24182335            pMipLevel->fDirty = false;
     
    25472464     */
    25482465    pSave->iAlignment = 1;
    2549     VMSVGA3D_ASSERT_GL_CALL(glGetIntegerv(GL_PACK_ALIGNMENT, &pSave->iAlignment), pState, pContext);
     2466    VMSVGA3D_ASSERT_GL_CALL(glGetIntegerv(GL_UNPACK_ALIGNMENT, &pSave->iAlignment), pState, pContext);
    25502467    pSave->cxRow = 0;
    2551     VMSVGA3D_ASSERT_GL_CALL(glGetIntegerv(GL_PACK_ROW_LENGTH, &pSave->cxRow), pState, pContext);
     2468    VMSVGA3D_ASSERT_GL_CALL(glGetIntegerv(GL_UNPACK_ROW_LENGTH, &pSave->cxRow), pState, pContext);
    25522469
    25532470#ifdef VMSVGA3D_PARANOID_TEXTURE_PACKING
     
    26652582    RT_NOREF(iBox);
    26662583
    2667     switch (pSurface->enmOGLResType)
    2668     {
    2669     case VMSVGA3D_OGLRESTYPE_TEXTURE:
     2584    switch (pSurface->surfaceFlags & VMSVGA3D_SURFACE_HINT_SWITCH_MASK)
     2585    {
     2586    case SVGA3D_SURFACE_HINT_TEXTURE | SVGA3D_SURFACE_HINT_DEPTHSTENCIL:
     2587    case SVGA3D_SURFACE_HINT_DEPTHSTENCIL:
     2588    case SVGA3D_SURFACE_CUBEMAP | SVGA3D_SURFACE_HINT_TEXTURE:
     2589    case SVGA3D_SURFACE_CUBEMAP | SVGA3D_SURFACE_HINT_TEXTURE | SVGA3D_SURFACE_HINT_RENDERTARGET:
     2590    case SVGA3D_SURFACE_HINT_TEXTURE | SVGA3D_SURFACE_HINT_RENDERTARGET:
     2591    case SVGA3D_SURFACE_HINT_TEXTURE:
     2592    case SVGA3D_SURFACE_HINT_RENDERTARGET:
    26702593    {
    26712594        uint32_t cbSurfacePitch;
     
    27022625        }
    27032626
    2704         /* The buffer must be large enough to hold entire texture in the OpenGL format.
    2705          * Multiply by the width and height "reduction" factors.
    2706          * This can allocate more memory than required, but it is simpler for now.
    2707          * Actually cbBuf = cbGLPixel * pMipmapLevel->mipmapSize.width * pMipmapLevel->mipmapSize.height
    2708          */
    2709         pDoubleBuffer = (uint8_t *)RTMemAlloc(pMipLevel->cbSurface * pSurface->cxBlock * pSurface->cyBlock);
     2627        pDoubleBuffer = (uint8_t *)RTMemAlloc(pMipLevel->cbSurface);
    27102628        AssertReturn(pDoubleBuffer, VERR_NO_MEMORY);
    27112629
     
    27182636            VMSVGA3D_CHECK_LAST_ERROR_WARN(pState, pContext);
    27192637
    2720             glBindTexture(pSurface->targetGL, GLTextureId(pSurface));
     2638            glBindTexture(pSurface->targetGL, pSurface->oglId.texture);
    27212639            VMSVGA3D_CHECK_LAST_ERROR_WARN(pState, pContext);
    2722 
    2723             if (pSurface->fEmulated)
    2724             {
    2725                  FormatConvReadTexture(pState, pContext, pSurface, uHostMipmap);
    2726             }
    27272640
    27282641            /* Set row length and alignment of the input data. */
     
    27762689
    27772690            /* Must bind texture to the current context in order to change it. */
    2778             glBindTexture(pSurface->targetGL, GLTextureId(pSurface));
     2691            glBindTexture(pSurface->targetGL, pSurface->oglId.texture);
    27792692            VMSVGA3D_CHECK_LAST_ERROR_WARN(pState, pContext);
    27802693
     
    28452758                                    pSurface->typeGL,
    28462759                                    pDoubleBuffer);
    2847                     VMSVGA3D_CHECK_LAST_ERROR_WARN(pState, pContext);
    2848 
    2849                     if (pSurface->fEmulated)
    2850                     {
    2851                         /* Convert the texture to the actual texture if necessary */
    2852                         FormatConvUpdateTexture(pState, pContext, pSurface, uHostMipmap);
    2853                     }
    28542760                }
    28552761            }
     
    28712777    }
    28722778
    2873     case VMSVGA3D_OGLRESTYPE_BUFFER:
     2779    case SVGA3D_SURFACE_HINT_VERTEXBUFFER | SVGA3D_SURFACE_HINT_INDEXBUFFER:
     2780    case SVGA3D_SURFACE_HINT_VERTEXBUFFER:
     2781    case SVGA3D_SURFACE_HINT_INDEXBUFFER:
    28742782    {
    28752783        /* Buffers are uncompressed. */
     
    30872995            rc = vmsvga3dContextDefineOgl(pThis, VMSVGA3D_SHARED_CTX_ID, VMSVGA3D_DEF_CTX_F_SHARED_CTX);
    30882996            AssertLogRelRCReturn(rc, rc);
    3089 
    3090             /* Create resources which use the shared context. */
    3091             vmsvga3dOnSharedContextDefine(pState);
    30922997        }
    30932998    }
     
    32913196
    32923197    VMSVGA3D_SET_CURRENT_CONTEXT(pState, pContext);
    3293 
    3294     if (pContext->id == VMSVGA3D_SHARED_CTX_ID)
    3295     {
    3296         /* Delete resources which use the shared context. */
    3297         vmsvga3dOnSharedContextDestroy(pState);
    3298     }
    32993198
    33003199    /* Destroy all leftover pixel shaders. */
     
    63166215        {
    63176216            /* Render without an index buffer */
    6318             Log(("DrawPrimitive %d cPrimitives=%d cVertices=%d index index bias=%d cInstances=%d\n", modeDraw, pRange[iPrimitive].primitiveCount, cVertices, pRange[iPrimitive].indexBias, cInstances));
     6217            Log(("DrawPrimitive %x cPrimitives=%d cVertices=%d index index bias=%d\n", modeDraw, pRange[iPrimitive].primitiveCount, cVertices, pRange[iPrimitive].indexBias));
    63196218            if (cInstances == 0)
    63206219            {
     
    63416240            }
    63426241
    6343             Log(("DrawIndexedPrimitive %d cPrimitives=%d cVertices=%d hint.first=%d hint.last=%d index offset=%d primitivecount=%d index width=%d index bias=%d cInstances=%d\n", modeDraw, pRange[iPrimitive].primitiveCount, cVertices, pVertexDecl[0].rangeHint.first,  pVertexDecl[0].rangeHint.last,  pRange[iPrimitive].indexArray.offset, pRange[iPrimitive].primitiveCount,  pRange[iPrimitive].indexWidth, pRange[iPrimitive].indexBias, cInstances));
     6242            Log(("DrawIndexedPrimitive %x cPrimitives=%d cVertices=%d hint.first=%d hint.last=%d index offset=%d primitivecount=%d index width=%d index bias=%d\n", modeDraw, pRange[iPrimitive].primitiveCount, cVertices, pVertexDecl[0].rangeHint.first,  pVertexDecl[0].rangeHint.last,  pRange[iPrimitive].indexArray.offset, pRange[iPrimitive].primitiveCount,  pRange[iPrimitive].indexWidth, pRange[iPrimitive].indexBias));
    63446243            if (cInstances == 0)
    63456244            {
     
    64516350        int rc2 = vmsvga3dSurfaceFromSid(pState, pContext->state.aRenderTargets[SVGA3D_RT_COLOR0], &pSurface);
    64526351        if (RT_SUCCESS(rc2))
    6453             vmsvga3dInfoSurfaceToBitmap(NULL, pSurface, "bmpgl", "rt", "-post");
     6352            vmsvga3dInfoSurfaceToBitmap(NULL, pSurface, "bmp", "rt", "-post");
    64546353    }
    64556354#endif
  • trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-shared.cpp

    r81754 r81755  
    396396
    397397    case SVGA3D_UYVY:
    398         *pcxBlock = 2;
    399         *pcyBlock = 1;
    400         return 4;
     398        *pcxBlock = 1;
     399        *pcyBlock = 1;
     400        return 2;
    401401
    402402    case SVGA3D_YUY2:
    403         *pcxBlock = 2;
    404         *pcyBlock = 1;
    405         return 4;
     403        *pcxBlock = 1;
     404        *pcyBlock = 1;
     405        return 2;
    406406
    407407    case SVGA3D_V16U16:
  • trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d.cpp

    r81754 r81755  
    248248    /* pSurface->emulated.pTexture = NULL; */
    249249#else
    250     /* pSurface->fEmulated = false; */
    251     pSurface->idEmulated = OPENGL_INVALID_ID;
    252250    vmsvga3dSurfaceFormat2OGL(pSurface, format);
    253251#endif
Note: See TracChangeset for help on using the changeset viewer.

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