VirtualBox

忽略:
時間撮記:
2014-2-24 上午09:01:18 (11 年 以前)
作者:
vboxsync
訊息:

DevVGA/HGSMI: use RTList

位置:
trunk/src/VBox/Devices/Graphics/HGSMI
檔案:
刪除 2 筆資料
修改 2 筆資料

圖例:

未更動
新增
刪除
  • trunk/src/VBox/Devices/Graphics/HGSMI/HGSMIHost.cpp

    r50542 r50550  
    6161#include <iprt/critsect.h>
    6262#include <iprt/heap.h>
     63#include <iprt/list.h>
    6364#include <iprt/semaphore.h>
    6465#include <iprt/string.h>
    65 #include <iprt/asm.h>
    6666
    6767#include <VBox/err.h>
     
    7474#include <VBox/HGSMI/HGSMIChSetup.h>
    7575
    76 #include "HGSMIHostHlp.h"
    7776#include "../DevVGASavedState.h"
    7877
     
    133132
    134133
    135 typedef struct _HGSMIINSTANCE
     134typedef struct HGSMIINSTANCE
    136135{
    137136    PVM pVM;                           /* The VM. */
     
    145144    RTCRITSECT    hostHeapCritSect;    /* Heap serialization lock. */
    146145
    147     HGSMILIST hostFIFO;                /* Pending host buffers. */
    148     HGSMILIST hostFIFORead;            /* Host buffers read by the guest. */
    149     HGSMILIST hostFIFOProcessed;       /* Processed by the guest. */
    150     HGSMILIST hostFIFOFree;            /* Buffers for reuse. */
     146    RTLISTANCHOR hostFIFO;             /* Pending host buffers. */
     147    RTLISTANCHOR hostFIFORead;         /* Host buffers read by the guest. */
     148    RTLISTANCHOR hostFIFOProcessed;    /* Processed by the guest. */
     149    RTLISTANCHOR hostFIFOFree;         /* Buffers for reuse. */
    151150#ifdef VBOX_WITH_WDDM
    152     HGSMILIST guestCmdCompleted;       /* list of completed guest commands to be returned to the guest*/
    153 #endif
    154     RTCRITSECT    hostFIFOCritSect;    /* FIFO serialization lock. */
     151    RTLISTANCHOR guestCmdCompleted;    /* list of completed guest commands to be returned to the guest*/
     152#endif
     153    RTCRITSECT hostFIFOCritSect;       /* FIFO serialization lock. */
    155154
    156155    PFNHGSMINOTIFYGUEST pfnNotifyGuest; /* Guest notification callback. */
    157     void *pvNotifyGuest;               /* Guest notification callback context. */
    158 
    159     volatile HGSMIHOSTFLAGS * pHGFlags;
     156    void *pvNotifyGuest;                /* Guest notification callback context. */
     157
     158    volatile HGSMIHOSTFLAGS *pHGFlags;
    160159
    161160    HGSMICHANNELINFO channelInfo;      /* Channel handlers indexed by the channel id.
    162                                                       * The array is accessed under the instance lock.
    163                                                       */
    164  } HGSMIINSTANCE;
     161                                        * The array is accessed under the instance lock.
     162                                        */
     163} HGSMIINSTANCE;
    165164
    166165
     
    168167typedef FNHGSMIHOSTFIFOCALLBACK *PFNHGSMIHOSTFIFOCALLBACK;
    169168
    170 typedef struct _HGSMIHOSTFIFOENTRY
    171 {
    172     /* The list field. Must be the first field. */
    173     HGSMILISTENTRY entry;
    174 
    175     /* Backlink to the HGSMI instance. */
    176     HGSMIINSTANCE *pIns;
     169typedef struct HGSMIHOSTFIFOENTRY
     170{
     171    RTLISTNODE nodeEntry;
     172
     173    HGSMIINSTANCE *pIns;               /* Backlink to the HGSMI instance. */
    177174
    178175#if 0
     
    181178    RTSEMEVENTMULTI hEvent;
    182179#endif
    183     /* Status flags of the entry. */
    184     volatile uint32_t fl;
    185 
    186     /* Offset in the memory region of the entry data. */
    187     HGSMIOFFSET offBuffer;
     180
     181    volatile uint32_t fl;              /* Status flags of the entry. */
     182
     183    HGSMIOFFSET offBuffer;             /* Offset in the memory region of the entry data. */
    188184
    189185#if 0
     
    195191
    196192} HGSMIHOSTFIFOENTRY;
    197 
    198 #define HGSMILISTENTRY_2_FIFOENTRY(_pe) \
    199     ( (HGSMIHOSTFIFOENTRY*)((uint8_t *)(_pe) - RT_OFFSETOF(HGSMIHOSTFIFOENTRY, entry)) )
    200 
    201 //AssertCompile(RT_OFFSETOF(HGSMIHOSTFIFOENTRY, entry) == 0);
    202193
    203194
     
    213204#ifdef VBOX_WITH_WDDM
    214205
    215 typedef struct _HGSMIGUESTCOMPLENTRY
    216 {
    217     /* The list field. Must be the first field. */
    218     HGSMILISTENTRY entry;
    219     /* guest command buffer */
    220     HGSMIOFFSET offBuffer;
     206typedef struct HGSMIGUESTCOMPLENTRY
     207{
     208    RTLISTNODE nodeEntry;
     209    HGSMIOFFSET offBuffer; /* Offset of the guest command buffer. */
    221210} HGSMIGUESTCOMPLENTRY;
    222211
    223 #define HGSMILISTENTRY_2_HGSMIGUESTCOMPLENTRY(_pe) \
    224     ( (HGSMIGUESTCOMPLENTRY*)((uint8_t *)(_pe) - RT_OFFSETOF(HGSMIGUESTCOMPLENTRY, entry)) )
    225212
    226213static void hgsmiGuestCompletionFIFOFree (HGSMIINSTANCE *pIns, HGSMIGUESTCOMPLENTRY *pEntry)
     
    376363    int rc = hgsmiFIFOLock(pIns);
    377364    AssertRC(rc);
    378     if(RT_SUCCESS(rc))
    379     {
    380         /* Get the host FIFO head entry. */
    381         HGSMILISTENTRY *pHead = pIns->guestCmdCompleted.pHead;
    382         if(pHead)
    383             hgsmiListRemove (&pIns->guestCmdCompleted, pHead, NULL);
    384 
    385         if(!pIns->guestCmdCompleted.pHead)
     365    if (RT_SUCCESS(rc))
     366    {
     367        HGSMIGUESTCOMPLENTRY *pEntry = RTListGetFirst(&pIns->guestCmdCompleted, HGSMIGUESTCOMPLENTRY, nodeEntry);
     368        if (pEntry)
     369        {
     370            RTListNodeRemove(&pEntry->nodeEntry);
     371        }
     372
     373        if (RTListIsEmpty(&pIns->guestCmdCompleted))
    386374        {
    387375            if(pIns->pHGFlags)
    388                 ASMAtomicAndU32(&pIns->pHGFlags->u32HostFlags, (~HGSMIHOSTFLAGS_GCOMMAND_COMPLETED));
     376            {
     377                ASMAtomicAndU32(&pIns->pHGFlags->u32HostFlags, ~HGSMIHOSTFLAGS_GCOMMAND_COMPLETED);
     378            }
    389379        }
    390380
    391381        hgsmiFIFOUnlock(pIns);
    392382
    393         if (pHead)
    394         {
    395             HGSMIGUESTCOMPLENTRY *pEntry = HGSMILISTENTRY_2_HGSMIGUESTCOMPLENTRY(pHead);
     383        if (pEntry)
     384        {
    396385            offCmd = pEntry->offBuffer;
    397386
    398387            LogFlowFunc(("host FIFO head %p.\n", pEntry));
    399388
    400             hgsmiGuestCompletionFIFOFree (pIns, pEntry);
     389            hgsmiGuestCompletionFIFOFree(pIns, pEntry);
    401390        }
    402391    }
     
    428417}
    429418
    430 static bool hgsmiProcessHostCmdCompletion (HGSMIINSTANCE *pIns,
    431                      HGSMIOFFSET offBuffer,
    432                      bool bCompleteFirst)
     419static bool hgsmiProcessHostCmdCompletion(HGSMIINSTANCE *pIns,
     420                                          HGSMIOFFSET offBuffer,
     421                                          bool bCompleteFirst)
    433422{
    434423    VM_ASSERT_EMT(pIns->pVM);
     
    437426    if(RT_SUCCESS(rc))
    438427    {
    439         /* Search the Read list for the given buffer offset. Also find the previous entry. */
    440         HGSMIHOSTFIFOENTRY *pEntry = HGSMILISTENTRY_2_FIFOENTRY(pIns->hostFIFORead.pHead);
    441         HGSMIHOSTFIFOENTRY *pPrev = NULL;
    442 
    443         while (pEntry)
    444         {
    445             Assert(pEntry->fl == (HGSMI_F_HOST_FIFO_ALLOCATED | HGSMI_F_HOST_FIFO_READ));
    446 
    447             if (bCompleteFirst || pEntry->offBuffer == offBuffer)
    448             {
     428        /* Search the Read list for the given buffer offset. */
     429        HGSMIHOSTFIFOENTRY *pEntry = NULL;
     430
     431        HGSMIHOSTFIFOENTRY *pIter;
     432        RTListForEach(&pIns->hostFIFORead, pIter, HGSMIHOSTFIFOENTRY, nodeEntry)
     433        {
     434            Assert(pIter->fl == (HGSMI_F_HOST_FIFO_ALLOCATED | HGSMI_F_HOST_FIFO_READ));
     435            if (bCompleteFirst || pIter->offBuffer == offBuffer)
     436            {
     437                pEntry = pIter;
    449438                break;
    450439            }
    451 
    452 #ifdef DEBUGVHWASTRICT
    453             /* guest usually completes commands in the order it receives it
    454              * if we're here this would typically means there is some cmd loss */
    455             AssertFailed();
    456 #endif
    457 
    458             pPrev = pEntry;
    459             pEntry = HGSMILISTENTRY_2_FIFOENTRY(pEntry->entry.pNext);
    460440        }
    461441
     
    466446        if (pEntry)
    467447        {
    468             /* Exclude from the Read list. */
    469             hgsmiListRemove (&pIns->hostFIFORead, &pEntry->entry, pPrev? &pPrev->entry: NULL);
     448            RTListNodeRemove(&pEntry->nodeEntry);
    470449
    471450            pEntry->fl &= ~HGSMI_F_HOST_FIFO_READ;
    472451            pEntry->fl |= HGSMI_F_HOST_FIFO_PROCESSED;
    473452
    474             /* Save in the Processed list. */
    475             hgsmiListAppend (&pIns->hostFIFOProcessed, &pEntry->entry);
     453            RTListAppend(&pIns->hostFIFOProcessed, &pEntry->nodeEntry);
    476454
    477455            hgsmiFIFOUnlock(pIns);
     
    522500    {
    523501        /* Get the host FIFO head entry. */
    524         HGSMIHOSTFIFOENTRY *pEntry = HGSMILISTENTRY_2_FIFOENTRY(pIns->hostFIFO.pHead);
     502        HGSMIHOSTFIFOENTRY *pEntry = RTListGetFirst(&pIns->hostFIFO, HGSMIHOSTFIFOENTRY, nodeEntry);
    525503
    526504        LogFlowFunc(("host FIFO head %p.\n", pEntry));
     
    530508            Assert(pEntry->fl == (HGSMI_F_HOST_FIFO_ALLOCATED | HGSMI_F_HOST_FIFO_QUEUED));
    531509
    532             /* Exclude from the FIFO. */
    533             hgsmiListRemove (&pIns->hostFIFO, &pEntry->entry, NULL);
    534 
    535             if(!pIns->hostFIFO.pHead)
     510            /*
     511             * Move the entry to the Read list.
     512             */
     513            RTListNodeRemove(&pEntry->nodeEntry);
     514
     515            if (RTListIsEmpty(&pIns->hostFIFO))
    536516            {
    537517                ASMAtomicAndU32(&pIns->pHGFlags->u32HostFlags, (~HGSMIHOSTFLAGS_COMMANDS_PENDING));
     
    541521            pEntry->fl |= HGSMI_F_HOST_FIFO_READ;
    542522
    543             /* Save in the Read list. */
    544             hgsmiListAppend (&pIns->hostFIFORead, &pEntry->entry);
     523            RTListAppend(&pIns->hostFIFORead, &pEntry->nodeEntry);
    545524
    546525            hgsmiFIFOUnlock(pIns);
    547             Assert(pEntry->offBuffer != HGSMIOFFSET_VOID);
     526
    548527            /* Return the buffer offset of the host FIFO head. */
    549528            return pEntry->offBuffer;
     
    759738    if(RT_SUCCESS(rc))
    760739    {
    761         hgsmiListRemove (&pIns->hostFIFOProcessed, &pEntry->entry, NULL);
     740        RTListNodeRemove(&pEntry->nodeEntry);
    762741        hgsmiFIFOUnlock (pIns);
    763742
     
    788767        if(RT_SUCCESS(rc))
    789768        {
    790             /* Search the Processed list for the given offMem. Also find the previous entry. */
    791             HGSMIHOSTFIFOENTRY *pEntry = HGSMILISTENTRY_2_FIFOENTRY(pIns->hostFIFOProcessed.pHead);
    792             HGSMIHOSTFIFOENTRY *pPrev = NULL;
    793 
    794             while (pEntry)
    795             {
    796                 Assert(pEntry->fl == (HGSMI_F_HOST_FIFO_ALLOCATED | HGSMI_F_HOST_FIFO_PROCESSED));
    797 
    798                 if (pEntry->offBuffer == offMem)
     769            /* Search the Processed list for the given offMem. */
     770            HGSMIHOSTFIFOENTRY *pEntry = NULL;
     771
     772            HGSMIHOSTFIFOENTRY *pIter;
     773            RTListForEach(&pIns->hostFIFOProcessed, pIter, HGSMIHOSTFIFOENTRY, nodeEntry)
     774            {
     775                Assert(pIter->fl == (HGSMI_F_HOST_FIFO_ALLOCATED | HGSMI_F_HOST_FIFO_PROCESSED));
     776
     777                if (pIter->offBuffer == offMem)
    799778                {
     779                    pEntry = pIter;
    800780                    break;
    801781                }
    802 
    803                 pPrev = pEntry;
    804                 pEntry = HGSMILISTENTRY_2_FIFOENTRY(pEntry->entry.pNext);
    805782            }
    806783
    807784            if (pEntry)
    808785            {
    809                 /* Exclude from the Processed list. */
    810                 hgsmiListRemove (&pIns->hostFIFOProcessed, &pEntry->entry, &pPrev->entry);
     786                RTListNodeRemove(&pEntry->nodeEntry);
    811787            }
    812788            else
     
    815791                AssertFailed ();
    816792            }
    817 
    818793
    819794            hgsmiFIFOUnlock (pIns);
     
    845820}
    846821
    847 #define HGSMI_SET_COMMAND_PROCESSED_STATE(_pe) \
    848 { \
    849     Assert((_pe)->entry.pNext == NULL); \
    850     Assert((_pe)->fl == (HGSMI_F_HOST_FIFO_ALLOCATED | HGSMI_F_HOST_FIFO_PROCESSED)); \
    851 }
    852 
    853822#if 0
    854823static DECLCALLBACK(void) hgsmiHostCommandRaiseEventCallback (void *pvCallback)
     
    857826    HGSMIHOSTFIFOENTRY *pEntry = (HGSMIHOSTFIFOENTRY *)pvCallback;
    858827
    859     HGSMI_SET_COMMAND_PROCESSED_STATE(pEntry);
     828    Assert(pEntry->fl == (HGSMI_F_HOST_FIFO_ALLOCATED | HGSMI_F_HOST_FIFO_PROCESSED));
    860829
    861830    /* This is a simple callback, just signal the event. */
     
    869838    HGSMIHOSTFIFOENTRY *pEntry = (HGSMIHOSTFIFOENTRY *)pvCallback;
    870839
    871     HGSMI_SET_COMMAND_PROCESSED_STATE(pEntry);
     840    Assert(pEntry->fl == (HGSMI_F_HOST_FIFO_ALLOCATED | HGSMI_F_HOST_FIFO_PROCESSED));
    872841
    873842    /* This is a simple callback, just signal the event. */
     
    900869        if (RT_SUCCESS (rc))
    901870        {
    902             hgsmiListAppend (&pIns->hostFIFO, &pEntry->entry);
     871            RTListAppend(&pIns->hostFIFO, &pEntry->nodeEntry);
    903872            ASMAtomicOrU32(&pIns->pHGFlags->u32HostFlags, HGSMIHOSTFLAGS_COMMANDS_PENDING);
    904873
     
    11791148}
    11801149
    1181 static int hgsmiHostSaveFifoEntryLocked (HGSMIHOSTFIFOENTRY *pEntry, PSSMHANDLE pSSM)
    1182 {
    1183     SSMR3PutU32 (pSSM, pEntry->fl);
    1184     return SSMR3PutU32 (pSSM, pEntry->offBuffer);
    1185 }
    1186 
    1187 static int hgsmiHostSaveFifoLocked (HGSMILIST * pFifo, PSSMHANDLE pSSM)
     1150static int hgsmiHostSaveFifoLocked(RTLISTANCHOR *pList, PSSMHANDLE pSSM)
    11881151{
    11891152    VBOXHGSMI_SAVE_FIFOSTART(pSSM);
    1190     uint32_t size = 0;
    1191     for(HGSMILISTENTRY * pEntry = pFifo->pHead; pEntry; pEntry = pEntry->pNext)
    1192     {
    1193         ++size;
    1194     }
    1195     int rc = SSMR3PutU32 (pSSM, size);
    1196 
    1197     for(HGSMILISTENTRY * pEntry = pFifo->pHead; pEntry && RT_SUCCESS(rc); pEntry = pEntry->pNext)
    1198     {
    1199         HGSMIHOSTFIFOENTRY *pFifoEntry = HGSMILISTENTRY_2_FIFOENTRY(pEntry);
    1200         rc = hgsmiHostSaveFifoEntryLocked (pFifoEntry, pSSM);
     1153
     1154    HGSMIHOSTFIFOENTRY *pIter;
     1155
     1156    uint32_t cEntries = 0;
     1157    RTListForEach(pList, pIter, HGSMIHOSTFIFOENTRY, nodeEntry)
     1158    {
     1159        ++cEntries;
     1160    }
     1161
     1162    int rc = SSMR3PutU32(pSSM, cEntries);
     1163    if (RT_SUCCESS(rc))
     1164    {
     1165        RTListForEach(pList, pIter, HGSMIHOSTFIFOENTRY, nodeEntry)
     1166        {
     1167            SSMR3PutU32(pSSM, pIter->fl);
     1168            rc = SSMR3PutU32(pSSM, pIter->offBuffer);
     1169            if (RT_FAILURE(rc))
     1170            {
     1171                break;
     1172            }
     1173        }
    12011174    }
    12021175
     
    12061179}
    12071180
    1208 static int hgsmiHostSaveGuestCmdCompletedFifoEntryLocked (HGSMIGUESTCOMPLENTRY *pEntry, PSSMHANDLE pSSM)
    1209 {
    1210     return SSMR3PutU32 (pSSM, pEntry->offBuffer);
    1211 }
    1212 
    1213 static int hgsmiHostSaveGuestCmdCompletedFifoLocked (HGSMILIST * pFifo, PSSMHANDLE pSSM)
     1181static int hgsmiHostSaveGuestCmdCompletedFifoLocked(RTLISTANCHOR *pList, PSSMHANDLE pSSM)
    12141182{
    12151183    VBOXHGSMI_SAVE_FIFOSTART(pSSM);
    1216     uint32_t size = 0;
    1217     for(HGSMILISTENTRY * pEntry = pFifo->pHead; pEntry; pEntry = pEntry->pNext)
    1218     {
    1219         ++size;
    1220     }
    1221     int rc = SSMR3PutU32 (pSSM, size);
    1222 
    1223     for(HGSMILISTENTRY * pEntry = pFifo->pHead; pEntry && RT_SUCCESS(rc); pEntry = pEntry->pNext)
    1224     {
    1225         HGSMIGUESTCOMPLENTRY *pFifoEntry = HGSMILISTENTRY_2_HGSMIGUESTCOMPLENTRY(pEntry);
    1226         rc = hgsmiHostSaveGuestCmdCompletedFifoEntryLocked (pFifoEntry, pSSM);
     1184
     1185    HGSMIGUESTCOMPLENTRY *pIter;
     1186
     1187    uint32_t cEntries = 0;
     1188    RTListForEach(pList, pIter, HGSMIGUESTCOMPLENTRY, nodeEntry)
     1189    {
     1190        ++cEntries;
     1191    }
     1192    int rc = SSMR3PutU32(pSSM, cEntries);
     1193    if (RT_SUCCESS(rc))
     1194    {
     1195        RTListForEach(pList, pIter, HGSMIGUESTCOMPLENTRY, nodeEntry)
     1196        {
     1197            rc = SSMR3PutU32(pSSM, pIter->offBuffer);
     1198            if (RT_FAILURE(rc))
     1199            {
     1200                break;
     1201            }
     1202        }
    12271203    }
    12281204
     
    12521228}
    12531229
    1254 static int hgsmiHostLoadFifoLocked (PHGSMIINSTANCE pIns, HGSMILIST * pFifo, PSSMHANDLE pSSM)
     1230static int hgsmiHostLoadFifoLocked(PHGSMIINSTANCE pIns, RTLISTANCHOR *pList, PSSMHANDLE pSSM)
    12551231{
    12561232    VBOXHGSMI_LOAD_FIFOSTART(pSSM);
    12571233
    1258     uint32_t size;
    1259     int rc = SSMR3GetU32 (pSSM, &size); AssertRC(rc);
    1260     if(RT_SUCCESS(rc) && size)
    1261     {
    1262         for(uint32_t i = 0; i < size; ++i)
    1263         {
    1264             HGSMIHOSTFIFOENTRY *pFifoEntry = NULL;  /* initialized to shut up gcc */
    1265             rc = hgsmiHostLoadFifoEntryLocked (pIns, &pFifoEntry, pSSM);
     1234    uint32_t cEntries = 0;
     1235    int rc = SSMR3GetU32(pSSM, &cEntries);
     1236    if (RT_SUCCESS(rc) && cEntries)
     1237    {
     1238        uint32_t i;
     1239        for (i = 0; i < cEntries; ++i)
     1240        {
     1241            HGSMIHOSTFIFOENTRY *pEntry = NULL;
     1242            rc = hgsmiHostLoadFifoEntryLocked(pIns, &pEntry, pSSM);
    12661243            AssertRCBreak(rc);
    1267             hgsmiListAppend (pFifo, &pFifoEntry->entry);
     1244
     1245            RTListAppend(pList, &pEntry->nodeEntry);
    12681246        }
    12691247    }
     
    12891267}
    12901268
    1291 static int hgsmiHostLoadGuestCmdCompletedFifoLocked (PHGSMIINSTANCE pIns, HGSMILIST * pFifo, PSSMHANDLE pSSM, uint32_t u32Version)
     1269static int hgsmiHostLoadGuestCmdCompletedFifoLocked(PHGSMIINSTANCE pIns, RTLISTANCHOR *pList, PSSMHANDLE pSSM, uint32_t u32Version)
    12921270{
    12931271    VBOXHGSMI_LOAD_FIFOSTART(pSSM);
    12941272
    1295     uint32_t size;
    1296     int rc = SSMR3GetU32 (pSSM, &size); AssertRC(rc);
    1297     if(RT_SUCCESS(rc) && size)
     1273    uint32_t i;
     1274
     1275    uint32_t cEntries = 0;
     1276    int rc = SSMR3GetU32(pSSM, &cEntries);
     1277    if (RT_SUCCESS(rc) && cEntries)
    12981278    {
    12991279        if (u32Version > VGA_SAVEDSTATE_VERSION_INV_GCMDFIFO)
    13001280        {
    1301             for(uint32_t i = 0; i < size; ++i)
    1302             {
    1303                 HGSMIGUESTCOMPLENTRY *pFifoEntry = NULL;  /* initialized to shut up gcc */
    1304                 rc = hgsmiHostLoadGuestCmdCompletedFifoEntryLocked (pIns, &pFifoEntry, pSSM);
     1281            for (i = 0; i < cEntries; ++i)
     1282            {
     1283                HGSMIGUESTCOMPLENTRY *pEntry = NULL;
     1284                rc = hgsmiHostLoadGuestCmdCompletedFifoEntryLocked(pIns, &pEntry, pSSM);
    13051285                AssertRCBreak(rc);
    1306                 hgsmiListAppend (pFifo, &pFifoEntry->entry);
     1286
     1287                RTListAppend(pList, &pEntry->nodeEntry);
    13071288            }
    13081289        }
     
    13111292            LogRel(("WARNING: the current saved state version has some 3D support data missing, "
    13121293                    "which may lead to some guest applications function improperly"));
    1313             /* just read out all invalid data and discard it */
    1314             for(uint32_t i = 0; i < size; ++i)
    1315             {
    1316                 HGSMIHOSTFIFOENTRY *pFifoEntry = NULL;  /* initialized to shut up gcc */
    1317                 rc = hgsmiHostLoadFifoEntryLocked (pIns, &pFifoEntry, pSSM);
     1294
     1295            /* Just read out all invalid data and discard it. */
     1296            for (i = 0; i < cEntries; ++i)
     1297            {
     1298                HGSMIHOSTFIFOENTRY *pEntry = NULL;
     1299                rc = hgsmiHostLoadFifoEntryLocked(pIns, &pEntry, pSSM);
    13181300                AssertRCBreak(rc);
    1319                 hgsmiHostFIFOFree (pIns, pFifoEntry);
     1301
     1302                hgsmiHostFIFOFree(pIns, pEntry);
    13201303            }
    13211304        }
     
    18181801        pIns->pfnNotifyGuest = pfnNotifyGuest;
    18191802        pIns->pvNotifyGuest  = pvNotifyGuest;
     1803
     1804        RTListInit(&pIns->hostFIFO);
     1805        RTListInit(&pIns->hostFIFORead);
     1806        RTListInit(&pIns->hostFIFOProcessed);
     1807        RTListInit(&pIns->hostFIFOFree);
     1808        RTListInit(&pIns->guestCmdCompleted);
    18201809    }
    18211810
     
    19121901        if (RT_SUCCESS (rc))
    19131902        {
    1914             hgsmiListAppend (&pIns->guestCmdCompleted, &pEntry->entry);
     1903            RTListAppend(&pIns->guestCmdCompleted, &pEntry->nodeEntry);
    19151904            ASMAtomicOrU32(&pIns->pHGFlags->u32HostFlags, HGSMIHOSTFLAGS_GCOMMAND_COMPLETED);
    19161905
  • trunk/src/VBox/Devices/Graphics/HGSMI/HGSMIHost.h

    r44528 r50550  
    2626#include <VBox/HGSMI/HGSMIChSetup.h>
    2727
    28 struct _HGSMIINSTANCE;
    29 typedef struct _HGSMIINSTANCE *PHGSMIINSTANCE;
     28struct HGSMIINSTANCE;
     29typedef struct HGSMIINSTANCE *PHGSMIINSTANCE;
    3030
    3131/* Callback for the guest notification about a new host buffer. */
注意: 瀏覽 TracChangeset 來幫助您使用更動檢視器

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