VirtualBox

Changeset 56473 in vbox


Ignore:
Timestamp:
Jun 17, 2015 11:08:31 AM (10 years ago)
Author:
vboxsync
Message:

Host 3D: extend SPU structure with interface for save/restore internal SPU state; provide plug for Expando SPU saving state; drop unused and confusing stuff from DLM module.

Location:
trunk/src/VBox
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/GuestHost/OpenGL/spu_loader/dispatchheader.py

    r15532 r56473  
    4949print 'struct _copy_list_node;'
    5050print ''
     51print '/* Prototype for SPU internal state load/unload callbacks. */'
     52print ''
     53print 'typedef int (*SPUStateFunc_t)(void *);'
     54print ''
    5155print '/* The SPU dispatch table */'
    5256print 'typedef struct _spu_dispatch_table {'
     
    6064        int mark;
    6165        void *server;           
     66        SPUStateFunc_t spu_save_state; /* Save SPU internal state callback (optional) */
     67        SPUStateFunc_t spu_load_state; /* Load SPU internal state callback (optional) */
    6268} SPUDispatchTable;
    6369
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_main.c

    r55971 r56473  
    16841684
    16851685#ifdef VBOX_WITH_CR_DISPLAY_LISTS
    1686     rc = crDLMSaveState();
    1687     AssertRCReturn(rc, rc);
     1686    if (cr_server.head_spu->dispatch_table.spu_save_state)
     1687    {
     1688        rc = cr_server.head_spu->dispatch_table.spu_save_state("NULL");
     1689        AssertRCReturn(rc, rc);
     1690    }
     1691    else
     1692        crDebug("Do not save %s SPU state: no interface exported.", cr_server.head_spu->name);
    16881693#endif
    16891694
  • trunk/src/VBox/HostServices/SharedOpenGL/dlm/dlm.c

    r55762 r56473  
    614614}
    615615
    616 CRDLMError DLM_APIENTRY crDLMGetDLMBounds(CRDLM *dlm, unsigned long listIdentifier, CRDLMBounds *bounds)
    617 {
    618         DLMListInfo *listInfo
    619                 = (DLMListInfo *) crHashtableSearch(dlm->displayLists, listIdentifier);
    620         if (listInfo) {
    621                 *bounds = listInfo->bbox;
    622                 return GL_NO_ERROR;
    623         }
    624         else {
    625                 return GL_INVALID_OPERATION;
    626         }
    627 }
    628 
    629 CRDLMError DLM_APIENTRY crDLMGetBounds(unsigned long listIdentifier, CRDLMBounds *bounds)
    630 {
    631     CRDLMContextState *listState = CURRENT_STATE();
    632     if (listState) {
    633         return crDLMGetDLMBounds(listState->dlm, listIdentifier, bounds);
    634     }
    635     else {
    636         return CRDLM_ERROR_STATE;
    637     }
    638 }
    639 
    640 
    641 /**
    642  * Set the bounding box for a display list.
    643  */
    644 void DLM_APIENTRY crDLMSetDLMBounds(CRDLM *dlm, unsigned long listIdentifier,
    645                double xmin, double ymin, double zmin,
    646                double xmax, double ymax, double zmax)
    647 {
    648         DLMListInfo *listInfo
    649                 = (DLMListInfo *) crHashtableSearch(dlm->displayLists, listIdentifier);
    650         if (!listInfo) {
    651                 /* allocate a list info now */
    652                 CRDLMContextState *listState = CURRENT_STATE();
    653                 listInfo = (DLMListInfo *) crCalloc(sizeof(DLMListInfo));
    654                 crHashtableReplace(listState->dlm->displayLists,
    655                                                                                          listIdentifier, listInfo, crdlm_free_list);
    656         }
    657         if (listInfo) {
    658                 listInfo->bbox.xmin = xmin;
    659                 listInfo->bbox.ymin = ymin;
    660                 listInfo->bbox.zmin = zmin;
    661                 listInfo->bbox.xmax = xmax;
    662                 listInfo->bbox.ymax = ymax;
    663                 listInfo->bbox.zmax = zmax;
    664         }
    665 }
    666 
    667 void DLM_APIENTRY crDLMSetBounds(unsigned long listIdentifier,
    668                double xmin, double ymin, double zmin,
    669                double xmax, double ymax, double zmax)
    670 {
    671     CRDLMContextState *listState = CURRENT_STATE();
    672     if (listState) {
    673         crDLMSetDLMBounds(listState->dlm, listIdentifier,
    674             xmin, ymin, zmin, xmax, ymax, zmax);
    675     }
    676 }
    677 
    678 /**
    679  * Return GL_TRUE if the given list has a valid bounding box
    680  */
    681 GLboolean DLM_APIENTRY crDLMListHasDLMBounds(CRDLM *dlm, unsigned long listIdentifier)
    682 {
    683         DLMListInfo *listInfo
    684                 = (DLMListInfo *) crHashtableSearch(dlm->displayLists, listIdentifier);
    685         if (listInfo)
    686                 return listInfo->bbox.xmin != FLT_MAX;
    687         else
    688                 return GL_FALSE;
    689 }
    690 
    691 GLboolean DLM_APIENTRY crDLMListHasBounds(unsigned long listIdentifier)
    692 {
    693     CRDLMContextState *listState = CURRENT_STATE();
    694     if (listState) {
    695         return crDLMListHasDLMBounds(listState->dlm, listIdentifier);
    696     }
    697     return 0;
    698 }
    699 
    700616/*
    701617 * Return id of list currently being compiled.  Returns 0 of there's no
     
    734650}
    735651
     652static void crDLMSaveListsCb(unsigned long key, void *pData1, void *pData2 /* unused */ )
     653{
     654    DLMListInfo *pListInfo = (DLMListInfo*)pData1;
     655
     656    if (pListInfo)
     657    {
     658        crDebug("Saving Display Lists: found ID=%u, numInstances=%d, references=%p.",
     659            key, pListInfo->numInstances, pListInfo->references);
     660
     661        DLMInstanceList *pInstance = pListInfo->first;
     662        while (pInstance) {
     663            crDebug("\t%p", pInstance->execute);
     664            pInstance = pInstance->next;
     665        }
     666    }
     667    else
     668        crError("Saving Display Lists: found record with no data. Skipping.");
     669}
     670
    736671int32_t DLM_APIENTRY crDLMSaveState(void)
    737672{
     673    CRDLMContextState *pListState = CURRENT_STATE();
     674
     675    if (pListState)
     676        crHashtableWalk(pListState->dlm->displayLists, crDLMSaveListsCb, (void *)NULL);
     677    else
     678        crDebug("Saving Display Lists: no data to save.");
     679
    738680    return 0;
    739681}
  • trunk/src/VBox/HostServices/SharedOpenGL/dlm/dlm_generated.py

    r55762 r56473  
    8686        print ' DLMInstanceList *stateNext;'
    8787        print ' int cbInstance;'
     88        print ' VBoxDLOpCode iVBoxOpCode;'
    8889        print ' void (DLM_APIENTRY *execute)(DLMInstanceList *instance, SPUDispatchTable *dispatchTable);'
    8990        for (name, type, vecSize) in params:
     
    323324        print '\tinstance->cbInstance = sizeof(struct instance%s);' % functionName
    324325       
     326        # Set OPCODE.
     327        print '\tinstance->iVBoxOpCode = VBOX_DL_OPCODE_%s;' % functionName
     328       
    325329        # If there's a pointer parameter, apply it.
    326330        if len(pointers) == 1:
  • trunk/src/VBox/HostServices/SharedOpenGL/dlm/dlm_header.py

    r55762 r56473  
    77# mode is "header" or "defs"
    88mode = sys.argv[1]
     9
     10keys = apiutil.GetDispatchedFunctions(sys.argv[2]+"/APIspec.txt")
    911
    1012# Any new function implemented in the DLM has to have an entry added here.
     
    3638        ('CRDLMError DLM_APIENTRY', 'crDLMDeleteListContent', 'CRDLM *dlm, unsigned long listIdentifier'),
    3739        ('int DLM_APIENTRY', 'crDLMGetReferences', 'CRDLM *dlm, unsigned long listIdentifier, int firstIndex, int sizeofBuffer, unsigned int *buffer'),
    38         ('CRDLMError DLM_APIENTRY', 'crDLMGetDLMBounds', 'CRDLM *dlm, unsigned long listIdentifier, CRDLMBounds *bounds'),
    39         ('CRDLMError DLM_APIENTRY', 'crDLMGetBounds', 'unsigned long listIdentifier, CRDLMBounds *bounds'),
    40         ('void DLM_APIENTRY', 'crDLMSetDLMBounds', 'CRDLM *dlm, unsigned long listIdentifier, double xmin, double ymin, double zmin, double xmax, double ymax, double zmax'),
    41         ('void DLM_APIENTRY', 'crDLMSetBounds', 'unsigned long listIdentifier, double xmin, double ymin, double zmin, double xmax, double ymax, double zmax'),
    4240        ('void DLM_APIENTRY', 'crDLMComputeBoundingBox', 'unsigned long listId'),
    43         ('GLboolean DLM_APIENTRY', 'crDLMListHasDLMBounds', 'CRDLM *dlm, unsigned long listIdentifier'),
    44         ('GLboolean DLM_APIENTRY', 'crDLMListHasBounds', 'unsigned long listIdentifier'),
    4541        ('GLuint DLM_APIENTRY', 'crDLMGetCurrentList', 'void'),
    4642        ('GLenum DLM_APIENTRY', 'crDLMGetCurrentMode', 'void'),
     
    5955
    6056if mode == 'header':
    61         print """#ifndef CR_DLM_H
     57    print """#ifndef CR_DLM_H
    6258
    6359/* DO NOT EDIT.  This file is auto-generated by %s. */
     
    7975#include "cr_threads.h"
    8076#endif
    81 
     77""" % os.path.basename(sys.argv[0])
     78
     79    # Generate operation codes enum to be used for saving and restoring lists.
     80    print "/* OpCodes codes enum to be used for saving and restoring lists. */"
     81    print "typedef enum {"
     82
     83    for func_name in keys:
     84        print "    VBOX_DL_OPCODE_%s," % func_name
     85
     86    print "} VBoxDLOpCode;"
     87
     88    print """
    8289/* 3D bounding box */
    8390typedef struct {
     
    96103        struct DLMInstanceList *next;
    97104        struct DLMInstanceList *stateNext;
    98         int    cbInstance;
     105        int                     cbInstance;
     106        VBoxDLOpCode            iVBoxOpCode; /* This field name should not interfere w/ OpenGL function parameters names (for example w/ param 'opcode' for glLogicOp()). */
    99107        void (*execute)(struct DLMInstanceList *instance, SPUDispatchTable *dispatchTable);
    100108} DLMInstanceList;
     
    191199extern "C" {
    192200#endif
    193 """ % os.path.basename(sys.argv[0])
     201"""
    194202elif mode == 'defs':
    195203        apiutil.CopyrightDef()
     
    215223
    216224
    217 keys = apiutil.GetDispatchedFunctions(sys.argv[2]+"/APIspec.txt")
     225
    218226for func_name in keys:
    219227        props = apiutil.Properties(func_name)
  • trunk/src/VBox/HostServices/SharedOpenGL/dlm/dlm_lists.c

    r54905 r56473  
    9595    listState->currentListIdentifier = listIdentifier;
    9696    listState->currentListMode = mode;
     97
     98    crDebug("Display Lists: create new with guest ID %u.", listIdentifier);
    9799}
    98100
  • trunk/src/VBox/HostServices/SharedOpenGL/expando/expandospu_init.c

    r54905 r56473  
    1919        _cr_expando_table /* THE ACTUAL FUNCTIONS */
    2020};
     21
     22static int
     23expandoSPUSaveState(void *pData)
     24{
     25    crDebug("Saving state of Expando SPU.");
     26    crDLMSaveState();
     27    return 0;
     28}
    2129
    2230static SPUFunctions *
     
    4856        /* We'll be using the state tracker for each context */
    4957        crStateInit();
     58
     59    /* Export optional interfaces for SPU save/restore. */
     60    self->dispatch_table.spu_save_state = expandoSPUSaveState;
    5061
    5162        return &expando_functions;
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