wgl: Parse driconf options

Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Charmaine Lee <charmainel@vmware.com>
Reviewed-by: Neha Bhende <bhenden@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12158>
This commit is contained in:
Jesse Natalie 2021-08-01 08:41:35 -07:00 committed by Marge Bot
parent 68ff6f8be5
commit 35ec7e8b8e
4 changed files with 31 additions and 2 deletions

View File

@ -54,4 +54,5 @@ libwgl = static_library(
include_directories : [
inc_include, inc_src, inc_gallium, inc_gallium_aux, inc_mapi, inc_mesa,
],
dependencies : [idep_xmlconfig],
)

View File

@ -38,7 +38,6 @@
#include "util/compiler.h"
#include "util/u_memory.h"
#include "util/u_atomic.h"
#include "frontend/api.h"
#include "hud/hud_context.h"
#include "gldrv.h"
@ -271,6 +270,8 @@ stw_create_context_attribs(HDC hdc, INT iLayerPlane, DHGLRC hShareContext,
goto no_st_ctx;
}
attribs.options = stw_dev->st_options;
ctx->st = stw_dev->stapi->create_context(stw_dev->stapi,
stw_dev->smapi, &attribs, &ctx_err, shareCtx ? shareCtx->st : NULL);
if (ctx->st == NULL)

View File

@ -31,6 +31,8 @@
#include "util/u_debug.h"
#include "util/u_math.h"
#include "util/u_memory.h"
#include "util/u_driconf.h"
#include "util/driconf.h"
#include "pipe/p_screen.h"
#include "stw_device.h"
@ -98,6 +100,20 @@ init_screen(const struct stw_winsys *stw_winsys, HDC hdc)
return true;
}
static void
init_options()
{
const driOptionDescription gallium_driconf[] = {
#include "pipe-loader/driinfo_gallium.h"
};
driParseOptionInfo(&stw_dev->option_info, gallium_driconf, ARRAY_SIZE(gallium_driconf));
driParseConfigFiles(&stw_dev->option_cache, &stw_dev->option_info, 0,
"", NULL, NULL, NULL, 0, NULL, 0);
u_driconf_fill_st_options(&stw_dev->st_options, &stw_dev->option_cache);
}
boolean
stw_init(const struct stw_winsys *stw_winsys)
{
@ -161,6 +177,7 @@ stw_init_screen(HDC hdc)
LeaveCriticalSection(&stw_dev->screen_mutex);
return false;
}
init_options();
stw_pixelformat_init();
}
@ -205,6 +222,11 @@ stw_cleanup(void)
return;
}
free(stw_dev->st_options.force_gl_vendor);
free(stw_dev->st_options.force_gl_renderer);
driDestroyOptionCache(&stw_dev->option_cache);
driDestroyOptionInfo(&stw_dev->option_info);
handle_table_destroy(stw_dev->ctx_table);
stw_framebuffer_cleanup();

View File

@ -30,13 +30,14 @@
#include "pipe/p_compiler.h"
#include "frontend/api.h"
#include "util/u_handle_table.h"
#include "util/u_dynarray.h"
#include "util/xmlconfig.h"
#include <GL/gl.h>
#include "gldrv.h"
#include "stw_pixelformat.h"
#ifdef __cplusplus
extern "C" {
#endif
@ -85,6 +86,10 @@ struct stw_device
int refresh_rate;
int swap_interval;
driOptionCache option_cache;
driOptionCache option_info;
struct st_config_options st_options;
bool initialized;
};