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 "pipe/p_util.h"
30 #include "pipe/p_winsys.h"
33 #include "i915_context.h"
34 #include "i915_screen.h"
35 #include "i915_texture.h"
39 i915_get_vendor( struct pipe_screen
*pscreen
)
41 return "Tungsten Graphics, Inc.";
46 i915_get_name( struct pipe_screen
*pscreen
)
48 static char buffer
[128];
51 switch (i915_screen(pscreen
)->pci_id
) {
55 case PCI_CHIP_I915_GM
:
61 case PCI_CHIP_I945_GM
:
64 case PCI_CHIP_I945_GME
:
81 sprintf(buffer
, "i915 (chipset: %s)", chipset
);
87 i915_get_param(struct pipe_screen
*screen
, int param
)
90 case PIPE_CAP_MAX_TEXTURE_IMAGE_UNITS
:
92 case PIPE_CAP_NPOT_TEXTURES
:
94 case PIPE_CAP_TWO_SIDED_STENCIL
:
100 case PIPE_CAP_ANISOTROPIC_FILTER
:
102 case PIPE_CAP_POINT_SPRITE
:
104 case PIPE_CAP_MAX_RENDER_TARGETS
:
106 case PIPE_CAP_OCCLUSION_QUERY
:
108 case PIPE_CAP_TEXTURE_SHADOW_MAP
:
110 case PIPE_CAP_MAX_TEXTURE_2D_LEVELS
:
111 return 11; /* max 1024x1024 */
112 case PIPE_CAP_MAX_TEXTURE_3D_LEVELS
:
113 return 8; /* max 128x128x128 */
114 case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS
:
115 return 11; /* max 1024x1024 */
123 i915_get_paramf(struct pipe_screen
*screen
, int param
)
126 case PIPE_CAP_MAX_LINE_WIDTH
:
128 case PIPE_CAP_MAX_LINE_WIDTH_AA
:
131 case PIPE_CAP_MAX_POINT_WIDTH
:
133 case PIPE_CAP_MAX_POINT_WIDTH_AA
:
136 case PIPE_CAP_MAX_TEXTURE_ANISOTROPY
:
139 case PIPE_CAP_MAX_TEXTURE_LOD_BIAS
:
149 i915_is_format_supported( struct pipe_screen
*screen
,
150 enum pipe_format format
, uint type
)
152 static const enum pipe_format tex_supported
[] = {
153 PIPE_FORMAT_R8G8B8A8_UNORM
,
154 PIPE_FORMAT_A8R8G8B8_UNORM
,
155 PIPE_FORMAT_R5G6B5_UNORM
,
161 PIPE_FORMAT_YCBCR_REV
,
162 PIPE_FORMAT_S8Z24_UNORM
,
163 PIPE_FORMAT_NONE
/* list terminator */
165 static const enum pipe_format surface_supported
[] = {
166 PIPE_FORMAT_A8R8G8B8_UNORM
,
167 PIPE_FORMAT_R5G6B5_UNORM
,
168 PIPE_FORMAT_S8Z24_UNORM
,
169 /*PIPE_FORMAT_R16G16B16A16_SNORM,*/
170 PIPE_FORMAT_NONE
/* list terminator */
172 const enum pipe_format
*list
;
177 list
= tex_supported
;
180 list
= surface_supported
;
186 for (i
= 0; list
[i
] != PIPE_FORMAT_NONE
; i
++) {
187 if (list
[i
] == format
)
196 i915_destroy_screen( struct pipe_screen
*screen
)
203 * Create a new i915_screen object
206 i915_create_screen(struct pipe_winsys
*winsys
, uint pci_id
)
208 struct i915_screen
*i915screen
= CALLOC_STRUCT(i915_screen
);
214 case PCI_CHIP_I915_G
:
215 case PCI_CHIP_I915_GM
:
216 i915screen
->is_i945
= FALSE
;
219 case PCI_CHIP_I945_G
:
220 case PCI_CHIP_I945_GM
:
221 case PCI_CHIP_I945_GME
:
225 i915screen
->is_i945
= TRUE
;
229 winsys
->printf(winsys
,
230 "%s: unknown pci id 0x%x, cannot create screen\n",
231 __FUNCTION__
, pci_id
);
235 i915screen
->pci_id
= pci_id
;
237 i915screen
->screen
.winsys
= winsys
;
239 i915screen
->screen
.destroy
= i915_destroy_screen
;
241 i915screen
->screen
.get_name
= i915_get_name
;
242 i915screen
->screen
.get_vendor
= i915_get_vendor
;
243 i915screen
->screen
.get_param
= i915_get_param
;
244 i915screen
->screen
.get_paramf
= i915_get_paramf
;
245 i915screen
->screen
.is_format_supported
= i915_is_format_supported
;
247 i915_init_screen_texture_functions(&i915screen
->screen
);
249 return &i915screen
->screen
;