Cell: fix asst. warnings
[mesa.git] / src / mesa / pipe / cell / ppu / cell_clear.c
1 /**************************************************************************
2 *
3 * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
4 * All Rights Reserved.
5 *
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:
13 *
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
16 * of the Software.
17 *
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.
25 *
26 **************************************************************************/
27
28 /**
29 * Authors
30 * Brian Paul
31 */
32
33 #include <stdio.h>
34 #include <assert.h>
35 #include <stdint.h>
36 #include "pipe/p_inlines.h"
37 #include "pipe/p_util.h"
38 #include "pipe/cell/common.h"
39 #include "cell_clear.h"
40 #include "cell_context.h"
41 #include "cell_batch.h"
42 #include "cell_flush.h"
43 #include "cell_spu.h"
44
45
46 void
47 cell_clear_surface(struct pipe_context *pipe, struct pipe_surface *ps,
48 unsigned clearValue)
49 {
50 struct cell_context *cell = cell_context(pipe);
51 /*uint i;*/
52 uint surfIndex;
53
54 if (!cell->cbuf_map[0])
55 cell->cbuf_map[0] = pipe_surface_map(ps);
56
57 if (ps == cell->framebuffer.zsbuf) {
58 surfIndex = 1;
59 }
60 else {
61 surfIndex = 0;
62 }
63
64 #if 0
65 for (i = 0; i < cell->num_spus; i++) {
66 #if 1
67 uint clr = clearValue;
68 if (surfIndex == 0) {
69 /* XXX debug: clear color varied per-SPU to visualize tiles */
70 if ((clr & 0xff) == 0)
71 clr |= 64 + i * 8;
72 if ((clr & 0xff00) == 0)
73 clr |= (64 + i * 8) << 8;
74 if ((clr & 0xff0000) == 0)
75 clr |= (64 + i * 8) << 16;
76 if ((clr & 0xff000000) == 0)
77 clr |= (64 + i * 8) << 24;
78 }
79 cell_global.command[i].clear.value = clr;
80 #else
81 cell_global.command[i].clear.value = clearValue;
82 #endif
83 cell_global.command[i].clear.surface = surfIndex;
84 send_mbox_message(cell_global.spe_contexts[i], CELL_CMD_CLEAR_SURFACE);
85 }
86 #else
87 {
88 struct cell_command_clear_surface *clr
89 = (struct cell_command_clear_surface *)
90 cell_batch_alloc(cell, sizeof(*clr));
91 clr->opcode = CELL_CMD_CLEAR_SURFACE;
92 clr->surface = surfIndex;
93 clr->value = clearValue;
94 }
95 #endif
96
97 /* XXX temporary */
98 cell_flush(&cell->pipe, 0x0);
99
100 }