1 /**************************************************************************
3 * Copyright 2008 VMware, Inc.
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 VMWARE 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_math.h"
31 #include "util/u_cpu_detect.h"
32 #include "util/u_format.h"
33 #include "util/u_string.h"
34 #include "util/u_format_s3tc.h"
35 #include "pipe/p_defines.h"
36 #include "pipe/p_screen.h"
37 #include "draw/draw_context.h"
38 #include "gallivm/lp_bld_type.h"
40 #include "os/os_misc.h"
41 #include "os/os_time.h"
42 #include "lp_texture.h"
45 #include "lp_screen.h"
46 #include "lp_context.h"
48 #include "lp_public.h"
49 #include "lp_limits.h"
52 #include "state_tracker/sw_winsys.h"
57 static const struct debug_named_value lp_debug_flags
[] = {
58 { "pipe", DEBUG_PIPE
, NULL
},
59 { "tgsi", DEBUG_TGSI
, NULL
},
60 { "tex", DEBUG_TEX
, NULL
},
61 { "setup", DEBUG_SETUP
, NULL
},
62 { "rast", DEBUG_RAST
, NULL
},
63 { "query", DEBUG_QUERY
, NULL
},
64 { "screen", DEBUG_SCREEN
, NULL
},
65 { "counters", DEBUG_COUNTERS
, NULL
},
66 { "scene", DEBUG_SCENE
, NULL
},
67 { "fence", DEBUG_FENCE
, NULL
},
68 { "mem", DEBUG_MEM
, NULL
},
69 { "fs", DEBUG_FS
, NULL
},
75 static const struct debug_named_value lp_perf_flags
[] = {
76 { "texmem", PERF_TEX_MEM
, NULL
},
77 { "no_mipmap", PERF_NO_MIPMAPS
, NULL
},
78 { "no_linear", PERF_NO_LINEAR
, NULL
},
79 { "no_mip_linear", PERF_NO_MIP_LINEAR
, NULL
},
80 { "no_tex", PERF_NO_TEX
, NULL
},
81 { "no_blend", PERF_NO_BLEND
, NULL
},
82 { "no_depth", PERF_NO_DEPTH
, NULL
},
83 { "no_alphatest", PERF_NO_ALPHATEST
, NULL
},
89 llvmpipe_get_vendor(struct pipe_screen
*screen
)
91 return "VMware, Inc.";
96 llvmpipe_get_name(struct pipe_screen
*screen
)
99 util_snprintf(buf
, sizeof(buf
), "llvmpipe (LLVM %u.%u, %u bits)",
100 HAVE_LLVM
>> 8, HAVE_LLVM
& 0xff,
101 lp_native_vector_width
);
107 llvmpipe_get_param(struct pipe_screen
*screen
, enum pipe_cap param
)
110 case PIPE_CAP_NPOT_TEXTURES
:
111 case PIPE_CAP_MIXED_FRAMEBUFFER_SIZES
:
113 case PIPE_CAP_TWO_SIDED_STENCIL
:
117 case PIPE_CAP_MAX_DUAL_SOURCE_RENDER_TARGETS
:
119 case PIPE_CAP_MAX_STREAM_OUTPUT_BUFFERS
:
120 return PIPE_MAX_SO_BUFFERS
;
121 case PIPE_CAP_ANISOTROPIC_FILTER
:
123 case PIPE_CAP_POINT_SPRITE
:
125 case PIPE_CAP_MAX_RENDER_TARGETS
:
126 return PIPE_MAX_COLOR_BUFS
;
127 case PIPE_CAP_OCCLUSION_QUERY
:
129 case PIPE_CAP_QUERY_TIME_ELAPSED
:
131 case PIPE_CAP_QUERY_TIMESTAMP
:
133 case PIPE_CAP_QUERY_PIPELINE_STATISTICS
:
135 case PIPE_CAP_TEXTURE_MIRROR_CLAMP
:
137 case PIPE_CAP_TEXTURE_SHADOW_MAP
:
139 case PIPE_CAP_TEXTURE_SWIZZLE
:
141 case PIPE_CAP_TEXTURE_BORDER_COLOR_QUIRK
:
143 case PIPE_CAP_MAX_TEXTURE_2D_LEVELS
:
144 return LP_MAX_TEXTURE_2D_LEVELS
;
145 case PIPE_CAP_MAX_TEXTURE_3D_LEVELS
:
146 return LP_MAX_TEXTURE_3D_LEVELS
;
147 case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS
:
148 return LP_MAX_TEXTURE_CUBE_LEVELS
;
149 case PIPE_CAP_MAX_TEXTURE_ARRAY_LAYERS
:
150 return LP_MAX_TEXTURE_ARRAY_LAYERS
;
151 case PIPE_CAP_BLEND_EQUATION_SEPARATE
:
153 case PIPE_CAP_INDEP_BLEND_ENABLE
:
155 case PIPE_CAP_INDEP_BLEND_FUNC
:
157 case PIPE_CAP_TGSI_FS_COORD_ORIGIN_UPPER_LEFT
:
158 case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER
:
159 case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_HALF_INTEGER
:
161 case PIPE_CAP_TGSI_FS_COORD_ORIGIN_LOWER_LEFT
:
163 case PIPE_CAP_PRIMITIVE_RESTART
:
165 case PIPE_CAP_DEPTH_CLIP_DISABLE
:
167 case PIPE_CAP_SHADER_STENCIL_EXPORT
:
169 case PIPE_CAP_TGSI_INSTANCEID
:
170 case PIPE_CAP_VERTEX_ELEMENT_INSTANCE_DIVISOR
:
171 case PIPE_CAP_START_INSTANCE
:
173 case PIPE_CAP_FRAGMENT_COLOR_CLAMPED
:
175 case PIPE_CAP_MIXED_COLORBUFFER_FORMATS
:
177 case PIPE_CAP_SEAMLESS_CUBE_MAP
:
178 case PIPE_CAP_SEAMLESS_CUBE_MAP_PER_TEXTURE
:
180 /* this is a lie could support arbitrary large offsets */
181 case PIPE_CAP_MIN_TEXTURE_GATHER_OFFSET
:
182 case PIPE_CAP_MIN_TEXEL_OFFSET
:
184 case PIPE_CAP_MAX_TEXTURE_GATHER_OFFSET
:
185 case PIPE_CAP_MAX_TEXEL_OFFSET
:
187 case PIPE_CAP_CONDITIONAL_RENDER
:
189 case PIPE_CAP_TEXTURE_BARRIER
:
191 case PIPE_CAP_MAX_STREAM_OUTPUT_SEPARATE_COMPONENTS
:
192 case PIPE_CAP_MAX_STREAM_OUTPUT_INTERLEAVED_COMPONENTS
:
194 case PIPE_CAP_MAX_GEOMETRY_OUTPUT_VERTICES
:
195 case PIPE_CAP_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS
:
197 case PIPE_CAP_MAX_VERTEX_STREAMS
:
199 case PIPE_CAP_MAX_VERTEX_ATTRIB_STRIDE
:
201 case PIPE_CAP_STREAM_OUTPUT_PAUSE_RESUME
:
203 case PIPE_CAP_TGSI_CAN_COMPACT_CONSTANTS
:
205 case PIPE_CAP_VERTEX_COLOR_UNCLAMPED
:
206 case PIPE_CAP_VERTEX_COLOR_CLAMPED
:
208 case PIPE_CAP_GLSL_FEATURE_LEVEL
:
210 case PIPE_CAP_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION
:
212 case PIPE_CAP_COMPUTE
:
214 case PIPE_CAP_USER_VERTEX_BUFFERS
:
215 case PIPE_CAP_USER_INDEX_BUFFERS
:
217 case PIPE_CAP_USER_CONSTANT_BUFFERS
:
219 case PIPE_CAP_VERTEX_BUFFER_OFFSET_4BYTE_ALIGNED_ONLY
:
220 case PIPE_CAP_VERTEX_BUFFER_STRIDE_4BYTE_ALIGNED_ONLY
:
221 case PIPE_CAP_VERTEX_ELEMENT_SRC_OFFSET_4BYTE_ALIGNED_ONLY
:
222 case PIPE_CAP_TGSI_TEXCOORD
:
224 case PIPE_CAP_DRAW_INDIRECT
:
227 case PIPE_CAP_CUBE_MAP_ARRAY
:
229 case PIPE_CAP_CONSTANT_BUFFER_OFFSET_ALIGNMENT
:
231 case PIPE_CAP_TEXTURE_MULTISAMPLE
:
233 case PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT
:
235 case PIPE_CAP_TEXTURE_BUFFER_OBJECTS
:
237 case PIPE_CAP_MAX_TEXTURE_BUFFER_SIZE
:
239 case PIPE_CAP_TEXTURE_BUFFER_OFFSET_ALIGNMENT
:
241 case PIPE_CAP_PREFER_BLIT_BASED_TEXTURE_TRANSFER
:
243 case PIPE_CAP_MAX_VIEWPORTS
:
244 return PIPE_MAX_VIEWPORTS
;
245 case PIPE_CAP_ENDIANNESS
:
246 return PIPE_ENDIAN_NATIVE
;
247 case PIPE_CAP_TGSI_VS_LAYER_VIEWPORT
:
249 case PIPE_CAP_BUFFER_MAP_PERSISTENT_COHERENT
:
251 case PIPE_CAP_MAX_TEXTURE_GATHER_COMPONENTS
:
253 case PIPE_CAP_TEXTURE_GATHER_SM5
:
254 case PIPE_CAP_TEXTURE_QUERY_LOD
:
255 case PIPE_CAP_SAMPLE_SHADING
:
256 case PIPE_CAP_TEXTURE_GATHER_OFFSETS
:
258 case PIPE_CAP_TGSI_VS_WINDOW_SPACE_POSITION
:
260 case PIPE_CAP_TGSI_FS_FINE_DERIVATIVE
:
262 case PIPE_CAP_SAMPLER_VIEW_TARGET
:
264 case PIPE_CAP_FAKE_SW_MSAA
:
266 case PIPE_CAP_CONDITIONAL_RENDER_INVERTED
:
269 case PIPE_CAP_VENDOR_ID
:
271 case PIPE_CAP_DEVICE_ID
:
273 case PIPE_CAP_ACCELERATED
:
275 case PIPE_CAP_VIDEO_MEMORY
: {
276 /* XXX: Do we want to return the full amount fo system memory ? */
277 uint64_t system_memory
;
279 if (!os_get_total_physical_memory(&system_memory
))
282 return (int)(system_memory
>> 20);
286 case PIPE_CAP_CLIP_HALFZ
:
288 case PIPE_CAP_VERTEXID_NOBASE
:
290 case PIPE_CAP_POLYGON_OFFSET_CLAMP
:
291 case PIPE_CAP_TEXTURE_FLOAT_LINEAR
:
292 case PIPE_CAP_TEXTURE_HALF_FLOAT_LINEAR
:
294 case PIPE_CAP_CULL_DISTANCE
:
296 case PIPE_CAP_COPY_BETWEEN_COMPRESSED_AND_PLAIN_FORMATS
:
298 case PIPE_CAP_MULTISAMPLE_Z_RESOLVE
:
299 case PIPE_CAP_RESOURCE_FROM_USER_MEMORY
:
300 case PIPE_CAP_DEVICE_RESET_STATUS_QUERY
:
301 case PIPE_CAP_MAX_SHADER_PATCH_VARYINGS
:
302 case PIPE_CAP_DEPTH_BOUNDS_TEST
:
303 case PIPE_CAP_TGSI_TXQS
:
304 case PIPE_CAP_FORCE_PERSAMPLE_INTERP
:
305 case PIPE_CAP_SHAREABLE_SHADERS
:
306 case PIPE_CAP_CLEAR_TEXTURE
:
307 case PIPE_CAP_DRAW_PARAMETERS
:
308 case PIPE_CAP_TGSI_PACK_HALF_FLOAT
:
309 case PIPE_CAP_MULTI_DRAW_INDIRECT
:
310 case PIPE_CAP_MULTI_DRAW_INDIRECT_PARAMS
:
311 case PIPE_CAP_TGSI_FS_POSITION_IS_SYSVAL
:
312 case PIPE_CAP_TGSI_FS_FACE_IS_INTEGER_SYSVAL
:
313 case PIPE_CAP_SHADER_BUFFER_OFFSET_ALIGNMENT
:
314 case PIPE_CAP_INVALIDATE_BUFFER
:
315 case PIPE_CAP_GENERATE_MIPMAP
:
316 case PIPE_CAP_STRING_MARKER
:
317 case PIPE_CAP_BUFFER_SAMPLER_VIEW_RGBA_ONLY
:
318 case PIPE_CAP_SURFACE_REINTERPRET_BLOCKS
:
319 case PIPE_CAP_QUERY_BUFFER_OBJECT
:
320 case PIPE_CAP_QUERY_MEMORY_INFO
:
321 case PIPE_CAP_PCI_GROUP
:
322 case PIPE_CAP_PCI_BUS
:
323 case PIPE_CAP_PCI_DEVICE
:
324 case PIPE_CAP_PCI_FUNCTION
:
325 case PIPE_CAP_FRAMEBUFFER_NO_ATTACHMENT
:
326 case PIPE_CAP_ROBUST_BUFFER_ACCESS_BEHAVIOR
:
327 case PIPE_CAP_PRIMITIVE_RESTART_FOR_PATCHES
:
328 case PIPE_CAP_TGSI_VOTE
:
329 case PIPE_CAP_MAX_WINDOW_RECTANGLES
:
330 case PIPE_CAP_POLYGON_OFFSET_UNITS_UNSCALED
:
333 /* should only get here on unhandled cases */
334 debug_printf("Unexpected PIPE_CAP %d query\n", param
);
339 llvmpipe_get_shader_param(struct pipe_screen
*screen
, unsigned shader
, enum pipe_shader_cap param
)
343 case PIPE_SHADER_FRAGMENT
:
346 return gallivm_get_shader_param(param
);
348 case PIPE_SHADER_VERTEX
:
349 case PIPE_SHADER_GEOMETRY
:
351 case PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS
:
352 /* At this time, the draw module and llvmpipe driver only
353 * support vertex shader texture lookups when LLVM is enabled in
356 if (debug_get_bool_option("DRAW_USE_LLVM", TRUE
))
357 return PIPE_MAX_SAMPLERS
;
360 case PIPE_SHADER_CAP_MAX_SAMPLER_VIEWS
:
361 if (debug_get_bool_option("DRAW_USE_LLVM", TRUE
))
362 return PIPE_MAX_SHADER_SAMPLER_VIEWS
;
366 return draw_get_shader_param(shader
, param
);
374 llvmpipe_get_paramf(struct pipe_screen
*screen
, enum pipe_capf param
)
377 case PIPE_CAPF_MAX_LINE_WIDTH
:
379 case PIPE_CAPF_MAX_LINE_WIDTH_AA
:
380 return 255.0; /* arbitrary */
381 case PIPE_CAPF_MAX_POINT_WIDTH
:
383 case PIPE_CAPF_MAX_POINT_WIDTH_AA
:
384 return 255.0; /* arbitrary */
385 case PIPE_CAPF_MAX_TEXTURE_ANISOTROPY
:
386 return 16.0; /* not actually signficant at this time */
387 case PIPE_CAPF_MAX_TEXTURE_LOD_BIAS
:
388 return 16.0; /* arbitrary */
389 case PIPE_CAPF_GUARD_BAND_LEFT
:
390 case PIPE_CAPF_GUARD_BAND_TOP
:
391 case PIPE_CAPF_GUARD_BAND_RIGHT
:
392 case PIPE_CAPF_GUARD_BAND_BOTTOM
:
395 /* should only get here on unhandled cases */
396 debug_printf("Unexpected PIPE_CAP %d query\n", param
);
402 * Query format support for creating a texture, drawing surface, etc.
403 * \param format the format to test
404 * \param type one of PIPE_TEXTURE, PIPE_SURFACE
407 llvmpipe_is_format_supported( struct pipe_screen
*_screen
,
408 enum pipe_format format
,
409 enum pipe_texture_target target
,
410 unsigned sample_count
,
413 struct llvmpipe_screen
*screen
= llvmpipe_screen(_screen
);
414 struct sw_winsys
*winsys
= screen
->winsys
;
415 const struct util_format_description
*format_desc
;
417 format_desc
= util_format_description(format
);
421 assert(target
== PIPE_BUFFER
||
422 target
== PIPE_TEXTURE_1D
||
423 target
== PIPE_TEXTURE_1D_ARRAY
||
424 target
== PIPE_TEXTURE_2D
||
425 target
== PIPE_TEXTURE_2D_ARRAY
||
426 target
== PIPE_TEXTURE_RECT
||
427 target
== PIPE_TEXTURE_3D
||
428 target
== PIPE_TEXTURE_CUBE
||
429 target
== PIPE_TEXTURE_CUBE_ARRAY
);
431 if (sample_count
> 1)
434 if (bind
& PIPE_BIND_RENDER_TARGET
) {
435 if (format_desc
->colorspace
== UTIL_FORMAT_COLORSPACE_SRGB
) {
436 /* this is a lie actually other formats COULD exist where we would fail */
437 if (format_desc
->nr_channels
< 3)
440 else if (format_desc
->colorspace
!= UTIL_FORMAT_COLORSPACE_RGB
)
443 if (format_desc
->layout
!= UTIL_FORMAT_LAYOUT_PLAIN
&&
444 format
!= PIPE_FORMAT_R11G11B10_FLOAT
)
447 assert(format_desc
->block
.width
== 1);
448 assert(format_desc
->block
.height
== 1);
450 if (format_desc
->is_mixed
)
453 if (!format_desc
->is_array
&& !format_desc
->is_bitmask
&&
454 format
!= PIPE_FORMAT_R11G11B10_FLOAT
)
458 if ((bind
& (PIPE_BIND_RENDER_TARGET
| PIPE_BIND_SAMPLER_VIEW
)) &&
459 ((bind
& PIPE_BIND_DISPLAY_TARGET
) == 0)) {
460 /* Disable all 3-channel formats, where channel size != 32 bits.
461 * In some cases we run into crashes (in generate_unswizzled_blend()),
462 * for 3-channel RGB16 variants, there was an apparent LLVM bug.
463 * In any case, disabling the shallower 3-channel formats avoids a
464 * number of issues with GL_ARB_copy_image support.
466 if (format_desc
->is_array
&&
467 format_desc
->nr_channels
== 3 &&
468 format_desc
->block
.bits
!= 96) {
473 if (bind
& PIPE_BIND_DISPLAY_TARGET
) {
474 if(!winsys
->is_displaytarget_format_supported(winsys
, bind
, format
))
478 if (bind
& PIPE_BIND_DEPTH_STENCIL
) {
479 if (format_desc
->layout
!= UTIL_FORMAT_LAYOUT_PLAIN
)
482 if (format_desc
->colorspace
!= UTIL_FORMAT_COLORSPACE_ZS
)
485 /* TODO: Support stencil-only formats */
486 if (format_desc
->swizzle
[0] == PIPE_SWIZZLE_NONE
) {
491 if (format_desc
->layout
== UTIL_FORMAT_LAYOUT_BPTC
||
492 format_desc
->layout
== UTIL_FORMAT_LAYOUT_ASTC
) {
493 /* Software decoding is not hooked up. */
497 if (format_desc
->layout
== UTIL_FORMAT_LAYOUT_ETC
&&
498 format
!= PIPE_FORMAT_ETC1_RGB8
)
501 if (format_desc
->layout
== UTIL_FORMAT_LAYOUT_S3TC
) {
502 return util_format_s3tc_enabled
;
506 * Everything can be supported by u_format
507 * (those without fetch_rgba_float might be not but shouldn't hit that)
517 llvmpipe_flush_frontbuffer(struct pipe_screen
*_screen
,
518 struct pipe_resource
*resource
,
519 unsigned level
, unsigned layer
,
520 void *context_private
,
521 struct pipe_box
*sub_box
)
523 struct llvmpipe_screen
*screen
= llvmpipe_screen(_screen
);
524 struct sw_winsys
*winsys
= screen
->winsys
;
525 struct llvmpipe_resource
*texture
= llvmpipe_resource(resource
);
529 winsys
->displaytarget_display(winsys
, texture
->dt
, context_private
, sub_box
);
533 llvmpipe_destroy_screen( struct pipe_screen
*_screen
)
535 struct llvmpipe_screen
*screen
= llvmpipe_screen(_screen
);
536 struct sw_winsys
*winsys
= screen
->winsys
;
539 lp_rast_destroy(screen
->rast
);
541 lp_jit_screen_cleanup(screen
);
544 winsys
->destroy(winsys
);
546 pipe_mutex_destroy(screen
->rast_mutex
);
555 * Fence reference counting.
558 llvmpipe_fence_reference(struct pipe_screen
*screen
,
559 struct pipe_fence_handle
**ptr
,
560 struct pipe_fence_handle
*fence
)
562 struct lp_fence
**old
= (struct lp_fence
**) ptr
;
563 struct lp_fence
*f
= (struct lp_fence
*) fence
;
565 lp_fence_reference(old
, f
);
570 * Wait for the fence to finish.
573 llvmpipe_fence_finish(struct pipe_screen
*screen
,
574 struct pipe_fence_handle
*fence_handle
,
577 struct lp_fence
*f
= (struct lp_fence
*) fence_handle
;
580 return lp_fence_signalled(f
);
587 llvmpipe_get_timestamp(struct pipe_screen
*_screen
)
589 return os_time_get_nano();
593 * Create a new pipe_screen object
594 * Note: we're not presently subclassing pipe_screen (no llvmpipe_screen).
597 llvmpipe_create_screen(struct sw_winsys
*winsys
)
599 struct llvmpipe_screen
*screen
;
604 LP_DEBUG
= debug_get_flags_option("LP_DEBUG", lp_debug_flags
, 0 );
607 LP_PERF
= debug_get_flags_option("LP_PERF", lp_perf_flags
, 0 );
609 screen
= CALLOC_STRUCT(llvmpipe_screen
);
613 if (!lp_jit_screen_init(screen
)) {
618 screen
->winsys
= winsys
;
620 screen
->base
.destroy
= llvmpipe_destroy_screen
;
622 screen
->base
.get_name
= llvmpipe_get_name
;
623 screen
->base
.get_vendor
= llvmpipe_get_vendor
;
624 screen
->base
.get_device_vendor
= llvmpipe_get_vendor
; // TODO should be the CPU vendor
625 screen
->base
.get_param
= llvmpipe_get_param
;
626 screen
->base
.get_shader_param
= llvmpipe_get_shader_param
;
627 screen
->base
.get_paramf
= llvmpipe_get_paramf
;
628 screen
->base
.is_format_supported
= llvmpipe_is_format_supported
;
630 screen
->base
.context_create
= llvmpipe_create_context
;
631 screen
->base
.flush_frontbuffer
= llvmpipe_flush_frontbuffer
;
632 screen
->base
.fence_reference
= llvmpipe_fence_reference
;
633 screen
->base
.fence_finish
= llvmpipe_fence_finish
;
635 screen
->base
.get_timestamp
= llvmpipe_get_timestamp
;
637 llvmpipe_init_screen_resource_funcs(&screen
->base
);
639 screen
->num_threads
= util_cpu_caps
.nr_cpus
> 1 ? util_cpu_caps
.nr_cpus
: 0;
640 #ifdef PIPE_SUBSYSTEM_EMBEDDED
641 screen
->num_threads
= 0;
643 screen
->num_threads
= debug_get_num_option("LP_NUM_THREADS", screen
->num_threads
);
644 screen
->num_threads
= MIN2(screen
->num_threads
, LP_MAX_THREADS
);
646 screen
->rast
= lp_rast_create(screen
->num_threads
);
648 lp_jit_screen_cleanup(screen
);
652 pipe_mutex_init(screen
->rast_mutex
);
654 util_format_s3tc_init();
656 return &screen
->base
;