VirtualBox

Changeset 24891 in vbox


Ignore:
Timestamp:
Nov 24, 2009 11:36:06 AM (15 years ago)
Author:
vboxsync
Message:

crOpenGL: fix black screen in compiz after snapshot load (public #4868)

Location:
trunk/src/VBox
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_snapshot.c

    r24573 r24891  
    2626#include "cr_mem.h"
    2727#include "cr_string.h"
     28#include "cr_pixeldata.h"
    2829#include <stdio.h>
    2930
     
    10501051#endif
    10511052
     1053    {
     1054        CRViewportState *pVP = &pContext->viewport;
     1055        CRPixelPackState packing = pContext->client.pack;
     1056        GLint cbData = crPixelSize(GL_RGBA, GL_UNSIGNED_BYTE) * pVP->viewportH * pVP->viewportW;
     1057        void *pData = crAlloc(cbData);
     1058
     1059        if (!pData)
     1060        {
     1061            return VERR_NO_MEMORY;
     1062        }
     1063
     1064        diff_api.PixelStorei(GL_PACK_SKIP_ROWS, 0);
     1065        diff_api.PixelStorei(GL_PACK_SKIP_PIXELS, 0);
     1066        diff_api.PixelStorei(GL_PACK_ALIGNMENT, 1);
     1067        diff_api.PixelStorei(GL_PACK_ROW_LENGTH, 0);
     1068        diff_api.PixelStorei(GL_PACK_IMAGE_HEIGHT, 0);
     1069        diff_api.PixelStorei(GL_PACK_SKIP_IMAGES, 0);
     1070        diff_api.PixelStorei(GL_PACK_SWAP_BYTES, 0);
     1071        diff_api.PixelStorei(GL_PACK_LSB_FIRST, 0);
     1072
     1073        diff_api.ReadPixels(0, 0, pVP->viewportW, pVP->viewportH, GL_RGBA, GL_UNSIGNED_BYTE, pData);
     1074
     1075        diff_api.PixelStorei(GL_PACK_SKIP_ROWS, packing.skipRows);
     1076        diff_api.PixelStorei(GL_PACK_SKIP_PIXELS, packing.skipPixels);
     1077        diff_api.PixelStorei(GL_PACK_ALIGNMENT, packing.alignment);
     1078        diff_api.PixelStorei(GL_PACK_ROW_LENGTH, packing.rowLength);
     1079        diff_api.PixelStorei(GL_PACK_IMAGE_HEIGHT, packing.imageHeight);
     1080        diff_api.PixelStorei(GL_PACK_SKIP_IMAGES, packing.skipImages);
     1081        diff_api.PixelStorei(GL_PACK_SWAP_BYTES, packing.swapBytes);
     1082        diff_api.PixelStorei(GL_PACK_LSB_FIRST, packing.psLSBFirst);
     1083
     1084        rc = SSMR3PutMem(pSSM, pData, cbData);
     1085        AssertRCReturn(rc, rc);
     1086
     1087        crFree(pData);
     1088    }
     1089
    10521090    return VINF_SUCCESS;
    10531091}
     
    16921730#endif
    16931731
     1732    {
     1733        CRViewportState *pVP = &pContext->viewport;
     1734        CRPixelPackState unpack = pContext->client.unpack;
     1735        GLint cbData = crPixelSize(GL_RGBA, GL_UNSIGNED_BYTE) * pVP->viewportH * pVP->viewportW;
     1736        void *pData = crAlloc(cbData);
     1737
     1738        if (!pData)
     1739        {
     1740            return VERR_NO_MEMORY;
     1741        }
     1742
     1743        rc = SSMR3GetMem(pSSM, pData, cbData);
     1744        AssertRCReturn(rc, rc);
     1745
     1746        diff_api.PixelStorei(GL_UNPACK_SKIP_ROWS, 0);
     1747        diff_api.PixelStorei(GL_UNPACK_SKIP_PIXELS, 0);
     1748        diff_api.PixelStorei(GL_UNPACK_ALIGNMENT, 1);
     1749        diff_api.PixelStorei(GL_UNPACK_ROW_LENGTH, 0);
     1750        diff_api.PixelStorei(GL_UNPACK_IMAGE_HEIGHT, 0);
     1751        diff_api.PixelStorei(GL_UNPACK_SKIP_IMAGES, 0);
     1752        diff_api.PixelStorei(GL_UNPACK_SWAP_BYTES, 0);
     1753        diff_api.PixelStorei(GL_UNPACK_LSB_FIRST, 0);
     1754
     1755        diff_api.WindowPos2iARB(0, 0);
     1756        diff_api.DrawPixels(pVP->viewportW, pVP->viewportH, GL_RGBA, GL_UNSIGNED_BYTE, pData);
     1757
     1758        diff_api.PixelStorei(GL_UNPACK_SKIP_ROWS, unpack.skipRows);
     1759        diff_api.PixelStorei(GL_UNPACK_SKIP_PIXELS, unpack.skipPixels);
     1760        diff_api.PixelStorei(GL_UNPACK_ALIGNMENT, unpack.alignment);
     1761        diff_api.PixelStorei(GL_UNPACK_ROW_LENGTH, unpack.rowLength);
     1762        diff_api.PixelStorei(GL_UNPACK_IMAGE_HEIGHT, unpack.imageHeight);
     1763        diff_api.PixelStorei(GL_UNPACK_SKIP_IMAGES, unpack.skipImages);
     1764        diff_api.PixelStorei(GL_UNPACK_SWAP_BYTES, unpack.swapBytes);
     1765        diff_api.PixelStorei(GL_UNPACK_LSB_FIRST, unpack.psLSBFirst);
     1766
     1767        crFree(pData);
     1768    }
     1769
    16941770    return VINF_SUCCESS;
    16951771}
  • trunk/src/VBox/HostServices/SharedOpenGL/crserver/crservice.cpp

    r24503 r24891  
    7171
    7272static const char* gszVBoxOGLSSMMagic = "***OpenGL state data***";
    73 #define SHCROGL_SSM_VERSION 10
     73#define SHCROGL_SSM_VERSION 11
    7474
    7575typedef struct
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