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 "packspu.h"
|
---|
8 | #include "cr_string.h"
|
---|
9 | #include "cr_error.h"
|
---|
10 | #include "cr_spu.h"
|
---|
11 | #include "cr_mem.h"
|
---|
12 |
|
---|
13 | #include <stdio.h>
|
---|
14 |
|
---|
15 | static void __setDefaults( void )
|
---|
16 | {
|
---|
17 | crMemZero(pack_spu.context, CR_MAX_CONTEXTS * sizeof(ContextInfo));
|
---|
18 | pack_spu.numContexts = 0;
|
---|
19 |
|
---|
20 | crMemZero(pack_spu.thread, MAX_THREADS * sizeof(ThreadInfo));
|
---|
21 | pack_spu.numThreads = 0;
|
---|
22 | }
|
---|
23 |
|
---|
24 |
|
---|
25 | static void set_emit( void *foo, const char *response )
|
---|
26 | {
|
---|
27 | sscanf( response, "%d", &(pack_spu.emit_GATHER_POST_SWAPBUFFERS) );
|
---|
28 | }
|
---|
29 |
|
---|
30 | static void set_swapbuffer_sync( void *foo, const char *response )
|
---|
31 | {
|
---|
32 | sscanf( response, "%d", &(pack_spu.swapbuffer_sync) );
|
---|
33 | }
|
---|
34 |
|
---|
35 |
|
---|
36 |
|
---|
37 | /* No SPU options yet. Well.. not really..
|
---|
38 | */
|
---|
39 | SPUOptions packSPUOptions[] = {
|
---|
40 | { "emit_GATHER_POST_SWAPBUFFERS", CR_BOOL, 1, "0", NULL, NULL,
|
---|
41 | "Emit a parameter after SwapBuffers", (SPUOptionCB)set_emit },
|
---|
42 |
|
---|
43 | { "swapbuffer_sync", CR_BOOL, 1, "1", NULL, NULL,
|
---|
44 | "Sync on SwapBuffers", (SPUOptionCB) set_swapbuffer_sync },
|
---|
45 |
|
---|
46 | { NULL, CR_BOOL, 0, NULL, NULL, NULL, NULL, NULL },
|
---|
47 | };
|
---|
48 |
|
---|
49 |
|
---|
50 | void packspuSetVBoxConfiguration( const SPU *child_spu )
|
---|
51 | {
|
---|
52 | __setDefaults();
|
---|
53 | pack_spu.emit_GATHER_POST_SWAPBUFFERS = 0;
|
---|
54 | pack_spu.swapbuffer_sync = 0;
|
---|
55 | pack_spu.name = crStrdup("vboxhgcm://llp:7000");
|
---|
56 | pack_spu.buffer_size = 5 * 1024 * 1024;
|
---|
57 | }
|
---|