Changeset 56473 in vbox
- Timestamp:
- Jun 17, 2015 11:08:31 AM (10 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/GuestHost/OpenGL/spu_loader/dispatchheader.py
r15532 r56473 49 49 print 'struct _copy_list_node;' 50 50 print '' 51 print '/* Prototype for SPU internal state load/unload callbacks. */' 52 print '' 53 print 'typedef int (*SPUStateFunc_t)(void *);' 54 print '' 51 55 print '/* The SPU dispatch table */' 52 56 print 'typedef struct _spu_dispatch_table {' … … 60 64 int mark; 61 65 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) */ 62 68 } SPUDispatchTable; 63 69 -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_main.c
r55971 r56473 1684 1684 1685 1685 #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); 1688 1693 #endif 1689 1694 -
trunk/src/VBox/HostServices/SharedOpenGL/dlm/dlm.c
r55762 r56473 614 614 } 615 615 616 CRDLMError DLM_APIENTRY crDLMGetDLMBounds(CRDLM *dlm, unsigned long listIdentifier, CRDLMBounds *bounds)617 {618 DLMListInfo *listInfo619 = (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 *listInfo649 = (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 box680 */681 GLboolean DLM_APIENTRY crDLMListHasDLMBounds(CRDLM *dlm, unsigned long listIdentifier)682 {683 DLMListInfo *listInfo684 = (DLMListInfo *) crHashtableSearch(dlm->displayLists, listIdentifier);685 if (listInfo)686 return listInfo->bbox.xmin != FLT_MAX;687 else688 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 700 616 /* 701 617 * Return id of list currently being compiled. Returns 0 of there's no … … 734 650 } 735 651 652 static 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 736 671 int32_t DLM_APIENTRY crDLMSaveState(void) 737 672 { 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 738 680 return 0; 739 681 } -
trunk/src/VBox/HostServices/SharedOpenGL/dlm/dlm_generated.py
r55762 r56473 86 86 print ' DLMInstanceList *stateNext;' 87 87 print ' int cbInstance;' 88 print ' VBoxDLOpCode iVBoxOpCode;' 88 89 print ' void (DLM_APIENTRY *execute)(DLMInstanceList *instance, SPUDispatchTable *dispatchTable);' 89 90 for (name, type, vecSize) in params: … … 323 324 print '\tinstance->cbInstance = sizeof(struct instance%s);' % functionName 324 325 326 # Set OPCODE. 327 print '\tinstance->iVBoxOpCode = VBOX_DL_OPCODE_%s;' % functionName 328 325 329 # If there's a pointer parameter, apply it. 326 330 if len(pointers) == 1: -
trunk/src/VBox/HostServices/SharedOpenGL/dlm/dlm_header.py
r55762 r56473 7 7 # mode is "header" or "defs" 8 8 mode = sys.argv[1] 9 10 keys = apiutil.GetDispatchedFunctions(sys.argv[2]+"/APIspec.txt") 9 11 10 12 # Any new function implemented in the DLM has to have an entry added here. … … 36 38 ('CRDLMError DLM_APIENTRY', 'crDLMDeleteListContent', 'CRDLM *dlm, unsigned long listIdentifier'), 37 39 ('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'),42 40 ('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'),45 41 ('GLuint DLM_APIENTRY', 'crDLMGetCurrentList', 'void'), 46 42 ('GLenum DLM_APIENTRY', 'crDLMGetCurrentMode', 'void'), … … 59 55 60 56 if mode == 'header': 61 57 print """#ifndef CR_DLM_H 62 58 63 59 /* DO NOT EDIT. This file is auto-generated by %s. */ … … 79 75 #include "cr_threads.h" 80 76 #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 """ 82 89 /* 3D bounding box */ 83 90 typedef struct { … … 96 103 struct DLMInstanceList *next; 97 104 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()). */ 99 107 void (*execute)(struct DLMInstanceList *instance, SPUDispatchTable *dispatchTable); 100 108 } DLMInstanceList; … … 191 199 extern "C" { 192 200 #endif 193 """ % os.path.basename(sys.argv[0])201 """ 194 202 elif mode == 'defs': 195 203 apiutil.CopyrightDef() … … 215 223 216 224 217 keys = apiutil.GetDispatchedFunctions(sys.argv[2]+"/APIspec.txt") 225 218 226 for func_name in keys: 219 227 props = apiutil.Properties(func_name) -
trunk/src/VBox/HostServices/SharedOpenGL/dlm/dlm_lists.c
r54905 r56473 95 95 listState->currentListIdentifier = listIdentifier; 96 96 listState->currentListMode = mode; 97 98 crDebug("Display Lists: create new with guest ID %u.", listIdentifier); 97 99 } 98 100 -
trunk/src/VBox/HostServices/SharedOpenGL/expando/expandospu_init.c
r54905 r56473 19 19 _cr_expando_table /* THE ACTUAL FUNCTIONS */ 20 20 }; 21 22 static int 23 expandoSPUSaveState(void *pData) 24 { 25 crDebug("Saving state of Expando SPU."); 26 crDLMSaveState(); 27 return 0; 28 } 21 29 22 30 static SPUFunctions * … … 48 56 /* We'll be using the state tracker for each context */ 49 57 crStateInit(); 58 59 /* Export optional interfaces for SPU save/restore. */ 60 self->dispatch_table.spu_save_state = expandoSPUSaveState; 50 61 51 62 return &expando_functions;
Note:
See TracChangeset
for help on using the changeset viewer.