1 /**************************************************************************
3 * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sub license, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21 * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
22 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 **************************************************************************/
29 /* main() for Cell SPU code */
35 #include "pipe/p_defines.h"
37 #include "spu_funcs.h"
38 #include "spu_command.h"
40 #include "spu_per_fragment_op.h"
41 #include "spu_texture.h"
42 //#include "spu_test.h"
43 #include "cell/common.h"
48 /usr/lib/gcc/spu/4.1.1/include/spu_mfcio.h
49 /opt/cell/sdk/usr/include/libmisc.h
52 struct spu_global spu
;
58 memset(spu
.ctile_status
, TILE_STATUS_DEFINED
, sizeof(spu
.ctile_status
));
59 memset(spu
.ztile_status
, TILE_STATUS_DEFINED
, sizeof(spu
.ztile_status
));
60 invalidate_tex_cache();
63 /* In some versions of the SDK the SPE main takes 'unsigned long' as a
64 * parameter. In others it takes 'unsigned long long'. Use a define to
65 * select between the two.
67 #ifdef SPU_MAIN_PARAM_LONG_LONG
68 typedef unsigned long long main_param_t
;
70 typedef unsigned long main_param_t
;
77 main(main_param_t speid
, main_param_t argp
)
83 ASSERT(sizeof(tile_t
) == TILE_SIZE
* TILE_SIZE
* 4);
84 ASSERT(sizeof(struct cell_command_render
) % 8 == 0);
85 ASSERT(sizeof(struct cell_command_fragment_ops
) % 8 == 0);
86 ASSERT(((unsigned long) &spu
.fragment_program_code
) % 8 == 0);
91 D_PRINTF(CELL_DEBUG_CMD
, "main() speid=%lu\n", (unsigned long) speid
);
92 D_PRINTF(CELL_DEBUG_FRAGMENT_OP_FALLBACK
, "using fragment op fallback\n");
94 /* get initialization data */
95 mfc_get(&spu
.init
, /* dest */
96 (unsigned int) argp
, /* src */
97 sizeof(struct cell_init_info
), /* bytes */
101 wait_on_mask( 1 << tag
);
103 if (spu
.init
.id
== 0) {
104 return_function_info();
109 spu_test_misc(spu
.init
.id
);