diff options
Diffstat (limited to 'src/gallium/drivers/cell/ppu/cell_screen.c')
-rw-r--r-- | src/gallium/drivers/cell/ppu/cell_screen.c | 221 |
1 files changed, 0 insertions, 221 deletions
diff --git a/src/gallium/drivers/cell/ppu/cell_screen.c b/src/gallium/drivers/cell/ppu/cell_screen.c deleted file mode 100644 index 7ffdcc51bbd..00000000000 --- a/src/gallium/drivers/cell/ppu/cell_screen.c +++ /dev/null | |||
@@ -1,221 +0,0 @@ | |||
1 | /************************************************************************** | ||
2 | * | ||
3 | * Copyright 2008 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 | #include "util/u_memory.h" | ||
30 | #include "util/u_simple_screen.h" | ||
31 | #include "pipe/p_defines.h" | ||
32 | #include "pipe/p_screen.h" | ||
33 | |||
34 | #include "cell/common.h" | ||
35 | #include "cell_context.h" | ||
36 | #include "cell_screen.h" | ||
37 | #include "cell_texture.h" | ||
38 | #include "cell_public.h" | ||
39 | |||
40 | #include "state_tracker/sw_winsys.h" | ||
41 | |||
42 | |||
43 | static const char * | ||
44 | cell_get_vendor(struct pipe_screen *screen) | ||
45 | { | ||
46 | return "VMware, Inc."; | ||
47 | } | ||
48 | |||
49 | |||
50 | static const char * | ||
51 | cell_get_name(struct pipe_screen *screen) | ||
52 | { | ||
53 | return "Cell"; | ||
54 | } | ||
55 | |||
56 | |||
57 | static int | ||
58 | cell_get_param(struct pipe_screen *screen, enum pipe_cap param) | ||
59 | { | ||
60 | switch (param) { | ||
61 | case PIPE_CAP_MAX_COMBINED_SAMPLERS: | ||
62 | return CELL_MAX_SAMPLERS; | ||
63 | case PIPE_CAP_NPOT_TEXTURES: | ||
64 | return 1; | ||
65 | case PIPE_CAP_TWO_SIDED_STENCIL: | ||
66 | return 1; | ||
67 | case PIPE_CAP_ANISOTROPIC_FILTER: | ||
68 | return 0; | ||
69 | case PIPE_CAP_POINT_SPRITE: | ||
70 | return 1; | ||
71 | case PIPE_CAP_MAX_RENDER_TARGETS: | ||
72 | return 1; | ||
73 | case PIPE_CAP_OCCLUSION_QUERY: | ||
74 | return 1; | ||
75 | case PIPE_CAP_TIMER_QUERY: | ||
76 | return 0; | ||
77 | case PIPE_CAP_TEXTURE_SHADOW_MAP: | ||
78 | return 10; | ||
79 | case PIPE_CAP_MAX_TEXTURE_2D_LEVELS: | ||
80 | return CELL_MAX_TEXTURE_LEVELS; | ||
81 | case PIPE_CAP_MAX_TEXTURE_3D_LEVELS: | ||
82 | return 8; /* max 128x128x128 */ | ||
83 | case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS: | ||
84 | return CELL_MAX_TEXTURE_LEVELS; | ||
85 | case PIPE_CAP_TEXTURE_MIRROR_CLAMP: | ||
86 | return 0; /* XXX to do */ | ||
87 | case PIPE_CAP_TGSI_FS_COORD_ORIGIN_UPPER_LEFT: | ||
88 | case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_HALF_INTEGER: | ||
89 | return 1; | ||
90 | case PIPE_CAP_TGSI_FS_COORD_ORIGIN_LOWER_LEFT: | ||
91 | case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER: | ||
92 | return 0; | ||
93 | case PIPE_CAP_BLEND_EQUATION_SEPARATE: | ||
94 | return 1; | ||
95 | default: | ||
96 | return 0; | ||
97 | } | ||
98 | } | ||
99 | |||
100 | static int | ||
101 | cell_get_shader_param(struct pipe_screen *screen, unsigned shader, enum pipe_shader_cap param) | ||
102 | { | ||
103 | switch(shader) | ||
104 | { | ||
105 | case PIPE_SHADER_FRAGMENT: | ||
106 | switch (param) { | ||
107 | case PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS: | ||
108 | return CELL_MAX_SAMPLERS; | ||
109 | default: | ||
110 | return tgsi_exec_get_shader_param(param); | ||
111 | } | ||
112 | case PIPE_SHADER_VERTEX: | ||
113 | case PIPE_SHADER_GEOMETRY: | ||
114 | return draw_get_shader_param(shader, param); | ||
115 | default: | ||
116 | return 0; | ||
117 | } | ||
118 | } | ||
119 | |||
120 | static float | ||
121 | cell_get_paramf(struct pipe_screen *screen, enum pipe_capf param) | ||
122 | { | ||
123 | switch (param) { | ||
124 | case PIPE_CAPF_MAX_LINE_WIDTH: | ||
125 | /* fall-through */ | ||
126 | case PIPE_CAPF_MAX_LINE_WIDTH_AA: | ||
127 | return 255.0; /* arbitrary */ | ||
128 | |||
129 | case PIPE_CAPF_MAX_POINT_WIDTH: | ||
130 | /* fall-through */ | ||
131 | case PIPE_CAPF_MAX_POINT_WIDTH_AA: | ||
132 | return 255.0; /* arbitrary */ | ||
133 | |||
134 | case PIPE_CAPF_MAX_TEXTURE_ANISOTROPY: | ||
135 | return 0.0; | ||
136 | |||
137 | case PIPE_CAPF_MAX_TEXTURE_LOD_BIAS: | ||
138 | return 16.0; /* arbitrary */ | ||
139 | |||
140 | default: | ||
141 | return 0; | ||
142 | } | ||
143 | } | ||
144 | |||
145 | |||
146 | static boolean | ||
147 | cell_is_format_supported( struct pipe_screen *screen, | ||
148 | enum pipe_format format, | ||
149 | enum pipe_texture_target target, | ||
150 | unsigned sample_count, | ||
151 | unsigned tex_usage) | ||
152 | { | ||
153 | struct sw_winsys *winsys = cell_screen(screen)->winsys; | ||
154 | |||
155 | if (sample_count > 1) | ||
156 | return FALSE; | ||
157 | |||
158 | if (tex_usage & (PIPE_BIND_DISPLAY_TARGET | | ||
159 | PIPE_BIND_SCANOUT | | ||
160 | PIPE_BIND_SHARED)) { | ||
161 | if (!winsys->is_displaytarget_format_supported(winsys, tex_usage, format)) | ||
162 | return FALSE; | ||
163 | } | ||
164 | |||
165 | /* only a few formats are known to work at this time */ | ||
166 | switch (format) { | ||
167 | case PIPE_FORMAT_Z24_UNORM_S8_UINT: | ||
168 | case PIPE_FORMAT_Z24X8_UNORM: | ||
169 | case PIPE_FORMAT_B8G8R8A8_UNORM: | ||
170 | case PIPE_FORMAT_I8_UNORM: | ||
171 | return TRUE; | ||
172 | default: | ||
173 | return FALSE; | ||
174 | } | ||
175 | } | ||
176 | |||
177 | |||
178 | static void | ||
179 | cell_destroy_screen( struct pipe_screen *screen ) | ||
180 | { | ||
181 | struct cell_screen *sp_screen = cell_screen(screen); | ||
182 | struct sw_winsys *winsys = sp_screen->winsys; | ||
183 | |||
184 | if(winsys->destroy) | ||
185 | winsys->destroy(winsys); | ||
186 | |||
187 | FREE(screen); | ||
188 | } | ||
189 | |||
190 | |||
191 | |||
192 | /** | ||
193 | * Create a new pipe_screen object | ||
194 | * Note: we're not presently subclassing pipe_screen (no cell_screen) but | ||
195 | * that would be the place to put SPU thread/context info... | ||
196 | */ | ||
197 | struct pipe_screen * | ||
198 | cell_create_screen(struct sw_winsys *winsys) | ||
199 | { | ||
200 | struct cell_screen *screen = CALLOC_STRUCT(cell_screen); | ||
201 | |||
202 | if (!screen) | ||
203 | return NULL; | ||
204 | |||
205 | screen->winsys = winsys; | ||
206 | screen->base.winsys = NULL; | ||
207 | |||
208 | screen->base.destroy = cell_destroy_screen; | ||
209 | |||
210 | screen->base.get_name = cell_get_name; | ||
211 | screen->base.get_vendor = cell_get_vendor; | ||
212 | screen->base.get_param = cell_get_param; | ||
213 | screen->base.get_shader_param = cell_get_shader_param; | ||
214 | screen->base.get_paramf = cell_get_paramf; | ||
215 | screen->base.is_format_supported = cell_is_format_supported; | ||
216 | screen->base.context_create = cell_create_context; | ||
217 | |||
218 | cell_init_screen_texture_funcs(&screen->base); | ||
219 | |||
220 | return &screen->base; | ||
221 | } | ||