wgl: Add a driconf option to force pixel formats with GDI support

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39465>
This commit is contained in:
Jesse Natalie 2026-01-22 12:08:23 -08:00 committed by Marge Bot
parent 895ff7fe92
commit bac1ceb83f
3 changed files with 10 additions and 0 deletions

View file

@ -113,6 +113,7 @@ static const driOptionDescription gallium_driconf[] = {
DRI_CONF_SECTION("WGL")
DRI_CONF_WGL_FRAME_LATENCY(2)
DRI_CONF_WGL_SWAP_INTERVAL(1)
DRI_CONF_WGL_REQUIRE_GDI_COMPAT(false)
DRI_CONF_SECTION_END
};

View file

@ -264,6 +264,9 @@ add_color_format_variants(const struct stw_pf_color_info *color_formats,
bind_flags |= PIPE_BIND_DISPLAY_TARGET;
}
bool require_gdi_compat =
driQueryOptionb(&stw_dev->option_cache, "wgl_require_gdi_compat");
for (ms = 0; ms < ARRAY_SIZE(stw_pf_multisample); ms++) {
unsigned samples = stw_pf_multisample[ms];
@ -288,6 +291,8 @@ add_color_format_variants(const struct stw_pf_color_info *color_formats,
}
for (f = 0; f < ARRAY_SIZE(stw_pf_flag); f++) {
if (require_gdi_compat && (stw_pf_flag[f] & PFD_SUPPORT_GDI) == 0)
continue;
for (acc = 0; acc < 2; acc++) {
stw_pixelformat_add(stw_dev, extended, &color_formats[cfmt],
depth, acc * 16, stw_pf_flag[f], samples);

View file

@ -581,6 +581,10 @@
DRI_CONF_OPT_I(wgl_swap_interval, def, 1, 4, \
"Override default swap interval")
#define DRI_CONF_WGL_REQUIRE_GDI_COMPAT(def) \
DRI_CONF_OPT_B(wgl_require_gdi_compat, def, \
"Require all pixel formats to have PFD_SUPPORT_GDI flag")
/**
* \brief virgl specific configuration options
*/