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