X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fdrivers%2Fdri%2Fcommon%2Futils.c;h=0dd879abc968e3912709fd1ed2591e56c2b6de6d;hb=f0f04cd12db156ec53b7ea46fae27199af121f90;hp=b272eb74eaf5f3fd6b2007b65fa09216c98779eb;hpb=1f196b786d6bd0c6a5dbdc638574ff716cc3d4de;p=mesa.git diff --git a/src/mesa/drivers/dri/common/utils.c b/src/mesa/drivers/dri/common/utils.c index b272eb74eaf..0dd879abc96 100644 --- a/src/mesa/drivers/dri/common/utils.c +++ b/src/mesa/drivers/dri/common/utils.c @@ -34,10 +34,32 @@ #include "main/mtypes.h" #include "main/cpuinfo.h" #include "main/extensions.h" -#include "glapi/dispatch.h" #include "utils.h" +/** + * Print message to \c stderr if the \c LIBGL_DEBUG environment variable + * is set. + * + * Is called from the drivers. + * + * \param f \c printf like format string. + */ +void +__driUtilMessage(const char *f, ...) +{ + va_list args; + + if (getenv("LIBGL_DEBUG")) { + fprintf(stderr, "libGL: "); + va_start(args, f); + vfprintf(stderr, f, args); + va_end(args); + fprintf(stderr, "\n"); + } +} + + unsigned driParseDebugString( const char * debug, const struct dri_debug_control * control ) @@ -109,7 +131,7 @@ driGetRendererString( char * buffer, const char * hardware_name, cpu = _mesa_get_cpu_string(); if (cpu) { offset += sprintf(buffer + offset, " %s", cpu); - _mesa_free(cpu); + free(cpu); } return offset; @@ -231,9 +253,6 @@ void driInitSingleExtension( GLcontext * ctx, /** * Utility function used by drivers to test the verions of other components. * - * If one of the version requirements is not met, a message is logged using - * \c __driUtilMessage. - * * \param driver_name Name of the driver. Used in error messages. * \param driActual Actual DRI version supplied __driCreateNewScreen. * \param driExpected Minimum DRI version required by the driver. @@ -245,7 +264,7 @@ void driInitSingleExtension( GLcontext * ctx, * \returns \c GL_TRUE if all version requirements are met. Otherwise, * \c GL_FALSE is returned. * - * \sa __driCreateNewScreen, driCheckDriDdxDrmVersions2, __driUtilMessage + * \sa __driCreateNewScreen, driCheckDriDdxDrmVersions2 * * \todo * Now that the old \c driCheckDriDdxDrmVersions function is gone, this @@ -276,10 +295,9 @@ driCheckDriDdxDrmVersions3(const char * driver_name, } /* Check that the DDX driver version is compatible */ - /* for miniglx we pass in -1 so we can ignore the DDX version */ - if ( (ddxActual->major != -1) && ((ddxActual->major < ddxExpected->major_min) + if ( (ddxActual->major < ddxExpected->major_min) || (ddxActual->major > ddxExpected->major_max) - || (ddxActual->minor < ddxExpected->minor)) ) { + || (ddxActual->minor < ddxExpected->minor) ) { fprintf(stderr, format2, driver_name, "DDX", ddxExpected->major_min, ddxExpected->major_max, ddxExpected->minor, ddxActual->major, ddxActual->minor, ddxActual->patch); @@ -425,7 +443,8 @@ driCreateConfigs(GLenum fb_format, GLenum fb_type, const uint8_t * depth_bits, const uint8_t * stencil_bits, unsigned num_depth_stencil_bits, const GLenum * db_modes, unsigned num_db_modes, - const uint8_t * msaa_samples, unsigned num_msaa_modes) + const uint8_t * msaa_samples, unsigned num_msaa_modes, + GLboolean enable_accum) { static const uint8_t bits_table[4][4] = { /* R G B A */ @@ -487,7 +506,7 @@ driCreateConfigs(GLenum fb_format, GLenum fb_type, __GLcontextModes *modes; unsigned i, j, k, h; unsigned num_modes; - unsigned num_accum_bits = 2; + unsigned num_accum_bits = (enable_accum) ? 2 : 1; switch ( fb_type ) { case GL_UNSIGNED_BYTE_3_3_2: @@ -559,7 +578,7 @@ driCreateConfigs(GLenum fb_format, GLenum fb_type, } num_modes = num_depth_stencil_bits * num_db_modes * num_accum_bits * num_msaa_modes; - configs = _mesa_calloc((num_modes + 1) * sizeof *configs); + configs = calloc(1, (num_modes + 1) * sizeof *configs); if (configs == NULL) return NULL; @@ -568,7 +587,7 @@ driCreateConfigs(GLenum fb_format, GLenum fb_type, for ( i = 0 ; i < num_db_modes ; i++ ) { for ( h = 0 ; h < num_msaa_modes; h++ ) { for ( j = 0 ; j < num_accum_bits ; j++ ) { - *c = _mesa_malloc (sizeof **c); + *c = malloc (sizeof **c); modes = &(*c)->modes; c++; @@ -626,11 +645,10 @@ driCreateConfigs(GLenum fb_format, GLenum fb_type, modes->bindToTextureRgb = GL_TRUE; modes->bindToTextureRgba = GL_TRUE; modes->bindToMipmapTexture = GL_FALSE; - modes->bindToTextureTargets = modes->rgbMode ? - __DRI_ATTRIB_TEXTURE_1D_BIT | - __DRI_ATTRIB_TEXTURE_2D_BIT | - __DRI_ATTRIB_TEXTURE_RECTANGLE_BIT : - 0; + modes->bindToTextureTargets = + __DRI_ATTRIB_TEXTURE_1D_BIT | + __DRI_ATTRIB_TEXTURE_2D_BIT | + __DRI_ATTRIB_TEXTURE_RECTANGLE_BIT; } } } @@ -653,7 +671,7 @@ __DRIconfig **driConcatConfigs(__DRIconfig **a, while (b[j] != NULL) j++; - all = _mesa_malloc((i + j + 1) * sizeof *all); + all = malloc((i + j + 1) * sizeof *all); index = 0; for (i = 0; a[i] != NULL; i++) all[index++] = a[i]; @@ -661,8 +679,8 @@ __DRIconfig **driConcatConfigs(__DRIconfig **a, all[index++] = b[j]; all[index++] = NULL; - _mesa_free(a); - _mesa_free(b); + free(a); + free(b); return all; } @@ -727,10 +745,7 @@ driGetConfigAttribIndex(const __DRIconfig *config, { switch (attribMap[index].attrib) { case __DRI_ATTRIB_RENDER_TYPE: - if (config->modes.rgbMode) - *value = __DRI_ATTRIB_RGBA_BIT; - else - *value = __DRI_ATTRIB_COLOR_INDEX_BIT; + *value = __DRI_ATTRIB_RGBA_BIT; break; case __DRI_ATTRIB_CONFIG_CAVEAT: if (config->modes.visualRating == GLX_NON_CONFORMANT_CONFIG)