VirtualBox

Ignore:
Timestamp:
Apr 24, 2015 12:00:21 PM (10 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
99763
Message:

HGSMI: cleanup, logging, comments, move legacy host heap support from common code to the host code.

Location:
trunk/src/VBox/Devices/Graphics/HGSMI
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Graphics/HGSMI/HGSMIHost.cpp

    r55401 r55421  
    6767
    6868#include <VBox/err.h>
    69 #define LOG_GROUP LOG_GROUP_DEV_VGA
     69#define LOG_GROUP LOG_GROUP_HGSMI
    7070#include <VBox/log.h>
    7171#include <VBox/vmm/ssm.h>
     
    133133
    134134
     135/* Host heap types. */
     136#define HGSMI_HEAP_TYPE_NULL    0 /* Heap not initialized. */
     137#define HGSMI_HEAP_TYPE_POINTER 1 /* Deprecated, used only for old saved states. RTHEAPSIMPLE. */
     138#define HGSMI_HEAP_TYPE_OFFSET  2 /* Deprecated, used only for old saved states. RTHEAPOFFSET. */
     139#define HGSMI_HEAP_TYPE_MA      3 /* Memory allocator. */
     140
     141typedef struct HGSMIHOSTHEAP
     142{
     143    uint32_t u32HeapType;   /* HGSMI_HEAP_TYPE_* */
     144    int32_t volatile cRefs; /* How many blocks allocated. */
     145    HGSMIAREA area;         /* Host heap location. */
     146    union
     147    {
     148        HGSMIMADATA ma;     /* Memory allocator for the default host heap implementation. */
     149        struct              /* Legacy heap implementations. For old saved states. */
     150        {
     151            union
     152            {
     153                RTHEAPSIMPLE hPtr;  /* Pointer based heap. */
     154                RTHEAPOFFSET hOff;  /* Offset based heap. */
     155            } u;
     156        } legacy;
     157    } u;
     158} HGSMIHOSTHEAP;
     159
    135160typedef struct HGSMIINSTANCE
    136161{
     
    142167
    143168    HGSMIAREA area; /* The shared memory description. */
    144     HGSMIHEAP hostHeap;                /* Host heap instance. */
     169    HGSMIHOSTHEAP hostHeap;            /* Host heap instance. */
    145170    RTCRITSECT    hostHeapCritSect;    /* Heap serialization lock. */
    146171
     
    182207    volatile uint32_t fl;              /* Status flags of the entry. */
    183208
    184     HGSMIOFFSET offBuffer;             /* Offset in the memory region of the entry data. */
     209    HGSMIOFFSET offBuffer;             /* Offset of the HGSMI buffer header in the HGSMI host heap:
     210                                        * [pIns->hostHeap.area.offBase .. offLast]. */
    185211
    186212#if 0
     
    510536}
    511537
     538static HGSMIOFFSET hgsmiHostHeapOffset(HGSMIHOSTHEAP *pHeap)
     539{
     540    return pHeap->area.offBase;
     541}
     542
     543static HGSMISIZE hgsmiHostHeapSize(HGSMIHOSTHEAP *pHeap)
     544{
     545    return pHeap->area.cbArea;
     546}
     547
     548static void *hgsmiHostHeapBufferAlloc(HGSMIHOSTHEAP *pHeap,
     549                                      HGSMISIZE cbBuffer)
     550{
     551    void *pvBuf = NULL;
     552
     553    if (pHeap->u32HeapType == HGSMI_HEAP_TYPE_MA)
     554    {
     555        pvBuf = HGSMIMAAlloc(&pHeap->u.ma, cbBuffer);
     556    }
     557    else if (pHeap->u32HeapType == HGSMI_HEAP_TYPE_POINTER)
     558    {
     559        pvBuf = RTHeapSimpleAlloc(pHeap->u.legacy.u.hPtr, cbBuffer, 0);
     560    }
     561    else if (pHeap->u32HeapType == HGSMI_HEAP_TYPE_OFFSET)
     562    {
     563        pvBuf = RTHeapOffsetAlloc(pHeap->u.legacy.u.hOff, cbBuffer, 0);
     564    }
     565
     566    if (pvBuf)
     567    {
     568        ++pHeap->cRefs;
     569    }
     570
     571    return pvBuf;
     572}
     573
     574static void hgsmiHostHeapBufferFree(HGSMIHOSTHEAP *pHeap,
     575                                    void *pvBuf)
     576{
     577    if (pHeap->u32HeapType == HGSMI_HEAP_TYPE_MA)
     578    {
     579        HGSMIMAFree(&pHeap->u.ma, pvBuf);
     580    }
     581    else if (pHeap->u32HeapType == HGSMI_HEAP_TYPE_POINTER)
     582    {
     583        RTHeapSimpleFree(pHeap->u.legacy.u.hPtr, pvBuf);
     584    }
     585    else if (pHeap->u32HeapType == HGSMI_HEAP_TYPE_OFFSET)
     586    {
     587        RTHeapOffsetFree(pHeap->u.legacy.u.hOff, pvBuf);
     588    }
     589    --pHeap->cRefs;
     590}
     591
     592static void *hgsmiHostHeapDataAlloc(HGSMIHOSTHEAP *pHeap,
     593                                    HGSMISIZE cbData,
     594                                    uint8_t u8Channel,
     595                                    uint16_t u16ChannelInfo)
     596{
     597    HGSMISIZE cbAlloc = HGSMIBufferRequiredSize(cbData);
     598    HGSMIBUFFERHEADER *pHeader = (HGSMIBUFFERHEADER *)hgsmiHostHeapBufferAlloc(pHeap, cbAlloc);
     599    if (!pHeader)
     600        return NULL;
     601
     602    HGSMIBufferInitializeSingle(&pHeap->area, pHeader, cbAlloc, u8Channel, u16ChannelInfo);
     603
     604    return HGSMIBufferDataFromPtr(pHeader);
     605}
     606
     607static void hgsmiHostHeapDataFree(HGSMIHOSTHEAP *pHeap,
     608                                  void *pvData)
     609{
     610    if (   pvData
     611        && pHeap->u32HeapType != HGSMI_HEAP_TYPE_NULL)
     612    {
     613        HGSMIBUFFERHEADER *pHeader = HGSMIBufferHeaderFromData(pvData);
     614        hgsmiHostHeapBufferFree(pHeap, pHeader);
     615    }
     616}
     617
     618/* Needed for heap relocation: offset of the heap handle relative to the start of heap area. */
     619static HGSMIOFFSET hgsmiHostHeapHandleLocationOffset(HGSMIHOSTHEAP *pHeap)
     620{
     621    HGSMIOFFSET offHeapHandle;
     622    if (pHeap->u32HeapType == HGSMI_HEAP_TYPE_POINTER)
     623    {
     624        offHeapHandle = (HGSMIOFFSET)((uintptr_t)pHeap->u.legacy.u.hPtr - (uintptr_t)pHeap->area.pu8Base);
     625    }
     626    else if (pHeap->u32HeapType == HGSMI_HEAP_TYPE_OFFSET)
     627    {
     628        offHeapHandle = (HGSMIOFFSET)((uintptr_t)pHeap->u.legacy.u.hOff - (uintptr_t)pHeap->area.pu8Base);
     629    }
     630    else
     631    {
     632        offHeapHandle = HGSMIOFFSET_VOID;
     633    }
     634    return offHeapHandle;
     635}
     636
     637static int hgsmiHostHeapRelocate(HGSMIHOSTHEAP *pHeap,
     638                                 uint32_t u32HeapType,
     639                                 void *pvBase,
     640                                 uint32_t offHeapHandle,
     641                                 uintptr_t offDelta,
     642                                 HGSMISIZE cbArea,
     643                                 HGSMIOFFSET offBase)
     644{
     645    int rc = HGSMIAreaInitialize(&pHeap->area, pvBase, cbArea, offBase);
     646    if (RT_SUCCESS(rc))
     647    {
     648        if (u32HeapType == HGSMI_HEAP_TYPE_OFFSET)
     649        {
     650            pHeap->u.legacy.u.hOff = (RTHEAPOFFSET)((uint8_t *)pvBase + offHeapHandle);
     651        }
     652        else if (u32HeapType == HGSMI_HEAP_TYPE_POINTER)
     653        {
     654            pHeap->u.legacy.u.hPtr = (RTHEAPSIMPLE)((uint8_t *)pvBase + offHeapHandle);
     655            rc = RTHeapSimpleRelocate(pHeap->u.legacy.u.hPtr, offDelta); AssertRC(rc);
     656        }
     657        else
     658        {
     659            /* HGSMI_HEAP_TYPE_MA does not need the relocation. */
     660            rc = VERR_NOT_SUPPORTED;
     661        }
     662
     663        if (RT_SUCCESS(rc))
     664        {
     665            pHeap->u32HeapType = u32HeapType;
     666        }
     667        else
     668        {
     669            HGSMIAreaClear(&pHeap->area);
     670        }
     671    }
     672
     673    return rc;
     674}
     675
     676static int hgsmiHostHeapRestoreMA(HGSMIHOSTHEAP *pHeap,
     677                                  void *pvBase,
     678                                  HGSMISIZE cbArea,
     679                                  HGSMIOFFSET offBase,
     680                                  uint32_t cBlocks,
     681                                  HGSMIOFFSET *paDescriptors,
     682                                  HGSMISIZE cbMaxBlock,
     683                                  HGSMIENV *pEnv)
     684{
     685    int rc = HGSMIAreaInitialize(&pHeap->area, pvBase, cbArea, offBase);
     686    if (RT_SUCCESS(rc))
     687    {
     688        rc = HGSMIMAInit(&pHeap->u.ma, &pHeap->area, paDescriptors, cBlocks, cbMaxBlock, pEnv);
     689
     690        if (RT_FAILURE(rc))
     691        {
     692            HGSMIAreaClear(&pHeap->area);
     693        }
     694    }
     695
     696    return rc;
     697}
     698
     699static void hgsmiHostHeapSetupUninitialized(HGSMIHOSTHEAP *pHeap)
     700{
     701    RT_ZERO(*pHeap);
     702    pHeap->u32HeapType = HGSMI_HEAP_TYPE_NULL;
     703}
     704
     705static void hgsmiHostHeapDestroy(HGSMIHOSTHEAP *pHeap)
     706{
     707    if (pHeap->u32HeapType == HGSMI_HEAP_TYPE_MA)
     708    {
     709        HGSMIMAUninit(&pHeap->u.ma);
     710    }
     711    hgsmiHostHeapSetupUninitialized(pHeap);
     712}
     713
    512714static int hgsmiHostFIFOAlloc (HGSMIINSTANCE *pIns, HGSMIHOSTFIFOENTRY **ppEntry)
    513715{
     
    557759static int hgsmiHostCommandFreeByEntry (HGSMIHOSTFIFOENTRY *pEntry)
    558760{
     761    LogFlowFunc(("offBuffer 0x%08X\n", pEntry->offBuffer));
     762
    559763    HGSMIINSTANCE *pIns = pEntry->pIns;
    560764    int rc = hgsmiFIFOLock (pIns);
     
    564768        hgsmiFIFOUnlock (pIns);
    565769
    566         void *pvMem = HGSMIBufferDataFromOffset(&pIns->area, pEntry->offBuffer);
     770        void *pvData = HGSMIBufferDataFromOffset(&pIns->hostHeap.area, pEntry->offBuffer);
    567771
    568772        rc = hgsmiHostHeapLock (pIns);
     
    570774        {
    571775            /* Deallocate the host heap memory. */
    572             HGSMIHeapFree (&pIns->hostHeap, pvMem);
     776            hgsmiHostHeapDataFree(&pIns->hostHeap, pvData);
    573777
    574778            hgsmiHostHeapUnlock(pIns);
     
    577781        hgsmiHostFIFOFree (pIns, pEntry);
    578782    }
     783
     784    LogFlowFunc(("%Rrc\n", rc));
    579785    return rc;
    580786}
    581787
    582788static int hgsmiHostCommandFree (HGSMIINSTANCE *pIns,
    583                                                 void *pvMem)
    584 {
    585     HGSMIOFFSET offMem = HGSMIHeapBufferOffset (&pIns->hostHeap, pvMem);
     789                                                void *pvData)
     790{
    586791    int rc = VINF_SUCCESS;
    587     if (offMem != HGSMIOFFSET_VOID)
    588     {
     792    if (HGSMIAreaContainsPointer(&pIns->hostHeap.area, pvData))
     793    {
     794        HGSMIHOSTFIFOENTRY *pEntry = NULL;
     795        HGSMIOFFSET offBuffer = HGSMIBufferOffsetFromData(&pIns->hostHeap.area, pvData);
     796
    589797        rc = hgsmiFIFOLock (pIns);
    590798        if(RT_SUCCESS(rc))
    591799        {
    592             /* Search the Processed list for the given offMem. */
    593             HGSMIHOSTFIFOENTRY *pEntry = NULL;
    594 
     800            /* Search the Processed list for the given offBuffer. */
    595801            HGSMIHOSTFIFOENTRY *pIter;
    596802            RTListForEach(&pIns->hostFIFOProcessed, pIter, HGSMIHOSTFIFOENTRY, nodeEntry)
     
    598804                Assert(pIter->fl == (HGSMI_F_HOST_FIFO_ALLOCATED | HGSMI_F_HOST_FIFO_PROCESSED));
    599805
    600                 if (pIter->offBuffer == offMem)
     806                if (pIter->offBuffer == offBuffer)
    601807                {
    602808                    pEntry = pIter;
     
    611817            else
    612818            {
    613                 LogRel(("HGSMI[%s]: the host frees unprocessed FIFO entry: 0x%08X\n", pIns->pszName, offMem));
    614                 AssertFailed ();
     819                AssertLogRelMsgFailed(("HGSMI[%s]: the host frees unprocessed FIFO entry: 0x%08X\n",
     820                                       pIns->pszName, offBuffer));
    615821            }
    616822
     
    621827            {
    622828                /* Deallocate the host heap memory. */
    623                 HGSMIHeapFree (&pIns->hostHeap, pvMem);
     829                hgsmiHostHeapDataFree(&pIns->hostHeap, pvData);
    624830
    625831                hgsmiHostHeapUnlock(pIns);
     
    636842    else
    637843    {
     844        AssertLogRelMsgFailed(("HGSMI[%s]: the host frees invalid FIFO entry: %p\n",
     845                               pIns->pszName, pvData));
    638846        rc = VERR_INVALID_POINTER;
    639         LogRel(("HGSMI[%s]: the host frees invalid FIFO entry: %p\n", pIns->pszName, pvMem));
    640         AssertFailed ();
    641847    }
    642848    return rc;
     
    776982#endif
    777983/**
    778  * Allocate a shared memory block. The host can write command/data to the memory.
    779  *
    780  * @param pIns   Pointer to HGSMI instance,
    781  * @param ppvMem Where to store the allocated memory pointer to data.
    782  * @param cbMem  How many bytes of data to allocate.
     984 * Allocate a shared memory buffer. The host can write command/data to the memory.
     985 * The allocated buffer contains the 'header', 'data' and the 'tail', but *ppvData
     986 * will point to the 'data'.
     987 *
     988 * @return VBox status code. Pointer to the payload data in *ppvData.
     989 * @param pIns           HGSMI instance,
     990 * @param ppvData        Where to store the allocated memory pointer to data.
     991 * @param cbData         How many bytes of data to allocate.
     992 * @param u8Channel      HGSMI channel.
     993 * @param u16ChannelInfo Command parameter.
    783994 */
    784995int HGSMIHostCommandAlloc (HGSMIINSTANCE *pIns,
    785                            void **ppvMem,
    786                            HGSMISIZE cbMem,
     996                           void **ppvData,
     997                           HGSMISIZE cbData,
    787998                           uint8_t u8Channel,
    788999                           uint16_t u16ChannelInfo)
    7891000{
    790     LogFlowFunc (("pIns = %p, cbMem = 0x%08X(%d)\n", pIns, cbMem, cbMem));
     1001    LogFlowFunc (("pIns = %p, cbData = 0x%08X(%d)\n", pIns, cbData, cbData));
    7911002
    7921003    int rc = hgsmiHostHeapLock (pIns);
    7931004    if(RT_SUCCESS(rc))
    7941005    {
    795         void *pvMem = HGSMIHeapAlloc (&pIns->hostHeap,
    796                                   cbMem,
    797                                   u8Channel,
    798                                   u16ChannelInfo);
     1006        void *pvData = hgsmiHostHeapDataAlloc(&pIns->hostHeap,
     1007                                              cbData,
     1008                                              u8Channel,
     1009                                              u16ChannelInfo);
    7991010        hgsmiHostHeapUnlock(pIns);
    8001011
    801         if (pvMem)
    802         {
    803             *ppvMem = pvMem;
     1012        if (pvData)
     1013        {
     1014            *ppvData = pvData;
    8041015        }
    8051016        else
    8061017        {
    807             LogRel((0, "HGSMIHeapAlloc: HGSMIHeapAlloc failed\n"));
    808             rc = VERR_GENERAL_FAILURE;
    809         }
    810     }
    811 
    812     LogFlowFunc (("rc = %Rrc, pvMem = %p\n", rc, *ppvMem));
    813 
     1018            LogRel(("HGSMI[%s]: host heap allocation failed %dbytes\n", pIns->pszName, cbData));
     1019            rc = VERR_NO_MEMORY;
     1020        }
     1021    }
     1022
     1023    LogFlowFunc(("%Rrc, pvData = %p\n", rc, *ppvData));
    8141024    return rc;
    8151025}
     
    8191029 * and make it freed on completion.
    8201030 * The caller does not get notified in any way on command completion,
    821  * on success return the pvMem buffer can not be used after being passed to this function
    822  *
    823  * @param pIns  Pointer to HGSMI instance,
    824  * @param pvMem The pointer returned by 'HGSMIHostCommandAlloc'.
    825  * @param bDoIrq specifies whether the guest interrupt should be generated,
    826  * i.e. in case the command is not urgent(e.g. some guest command completion notification that does not require post-processing)
    827  * the command could be posted without raising an irq.
     1031 * on successful return the pvData buffer can not be used after being passed to this function.
     1032 *
     1033 * @param pIns   HGSMI instance,
     1034 * @param pvData The pointer returned by 'HGSMIHostCommandAlloc'.
     1035 * @param bDoIrq Specifies whether the guest interrupt should be generated.
     1036 *               In case the command is not urgent (e.g. some guest command
     1037 *               completion notification that does not require post-processing)
     1038 *               the command could be posted without raising an irq.
    8281039 */
    8291040int HGSMIHostCommandProcessAndFreeAsynch (PHGSMIINSTANCE pIns,
    830                              void *pvMem,
     1041                             void *pvData,
    8311042                             bool bDoIrq)
    8321043{
    833     LogFlowFunc(("pIns = %p, pvMem = %p\n", pIns, pvMem));
     1044    LogFlowFunc(("pIns = %p, pvData = %p\n", pIns, pvData));
    8341045
    8351046#if 0
     
    8371048#endif
    8381049
    839     HGSMIOFFSET offBuffer = HGSMIHeapBufferOffset (&pIns->hostHeap, pvMem);
     1050    HGSMIOFFSET offBuffer = HGSMIBufferOffsetFromData(&pIns->hostHeap.area, pvData);
    8401051
    8411052    int rc = hgsmiHostCommandProcess (pIns, offBuffer,
     
    9251136};
    9261137
    927 int HGSMISetupHostHeap (PHGSMIINSTANCE pIns,
    928                         HGSMIOFFSET    offHeap,
    929                         HGSMISIZE      cbHeap)
     1138int HGSMIHostHeapSetup(PHGSMIINSTANCE pIns,
     1139                       HGSMIOFFSET    offHeap,
     1140                       HGSMISIZE      cbHeap)
    9301141{
    9311142    LogFlowFunc(("pIns %p, offHeap 0x%08X, cbHeap = 0x%08X\n", pIns, offHeap, cbHeap));
     
    9331144    int rc = VINF_SUCCESS;
    9341145
    935     Assert (pIns);
    936 
    937 //    if (   offHeap >= pIns->cbMem
    938 //        || cbHeap > pIns->cbMem
    939 //        || offHeap + cbHeap > pIns->cbMem)
    940 //    {
    941 //        rc = VERR_INVALID_PARAMETER;
    942 //    }
    943 //    else
     1146    AssertPtrReturn(pIns, VERR_INVALID_PARAMETER);
     1147
     1148    if (   offHeap >= pIns->area.cbArea
     1149        || cbHeap > pIns->area.cbArea
     1150        || offHeap > pIns->area.cbArea - cbHeap)
     1151    {
     1152        AssertLogRelMsgFailed(("offHeap 0x%08X, cbHeap = 0x%08X, pIns->area.cbArea 0x%08X\n",
     1153                               offHeap, cbHeap, pIns->area.cbArea));
     1154        rc = VERR_INVALID_PARAMETER;
     1155    }
     1156    else
    9441157    {
    9451158        rc = hgsmiHostHeapLock (pIns);
     
    9491162            if (pIns->hostHeap.cRefs)
    9501163            {
    951                 AssertFailed();
     1164                AssertLogRelMsgFailed(("HGSMI[%s]: host heap setup ignored. %d allocated.\n",
     1165                                       pIns->pszName, pIns->hostHeap.cRefs));
    9521166                /* It is possible to change the heap only if there is no pending allocations. */
    9531167                rc = VERR_ACCESS_DENIED;
     
    9551169            else
    9561170            {
    957                 rc = HGSMIHeapSetup (&pIns->hostHeap,
    958                                      HGSMI_HEAP_TYPE_MA,
    959                                      pIns->area.pu8Base+offHeap,
    960                                      cbHeap,
    961                                      offHeap,
    962                                      &g_hgsmiEnv);
     1171                rc = HGSMIAreaInitialize(&pIns->hostHeap.area, pIns->area.pu8Base + offHeap, cbHeap, offHeap);
     1172                if (RT_SUCCESS(rc))
     1173                {
     1174                    rc = HGSMIMAInit(&pIns->hostHeap.u.ma, &pIns->hostHeap.area, NULL, 0, 0, &g_hgsmiEnv);
     1175                }
     1176
     1177                if (RT_SUCCESS(rc))
     1178                {
     1179                    pIns->hostHeap.u32HeapType = HGSMI_HEAP_TYPE_MA;
     1180                }
     1181                else
     1182                {
     1183                    HGSMIAreaClear(&pIns->hostHeap.area);
     1184                }
    9631185            }
    9641186
     
    12051427    off = pIns->hostHeap.u32HeapType == HGSMI_HEAP_TYPE_MA?
    12061428              0:
    1207               HGSMIHeapHandleLocationOffset(&pIns->hostHeap);
     1429              hgsmiHostHeapHandleLocationOffset(&pIns->hostHeap);
    12081430    rc = SSMR3PutU32 (pSSM, off);
    12091431    if(off != HGSMIOFFSET_VOID)
    12101432    {
    1211         SSMR3PutU32 (pSSM, HGSMIHeapOffset(&pIns->hostHeap));
    1212         SSMR3PutU32 (pSSM, HGSMIHeapSize(&pIns->hostHeap));
     1433        SSMR3PutU32 (pSSM, hgsmiHostHeapOffset(&pIns->hostHeap));
     1434        SSMR3PutU32 (pSSM, hgsmiHostHeapSize(&pIns->hostHeap));
    12131435        /* need save mem pointer to calculate offset on restore */
    12141436        SSMR3PutU64 (pSSM, (uint64_t)(uintptr_t)pIns->area.pu8Base);
     
    12611483    pIns->pHGFlags = (off != HGSMIOFFSET_VOID) ? (HGSMIHOSTFLAGS*)HGSMIOffsetToPointer (&pIns->area, off) : NULL;
    12621484
    1263     HGSMIHEAP hHeap = pIns->hostHeap;
     1485    HGSMIHOSTHEAP hHeap = pIns->hostHeap;
    12641486    rc = SSMR3GetU32(pSSM, &off);
    12651487    AssertRCReturn(rc, rc);
     
    13111533                if (RT_SUCCESS(rc))
    13121534                {
    1313                     rc = HGSMIHeapRestoreMA(&pIns->hostHeap,
    1314                                             pIns->area.pu8Base+offHeap,
    1315                                             cbHeap,
    1316                                             offHeap,
    1317                                             cBlocks,
    1318                                             paDescriptors,
    1319                                             cbMaxBlock,
    1320                                             &g_hgsmiEnv);
     1535                    rc = hgsmiHostHeapRestoreMA(&pIns->hostHeap,
     1536                                                pIns->area.pu8Base+offHeap,
     1537                                                cbHeap,
     1538                                                offHeap,
     1539                                                cBlocks,
     1540                                                paDescriptors,
     1541                                                cbMaxBlock,
     1542                                                &g_hgsmiEnv);
    13211543
    13221544                    RTMemFree(paDescriptors);
     
    13321554                    pIns->hostHeap.cRefs = 0;
    13331555
    1334                     rc = HGSMIHeapRelocate(&pIns->hostHeap,
    1335                                            u32HeapType,
    1336                                            pIns->area.pu8Base+offHeap,
    1337                                            off,
    1338                                            uintptr_t(pIns->area.pu8Base) - uintptr_t(oldMem),
    1339                                            cbHeap,
    1340                                            offHeap);
     1556                    rc = hgsmiHostHeapRelocate(&pIns->hostHeap,
     1557                                               u32HeapType,
     1558                                               pIns->area.pu8Base+offHeap,
     1559                                               off,
     1560                                               uintptr_t(pIns->area.pu8Base) - uintptr_t(oldMem),
     1561                                               cbHeap,
     1562                                               offHeap);
    13411563
    13421564                    hgsmiHostHeapUnlock (pIns);
     
    15341756                 size_t         cbContext)
    15351757{
    1536     LogFlowFunc(("ppIns = %p, pVM = %p, pszName = [%s], pu8MemBase = %p, cbMem = 0x%08X, offMemBase = 0x%08X, "
     1758    LogFlowFunc(("ppIns = %p, pVM = %p, pszName = [%s], offBase = 0x%08X, pu8MemBase = %p, cbMem = 0x%08X, "
    15371759                 "pfnNotifyGuest = %p, pvNotifyGuest = %p, cbContext = %d\n",
    15381760                 ppIns,
    15391761                 pVM,
    15401762                 pszName,
     1763                 offBase,
    15411764                 pu8MemBase,
    15421765                 cbMem,
     
    15851808        pIns->pszName        = VALID_PTR(pszName)? pszName: "";
    15861809
    1587         HGSMIHeapSetupUninitialized(&pIns->hostHeap);
     1810        hgsmiHostHeapSetupUninitialized(&pIns->hostHeap);
    15881811
    15891812        pIns->pfnNotifyGuest = pfnNotifyGuest;
     
    16341857#endif
    16351858
    1636     HGSMIHeapDestroy(&pIns->hostHeap);
    1637 
    1638     HGSMIHeapSetupUninitialized(&pIns->hostHeap);
     1859    hgsmiHostHeapDestroy(&pIns->hostHeap);
    16391860
    16401861    return flags;
     
    16471868    if (pIns)
    16481869    {
    1649         HGSMIHeapDestroy(&pIns->hostHeap);
     1870        hgsmiHostHeapDestroy(&pIns->hostHeap);
    16501871
    16511872        if (RTCritSectIsInitialized (&pIns->hostHeapCritSect))
  • trunk/src/VBox/Devices/Graphics/HGSMI/HGSMIHost.h

    r55401 r55421  
    6969                              uint8_t *pu8Channel);
    7070
    71 int HGSMISetupHostHeap (PHGSMIINSTANCE pIns,
    72                         HGSMIOFFSET    offHeap,
    73                         HGSMISIZE      cbHeap);
     71int HGSMIHostHeapSetup(PHGSMIINSTANCE pIns,
     72                       HGSMIOFFSET    offHeap,
     73                       HGSMISIZE      cbHeap);
    7474
    7575int HGSMISaveStateExec (PHGSMIINSTANCE pIns, PSSMHANDLE pSSM);
     
    107107/* Allocate a buffer in the host heap. */
    108108int HGSMIHostCommandAlloc (PHGSMIINSTANCE pIns,
    109                            void **ppvMem,
    110                            HGSMISIZE cbMem,
     109                           void **ppvData,
     110                           HGSMISIZE cbData,
    111111                           uint8_t u8Channel,
    112112                           uint16_t u16ChannelInfo);
     
    116116
    117117int HGSMIHostCommandProcessAndFreeAsynch (PHGSMIINSTANCE pIns,
    118                              void *pvMem,
     118                             void *pvData,
    119119                             bool bDoIrq);
    120120
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