*/
#include <string.h>
+#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <stdint.h>
uint64_t
-driParseDebugString( const char * debug,
- const struct dri_debug_control * control )
+driParseDebugString(const char *debug,
+ const struct dri_debug_control *control)
{
uint64_t flag = 0;
- if ( debug != NULL ) {
- while( control->string != NULL ) {
- if ( !strcmp( debug, "all" ) ||
- strstr( debug, control->string ) != NULL ) {
- flag |= control->flag;
- }
-
- control++;
+ if (debug != NULL) {
+ for (; control->string != NULL; control++) {
+ if (!strcmp(debug, "all")) {
+ flag |= control->flag;
+
+ } else {
+ const char *s = debug;
+ unsigned n;
+
+ for (; n = strcspn(s, ", "), *s; s += MAX2(1, n)) {
+ if (strlen(control->string) == n &&
+ !strncmp(control->string, s, n))
+ flag |= control->flag;
+ }
+ }
}
}
masks = masks_table[0];
break;
case MESA_FORMAT_B8G8R8X8_UNORM:
+ case MESA_FORMAT_B8G8R8X8_SRGB:
masks = masks_table[1];
break;
case MESA_FORMAT_B8G8R8A8_UNORM:
break;
default:
fprintf(stderr, "[%s:%u] Unknown framebuffer type %s (%d).\n",
- __FUNCTION__, __LINE__,
+ __func__, __LINE__,
_mesa_get_format_name(format), format);
return NULL;
}
is_srgb = _mesa_get_format_color_encoding(format) == GL_SRGB;
num_modes = num_depth_stencil_bits * num_db_modes * num_accum_bits * num_msaa_modes;
- configs = calloc(1, (num_modes + 1) * sizeof *configs);
+ configs = calloc(num_modes + 1, sizeof *configs);
if (configs == NULL)
return NULL;
driGetConfigAttrib(const __DRIconfig *config,
unsigned int attrib, unsigned int *value)
{
- int i;
+ unsigned i;
for (i = 0; i < ARRAY_SIZE(attribMap); i++)
if (attribMap[i].attrib == attrib)
* Currently only the following queries are supported by this function:
*
* - \c __DRI2_RENDERER_VERSION
+ * - \c __DRI2_RENDERER_PREFERRED_PROFILE
* - \c __DRI2_RENDERER_OPENGL_CORE_PROFILE_VERSION
* - \c __DRI2_RENDERER_OPENGL_COMPATIBLITY_PROFILE_VERSION
* - \c __DRI2_RENDERER_ES_PROFILE_VERSION
value[2] = v[2];
return 0;
}
+ case __DRI2_RENDERER_PREFERRED_PROFILE:
+ value[0] = (psp->max_gl_core_version != 0)
+ ? (1U << __DRI_API_OPENGL_CORE) : (1U << __DRI_API_OPENGL);
+ return 0;
case __DRI2_RENDERER_OPENGL_CORE_PROFILE_VERSION:
value[0] = psp->max_gl_core_version / 10;
value[1] = psp->max_gl_core_version % 10;