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