1
0
Fork 0

cogl: Remove support for cogl.conf

There are still environment variables for these controls, but having
them in a config file doesn't really make sense for mutter. Even if it
did we probably don't want to be parsing the same file as some
standalone version of cogl.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/902
This commit is contained in:
Adam Jackson 2019-10-22 19:47:34 -04:00 committed by Florian Müllner
parent 46aeb9634f
commit 17e39ad79c
6 changed files with 1 additions and 208 deletions

View file

@ -1,45 +0,0 @@
/*
* Cogl
*
* A Low Level GPU Graphics and Utilities API
*
* Copyright (C) 2011 Intel Corporation.
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*
*
* Authors:
* Robert Bragg <robert@linux.intel.com>
*/
#ifndef __COGL_CONFIG_PRIVATE_H
#define __COGL_CONFIG_PRIVATE_H
void
_cogl_config_read (void);
extern char *_cogl_config_driver;
extern char *_cogl_config_renderer;
extern char *_cogl_config_disable_gl_extensions;
extern char *_cogl_config_override_gl_version;
#endif /* __COGL_CONFIG_PRIVATE_H */

View file

@ -1,133 +0,0 @@
/*
* Cogl
*
* A Low Level GPU Graphics and Utilities API
*
* Copyright (C) 2011 Intel Corporation.
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*
* Authors:
* Robert Bragg <robert@linux.intel.com>
*/
#include "cogl-config.h"
#include "cogl-debug.h"
#include "cogl-config-private.h"
#include <glib.h>
char *_cogl_config_driver;
char *_cogl_config_renderer;
char *_cogl_config_disable_gl_extensions;
char *_cogl_config_override_gl_version;
/* Array of config options that just set a global string */
static const struct
{
const char *conf_name;
char **variable;
} cogl_config_string_options[] =
{
{ "COGL_DRIVER", &_cogl_config_driver },
{ "COGL_RENDERER", &_cogl_config_renderer },
{ "COGL_DISABLE_GL_EXTENSIONS", &_cogl_config_disable_gl_extensions },
{ "COGL_OVERRIDE_GL_VERSION", &_cogl_config_override_gl_version }
};
static void
_cogl_config_process (GKeyFile *key_file)
{
char *value;
int i;
value = g_key_file_get_string (key_file, "global", "COGL_DEBUG", NULL);
if (value)
{
_cogl_parse_debug_string (value,
TRUE /* enable the flags */,
TRUE /* ignore help option */);
g_free (value);
}
value = g_key_file_get_string (key_file, "global", "COGL_NO_DEBUG", NULL);
if (value)
{
_cogl_parse_debug_string (value,
FALSE /* disable the flags */,
TRUE /* ignore help option */);
g_free (value);
}
for (i = 0; i < G_N_ELEMENTS (cogl_config_string_options); i++)
{
const char *conf_name = cogl_config_string_options[i].conf_name;
char **variable = cogl_config_string_options[i].variable;
value = g_key_file_get_string (key_file, "global", conf_name, NULL);
if (value)
{
g_free (*variable);
*variable = value;
}
}
}
void
_cogl_config_read (void)
{
GKeyFile *key_file = g_key_file_new ();
const char * const *system_dirs = g_get_system_config_dirs ();
char *filename;
gboolean status = FALSE;
int i;
for (i = 0; system_dirs[i]; i++)
{
filename = g_build_filename (system_dirs[i], "cogl", "cogl.conf", NULL);
status = g_key_file_load_from_file (key_file,
filename,
0,
NULL);
g_free (filename);
if (status)
{
_cogl_config_process (key_file);
g_key_file_free (key_file);
key_file = g_key_file_new ();
break;
}
}
filename = g_build_filename (g_get_user_config_dir (), "cogl", "cogl.conf", NULL);
status = g_key_file_load_from_file (key_file,
filename,
0,
NULL);
g_free (filename);
if (status)
_cogl_config_process (key_file);
g_key_file_free (key_file);
}

View file

