From: Marek Olšák Date: Tue, 20 Jun 2017 22:34:12 +0000 (+0200) Subject: st/dri: get drirc options before creating pipe_screen X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6b0f6e693ba4b682679e31cc528974bbf0291e45;p=mesa.git st/dri: get drirc options before creating pipe_screen dri_init_options_get_screen_flags will return the flags for create_screen(). Reviewed-by: Nicolai Hähnle --- diff --git a/src/gallium/state_trackers/dri/dri2.c b/src/gallium/state_trackers/dri/dri2.c index 2d0e78cfdda..2402c61bd85 100644 --- a/src/gallium/state_trackers/dri/dri2.c +++ b/src/gallium/state_trackers/dri/dri2.c @@ -2025,8 +2025,13 @@ dri2_init_screen(__DRIscreen * sPriv) if (screen->fd < 0 || (fd = fcntl(screen->fd, F_DUPFD_CLOEXEC, 3)) < 0) goto free_screen; - if (pipe_loader_drm_probe_fd(&screen->dev, fd)) - pscreen = pipe_loader_create_screen(screen->dev, 0); + + if (pipe_loader_drm_probe_fd(&screen->dev, fd)) { + unsigned flags = + dri_init_options_get_screen_flags(screen, screen->dev->driver_name); + + pscreen = pipe_loader_create_screen(screen->dev, flags); + } if (!pscreen) goto release_pipe; @@ -2064,7 +2069,7 @@ dri2_init_screen(__DRIscreen * sPriv) else sPriv->extensions = dri_screen_extensions; - configs = dri_init_screen_helper(screen, pscreen, screen->dev->driver_name); + configs = dri_init_screen_helper(screen, pscreen); if (!configs) goto destroy_screen; @@ -2116,8 +2121,10 @@ dri_kms_init_screen(__DRIscreen * sPriv) if (screen->fd < 0 || (fd = fcntl(screen->fd, F_DUPFD_CLOEXEC, 3)) < 0) goto free_screen; + unsigned flags = dri_init_options_get_screen_flags(screen, "swrast"); + if (pipe_loader_sw_probe_kms(&screen->dev, fd)) - pscreen = pipe_loader_create_screen(screen->dev, 0); + pscreen = pipe_loader_create_screen(screen->dev, flags); if (!pscreen) goto release_pipe; @@ -2137,7 +2144,7 @@ dri_kms_init_screen(__DRIscreen * sPriv) sPriv->extensions = dri_screen_extensions; - configs = dri_init_screen_helper(screen, pscreen, "swrast"); + configs = dri_init_screen_helper(screen, pscreen); if (!configs) goto destroy_screen; diff --git a/src/gallium/state_trackers/dri/dri_screen.c b/src/gallium/state_trackers/dri/dri_screen.c index a66689e99e9..1b414b28d1a 100644 --- a/src/gallium/state_trackers/dri/dri_screen.c +++ b/src/gallium/state_trackers/dri/dri_screen.c @@ -460,10 +460,25 @@ dri_set_background_context(struct st_context_iface *st) backgroundCallable->setBackgroundContext(ctx->cPriv->loaderPrivate); } +unsigned +dri_init_options_get_screen_flags(struct dri_screen *screen, + const char* driver_name) +{ + unsigned flags = 0; + + driParseOptionInfo(&screen->optionCacheDefaults, gallium_config_options.xml); + driParseConfigFiles(&screen->optionCache, + &screen->optionCacheDefaults, + screen->sPriv->myNum, + driver_name); + dri_fill_st_options(screen); + + return flags; +} + const __DRIconfig ** dri_init_screen_helper(struct dri_screen *screen, - struct pipe_screen *pscreen, - const char* driver_name) + struct pipe_screen *pscreen) { screen->base.screen = pscreen; screen->base.get_egl_image = dri_get_egl_image; @@ -479,15 +494,6 @@ dri_init_screen_helper(struct dri_screen *screen, else screen->target = PIPE_TEXTURE_RECT; - driParseOptionInfo(&screen->optionCacheDefaults, gallium_config_options.xml); - - driParseConfigFiles(&screen->optionCache, - &screen->optionCacheDefaults, - screen->sPriv->myNum, - driver_name); - - dri_fill_st_options(screen); - /* Handle force_s3tc_enable. */ if (!util_format_s3tc_enabled && screen->options.force_s3tc_enable) { /* Ensure libtxc_dxtn has been loaded if available. diff --git a/src/gallium/state_trackers/dri/dri_screen.h b/src/gallium/state_trackers/dri/dri_screen.h index 7f5fd13630f..550bc510cec 100644 --- a/src/gallium/state_trackers/dri/dri_screen.h +++ b/src/gallium/state_trackers/dri/dri_screen.h @@ -137,10 +137,13 @@ void dri_fill_st_visual(struct st_visual *stvis, struct dri_screen *screen, const struct gl_config *mode); +unsigned +dri_init_options_get_screen_flags(struct dri_screen *screen, + const char* driver_name); + const __DRIconfig ** dri_init_screen_helper(struct dri_screen *screen, - struct pipe_screen *pscreen, - const char* driver_name); + struct pipe_screen *pscreen); void dri_destroy_screen_helper(struct dri_screen * screen); diff --git a/src/gallium/state_trackers/dri/drisw.c b/src/gallium/state_trackers/dri/drisw.c index 877aa716d26..189d61c4cb6 100644 --- a/src/gallium/state_trackers/dri/drisw.c +++ b/src/gallium/state_trackers/dri/drisw.c @@ -399,13 +399,15 @@ drisw_init_screen(__DRIscreen * sPriv) sPriv->driverPrivate = (void *)screen; sPriv->extensions = drisw_screen_extensions; + unsigned flags = dri_init_options_get_screen_flags(screen, "swrast"); + if (pipe_loader_sw_probe_dri(&screen->dev, &drisw_lf)) - pscreen = pipe_loader_create_screen(screen->dev, 0); + pscreen = pipe_loader_create_screen(screen->dev, flags); if (!pscreen) goto fail; - configs = dri_init_screen_helper(screen, pscreen, "swrast"); + configs = dri_init_screen_helper(screen, pscreen); if (!configs) goto fail;