blob: 96633d93654df5c5faf1ee08f175043e35780e6d [file] [log] [blame]
José Fonseca946f4322009-07-26 23:44:38 +01001/**************************************************************************
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"
José Fonseca39be50d2010-04-24 13:20:39 +010030#include "util/u_math.h"
31#include "util/u_cpu_detect.h"
José Fonsecab3755262009-11-10 17:51:06 -080032#include "util/u_format.h"
José Fonsecafe130a72010-04-06 22:49:57 +010033#include "util/u_format_s3tc.h"
José Fonseca946f4322009-07-26 23:44:38 +010034#include "pipe/p_defines.h"
35#include "pipe/p_screen.h"
Luca Barbieria508d2d2010-09-05 20:50:50 +020036#include "draw/draw_context.h"
José Fonseca946f4322009-07-26 23:44:38 +010037
38#include "lp_texture.h"
Brian Paul2876b682009-12-11 17:32:45 -070039#include "lp_fence.h"
José Fonseca08dd41f2009-08-23 05:52:20 +010040#include "lp_jit.h"
José Fonseca946f4322009-07-26 23:44:38 +010041#include "lp_screen.h"
Keith Whitwell7f41f542010-02-08 12:55:59 +000042#include "lp_context.h"
Keith Whitwelldec35d02009-10-09 14:59:35 +010043#include "lp_debug.h"
Keith Whitwell3c57c012010-03-09 15:25:42 +000044#include "lp_public.h"
José Fonseca39be50d2010-04-24 13:20:39 +010045#include "lp_limits.h"
Roland Scheideggeredac7402010-07-13 19:58:58 +020046#include "lp_rast.h"
Keith Whitwelldec35d02009-10-09 14:59:35 +010047
Keith Whitwell23e951d2010-03-04 16:23:05 +000048#include "state_tracker/sw_winsys.h"
49
Keith Whitwelldec35d02009-10-09 14:59:35 +010050#ifdef DEBUG
51int LP_DEBUG = 0;
52
53static const struct debug_named_value lp_debug_flags[] = {
Joakim Sindholt8413b922010-06-01 20:11:30 +020054 { "pipe", DEBUG_PIPE, NULL },
55 { "tgsi", DEBUG_TGSI, NULL },
56 { "tex", DEBUG_TEX, NULL },
57 { "setup", DEBUG_SETUP, NULL },
58 { "rast", DEBUG_RAST, NULL },
59 { "query", DEBUG_QUERY, NULL },
60 { "screen", DEBUG_SCREEN, NULL },
61 { "show_tiles", DEBUG_SHOW_TILES, NULL },
62 { "show_subtiles", DEBUG_SHOW_SUBTILES, NULL },
63 { "counters", DEBUG_COUNTERS, NULL },
Keith Whitwellb6e03ea2010-08-20 15:14:19 +010064 { "scene", DEBUG_SCENE, NULL },
65 { "fence", DEBUG_FENCE, NULL },
Keith Whitwellbc759cd2010-09-08 18:37:45 +010066 { "mem", DEBUG_MEM, NULL },
Keith Whitwell09863552010-09-16 15:16:27 +010067 { "fs", DEBUG_FS, NULL },
Joakim Sindholt8413b922010-06-01 20:11:30 +020068 DEBUG_NAMED_VALUE_END
Keith Whitwelldec35d02009-10-09 14:59:35 +010069};
70#endif
José Fonseca946f4322009-07-26 23:44:38 +010071
Keith Whitwell5f008192010-09-16 10:45:52 +010072int LP_PERF = 0;
73static const struct debug_named_value lp_perf_flags[] = {
74 { "texmem", PERF_TEX_MEM, NULL },
75 { "no_mipmap", PERF_NO_MIPMAPS, NULL },
76 { "no_linear", PERF_NO_LINEAR, NULL },
77 { "no_mip_linear", PERF_NO_MIP_LINEAR, NULL },
78 { "no_tex", PERF_NO_TEX, NULL },
79 { "no_blend", PERF_NO_BLEND, NULL },
80 { "no_depth", PERF_NO_DEPTH, NULL },
81 { "no_alphatest", PERF_NO_ALPHATEST, NULL },
82 DEBUG_NAMED_VALUE_END
83};
84
José Fonseca946f4322009-07-26 23:44:38 +010085
86static const char *
87llvmpipe_get_vendor(struct pipe_screen *screen)
88{
José Fonsecae173a9b2009-08-29 20:02:25 +010089 return "VMware, Inc.";
José Fonseca946f4322009-07-26 23:44:38 +010090}
91
92
93static const char *
94llvmpipe_get_name(struct pipe_screen *screen)
95{
96 return "llvmpipe";
97}
98
99
100static int
José Fonsecae1238b52010-05-11 11:11:03 +0100101llvmpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
José Fonseca946f4322009-07-26 23:44:38 +0100102{
103 switch (param) {
104 case PIPE_CAP_MAX_TEXTURE_IMAGE_UNITS:
105 return PIPE_MAX_SAMPLERS;
106 case PIPE_CAP_MAX_VERTEX_TEXTURE_UNITS:
Brian Paul4418a492010-08-26 11:45:25 -0600107 /* At this time, the draw module and llvmpipe driver only
108 * support vertex shader texture lookups when LLVM is enabled in
109 * the draw module.
110 */
111 if (debug_get_bool_option("DRAW_USE_LLVM", TRUE))
112 return PIPE_MAX_VERTEX_SAMPLERS;
113 else
114 return 0;
José Fonsecac0a13bb2009-12-04 21:25:40 +0000115 case PIPE_CAP_MAX_COMBINED_SAMPLERS:
116 return PIPE_MAX_SAMPLERS + PIPE_MAX_VERTEX_SAMPLERS;
José Fonseca946f4322009-07-26 23:44:38 +0100117 case PIPE_CAP_NPOT_TEXTURES:
118 return 1;
119 case PIPE_CAP_TWO_SIDED_STENCIL:
120 return 1;
121 case PIPE_CAP_GLSL:
122 return 1;
Jakob Bornecrantzc4e89d12010-04-29 16:18:43 +0100123 case PIPE_CAP_SM3:
124 return 1;
José Fonseca946f4322009-07-26 23:44:38 +0100125 case PIPE_CAP_ANISOTROPIC_FILTER:
126 return 0;
127 case PIPE_CAP_POINT_SPRITE:
128 return 1;
129 case PIPE_CAP_MAX_RENDER_TARGETS:
130 return PIPE_MAX_COLOR_BUFS;
131 case PIPE_CAP_OCCLUSION_QUERY:
132 return 1;
Mathias Fröhlichcdbd5f42010-05-17 11:48:56 -0700133 case PIPE_CAP_TIMER_QUERY:
134 return 0;
José Fonseca946f4322009-07-26 23:44:38 +0100135 case PIPE_CAP_TEXTURE_MIRROR_CLAMP:
136 return 1;
137 case PIPE_CAP_TEXTURE_MIRROR_REPEAT:
138 return 1;
139 case PIPE_CAP_TEXTURE_SHADOW_MAP:
140 return 1;
José Fonseca9881b5c2010-06-05 14:48:39 +0100141 case PIPE_CAP_TEXTURE_SWIZZLE:
142 return 1;
José Fonseca946f4322009-07-26 23:44:38 +0100143 case PIPE_CAP_MAX_TEXTURE_2D_LEVELS:
Brian Pauld73fadf2010-03-08 13:36:34 -0700144 return LP_MAX_TEXTURE_2D_LEVELS;
José Fonseca946f4322009-07-26 23:44:38 +0100145 case PIPE_CAP_MAX_TEXTURE_3D_LEVELS:
Brian Pauld73fadf2010-03-08 13:36:34 -0700146 return LP_MAX_TEXTURE_3D_LEVELS;
José Fonseca946f4322009-07-26 23:44:38 +0100147 case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS:
Brian Pauld73fadf2010-03-08 13:36:34 -0700148 return LP_MAX_TEXTURE_2D_LEVELS;
José Fonseca946f4322009-07-26 23:44:38 +0100149 case PIPE_CAP_BLEND_EQUATION_SEPARATE:
150 return 1;
Roland Scheidegger1a9d01d2010-01-26 17:32:57 +0100151 case PIPE_CAP_INDEP_BLEND_ENABLE:
Brian Paul7b937cf2010-05-10 17:03:10 -0600152 return 1;
Roland Scheidegger1a9d01d2010-01-26 17:32:57 +0100153 case PIPE_CAP_INDEP_BLEND_FUNC:
154 return 0;
Luca Barbieri6c4037502010-01-21 05:36:14 +0100155 case PIPE_CAP_TGSI_FS_COORD_ORIGIN_UPPER_LEFT:
156 case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER:
157 return 1;
158 case PIPE_CAP_TGSI_FS_COORD_ORIGIN_LOWER_LEFT:
159 case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_HALF_INTEGER:
160 return 0;
Roland Scheidegger1e171782010-05-29 01:31:01 +0200161 case PIPE_CAP_DEPTHSTENCIL_CLEAR_SEPARATE:
162 return 1;
Marek Olšák1a3fa3e2010-07-21 22:31:59 +0200163 case PIPE_CAP_DEPTH_CLAMP:
164 return 0;
José Fonseca946f4322009-07-26 23:44:38 +0100165 default:
166 return 0;
167 }
168}
169
Luca Barbieria508d2d2010-09-05 20:50:50 +0200170static int
171llvmpipe_get_shader_param(struct pipe_screen *screen, unsigned shader, enum pipe_shader_cap param)
172{
173 switch(shader)
174 {
175 case PIPE_SHADER_FRAGMENT:
176 return tgsi_exec_get_shader_param(param);
177 case PIPE_SHADER_VERTEX:
178 case PIPE_SHADER_GEOMETRY:
179 return draw_get_shader_param(shader, param);
180 default:
181 return 0;
182 }
183}
José Fonseca946f4322009-07-26 23:44:38 +0100184
185static float
José Fonsecae1238b52010-05-11 11:11:03 +0100186llvmpipe_get_paramf(struct pipe_screen *screen, enum pipe_cap param)
José Fonseca946f4322009-07-26 23:44:38 +0100187{
188 switch (param) {
189 case PIPE_CAP_MAX_LINE_WIDTH:
190 /* fall-through */
191 case PIPE_CAP_MAX_LINE_WIDTH_AA:
192 return 255.0; /* arbitrary */
193 case PIPE_CAP_MAX_POINT_WIDTH:
194 /* fall-through */
195 case PIPE_CAP_MAX_POINT_WIDTH_AA:
196 return 255.0; /* arbitrary */
197 case PIPE_CAP_MAX_TEXTURE_ANISOTROPY:
198 return 16.0; /* not actually signficant at this time */
199 case PIPE_CAP_MAX_TEXTURE_LOD_BIAS:
200 return 16.0; /* arbitrary */
José Fonsecacf9baf62010-05-12 17:25:17 +0100201 case PIPE_CAP_GUARD_BAND_LEFT:
202 case PIPE_CAP_GUARD_BAND_TOP:
203 case PIPE_CAP_GUARD_BAND_RIGHT:
204 case PIPE_CAP_GUARD_BAND_BOTTOM:
205 return 0.0;
José Fonseca946f4322009-07-26 23:44:38 +0100206 default:
José Fonsecaa1b3ca62010-05-12 14:10:23 +0100207 assert(0);
José Fonseca946f4322009-07-26 23:44:38 +0100208 return 0;
209 }
210}
211
212
213/**
214 * Query format support for creating a texture, drawing surface, etc.
215 * \param format the format to test
216 * \param type one of PIPE_TEXTURE, PIPE_SURFACE
217 */
218static boolean
José Fonsecae173a9b2009-08-29 20:02:25 +0100219llvmpipe_is_format_supported( struct pipe_screen *_screen,
Roland Scheideggere121a732010-05-17 21:23:31 +0200220 enum pipe_format format,
José Fonseca946f4322009-07-26 23:44:38 +0100221 enum pipe_texture_target target,
Roland Scheideggere121a732010-05-17 21:23:31 +0200222 unsigned sample_count,
José Fonsecaadc7cd62010-04-25 14:52:27 +0100223 unsigned bind,
José Fonseca946f4322009-07-26 23:44:38 +0100224 unsigned geom_flags )
225{
José Fonsecae173a9b2009-08-29 20:02:25 +0100226 struct llvmpipe_screen *screen = llvmpipe_screen(_screen);
Keith Whitwell94ce4eb2010-03-04 16:09:33 +0000227 struct sw_winsys *winsys = screen->winsys;
José Fonsecab3755262009-11-10 17:51:06 -0800228 const struct util_format_description *format_desc;
229
230 format_desc = util_format_description(format);
José Fonsecaadc7cd62010-04-25 14:52:27 +0100231 if (!format_desc)
José Fonsecab3755262009-11-10 17:51:06 -0800232 return FALSE;
José Fonsecae173a9b2009-08-29 20:02:25 +0100233
Brian Paule6d8b402010-05-28 13:31:23 -0600234 assert(target == PIPE_BUFFER ||
235 target == PIPE_TEXTURE_1D ||
José Fonseca946f4322009-07-26 23:44:38 +0100236 target == PIPE_TEXTURE_2D ||
Luca Barbieriae0ef6f2010-08-18 17:28:08 +0200237 target == PIPE_TEXTURE_RECT ||
José Fonseca946f4322009-07-26 23:44:38 +0100238 target == PIPE_TEXTURE_3D ||
239 target == PIPE_TEXTURE_CUBE);
240
Roland Scheideggere121a732010-05-17 21:23:31 +0200241 if (sample_count > 1)
242 return FALSE;
243
José Fonsecaadc7cd62010-04-25 14:52:27 +0100244 if (bind & PIPE_BIND_RENDER_TARGET) {
245 if (format_desc->colorspace == UTIL_FORMAT_COLORSPACE_ZS)
José Fonsecafe130a72010-04-06 22:49:57 +0100246 return FALSE;
247
José Fonsecaadc7cd62010-04-25 14:52:27 +0100248 if (format_desc->layout != UTIL_FORMAT_LAYOUT_PLAIN)
José Fonsecafe130a72010-04-06 22:49:57 +0100249 return FALSE;
250
José Fonsecaadc7cd62010-04-25 14:52:27 +0100251 if (format_desc->block.width != 1 ||
252 format_desc->block.height != 1)
José Fonsecab3755262009-11-10 17:51:06 -0800253 return FALSE;
254 }
255
José Fonsecaadc7cd62010-04-25 14:52:27 +0100256 if (bind & PIPE_BIND_DISPLAY_TARGET) {
257 if(!winsys->is_displaytarget_format_supported(winsys, bind, format))
José Fonsecab3755262009-11-10 17:51:06 -0800258 return FALSE;
259 }
260
José Fonsecaadc7cd62010-04-25 14:52:27 +0100261 if (bind & PIPE_BIND_DEPTH_STENCIL) {
262 if (format_desc->layout != UTIL_FORMAT_LAYOUT_PLAIN)
263 return FALSE;
264
265 if (format_desc->colorspace != UTIL_FORMAT_COLORSPACE_ZS)
José Fonsecab3755262009-11-10 17:51:06 -0800266 return FALSE;
267
268 /* FIXME: Temporary restriction. See lp_state_fs.c. */
José Fonsecaadc7cd62010-04-25 14:52:27 +0100269 if (format_desc->block.bits != 32)
José Fonsecab3755262009-11-10 17:51:06 -0800270 return FALSE;
271 }
272
José Fonsecaadc7cd62010-04-25 14:52:27 +0100273 if (format_desc->layout == UTIL_FORMAT_LAYOUT_S3TC) {
José Fonseca510669c2010-04-22 15:12:30 +0100274 return util_format_s3tc_enabled;
José Fonseca510669c2010-04-22 15:12:30 +0100275 }
276
José Fonsecaadc7cd62010-04-25 14:52:27 +0100277 /*
278 * Everything else should be supported by u_format.
279 */
José Fonsecae173a9b2009-08-29 20:02:25 +0100280 return TRUE;
281}
282
283
José Fonsecae173a9b2009-08-29 20:02:25 +0100284
285
286static void
287llvmpipe_flush_frontbuffer(struct pipe_screen *_screen,
288 struct pipe_surface *surface,
289 void *context_private)
290{
291 struct llvmpipe_screen *screen = llvmpipe_screen(_screen);
Keith Whitwell94ce4eb2010-03-04 16:09:33 +0000292 struct sw_winsys *winsys = screen->winsys;
Keith Whitwell287c94e2010-04-10 16:05:54 +0100293 struct llvmpipe_resource *texture = llvmpipe_resource(surface->texture);
José Fonsecae173a9b2009-08-29 20:02:25 +0100294
295 assert(texture->dt);
296 if (texture->dt)
297 winsys->displaytarget_display(winsys, texture->dt, context_private);
José Fonseca946f4322009-07-26 23:44:38 +0100298}
299
300
301static void
José Fonseca2d6b39f2009-08-09 23:10:19 +0100302llvmpipe_destroy_screen( struct pipe_screen *_screen )
José Fonseca946f4322009-07-26 23:44:38 +0100303{
José Fonseca2d6b39f2009-08-09 23:10:19 +0100304 struct llvmpipe_screen *screen = llvmpipe_screen(_screen);
Keith Whitwell94ce4eb2010-03-04 16:09:33 +0000305 struct sw_winsys *winsys = screen->winsys;
José Fonseca2d6b39f2009-08-09 23:10:19 +0100306
Roland Scheideggeredac7402010-07-13 19:58:58 +0200307 if (screen->rast)
308 lp_rast_destroy(screen->rast);
309
José Fonseca08dd41f2009-08-23 05:52:20 +0100310 lp_jit_screen_cleanup(screen);
José Fonseca946f4322009-07-26 23:44:38 +0100311
312 if(winsys->destroy)
313 winsys->destroy(winsys);
314
Roland Scheideggeredac7402010-07-13 19:58:58 +0200315 pipe_mutex_destroy(screen->rast_mutex);
316
José Fonseca946f4322009-07-26 23:44:38 +0100317 FREE(screen);
318}
319
320
321
Keith Whitwell5a45e532010-08-20 15:25:27 +0100322
323/**
324 * Fence reference counting.
325 */
326static void
327llvmpipe_fence_reference(struct pipe_screen *screen,
328 struct pipe_fence_handle **ptr,
329 struct pipe_fence_handle *fence)
330{
331 struct lp_fence **old = (struct lp_fence **) ptr;
332 struct lp_fence *f = (struct lp_fence *) fence;
333
334 lp_fence_reference(old, f);
335}
336
337
338/**
339 * Has the fence been executed/finished?
340 */
341static int
342llvmpipe_fence_signalled(struct pipe_screen *screen,
343 struct pipe_fence_handle *fence,
344 unsigned flag)
345{
346 struct lp_fence *f = (struct lp_fence *) fence;
347 return lp_fence_signalled(f);
348}
349
350
351/**
352 * Wait for the fence to finish.
353 */
354static int
355llvmpipe_fence_finish(struct pipe_screen *screen,
356 struct pipe_fence_handle *fence_handle,
357 unsigned flag)
358{
359 struct lp_fence *f = (struct lp_fence *) fence_handle;
360
361 lp_fence_wait(f);
362 return 0;
363}
364
365
366
José Fonseca946f4322009-07-26 23:44:38 +0100367/**
368 * Create a new pipe_screen object
369 * Note: we're not presently subclassing pipe_screen (no llvmpipe_screen).
370 */
371struct pipe_screen *
Keith Whitwell94ce4eb2010-03-04 16:09:33 +0000372llvmpipe_create_screen(struct sw_winsys *winsys)
José Fonseca946f4322009-07-26 23:44:38 +0100373{
Török Edwin4d52a252010-05-06 22:19:57 +0100374 struct llvmpipe_screen *screen;
375
376#ifdef PIPE_ARCH_X86
377 /* require SSE2 due to LLVM PR6960. */
378 util_cpu_detect();
379 if (!util_cpu_caps.has_sse2)
380 return NULL;
381#endif
382
383 screen = CALLOC_STRUCT(llvmpipe_screen);
José Fonseca946f4322009-07-26 23:44:38 +0100384
Keith Whitwelldec35d02009-10-09 14:59:35 +0100385#ifdef DEBUG
386 LP_DEBUG = debug_get_flags_option("LP_DEBUG", lp_debug_flags, 0 );
387#endif
388
Keith Whitwell5f008192010-09-16 10:45:52 +0100389 LP_PERF = debug_get_flags_option("LP_PERF", lp_perf_flags, 0 );
390
José Fonseca946f4322009-07-26 23:44:38 +0100391 if (!screen)
392 return NULL;
393
José Fonsecae173a9b2009-08-29 20:02:25 +0100394 screen->winsys = winsys;
José Fonseca946f4322009-07-26 23:44:38 +0100395
396 screen->base.destroy = llvmpipe_destroy_screen;
397
398 screen->base.get_name = llvmpipe_get_name;
399 screen->base.get_vendor = llvmpipe_get_vendor;
400 screen->base.get_param = llvmpipe_get_param;
Luca Barbieria508d2d2010-09-05 20:50:50 +0200401 screen->base.get_shader_param = llvmpipe_get_shader_param;
José Fonseca946f4322009-07-26 23:44:38 +0100402 screen->base.get_paramf = llvmpipe_get_paramf;
403 screen->base.is_format_supported = llvmpipe_is_format_supported;
404
Keith Whitwell7f41f542010-02-08 12:55:59 +0000405 screen->base.context_create = llvmpipe_create_context;
José Fonsecae173a9b2009-08-29 20:02:25 +0100406 screen->base.flush_frontbuffer = llvmpipe_flush_frontbuffer;
Keith Whitwell5a45e532010-08-20 15:25:27 +0100407 screen->base.fence_reference = llvmpipe_fence_reference;
408 screen->base.fence_signalled = llvmpipe_fence_signalled;
409 screen->base.fence_finish = llvmpipe_fence_finish;
José Fonsecae173a9b2009-08-29 20:02:25 +0100410
Keith Whitwell287c94e2010-04-10 16:05:54 +0100411 llvmpipe_init_screen_resource_funcs(&screen->base);
José Fonseca946f4322009-07-26 23:44:38 +0100412
José Fonseca08dd41f2009-08-23 05:52:20 +0100413 lp_jit_screen_init(screen);
José Fonseca2d6b39f2009-08-09 23:10:19 +0100414
José Fonseca65822eb2010-09-16 20:27:13 +0100415 screen->num_threads = util_cpu_caps.nr_cpus > 1 ? util_cpu_caps.nr_cpus : 0;
José Fonseca39be50d2010-04-24 13:20:39 +0100416#ifdef PIPE_OS_EMBEDDED
417 screen->num_threads = 0;
José Fonseca39be50d2010-04-24 13:20:39 +0100418#endif
419 screen->num_threads = debug_get_num_option("LP_NUM_THREADS", screen->num_threads);
420 screen->num_threads = MIN2(screen->num_threads, LP_MAX_THREADS);
José Fonseca39be50d2010-04-24 13:20:39 +0100421
Roland Scheideggeredac7402010-07-13 19:58:58 +0200422 screen->rast = lp_rast_create(screen->num_threads);
423 if (!screen->rast) {
424 lp_jit_screen_cleanup(screen);
425 FREE(screen);
426 return NULL;
427 }
428 pipe_mutex_init(screen->rast_mutex);
429
José Fonseca39be50d2010-04-24 13:20:39 +0100430 util_format_s3tc_init();
431
José Fonseca946f4322009-07-26 23:44:38 +0100432 return &screen->base;
433}