[Mesa-dev] [PATCH] glx/dri: Initialize api even if num_attribs == 0.
Vadim Girlin
vadimgirlin at gmail.com
Tue Jan 10 23:47:04 PST 2012
On Tue, 2012-01-10 at 23:36 -0800, Kenneth Graunke wrote:
> Both dri2_create_context_attribs and drisw_create_context_attribs call
> dri2_convert_glx_attribs, expecting it to fill in *api on success.
>
> However, when num_attribs == 0, it was returning true without setting
> *api, causing the caller to use an uninitialized value.
>
> Cc: Vadim Girlin <vadimgirlin at gmail.com>
> Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
> ---
> src/glx/dri_common.c | 4 +++-
> 1 files changed, 3 insertions(+), 1 deletions(-)
>
> Vadim, hopefully this should also fix Unigine Heaven for you.
Yes, this patch works too, thanks.
By the way, to run Heaven I had to build the xserver with the patches
from xorg-devel:
http://lists.x.org/archives/xorg-devel/2011-December/028091.html
I'm not sure if there is another way.
Vadim
>
> diff --git a/src/glx/dri_common.c b/src/glx/dri_common.c
> index 8feb587..ed0b134 100644
> --- a/src/glx/dri_common.c
> +++ b/src/glx/dri_common.c
> @@ -429,8 +429,10 @@ dri2_convert_glx_attribs(unsigned num_attribs, const uint32_t *attribs,
> uint32_t profile;
> int render_type = GLX_RGBA_TYPE;
>
> - if (num_attribs == 0)
> + if (num_attribs == 0) {
> + *api = __DRI_API_OPENGL;
> return true;
> + }
>
> /* This is actually an internal error, but what the heck.
> */
More information about the mesa-dev
mailing list