1 /**************************************************************************
3 * Copyright 2008 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 #include "util/u_memory.h"
30 #include "util/u_simple_screen.h"
31 #include "pipe/p_defines.h"
32 #include "pipe/p_screen.h"
34 #include "cell/common.h"
35 #include "cell_context.h"
36 #include "cell_screen.h"
37 #include "cell_texture.h"
38 #include "cell_buffer.h"
39 #include "cell_public.h"
41 #include "state_tracker/sw_winsys.h"
45 cell_get_vendor(struct pipe_screen *screen)
47 return "VMware, Inc.";
52 cell_get_name(struct pipe_screen *screen)
59 cell_get_param(struct pipe_screen *screen, int param)
62 case PIPE_CAP_MAX_TEXTURE_IMAGE_UNITS:
63 return CELL_MAX_SAMPLERS;
64 case PIPE_CAP_MAX_COMBINED_SAMPLERS:
65 return CELL_MAX_SAMPLERS;
66 case PIPE_CAP_NPOT_TEXTURES:
68 case PIPE_CAP_TWO_SIDED_STENCIL:
72 case PIPE_CAP_ANISOTROPIC_FILTER:
74 case PIPE_CAP_POINT_SPRITE:
76 case PIPE_CAP_MAX_RENDER_TARGETS:
78 case PIPE_CAP_OCCLUSION_QUERY:
80 case PIPE_CAP_TEXTURE_SHADOW_MAP:
82 case PIPE_CAP_MAX_TEXTURE_2D_LEVELS:
83 return CELL_MAX_TEXTURE_LEVELS;
84 case PIPE_CAP_MAX_TEXTURE_3D_LEVELS:
85 return 8; /* max 128x128x128 */
86 case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS:
87 return CELL_MAX_TEXTURE_LEVELS;
88 case PIPE_CAP_TEXTURE_MIRROR_REPEAT:
89 return 1; /* XXX not really true */
90 case PIPE_CAP_TEXTURE_MIRROR_CLAMP:
91 return 0; /* XXX to do */
92 case PIPE_CAP_TGSI_CONT_SUPPORTED:
94 case PIPE_CAP_TGSI_FS_COORD_ORIGIN_UPPER_LEFT:
95 case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_HALF_INTEGER:
97 case PIPE_CAP_TGSI_FS_COORD_ORIGIN_LOWER_LEFT:
98 case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER:
100 case PIPE_CAP_BLEND_EQUATION_SEPARATE:
109 cell_get_paramf(struct pipe_screen *screen, int param)
112 case PIPE_CAP_MAX_LINE_WIDTH:
114 case PIPE_CAP_MAX_LINE_WIDTH_AA:
115 return 255.0; /* arbitrary */
117 case PIPE_CAP_MAX_POINT_WIDTH:
119 case PIPE_CAP_MAX_POINT_WIDTH_AA:
120 return 255.0; /* arbitrary */
122 case PIPE_CAP_MAX_TEXTURE_ANISOTROPY:
125 case PIPE_CAP_MAX_TEXTURE_LOD_BIAS:
126 return 16.0; /* arbitrary */
135 cell_is_format_supported( struct pipe_screen *screen,
136 enum pipe_format format,
137 enum pipe_texture_target target,
139 unsigned geom_flags )
142 struct sw_winsys *winsys = cell_screen(screen)->winsys;
144 if (tex_usage & (PIPE_TEXTURE_USAGE_DISPLAY_TARGET |
145 PIPE_TEXTURE_USAGE_SCANOUT |
146 PIPE_TEXTURE_USAGE_SHARED)) {
147 if (!winsys->is_displaytarget_format_supported(winsys, tex_usage, format))
151 /* only a few formats are known to work at this time */
153 case PIPE_FORMAT_Z24_UNORM_S8_USCALED:
154 case PIPE_FORMAT_Z24X8_UNORM:
155 case PIPE_FORMAT_B8G8R8A8_UNORM:
156 case PIPE_FORMAT_I8_UNORM:
165 cell_destroy_screen( struct pipe_screen *screen )
167 struct cell_screen *sp_screen = cell_screen(screen);
168 struct sw_winsys *winsys = sp_screen->winsys;
171 winsys->destroy(winsys);
179 * Create a new pipe_screen object
180 * Note: we're not presently subclassing pipe_screen (no cell_screen) but
181 * that would be the place to put SPU thread/context info...
184 cell_create_screen(struct sw_winsys *winsys)
186 struct cell_screen *screen = CALLOC_STRUCT(cell_screen);
191 screen->winsys = winsys;
192 screen->base.winsys = NULL;
194 screen->base.destroy = cell_destroy_screen;
196 screen->base.get_name = cell_get_name;
197 screen->base.get_vendor = cell_get_vendor;
198 screen->base.get_param = cell_get_param;
199 screen->base.get_paramf = cell_get_paramf;
200 screen->base.is_format_supported = cell_is_format_supported;
201 screen->base.context_create = cell_create_context;
203 cell_init_screen_texture_funcs(&screen->base);
204 cell_init_screen_buffer_funcs(&screen->base);
206 return &screen->base;