driconf: add force_integer_tex_nearest option
[mesa.git] / src / gallium / state_trackers / dri / dri_screen.c
1 /**************************************************************************
2 *
3 * Copyright 2009, VMware, Inc.
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 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.
25 *
26 **************************************************************************/
27 /*
28 * Author: Keith Whitwell <keithw@vmware.com>
29 * Author: Jakob Bornecrantz <wallbraker@gmail.com>
30 */
31
32 #include "utils.h"
33
34 #include "dri_screen.h"
35 #include "dri_context.h"
36 #include "dri_helpers.h"
37
38 #include "util/u_inlines.h"
39 #include "pipe/p_screen.h"
40 #include "pipe/p_format.h"
41 #include "pipe-loader/pipe_loader.h"
42 #include "state_tracker/st_gl_api.h" /* for st_gl_api_create */
43 #include "state_tracker/drm_driver.h"
44
45 #include "util/u_debug.h"
46 #include "util/format/u_format_s3tc.h"
47
48 #define MSAA_VISUAL_MAX_SAMPLES 32
49
50 #undef false
51
52 const __DRIconfigOptionsExtension gallium_config_options = {
53 .base = { __DRI_CONFIG_OPTIONS, 2 },
54 .xml = gallium_driinfo_xml,
55 .getXml = pipe_loader_get_driinfo_xml
56 };
57
58 #define false 0
59
60 static void
61 dri_fill_st_options(struct dri_screen *screen)
62 {
63 struct st_config_options *options = &screen->options;
64 const struct driOptionCache *optionCache = &screen->dev->option_cache;
65
66 options->disable_blend_func_extended =
67 driQueryOptionb(optionCache, "disable_blend_func_extended");
68 options->disable_arb_gpu_shader5 =
69 driQueryOptionb(optionCache, "disable_arb_gpu_shader5");
70 options->disable_glsl_line_continuations =
71 driQueryOptionb(optionCache, "disable_glsl_line_continuations");
72 options->force_glsl_extensions_warn =
73 driQueryOptionb(optionCache, "force_glsl_extensions_warn");
74 options->force_glsl_version =
75 driQueryOptioni(optionCache, "force_glsl_version");
76 options->allow_glsl_extension_directive_midshader =
77 driQueryOptionb(optionCache, "allow_glsl_extension_directive_midshader");
78 options->allow_glsl_builtin_const_expression =
79 driQueryOptionb(optionCache, "allow_glsl_builtin_const_expression");
80 options->allow_glsl_relaxed_es =
81 driQueryOptionb(optionCache, "allow_glsl_relaxed_es");
82 options->allow_glsl_builtin_variable_redeclaration =
83 driQueryOptionb(optionCache, "allow_glsl_builtin_variable_redeclaration");
84 options->allow_higher_compat_version =
85 driQueryOptionb(optionCache, "allow_higher_compat_version");
86 options->glsl_zero_init = driQueryOptionb(optionCache, "glsl_zero_init");
87 options->force_integer_tex_nearest =
88 driQueryOptionb(optionCache, "force_integer_tex_nearest");
89 options->vs_position_always_invariant =
90 driQueryOptionb(optionCache, "vs_position_always_invariant");
91 options->force_glsl_abs_sqrt =
92 driQueryOptionb(optionCache, "force_glsl_abs_sqrt");
93 options->allow_glsl_cross_stage_interpolation_mismatch =
94 driQueryOptionb(optionCache, "allow_glsl_cross_stage_interpolation_mismatch");
95 options->allow_glsl_layout_qualifier_on_function_parameters =
96 driQueryOptionb(optionCache, "allow_glsl_layout_qualifier_on_function_parameters");
97 options->allow_draw_out_of_order =
98 driQueryOptionb(optionCache, "allow_draw_out_of_order");
99
100 char *vendor_str = driQueryOptionstr(optionCache, "force_gl_vendor");
101 /* not an empty string */
102 if (*vendor_str)
103 options->force_gl_vendor = strdup(vendor_str);
104
105 driComputeOptionsSha1(optionCache, options->config_options_sha1);
106 }
107
108 static unsigned
109 dri_loader_get_cap(struct dri_screen *screen, enum dri_loader_cap cap)
110 {
111 const __DRIdri2LoaderExtension *dri2_loader = screen->sPriv->dri2.loader;
112 const __DRIimageLoaderExtension *image_loader = screen->sPriv->image.loader;
113
114 if (dri2_loader && dri2_loader->base.version >= 4 &&
115 dri2_loader->getCapability)
116 return dri2_loader->getCapability(screen->sPriv->loaderPrivate, cap);
117
118 if (image_loader && image_loader->base.version >= 2 &&
119 image_loader->getCapability)
120 return image_loader->getCapability(screen->sPriv->loaderPrivate, cap);
121
122 return 0;
123 }
124
125 static const __DRIconfig **
126 dri_fill_in_modes(struct dri_screen *screen)
127 {
128 static const mesa_format mesa_formats[] = {
129 MESA_FORMAT_B10G10R10A2_UNORM,
130 MESA_FORMAT_B10G10R10X2_UNORM,
131 MESA_FORMAT_R10G10B10A2_UNORM,
132 MESA_FORMAT_R10G10B10X2_UNORM,
133 MESA_FORMAT_B8G8R8A8_UNORM,
134 MESA_FORMAT_B8G8R8X8_UNORM,
135 MESA_FORMAT_B8G8R8A8_SRGB,
136 MESA_FORMAT_B8G8R8X8_SRGB,
137 MESA_FORMAT_B5G6R5_UNORM,
138 MESA_FORMAT_RGBA_FLOAT16,
139 MESA_FORMAT_RGBX_FLOAT16,
140
141 /* The 32-bit RGBA format must not precede the 32-bit BGRA format.
142 * Likewise for RGBX and BGRX. Otherwise, the GLX client and the GLX
143 * server may disagree on which format the GLXFBConfig represents,
144 * resulting in swapped color channels.
145 *
146 * The problem, as of 2017-05-30:
147 * When matching a GLXFBConfig to a __DRIconfig, GLX ignores the channel
148 * order and chooses the first __DRIconfig with the expected channel
149 * sizes. Specifically, GLX compares the GLXFBConfig's and __DRIconfig's
150 * __DRI_ATTRIB_{CHANNEL}_SIZE but ignores __DRI_ATTRIB_{CHANNEL}_MASK.
151 *
152 * EGL does not suffer from this problem. It correctly compares the
153 * channel masks when matching EGLConfig to __DRIconfig.
154 */
155
156 /* Required by Android, for HAL_PIXEL_FORMAT_RGBA_8888. */
157 MESA_FORMAT_R8G8B8A8_UNORM,
158
159 /* Required by Android, for HAL_PIXEL_FORMAT_RGBX_8888. */
160 MESA_FORMAT_R8G8B8X8_UNORM,
161 };
162 static const enum pipe_format pipe_formats[] = {
163 PIPE_FORMAT_B10G10R10A2_UNORM,
164 PIPE_FORMAT_B10G10R10X2_UNORM,
165 PIPE_FORMAT_R10G10B10A2_UNORM,
166 PIPE_FORMAT_R10G10B10X2_UNORM,
167 PIPE_FORMAT_BGRA8888_UNORM,
168 PIPE_FORMAT_BGRX8888_UNORM,
169 PIPE_FORMAT_BGRA8888_SRGB,
170 PIPE_FORMAT_BGRX8888_SRGB,
171 PIPE_FORMAT_B5G6R5_UNORM,
172 PIPE_FORMAT_R16G16B16A16_FLOAT,
173 PIPE_FORMAT_R16G16B16X16_FLOAT,
174 PIPE_FORMAT_RGBA8888_UNORM,
175 PIPE_FORMAT_RGBX8888_UNORM,
176 };
177 mesa_format format;
178 __DRIconfig **configs = NULL;
179 uint8_t depth_bits_array[5];
180 uint8_t stencil_bits_array[5];
181 unsigned depth_buffer_factor;
182 unsigned msaa_samples_max;
183 unsigned i;
184 struct pipe_screen *p_screen = screen->base.screen;
185 bool pf_z16, pf_x8z24, pf_z24x8, pf_s8z24, pf_z24s8, pf_z32;
186 bool mixed_color_depth;
187 bool allow_rgba_ordering;
188 bool allow_rgb10;
189 bool allow_fp16;
190
191 static const GLenum back_buffer_modes[] = {
192 __DRI_ATTRIB_SWAP_NONE, __DRI_ATTRIB_SWAP_UNDEFINED,
193 __DRI_ATTRIB_SWAP_COPY
194 };
195
196 if (driQueryOptionb(&screen->dev->option_cache, "always_have_depth_buffer")) {
197 /* all visuals will have a depth buffer */
198 depth_buffer_factor = 0;
199 }
200 else {
201 depth_bits_array[0] = 0;
202 stencil_bits_array[0] = 0;
203 depth_buffer_factor = 1;
204 }
205
206 allow_rgba_ordering = dri_loader_get_cap(screen, DRI_LOADER_CAP_RGBA_ORDERING);
207 allow_rgb10 = driQueryOptionb(&screen->dev->option_cache, "allow_rgb10_configs");
208 allow_fp16 = driQueryOptionb(&screen->dev->option_cache, "allow_fp16_configs");
209 allow_fp16 &= dri_loader_get_cap(screen, DRI_LOADER_CAP_FP16);
210
211 msaa_samples_max = (screen->st_api->feature_mask & ST_API_FEATURE_MS_VISUALS_MASK)
212 ? MSAA_VISUAL_MAX_SAMPLES : 1;
213
214 pf_x8z24 = p_screen->is_format_supported(p_screen, PIPE_FORMAT_Z24X8_UNORM,
215 PIPE_TEXTURE_2D, 0, 0,
216 PIPE_BIND_DEPTH_STENCIL);
217 pf_z24x8 = p_screen->is_format_supported(p_screen, PIPE_FORMAT_X8Z24_UNORM,
218 PIPE_TEXTURE_2D, 0, 0,
219 PIPE_BIND_DEPTH_STENCIL);
220 pf_s8z24 = p_screen->is_format_supported(p_screen, PIPE_FORMAT_Z24_UNORM_S8_UINT,
221 PIPE_TEXTURE_2D, 0, 0,
222 PIPE_BIND_DEPTH_STENCIL);
223 pf_z24s8 = p_screen->is_format_supported(p_screen, PIPE_FORMAT_S8_UINT_Z24_UNORM,
224 PIPE_TEXTURE_2D, 0, 0,
225 PIPE_BIND_DEPTH_STENCIL);
226 pf_z16 = p_screen->is_format_supported(p_screen, PIPE_FORMAT_Z16_UNORM,
227 PIPE_TEXTURE_2D, 0, 0,
228 PIPE_BIND_DEPTH_STENCIL);
229 pf_z32 = p_screen->is_format_supported(p_screen, PIPE_FORMAT_Z32_UNORM,
230 PIPE_TEXTURE_2D, 0, 0,
231 PIPE_BIND_DEPTH_STENCIL);
232
233 if (pf_z16) {
234 depth_bits_array[depth_buffer_factor] = 16;
235 stencil_bits_array[depth_buffer_factor++] = 0;
236 }
237 if (pf_x8z24 || pf_z24x8) {
238 depth_bits_array[depth_buffer_factor] = 24;
239 stencil_bits_array[depth_buffer_factor++] = 0;
240 screen->d_depth_bits_last = pf_x8z24;
241 }
242 if (pf_s8z24 || pf_z24s8) {
243 depth_bits_array[depth_buffer_factor] = 24;
244 stencil_bits_array[depth_buffer_factor++] = 8;
245 screen->sd_depth_bits_last = pf_s8z24;
246 }
247 if (pf_z32) {
248 depth_bits_array[depth_buffer_factor] = 32;
249 stencil_bits_array[depth_buffer_factor++] = 0;
250 }
251
252 mixed_color_depth =
253 p_screen->get_param(p_screen, PIPE_CAP_MIXED_COLOR_DEPTH_BITS);
254
255 assert(ARRAY_SIZE(mesa_formats) == ARRAY_SIZE(pipe_formats));
256
257 /* Add configs. */
258 for (format = 0; format < ARRAY_SIZE(mesa_formats); format++) {
259 __DRIconfig **new_configs = NULL;
260 unsigned num_msaa_modes = 0; /* includes a single-sample mode */
261 uint8_t msaa_modes[MSAA_VISUAL_MAX_SAMPLES];
262
263 /* Expose only BGRA ordering if the loader doesn't support RGBA ordering. */
264 if (!allow_rgba_ordering &&
265 (mesa_formats[format] == MESA_FORMAT_R8G8B8A8_UNORM ||
266 mesa_formats[format] == MESA_FORMAT_R8G8B8X8_UNORM))
267 continue;
268
269 if (!allow_rgb10 &&
270 (mesa_formats[format] == MESA_FORMAT_B10G10R10A2_UNORM ||
271 mesa_formats[format] == MESA_FORMAT_B10G10R10X2_UNORM ||
272 mesa_formats[format] == MESA_FORMAT_R10G10B10A2_UNORM ||
273 mesa_formats[format] == MESA_FORMAT_R10G10B10X2_UNORM))
274 continue;
275
276 if (!allow_fp16 &&
277 (mesa_formats[format] == MESA_FORMAT_RGBA_FLOAT16 ||
278 mesa_formats[format] == MESA_FORMAT_RGBX_FLOAT16))
279 continue;
280
281 if (!p_screen->is_format_supported(p_screen, pipe_formats[format],
282 PIPE_TEXTURE_2D, 0, 0,
283 PIPE_BIND_RENDER_TARGET |
284 PIPE_BIND_DISPLAY_TARGET))
285 continue;
286
287 for (i = 1; i <= msaa_samples_max; i++) {
288 int samples = i > 1 ? i : 0;
289
290 if (p_screen->is_format_supported(p_screen, pipe_formats[format],
291 PIPE_TEXTURE_2D, samples, samples,
292 PIPE_BIND_RENDER_TARGET)) {
293 msaa_modes[num_msaa_modes++] = samples;
294 }
295 }
296
297 if (num_msaa_modes) {
298 /* Single-sample configs with an accumulation buffer. */
299 new_configs = driCreateConfigs(mesa_formats[format],
300 depth_bits_array, stencil_bits_array,
301 depth_buffer_factor, back_buffer_modes,
302 ARRAY_SIZE(back_buffer_modes),
303 msaa_modes, 1,
304 GL_TRUE, !mixed_color_depth, GL_FALSE);
305 configs = driConcatConfigs(configs, new_configs);
306
307 /* Multi-sample configs without an accumulation buffer. */
308 if (num_msaa_modes > 1) {
309 new_configs = driCreateConfigs(mesa_formats[format],
310 depth_bits_array, stencil_bits_array,
311 depth_buffer_factor, back_buffer_modes,
312 ARRAY_SIZE(back_buffer_modes),
313 msaa_modes+1, num_msaa_modes-1,
314 GL_FALSE, !mixed_color_depth, GL_FALSE);
315 configs = driConcatConfigs(configs, new_configs);
316 }
317 }
318 }
319
320 if (configs == NULL) {
321 debug_printf("%s: driCreateConfigs failed\n", __FUNCTION__);
322 return NULL;
323 }
324
325 return (const __DRIconfig **)configs;
326 }
327
328 /**
329 * Roughly the converse of dri_fill_in_modes.
330 */
331 void
332 dri_fill_st_visual(struct st_visual *stvis,
333 const struct dri_screen *screen,
334 const struct gl_config *mode)
335 {
336 memset(stvis, 0, sizeof(*stvis));
337
338 if (!mode) {
339 stvis->no_config = true;
340 return;
341 }
342
343 /* Deduce the color format. */
344 switch (mode->redMask) {
345 case 0:
346 /* Formats > 32 bpp */
347 assert(mode->floatMode);
348 if (mode->alphaShift > -1) {
349 assert(mode->alphaShift == 48);
350 stvis->color_format = PIPE_FORMAT_R16G16B16A16_FLOAT;
351 } else {
352 stvis->color_format = PIPE_FORMAT_R16G16B16X16_FLOAT;
353 }
354 break;
355
356 case 0x3FF00000:
357 if (mode->alphaMask) {
358 assert(mode->alphaMask == 0xC0000000);
359 stvis->color_format = PIPE_FORMAT_B10G10R10A2_UNORM;
360 } else {
361 stvis->color_format = PIPE_FORMAT_B10G10R10X2_UNORM;
362 }
363 break;
364
365 case 0x000003FF:
366 if (mode->alphaMask) {
367 assert(mode->alphaMask == 0xC0000000);
368 stvis->color_format = PIPE_FORMAT_R10G10B10A2_UNORM;
369 } else {
370 stvis->color_format = PIPE_FORMAT_R10G10B10X2_UNORM;
371 }
372 break;
373
374 case 0x00FF0000:
375 if (mode->alphaMask) {
376 assert(mode->alphaMask == 0xFF000000);
377 stvis->color_format = mode->sRGBCapable ?
378 PIPE_FORMAT_BGRA8888_SRGB :
379 PIPE_FORMAT_BGRA8888_UNORM;
380 } else {
381 stvis->color_format = mode->sRGBCapable ?
382 PIPE_FORMAT_BGRX8888_SRGB :
383 PIPE_FORMAT_BGRX8888_UNORM;
384 }
385 break;
386
387 case 0x000000FF:
388 if (mode->alphaMask) {
389 assert(mode->alphaMask == 0xFF000000);
390 stvis->color_format = mode->sRGBCapable ?
391 PIPE_FORMAT_RGBA8888_SRGB :
392 PIPE_FORMAT_RGBA8888_UNORM;
393 } else {
394 stvis->color_format = mode->sRGBCapable ?
395 PIPE_FORMAT_RGBX8888_SRGB :
396 PIPE_FORMAT_RGBX8888_UNORM;
397 }
398 break;
399
400 case 0x0000F800:
401 stvis->color_format = PIPE_FORMAT_B5G6R5_UNORM;
402 break;
403
404 default:
405 assert(!"unsupported visual: invalid red mask");
406 return;
407 }
408
409 if (mode->sampleBuffers) {
410 stvis->samples = mode->samples;
411 }
412
413 switch (mode->depthBits) {
414 default:
415 case 0:
416 stvis->depth_stencil_format = PIPE_FORMAT_NONE;
417 break;
418 case 16:
419 stvis->depth_stencil_format = PIPE_FORMAT_Z16_UNORM;
420 break;
421 case 24:
422 if (mode->stencilBits == 0) {
423 stvis->depth_stencil_format = (screen->d_depth_bits_last) ?
424 PIPE_FORMAT_Z24X8_UNORM:
425 PIPE_FORMAT_X8Z24_UNORM;
426 } else {
427 stvis->depth_stencil_format = (screen->sd_depth_bits_last) ?
428 PIPE_FORMAT_Z24_UNORM_S8_UINT:
429 PIPE_FORMAT_S8_UINT_Z24_UNORM;
430 }
431 break;
432 case 32:
433 stvis->depth_stencil_format = PIPE_FORMAT_Z32_UNORM;
434 break;
435 }
436
437 stvis->accum_format = (mode->accumRedBits > 0) ?
438 PIPE_FORMAT_R16G16B16A16_SNORM : PIPE_FORMAT_NONE;
439
440 stvis->buffer_mask |= ST_ATTACHMENT_FRONT_LEFT_MASK;
441 stvis->render_buffer = ST_ATTACHMENT_FRONT_LEFT;
442 if (mode->doubleBufferMode) {
443 stvis->buffer_mask |= ST_ATTACHMENT_BACK_LEFT_MASK;
444 stvis->render_buffer = ST_ATTACHMENT_BACK_LEFT;
445 }
446 if (mode->stereoMode) {
447 stvis->buffer_mask |= ST_ATTACHMENT_FRONT_RIGHT_MASK;
448 if (mode->doubleBufferMode)
449 stvis->buffer_mask |= ST_ATTACHMENT_BACK_RIGHT_MASK;
450 }
451
452 if (mode->depthBits > 0 || mode->stencilBits > 0)
453 stvis->buffer_mask |= ST_ATTACHMENT_DEPTH_STENCIL_MASK;
454 /* let the state tracker allocate the accum buffer */
455 }
456
457 static bool
458 dri_get_egl_image(struct st_manager *smapi,
459 void *egl_image,
460 struct st_egl_image *stimg)
461 {
462 struct dri_screen *screen = (struct dri_screen *)smapi;
463 __DRIimage *img = NULL;
464 const struct dri2_format_mapping *map;
465
466 if (screen->lookup_egl_image) {
467 img = screen->lookup_egl_image(screen, egl_image);
468 }
469
470 if (!img)
471 return FALSE;
472
473 stimg->texture = NULL;
474 pipe_resource_reference(&stimg->texture, img->texture);
475 map = dri2_get_mapping_by_fourcc(img->dri_fourcc);
476 stimg->format = map ? map->pipe_format : img->texture->format;
477 stimg->level = img->level;
478 stimg->layer = img->layer;
479
480 if (img->imported_dmabuf && map) {
481 /* Guess sized internal format for dma-bufs. Could be used
482 * by EXT_EGL_image_storage.
483 */
484 mesa_format mesa_format = driImageFormatToGLFormat(map->dri_format);
485 stimg->internalformat = driGLFormatToSizedInternalGLFormat(mesa_format);
486 }
487
488 return TRUE;
489 }
490
491 static int
492 dri_get_param(struct st_manager *smapi,
493 enum st_manager_param param)
494 {
495 struct dri_screen *screen = (struct dri_screen *)smapi;
496
497 switch(param) {
498 case ST_MANAGER_BROKEN_INVALIDATE:
499 return screen->broken_invalidate;
500 default:
501 return 0;
502 }
503 }
504
505 void
506 dri_destroy_screen_helper(struct dri_screen * screen)
507 {
508 if (screen->base.destroy)
509 screen->base.destroy(&screen->base);
510
511 if (screen->st_api && screen->st_api->destroy)
512 screen->st_api->destroy(screen->st_api);
513
514 if (screen->base.screen)
515 screen->base.screen->destroy(screen->base.screen);
516
517 mtx_destroy(&screen->opencl_func_mutex);
518 }
519
520 void
521 dri_destroy_screen(__DRIscreen * sPriv)
522 {
523 struct dri_screen *screen = dri_screen(sPriv);
524
525 dri_destroy_screen_helper(screen);
526
527 pipe_loader_release(&screen->dev, 1);
528
529 free(screen->options.force_gl_vendor);
530
531 /* The caller in dri_util preserves the fd ownership */
532 free(screen);
533 sPriv->driverPrivate = NULL;
534 sPriv->extensions = NULL;
535 }
536
537 static void
538 dri_postprocessing_init(struct dri_screen *screen)
539 {
540 unsigned i;
541
542 for (i = 0; i < PP_FILTERS; i++) {
543 screen->pp_enabled[i] = driQueryOptioni(&screen->dev->option_cache,
544 pp_filters[i].name);
545 }
546 }
547
548 static void
549 dri_set_background_context(struct st_context_iface *st,
550 struct util_queue_monitoring *queue_info)
551 {
552 struct dri_context *ctx = (struct dri_context *)st->st_manager_private;
553 const __DRIbackgroundCallableExtension *backgroundCallable =
554 ctx->sPriv->dri2.backgroundCallable;
555
556 /* Note: Mesa will only call this function if GL multithreading is enabled
557 * We only do that if the loader exposed the __DRI_BACKGROUND_CALLABLE
558 * extension. So we know that backgroundCallable is not NULL.
559 */
560 assert(backgroundCallable);
561 backgroundCallable->setBackgroundContext(ctx->cPriv->loaderPrivate);
562
563 if (ctx->hud)
564 hud_add_queue_for_monitoring(ctx->hud, queue_info);
565 }
566
567 void
568 dri_init_options(struct dri_screen *screen)
569 {
570 pipe_loader_load_options(screen->dev);
571
572 dri_fill_st_options(screen);
573 }
574
575 const __DRIconfig **
576 dri_init_screen_helper(struct dri_screen *screen,
577 struct pipe_screen *pscreen)
578 {
579 screen->base.screen = pscreen;
580 screen->base.get_egl_image = dri_get_egl_image;
581 screen->base.get_param = dri_get_param;
582 screen->base.set_background_context = dri_set_background_context;
583
584 screen->st_api = st_gl_api_create();
585 if (!screen->st_api)
586 return NULL;
587
588 if(pscreen->get_param(pscreen, PIPE_CAP_NPOT_TEXTURES))
589 screen->target = PIPE_TEXTURE_2D;
590 else
591 screen->target = PIPE_TEXTURE_RECT;
592
593 dri_postprocessing_init(screen);
594
595 screen->st_api->query_versions(screen->st_api, &screen->base,
596 &screen->options,
597 &screen->sPriv->max_gl_core_version,
598 &screen->sPriv->max_gl_compat_version,
599 &screen->sPriv->max_gl_es1_version,
600 &screen->sPriv->max_gl_es2_version);
601
602 return dri_fill_in_modes(screen);
603 }
604
605 /* vim: set sw=3 ts=8 sts=3 expandtab: */