Bug 91293 - GLX_NONE != None
Summary: GLX_NONE != None
Status: RESOLVED FIXED
Alias: None
Product: cairo
Classification: Unclassified
Component: gl backend (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: cairo-bugs mailing list
QA Contact: cairo-bugs mailing list
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-07-10 15:08 UTC by Massimo
Modified: 2015-07-31 00:20 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Description Massimo 2015-07-10 15:08:44 UTC
Running:

>(cd test; DISPLAY=:2 CAIRO_TEST_TARGET=gl valgrind --track-origins=yes .libs/cairo-test-suite -f text-antialias-gray )

valgrind reports:

>==10525== Conditional jump or move depends on uninitialised value(s)
>==10525==    at 0x393C81C995: ??? (in /usr/lib64/libGL.so.1.2.0)
>==10525==    by 0x393C819E11: glXChooseVisual (in /usr/lib64/libGL.so.1.2.0)
>==10525==    by 0x45EDB8: _cairo_boilerplate_gl_create_surface (cairo/boilerplate/cairo-boilerplate-glx.c:123)
>==10525==    by 0x40DD4C: cairo_test_for_target (cairo/test/cairo-test.c:819)
>==10525==    by 0x40EEC1: _cairo_test_context_run_for_target (cairo/test/cairo-test.c:1551)
>==10525==    by 0x40BB13: _cairo_test_runner_draw (cairo/test/cairo-test-runner.c:255)
>==10525==    by 0x40BB13: main (cairo/test/cairo-test-runner.c:937)
>==10525==  Uninitialised value was created by a stack allocation
>==10525==    at 0x45EC40: _cairo_boilerplate_gl_create_surface (cairo/boilerplate/cairo-boilerplate-glx.c:78)


looking what's allocated on the stack in
boilerplate/cairo-boilerplate-glx.c around line 78:

http://cgit.freedesktop.org/cairo/tree/boilerplate/cairo-boilerplate-glx.c#n78

you can see that the attribute list is terminated by GLX_NONE, but
the man page of 'glXChooseVisual' says it must be terminated with None.

on my laptop  grep says:
[massimo@laptop cairo (master *)]$ grep None /usr/include/X11/X.h
#define None                 0L /* universal null resource or null atom */
[massimo@laptop cairo (master *)]$ grep GLX_NONE /usr/include/GL/glx.h
#define GLX_NONE                        0x8000

so they're not interchangeable. And ending the attribute list
with 'None' valgrind does not report this particular warning.

My suggestion here is:
    
sed -i 's/GLX_NONE/None/' boilerplate/cairo-boilerplate-glx.c
make -C boilerplate libcairoboilerplate.la && make -C test
Comment 1 Bryce Harrington 2015-07-31 00:20:18 UTC
LGTM, pushed:

To ssh://git.cairographics.org/git/cairo
   c04bd43..2de9fca  master -> master


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.