@ -46,7 +46,6 @@
#include "cogl-attribute-private.h" #include "cogl-attribute-private.h"
#include "cogl1-context.h" #include "cogl1-context.h"
#include "cogl-gpu-info-private.h" #include "cogl-gpu-info-private.h"
#include "cogl-config-private.h"
#include "cogl-gtype-private.h" #include "cogl-gtype-private.h"
#include "driver/gl/cogl-pipeline-opengl-private.h" #include "driver/gl/cogl-pipeline-opengl-private.h"
#include "driver/gl/cogl-util-gl-private.h" #include "driver/gl/cogl-util-gl-private.h"
@ -590,11 +589,9 @@ _cogl_context_get_gl_extensions (CoglContext *context)
ret = g_strsplit (all_extensions, " ", 0 /* max tokens */); ret = g_strsplit (all_extensions, " ", 0 /* max tokens */);
} }
if ((env_disabled_extensions = g_getenv ("COGL_DISABLE_GL_EXTENSIONS")) if ((env_disabled_extensions = g_getenv ("COGL_DISABLE_GL_EXTENSIONS")))
|| _cogl_config_disable_gl_extensions)
{ {
char **split_env_disabled_extensions; char **split_env_disabled_extensions;
char **split_conf_disabled_extensions;
char **src, **dst; char **src, **dst;
if (env_disabled_extensions) if (env_disabled_extensions)
@ -605,14 +602,6 @@ _cogl_context_get_gl_extensions (CoglContext *context)
else else
split_env_disabled_extensions = NULL; split_env_disabled_extensions = NULL;
if (_cogl_config_disable_gl_extensions)
split_conf_disabled_extensions =
g_strsplit (_cogl_config_disable_gl_extensions,
",",
0 /* no max tokens */);
else
split_conf_disabled_extensions = NULL;
for (dst = ret, src = ret; for (dst = ret, src = ret;
*src; *src;
src++) src++)
@ -623,10 +612,6 @@ _cogl_context_get_gl_extensions (CoglContext *context)
for (d = split_env_disabled_extensions; *d; d++) for (d = split_env_disabled_extensions; *d; d++)
if (!strcmp (*src, *d)) if (!strcmp (*src, *d))
goto disabled; goto disabled;
if (split_conf_disabled_extensions)
for (d = split_conf_disabled_extensions; *d; d++)
if (!strcmp (*src, *d))
goto disabled;
*(dst++) = *src; *(dst++) = *src;
continue; continue;
@ -640,8 +625,6 @@ _cogl_context_get_gl_extensions (CoglContext *context)
if (split_env_disabled_extensions) if (split_env_disabled_extensions)
g_strfreev (split_env_disabled_extensions); g_strfreev (split_env_disabled_extensions);
if (split_conf_disabled_extensions)
g_strfreev (split_conf_disabled_extensions);
} }
return ret; return ret;
@ -654,8 +637,6 @@ _cogl_context_get_gl_version (CoglContext *context)
if ((version_override = g_getenv ("COGL_OVERRIDE_GL_VERSION"))) if ((version_override = g_getenv ("COGL_OVERRIDE_GL_VERSION")))
return version_override; return version_override;
else if (_cogl_config_override_gl_version)
return _cogl_config_override_gl_version;
else else
return (const char *) context->glGetString (GL_VERSION); return (const char *) context->glGetString (GL_VERSION);

View file

@ -43,7 +43,6 @@
#include "cogl-renderer.h" #include "cogl-renderer.h"
#include "cogl-renderer-private.h" #include "cogl-renderer-private.h"
#include "cogl-display-private.h" #include "cogl-display-private.h"
#include "cogl-config-private.h"
#include "cogl-gtype-private.h" #include "cogl-gtype-private.h"
#include "winsys/cogl-winsys-private.h" #include "winsys/cogl-winsys-private.h"
@ -395,9 +394,6 @@ _cogl_renderer_choose_driver (CoglRenderer *renderer,
const CoglDriverDescription *desc; const CoglDriverDescription *desc;
int i; int i;
if (!driver_name)
driver_name = _cogl_config_driver;
if (driver_name) if (driver_name)
{ {
driver_override = driver_name_to_id (driver_name); driver_override = driver_name_to_id (driver_name);
@ -568,8 +564,6 @@ cogl_renderer_connect (CoglRenderer *renderer, GError **error)
else else
{ {
char *user_choice = getenv ("COGL_RENDERER"); char *user_choice = getenv ("COGL_RENDERER");
if (!user_choice)
user_choice = _cogl_config_renderer;
if (user_choice && if (user_choice &&
g_ascii_strcasecmp (winsys->name, user_choice) != 0) g_ascii_strcasecmp (winsys->name, user_choice) != 0)
continue; continue;

View file

@ -48,7 +48,6 @@
#include "cogl-attribute-private.h" #include "cogl-attribute-private.h"
#include "cogl-framebuffer-private.h" #include "cogl-framebuffer-private.h"
#include "cogl-renderer-private.h" #include "cogl-renderer-private.h"
#include "cogl-config-private.h"
#include "cogl-private.h" #include "cogl-private.h"
#include "cogl1-context.h" #include "cogl1-context.h"
#include "cogl-offscreen.h" #include "cogl-offscreen.h"
@ -630,7 +629,6 @@ _cogl_init (void)
g_type_init (); g_type_init ();
#endif #endif
_cogl_config_read ();
_cogl_debug_check_environment (); _cogl_debug_check_environment ();
initialized = TRUE; initialized = TRUE;
} }

View file

@ -339,8 +339,6 @@ cogl_sources = [
'cogl-point-in-poly.c', 'cogl-point-in-poly.c',
'cogl-list.c', 'cogl-list.c',
'cogl-list.h', 'cogl-list.h',
'cogl-config-private.h',
'cogl-config.c',
'cogl-boxed-value.h', 'cogl-boxed-value.h',
'cogl-boxed-value.c', 'cogl-boxed-value.c',
'cogl-snippet-private.h', 'cogl-snippet-private.h',