[Mesa-dev] [PATCH 2/2] swr: Report format max_samples=1 to maintain support for "fake" msaa.
Brian Paul
brianp at vmware.com
Fri Sep 1 04:09:48 UTC 2017
I'm not familiar with this driver so I'll give this an
Acked-by: Brian Paul <brianp at vmware.com>
Roland gave me his R-b for the state tracker patch off-list.
I'll commit that and you can take care of this one. Feel free to close
the bug then.
-Brian
On 08/25/2017 01:59 PM, Bruce Cherniak wrote:
> Accompanying patch "st/mesa: only try to create 1x msaa surfaces for
> 'fake' msaa" requires driver to report max_samples=1 to enable "fake"
> msaa. Previously, 0 and 1 were treated equivalently in st_init_extensions()
> and either could enable "fake" msaa.
>
> This patch raises the swr default msaa_max_count from 0 to 1, so that
> swr_is_format_supported will report max_samples=1.
>
> Real msaa can still be enabled by exporting SWR_MSAA_MAX_COUNT with a
> pow2 value between 2 and 16.
>
> This patch is necessary to prevent an OpenSWR regression resulting from
> the st/mesa patch.
>
> Bugzilla: https://urldefense.proofpoint.com/v2/url?u=https-3A__bugs.freedesktop.org_show-5Fbug.cgi-3Fid-3D102038&d=DwIBAg&c=uilaK90D4TOVoH58JNXRgQ&r=Ie7_encNUsqxbSRbqbNgofw0ITcfE8JKfaUjIQhncGA&m=qdD02tm0IRZ3cDM-14sDyg5PjXgN7HpvqxwdIKPKG_0&s=Lfh53G7s15bwea6KD_n-r5t38aWcMLmz8Dp-k0TfKbA&e=
> ---
> src/gallium/drivers/swr/swr_screen.cpp | 22 +++++++++++-----------
> 1 file changed, 11 insertions(+), 11 deletions(-)
>
> diff --git a/src/gallium/drivers/swr/swr_screen.cpp b/src/gallium/drivers/swr/swr_screen.cpp
> index 3287bc6fee..cc8d9955b8 100644
> --- a/src/gallium/drivers/swr/swr_screen.cpp
> +++ b/src/gallium/drivers/swr/swr_screen.cpp
> @@ -255,13 +255,13 @@ swr_get_param(struct pipe_screen *screen, enum pipe_cap param)
> return 1;
>
> /* MSAA support
> - * If user has explicitly set max_sample_count = 0 (via SWR_MSAA_MAX_COUNT)
> - * then disable all MSAA support and go back to old caps. */
> + * If user has explicitly set max_sample_count = 1 (via SWR_MSAA_MAX_COUNT)
> + * then disable all MSAA support and go back to old (FAKE_SW_MSAA) caps. */
> case PIPE_CAP_TEXTURE_MULTISAMPLE:
> case PIPE_CAP_MULTISAMPLE_Z_RESOLVE:
> - return swr_screen(screen)->msaa_max_count ? 1 : 0;
> + return (swr_screen(screen)->msaa_max_count > 1) ? 1 : 0;
> case PIPE_CAP_FAKE_SW_MSAA:
> - return swr_screen(screen)->msaa_max_count ? 0 : 1;
> + return (swr_screen(screen)->msaa_max_count > 1) ? 0 : 1;
>
> /* unsupported features */
> case PIPE_CAP_ANISOTROPIC_FILTER:
> @@ -1079,22 +1079,22 @@ swr_validate_env_options(struct swr_screen *screen)
> screen->client_copy_limit = client_copy_limit;
>
> /* XXX msaa under development, disable by default for now */
> - screen->msaa_max_count = 0; /* was SWR_MAX_NUM_MULTISAMPLES; */
> + screen->msaa_max_count = 1; /* was SWR_MAX_NUM_MULTISAMPLES; */
>
> /* validate env override values, within range and power of 2 */
> - int msaa_max_count = debug_get_num_option("SWR_MSAA_MAX_COUNT", 0);
> - if (msaa_max_count) {
> - if ((msaa_max_count < 0) || (msaa_max_count > SWR_MAX_NUM_MULTISAMPLES)
> + int msaa_max_count = debug_get_num_option("SWR_MSAA_MAX_COUNT", 1);
> + if (msaa_max_count != 1) {
> + if ((msaa_max_count < 1) || (msaa_max_count > SWR_MAX_NUM_MULTISAMPLES)
> || !util_is_power_of_two(msaa_max_count)) {
> fprintf(stderr, "SWR_MSAA_MAX_COUNT invalid: %d\n", msaa_max_count);
> fprintf(stderr, "must be power of 2 between 1 and %d" \
> - " (or 0 to disable msaa)\n",
> + " (or 1 to disable msaa)\n",
> SWR_MAX_NUM_MULTISAMPLES);
> - msaa_max_count = 0;
> + msaa_max_count = 1;
> }
>
> fprintf(stderr, "SWR_MSAA_MAX_COUNT: %d\n", msaa_max_count);
> - if (!msaa_max_count)
> + if (msaa_max_count == 1)
> fprintf(stderr, "(msaa disabled)\n");
>
> screen->msaa_max_count = msaa_max_count;
>
More information about the mesa-dev
mailing list