[Mesa-dev] [PATCH]: global forcing anisotropy

Michel Dänzer michel at daenzer.net
Fri May 20 04:31:47 PDT 2011


On Don, 2011-05-19 at 21:59 +0200, Carl-Philip Haensch wrote: 
> This attached patch should enable an option for forcing anisotropy  
> from driconf.

[...]

> From: Carl-Philip Haensch <carli at carli-laptop.(none)>

Please use a valid e-mail address for the Git author identity. E.g. you can put

        [user]
        	email = Carl-Philip.Haensch at mailbox.tu-dresden.de

in ~/.gitconfig and override it in any Git repository's .git/config if
necessary. You can verify the current author and committer identity in
each repository with 

        git var -l|grep GIT.*IDENT


> diff --git a/src/gallium/state_trackers/dri/common/dri_context.c b/src/gallium/state_trackers/dri/common/dri_context.c
> index e23c1bc..73ac43b 100644
> --- a/src/gallium/state_trackers/dri/common/dri_context.c
> +++ b/src/gallium/state_trackers/dri/common/dri_context.c
> @@ -37,6 +37,7 @@
>  
>  #include "pipe/p_context.h"
>  #include "state_tracker/st_context.h"
> +#include "state_tracker/drm_driver.h"
>  
>  static void
>  dri_init_extensions(struct dri_context *ctx)
> @@ -86,8 +87,8 @@ dri_create_context(gl_api api, const struct gl_config * visual,
>     ctx->lock = screen->drmLock;
>  
>     driParseConfigFiles(&ctx->optionCache,
> -                      &screen->optionCache, sPriv->myNum, "dri");
> -
> +                      &screen->optionCache, sPriv->myNum, driver_descriptor.name);

This should probably be a separate fix.


> +   screen->global_optionCache = &ctx->optionCache;

screen->global_optionCache will become a dangling pointer after the
context is destroyed. 

I suspect a per-context hook corresponding to dri_get_param() may be necessary here.


> diff --git a/src/mesa/state_tracker/st_atom_sampler.c b/src/mesa/state_tracker/st_atom_sampler.c
> index 06024ad..0dba553 100644
> --- a/src/mesa/state_tracker/st_atom_sampler.c
> +++ b/src/mesa/state_tracker/st_atom_sampler.c
> @@ -177,8 +177,9 @@ static void convert_sampler(struct st_context *st,
>                           sampler->border_color);
>      }
>  
> -    sampler->max_anisotropy = (msamp->MaxAnisotropy == 1.0 ?
> -                              0 : (GLuint) msamp->MaxAnisotropy);
> +    sampler->max_anisotropy = MAX2((msamp->MaxAnisotropy == 1.0 ?
> +                              0 : (GLuint) msamp->MaxAnisotropy),
> +                              st->min_anisotropy);

Might be better to write this something like

        float max_anisotropy = MAX2(msamp->MaxAnisotropy, st->min_anisotropy);
        sampler->max_anisotropy = max_anisotropy == 1.0f ? 0 : max_anisotropy;

This way sampler->max_anisotropy will still end up being 0 even if
st->min_anisotropy is 1.0. 


> diff --git a/src/mesa/state_tracker/st_manager.c b/src/mesa/state_tracker/st_manager.c
> index a68544d..4d677a4 100644
> --- a/src/mesa/state_tracker/st_manager.c
> +++ b/src/mesa/state_tracker/st_manager.c
> @@ -694,7 +694,9 @@ st_api_create_context(struct st_api *stapi, struct st_manager *smapi,
>  
>     st->invalidate_on_gl_viewport =
>        smapi->get_param(smapi, ST_MANAGER_BROKEN_INVALIDATE);
> -
> +   st->force_msaa = 0; // ToDo: Ask driconf for it

This looks unrelated to the rest of the change.


-- 
Earthling Michel Dänzer           |                http://www.vmware.com
Libre software enthusiast         |          Debian, X and DRI developer


More information about the mesa-dev mailing list