VirtualBox

Changeset 73297 in vbox for trunk


Ignore:
Timestamp:
Jul 21, 2018 8:20:44 PM (7 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
123904
Message:

DevVGA-SVGA3d: moved vmsvga3dSurfaceBlitToScreen to DevVGA-SVGA3d, because it has no backend-specific code; a couple of formats for OpenGL backend.

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

Legend:

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

    r73296 r73297  
    18371837        break;
    18381838
     1839    case SVGA3D_R8G8B8A8_SNORM:
     1840        pSurface->internalFormatGL = GL_RGB8;
     1841        pSurface->formatGL = GL_BGRA;
     1842        pSurface->typeGL = GL_UNSIGNED_INT_8_8_8_8_REV;
     1843        AssertMsgFailed(("test me - SVGA3D_R8G8B8A8_SNORM\n"));
     1844        break;
     1845    case SVGA3D_R16G16_UNORM:
     1846        pSurface->internalFormatGL = GL_RG16;
     1847        pSurface->formatGL = GL_RG;
     1848        pSurface->typeGL = GL_UNSIGNED_SHORT;
     1849        AssertMsgFailed(("test me - SVGA3D_R16G16_UNORM\n"));
     1850        break;
     1851
    18391852#if 0
    18401853    /* Packed Video formats */
     
    26672680
    26682681    return rc;
    2669 }
    2670 
    2671 
    2672 int vmsvga3dSurfaceBlitToScreen(PVGASTATE pThis, uint32_t dest, SVGASignedRect destRect, SVGA3dSurfaceImageId src, SVGASignedRect srcRect, uint32_t cRects, SVGASignedRect *pRect)
    2673 {
    2674     /* Requires SVGA_FIFO_CAP_SCREEN_OBJECT support */
    2675     Log(("vmsvga3dSurfaceBlitToScreen: dest=%d (%d,%d)(%d,%d) surface=%x (face=%d, mipmap=%d) (%d,%d)(%d,%d) cRects=%d\n", dest, destRect.left, destRect.top, destRect.right, destRect.bottom, src.sid, src.face, src.mipmap, srcRect.left, srcRect.top, srcRect.right, srcRect.bottom, cRects));
    2676     for (uint32_t i = 0; i < cRects; i++)
    2677     {
    2678         Log(("vmsvga3dSurfaceBlitToScreen: clipping rect %d (%d,%d)(%d,%d)\n", i, pRect[i].left, pRect[i].top, pRect[i].right, pRect[i].bottom));
    2679     }
    2680 
    2681     /** @todo Only screen 0 for now. */
    2682     AssertReturn(dest == 0, VERR_INTERNAL_ERROR);
    2683     AssertReturn(src.mipmap == 0 && src.face == 0, VERR_INVALID_PARAMETER);
    2684     /** @todo scaling */
    2685     AssertReturn(destRect.right - destRect.left == srcRect.right - srcRect.left && destRect.bottom - destRect.top == srcRect.bottom - srcRect.top, VERR_INVALID_PARAMETER);
    2686 
    2687     if (cRects == 0)
    2688     {
    2689         /* easy case; no clipping */
    2690         SVGA3dCopyBox        box;
    2691         SVGA3dGuestImage     dst;
    2692 
    2693         box.x       = destRect.left;
    2694         box.y       = destRect.top;
    2695         box.z       = 0;
    2696         box.w       = destRect.right - destRect.left;
    2697         box.h       = destRect.bottom - destRect.top;
    2698         box.d       = 1;
    2699         box.srcx    = srcRect.left;
    2700         box.srcy    = srcRect.top;
    2701         box.srcz    = 0;
    2702 
    2703         dst.ptr.gmrId  = SVGA_GMR_FRAMEBUFFER;
    2704         dst.ptr.offset = pThis->svga.uScreenOffset;
    2705         dst.pitch      = pThis->svga.cbScanline;
    2706 
    2707         int rc = vmsvga3dSurfaceDMA(pThis, dst, src, SVGA3D_READ_HOST_VRAM, 1, &box);
    2708         AssertRCReturn(rc, rc);
    2709 
    2710         vgaR3UpdateDisplay(pThis, box.x, box.y, box.w, box.h);
    2711         return VINF_SUCCESS;
    2712     }
    2713     else
    2714     {
    2715         SVGA3dGuestImage dst;
    2716         SVGA3dCopyBox    box;
    2717 
    2718         box.srcz    = 0;
    2719         box.z       = 0;
    2720         box.d       = 1;
    2721 
    2722         dst.ptr.gmrId  = SVGA_GMR_FRAMEBUFFER;
    2723         dst.ptr.offset = pThis->svga.uScreenOffset;
    2724         dst.pitch      = pThis->svga.cbScanline;
    2725 
    2726         /** @todo merge into one SurfaceDMA call */
    2727         for (uint32_t i = 0; i < cRects; i++)
    2728         {
    2729             /* The clipping rectangle is relative to the top-left corner of srcRect & destRect. Adjust here. */
    2730             box.srcx = srcRect.left + pRect[i].left;
    2731             box.srcy = srcRect.top  + pRect[i].top;
    2732 
    2733             box.x    = pRect[i].left + destRect.left;
    2734             box.y    = pRect[i].top  + destRect.top;
    2735             box.z    = 0;
    2736             box.w    = pRect[i].right - pRect[i].left;
    2737             box.h    = pRect[i].bottom - pRect[i].top;
    2738 
    2739             int rc = vmsvga3dSurfaceDMA(pThis, dst, src, SVGA3D_READ_HOST_VRAM, 1, &box);
    2740             AssertRCReturn(rc, rc);
    2741 
    2742             vgaR3UpdateDisplay(pThis, box.x, box.y, box.w, box.h);
    2743         }
    2744 
    2745         return VINF_SUCCESS;
    2746     }
    27472682}
    27482683
  • trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-win.cpp

    r73195 r73297  
    24072407}
    24082408
    2409 
    2410 int vmsvga3dSurfaceBlitToScreen(PVGASTATE pThis, uint32_t idDstScreen, SVGASignedRect destRect, SVGA3dSurfaceImageId src, SVGASignedRect srcRect, uint32_t cRects, SVGASignedRect *pRect)
    2411 {
    2412     /* Requires SVGA_FIFO_CAP_SCREEN_OBJECT support */
    2413     LogFunc(("dest=%d (%d,%d)(%d,%d) sid=%x (face=%d, mipmap=%d) (%d,%d)(%d,%d) cRects=%d\n",
    2414              idDstScreen, destRect.left, destRect.top, destRect.right, destRect.bottom, src.sid, src.face, src.mipmap,
    2415              srcRect.left, srcRect.top, srcRect.right, srcRect.bottom, cRects));
    2416     for (uint32_t i = 0; i < cRects; i++)
    2417     {
    2418         LogFunc(("clipping rect %d (%d,%d)(%d,%d)\n", i, pRect[i].left, pRect[i].top, pRect[i].right, pRect[i].bottom));
    2419     }
    2420 
    2421     /** @todo Only screen 0 for now. */
    2422     AssertReturn(idDstScreen == 0, VERR_INTERNAL_ERROR);
    2423     AssertReturn(src.mipmap == 0 && src.face == 0, VERR_INVALID_PARAMETER);
    2424     /** @todo scaling */
    2425     AssertReturn(destRect.right - destRect.left == srcRect.right - srcRect.left && destRect.bottom - destRect.top == srcRect.bottom - srcRect.top, VERR_INVALID_PARAMETER);
    2426 
    2427     SVGA3dCopyBox    box;
    2428     SVGA3dGuestImage dest;
    2429 
    2430     box.srcz = 0;
    2431     box.z    = 0;
    2432     box.d    = 1;
    2433 
    2434     /** @todo SVGA_GMR_FRAMEBUFFER is not the screen object
    2435      * and might not point to the start of VRAM as assumed here.
    2436      */
    2437     dest.ptr.gmrId  = SVGA_GMR_FRAMEBUFFER;
    2438     dest.ptr.offset = pThis->svga.uScreenOffset;
    2439     dest.pitch      = pThis->svga.cbScanline;
    2440 
    2441     if (cRects == 0)
    2442     {
    2443         /* easy case; no clipping */
    2444 
    2445         /* SVGA_3D_CMD_SURFACE_DMA:
    2446          * 'define the "source" in each copyBox as the guest image and the
    2447          * "destination" as the host image, regardless of transfer direction.'
    2448          *
    2449          * Since the BlitToScreen operation transfers from a host surface to the guest VRAM,
    2450          * it must set the copyBox "source" to the guest destination coords and
    2451          * the copyBox "destination" to the host surface source coords.
    2452          */
    2453         /* Host image. */
    2454         box.x       = srcRect.left;
    2455         box.y       = srcRect.top;
    2456         box.w       = srcRect.right - srcRect.left;
    2457         box.h       = srcRect.bottom - srcRect.top;
    2458         /* Guest image. */
    2459         box.srcx    = destRect.left;
    2460         box.srcy    = destRect.top;
    2461 
    2462         int rc = vmsvga3dSurfaceDMA(pThis, dest, src, SVGA3D_READ_HOST_VRAM, 1, &box);
    2463         AssertRCReturn(rc, rc);
    2464 
    2465         /* Update the guest image, which is at box.src. */
    2466         vgaR3UpdateDisplay(pThis, box.srcx, box.srcy, box.w, box.h);
    2467     }
    2468     else
    2469     {
    2470         /** @todo merge into one SurfaceDMA call */
    2471         for (uint32_t i = 0; i < cRects; i++)
    2472         {
    2473             /* The clipping rectangle is relative to the top-left corner of srcRect & destRect. Adjust here. */
    2474             /* Host image. See 'SVGA_3D_CMD_SURFACE_DMA:' commant in the 'if' branch. */
    2475             box.x    = srcRect.left + pRect[i].left;
    2476             box.y    = srcRect.top  + pRect[i].top;
    2477             box.z    = 0;
    2478             box.w    = pRect[i].right - pRect[i].left;
    2479             box.h    = pRect[i].bottom - pRect[i].top;
    2480             /* Guest image. */
    2481             box.srcx = destRect.left + pRect[i].left;
    2482             box.srcy = destRect.top  + pRect[i].top;
    2483 
    2484             int rc = vmsvga3dSurfaceDMA(pThis, dest, src, SVGA3D_READ_HOST_VRAM, 1, &box);
    2485             AssertRCReturn(rc, rc);
    2486 
    2487             /* Update the guest image, which is at box.src. */
    2488             vgaR3UpdateDisplay(pThis, box.srcx, box.srcy, box.w, box.h);
    2489         }
    2490     }
    2491 
    2492     return VINF_SUCCESS;
    2493 }
    2494 
    24952409int vmsvga3dGenerateMipmaps(PVGASTATE pThis, uint32_t sid, SVGA3dTextureFilter filter)
    24962410{
  • trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d.cpp

    r73194 r73297  
    801801    AssertFailedReturn(rc);
    802802}
     803
     804int vmsvga3dSurfaceBlitToScreen(PVGASTATE pThis, uint32_t idDstScreen, SVGASignedRect destRect, SVGA3dSurfaceImageId src, SVGASignedRect srcRect, uint32_t cRects, SVGASignedRect *pRect)
     805{
     806    /* Requires SVGA_FIFO_CAP_SCREEN_OBJECT support */
     807    LogFunc(("dest=%d (%d,%d)(%d,%d) sid=%x (face=%d, mipmap=%d) (%d,%d)(%d,%d) cRects=%d\n",
     808             idDstScreen, destRect.left, destRect.top, destRect.right, destRect.bottom, src.sid, src.face, src.mipmap,
     809             srcRect.left, srcRect.top, srcRect.right, srcRect.bottom, cRects));
     810    for (uint32_t i = 0; i < cRects; i++)
     811    {
     812        LogFunc(("clipping rect %d (%d,%d)(%d,%d)\n", i, pRect[i].left, pRect[i].top, pRect[i].right, pRect[i].bottom));
     813    }
     814
     815    /** @todo Only screen 0 for now. */
     816    AssertReturn(idDstScreen == 0, VERR_INTERNAL_ERROR);
     817    AssertReturn(src.mipmap == 0 && src.face == 0, VERR_INVALID_PARAMETER);
     818    /** @todo scaling */
     819    AssertReturn(destRect.right - destRect.left == srcRect.right - srcRect.left && destRect.bottom - destRect.top == srcRect.bottom - srcRect.top, VERR_INVALID_PARAMETER);
     820
     821    SVGA3dCopyBox    box;
     822    SVGA3dGuestImage dest;
     823
     824    box.srcz = 0;
     825    box.z    = 0;
     826    box.d    = 1;
     827
     828    /** @todo SVGA_GMR_FRAMEBUFFER is not the screen object
     829     * and might not point to the start of VRAM as assumed here.
     830     */
     831    dest.ptr.gmrId  = SVGA_GMR_FRAMEBUFFER;
     832    dest.ptr.offset = pThis->svga.uScreenOffset;
     833    dest.pitch      = pThis->svga.cbScanline;
     834
     835    if (cRects == 0)
     836    {
     837        /* easy case; no clipping */
     838
     839        /* SVGA_3D_CMD_SURFACE_DMA:
     840         * 'define the "source" in each copyBox as the guest image and the
     841         * "destination" as the host image, regardless of transfer direction.'
     842         *
     843         * Since the BlitToScreen operation transfers from a host surface to the guest VRAM,
     844         * it must set the copyBox "source" to the guest destination coords and
     845         * the copyBox "destination" to the host surface source coords.
     846         */
     847        /* Host image. */
     848        box.x       = srcRect.left;
     849        box.y       = srcRect.top;
     850        box.w       = srcRect.right - srcRect.left;
     851        box.h       = srcRect.bottom - srcRect.top;
     852        /* Guest image. */
     853        box.srcx    = destRect.left;
     854        box.srcy    = destRect.top;
     855
     856        int rc = vmsvga3dSurfaceDMA(pThis, dest, src, SVGA3D_READ_HOST_VRAM, 1, &box);
     857        AssertRCReturn(rc, rc);
     858
     859        /* Update the guest image, which is at box.src. */
     860        vgaR3UpdateDisplay(pThis, box.srcx, box.srcy, box.w, box.h);
     861    }
     862    else
     863    {
     864        /** @todo merge into one SurfaceDMA call */
     865        for (uint32_t i = 0; i < cRects; i++)
     866        {
     867            /* The clipping rectangle is relative to the top-left corner of srcRect & destRect. Adjust here. */
     868            /* Host image. See 'SVGA_3D_CMD_SURFACE_DMA:' commant in the 'if' branch. */
     869            box.x    = srcRect.left + pRect[i].left;
     870            box.y    = srcRect.top  + pRect[i].top;
     871            box.z    = 0;
     872            box.w    = pRect[i].right - pRect[i].left;
     873            box.h    = pRect[i].bottom - pRect[i].top;
     874            /* Guest image. */
     875            box.srcx = destRect.left + pRect[i].left;
     876            box.srcy = destRect.top  + pRect[i].top;
     877
     878            int rc = vmsvga3dSurfaceDMA(pThis, dest, src, SVGA3D_READ_HOST_VRAM, 1, &box);
     879            AssertRCReturn(rc, rc);
     880
     881            /* Update the guest image, which is at box.src. */
     882            vgaR3UpdateDisplay(pThis, box.srcx, box.srcy, box.w, box.h);
     883        }
     884    }
     885
     886    return VINF_SUCCESS;
     887}
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