VirtualBox

source: vbox/trunk/src/VBox/GuestHost/OpenGL/packer/pack_init.c@ 53592

Last change on this file since 53592 was 52451, checked in by vboxsync, 10 years ago

crOpenGL: command blocks flushing

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 1.6 KB
Line 
1/* Copyright (c) 2001, Stanford University
2 * All rights reserved
3 *
4 * See the file LICENSE.txt for information on redistributing this software.
5 */
6
7#include "cr_error.h"
8#include "cr_mem.h"
9#include "packer.h"
10#include <stdio.h>
11
12#ifdef CHROMIUM_THREADSAFE
13CRtsd _PackerTSD;
14int cr_packer_globals; /* dummy - for the sake of packer.def */
15#else
16int _PackerTSD; /* dummy - for the sake of packer.def */ /* drm1 */
17DLLDATA(CRPackContext) cr_packer_globals;
18#endif
19
20uint32_t cr_packer_cmd_blocks_enabled = 0;
21
22CRPackContext *crPackNewContext( int swapping )
23{
24#ifdef CHROMIUM_THREADSAFE
25 CRPackContext *pc = crCalloc(sizeof(CRPackContext));
26 if (!pc)
27 return NULL;
28 crInitMutex(&pc->mutex);
29#else
30 GET_PACKER_CONTEXT(pc);
31 crMemZero( pc, sizeof(CRPackContext));
32#endif
33 pc->u32CmdBlockState = 0;
34 pc->swapping = swapping;
35 pc->Flush = NULL;
36 pc->SendHuge = NULL;
37 pc->updateBBOX = 0;
38 return pc;
39}
40
41void crPackDeleteContext(CRPackContext *pc)
42{
43#ifdef CHROMIUM_THREADSAFE
44 crFreeMutex(&pc->mutex);
45 crFree(pc);
46#endif
47}
48
49/* Set packing context for the calling thread */
50void crPackSetContext( CRPackContext *pc )
51{
52#ifdef CHROMIUM_THREADSAFE
53 crSetTSD( &_PackerTSD, pc );
54#else
55 CRASSERT( pc == &cr_packer_globals );
56 (void)pc;
57#endif
58}
59
60
61/* Return packing context for the calling thread */
62CRPackContext *crPackGetContext( void )
63{
64#ifdef CHROMIUM_THREADSAFE
65 return (CRPackContext *) crGetTSD( &_PackerTSD );
66#else
67 return &cr_packer_globals;
68#endif
69}
70
71void crPackCapsSet(uint32_t u32Caps)
72{
73 cr_packer_cmd_blocks_enabled = (u32Caps & (CR_VBOX_CAP_CMDBLOCKS_FLUSH | CR_VBOX_CAP_CMDBLOCKS));
74}
Note: See TracBrowser for help on using the repository browser.

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