[Mesa-dev] [PATCH] mesa: Specify a better GL_MAX_SERVER_WAIT_TIMEOUT limit.

Ian Romanick idr at freedesktop.org
Wed Aug 7 15:48:26 PDT 2013


On 08/07/2013 12:56 PM, Kenneth Graunke wrote:
> The previous value of (GLuint64) ~0 has some problems:
>
> GL_MAX_SERVER_WAIT_TIMEOUT is supposed to be a GLuint64 value, but has
> to be queried via GetInteger64v(), which returns a GLint64.  This means
> that some applications are likely to treat it as a signed integer, where
> ~0 means -1.  Negative values are nonsensical and problematic.
>
> When interpreted correctly, ~0 translates to about 0.58 million years,
> which seems rather excessive.
>
> This patch changes it to 0x1fff7fffffff, which is about 1.11 years.
> This is still plenty long, and is the same as both an int64 and uint64.
> Applications that accidentally store it in a 32-bit int/unsigned also
> get a non-zero value, which is again the same as both int and unsigned.
         ^^^^^^^^ and non-negative

> Cc: Ian Romanick <idr at freedesktop.org>
> Cc: Nicholas Mack <nichmack at gmail.com>
> Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
> ---
>   src/mesa/main/context.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
> index d687fb7..582b3d4 100644
> --- a/src/mesa/main/context.c
> +++ b/src/mesa/main/context.c
> @@ -622,7 +622,7 @@ _mesa_init_constants(struct gl_context *ctx)
>      ctx->Const.MaxSamples = 0;
>
>      /* GL_ARB_sync */
> -   ctx->Const.MaxServerWaitTimeout = (GLuint64) ~0;
> +   ctx->Const.MaxServerWaitTimeout = 0x1fff7fffffff;

Does this need any ULL decoration on the end to make other compilers happy?

>
>      /* GL_ATI_envmap_bumpmap */
>      ctx->Const.SupportedBumpUnits = SUPPORTED_ATI_BUMP_UNITS;
>



More information about the mesa-dev mailing list