summaryrefslogtreecommitdiffstats
path: root/src/VBox/GuestHost/OpenGL/packer/pack_init.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-06 03:01:46 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-06 03:01:46 +0000
commitf8fe689a81f906d1b91bb3220acde2a4ecb14c5b (patch)
tree26484e9d7e2c67806c2d1760196ff01aaa858e8c /src/VBox/GuestHost/OpenGL/packer/pack_init.c
parentInitial commit. (diff)
downloadvirtualbox-upstream.tar.xz
virtualbox-upstream.zip
Adding upstream version 6.0.4-dfsg.upstream/6.0.4-dfsgupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/VBox/GuestHost/OpenGL/packer/pack_init.c')
-rw-r--r--src/VBox/GuestHost/OpenGL/packer/pack_init.c74
1 files changed, 74 insertions, 0 deletions
diff --git a/src/VBox/GuestHost/OpenGL/packer/pack_init.c b/src/VBox/GuestHost/OpenGL/packer/pack_init.c
new file mode 100644
index 00000000..8332a5c3
--- /dev/null
+++ b/src/VBox/GuestHost/OpenGL/packer/pack_init.c
@@ -0,0 +1,74 @@
+/* Copyright (c) 2001, Stanford University
+ * All rights reserved
+ *
+ * See the file LICENSE.txt for information on redistributing this software.
+ */
+
+#include "cr_error.h"
+#include "cr_mem.h"
+#include "packer.h"
+#include <stdio.h>
+
+#ifdef CHROMIUM_THREADSAFE
+CRtsd _PackerTSD;
+int cr_packer_globals; /* dummy - for the sake of packer.def */
+#else
+int _PackerTSD; /* dummy - for the sake of packer.def */ /* drm1 */
+DLLDATA(CRPackContext) cr_packer_globals;
+#endif
+
+uint32_t cr_packer_cmd_blocks_enabled = 0;
+
+CRPackContext *crPackNewContext( int swapping )
+{
+#ifdef CHROMIUM_THREADSAFE
+ CRPackContext *pc = crCalloc(sizeof(CRPackContext));
+ if (!pc)
+ return NULL;
+ crInitMutex(&pc->mutex);
+#else
+ GET_PACKER_CONTEXT(pc);
+ crMemZero( pc, sizeof(CRPackContext));
+#endif
+ pc->u32CmdBlockState = 0;
+ pc->swapping = swapping;
+ pc->Flush = NULL;
+ pc->SendHuge = NULL;
+ pc->updateBBOX = 0;
+ return pc;
+}
+
+void crPackDeleteContext(CRPackContext *pc)
+{
+#ifdef CHROMIUM_THREADSAFE
+ crFreeMutex(&pc->mutex);
+ crFree(pc);
+#endif
+}
+
+/* Set packing context for the calling thread */
+void crPackSetContext( CRPackContext *pc )
+{
+#ifdef CHROMIUM_THREADSAFE
+ crSetTSD( &_PackerTSD, pc );
+#else
+ CRASSERT( pc == &cr_packer_globals );
+ (void)pc;
+#endif
+}
+
+
+/* Return packing context for the calling thread */
+CRPackContext *crPackGetContext( void )
+{
+#ifdef CHROMIUM_THREADSAFE
+ return (CRPackContext *) crGetTSD( &_PackerTSD );
+#else
+ return &cr_packer_globals;
+#endif
+}
+
+void crPackCapsSet(uint32_t u32Caps)
+{
+ cr_packer_cmd_blocks_enabled = (u32Caps & (CR_VBOX_CAP_CMDBLOCKS_FLUSH | CR_VBOX_CAP_CMDBLOCKS));
+}