I did a quick experiment to try adding an option to use system mesa for Linux distros, but ran into issues.
I'd have some questions:1. Why some gyp targets like ui/gl/gl.gyp:gl hardcode mesa include paths instead of depending on some target from third_party/mesa/mesa.gyp?
2. What's the purpose of ui/gl/generate_bindings.py?
3. Why are symbol names mirroring mesa naming scheme being put into gfx namespace in generated out/Debug/obj/gen/ui/gl/gl_bindings_autogen_osmesa.h ? This results in name clashes like below (when trying system mesa):
out/Debug/obj/gen/ui/gl/gl_bindings_autogen_osmesa.h:40:43: error: previous declaration of ‘GLboolean (* gfx::g_OSMesaGetColorBuffer)(osmesa_context*, GLint*, GLint*, GLint*, void**)’/usr/include/GL/osmesa.h:267:44: error: ‘void (* gfx::g_OSMesaGetProcAddress(const char*))()’ should have been declared inside ‘gfx’/usr/include/GL/osmesa.h:267:44: error: ‘void (* gfx::g_OSMesaGetProcAddress(const char*))()’ redeclared as different kind of symbolout/Debug/obj/gen/ui/gl/gl_bindings_autogen_osmesa.h:41:43: error: previous declaration of ‘void (* (* gfx::g_OSMesaGetProcAddress)(const char*))()’/usr/include/GL/osmesa.h:276:34: error: ‘void gfx::g_OSMesaColorClamp(GLboolean)’ should have been declared inside ‘gfx’/usr/include/GL/osmesa.h:276:34: error: ‘void gfx::g_OSMesaColorClamp(GLboolean)’ redeclared as different kind of symbolout/Debug/obj/gen/ui/gl/gl_bindings_autogen_osmesa.h:42:39: error: previous declaration of ‘void (* gfx::g_OSMesaColorClamp)(GLboolean)’make: *** [out/Debug/obj.target/gl/ui/gl/gl_surface_linux.o] Error 1
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev
On Mon, Oct 22, 2012 at 12:03 PM, Paweł Hajdan, Jr. <phajd...@chromium.org> wrote:I did a quick experiment to try adding an option to use system mesa for Linux distros, but ran into issues.I think we have some fair amount of mods in third_party/mesa.
I'd have some questions:1. Why some gyp targets like ui/gl/gl.gyp:gl hardcode mesa include paths instead of depending on some target from third_party/mesa/mesa.gyp?That could probably be fixed, though right now mesa.gyp doesn't have a target that would export the path without compiling something. Adding a deps would make us compile osmesa when we don't really need it (see below).
2. What's the purpose of ui/gl/generate_bindings.py?We need to choose the GL implementation at run-time because different systems have different GL support (e.g. native vs ANGLE on windows, GLX vs EGL on linux/Chrome OS etc., osmesa for tests etc.), so we need to dynamically load the GL library.We don't want this fact to leak all over the GPU code, so we generate wrappers around the GL libraries that hide the symbol indirection. That's what generate_bindings.py does.
3. Why are symbol names mirroring mesa naming scheme being put into gfx namespace in generated out/Debug/obj/gen/ui/gl/gl_bindings_autogen_osmesa.h ? This results in name clashes like below (when trying system mesa):We reuse GL/GLX/EGL/WGL/MESA names so that the calling code is clear about what it calls.
out/Debug/obj/gen/ui/gl/gl_bindings_autogen_osmesa.h:40:43: error: previous declaration of ‘GLboolean (* gfx::g_OSMesaGetColorBuffer)(osmesa_context*, GLint*, GLint*, GLint*, void**)’/usr/include/GL/osmesa.h:267:44: error: ‘void (* gfx::g_OSMesaGetProcAddress(const char*))()’ should have been declared inside ‘gfx’/usr/include/GL/osmesa.h:267:44: error: ‘void (* gfx::g_OSMesaGetProcAddress(const char*))()’ redeclared as different kind of symbolout/Debug/obj/gen/ui/gl/gl_bindings_autogen_osmesa.h:41:43: error: previous declaration of ‘void (* (* gfx::g_OSMesaGetProcAddress)(const char*))()’/usr/include/GL/osmesa.h:276:34: error: ‘void gfx::g_OSMesaColorClamp(GLboolean)’ should have been declared inside ‘gfx’/usr/include/GL/osmesa.h:276:34: error: ‘void gfx::g_OSMesaColorClamp(GLboolean)’ redeclared as different kind of symbolout/Debug/obj/gen/ui/gl/gl_bindings_autogen_osmesa.h:42:39: error: previous declaration of ‘void (* gfx::g_OSMesaColorClamp)(GLboolean)’make: *** [out/Debug/obj.target/gl/ui/gl/gl_surface_linux.o] Error 1I suspect some files depend on include order. Ideally we wouldn't need to include osmesa headers at all, however enums are not covered by generate_bindings, so I suspect that's why osmesa.h is still included.
On Mon, Oct 29, 2012 at 3:16 PM, Antoine Labour <pi...@google.com> wrote:
On Mon, Oct 22, 2012 at 12:03 PM, Paweł Hajdan, Jr. <phajd...@chromium.org> wrote:I did a quick experiment to try adding an option to use system mesa for Linux distros, but ran into issues.I think we have some fair amount of mods in third_party/mesa.Have you sent them upstream? If not, I'd be happy to help with doing the upstreaming. This should help with the maintenance, right? :)
On Mon, Oct 29, 2012 at 3:16 PM, Antoine Labour <pi...@google.com> wrote:
On Mon, Oct 22, 2012 at 12:03 PM, Paweł Hajdan, Jr. <phajd...@chromium.org> wrote:I did a quick experiment to try adding an option to use system mesa for Linux distros, but ran into issues.I think we have some fair amount of mods in third_party/mesa.Have you sent them upstream? If not, I'd be happy to help with doing the upstreaming. This should help with the maintenance, right? :)I'd have some questions:1. Why some gyp targets like ui/gl/gl.gyp:gl hardcode mesa include paths instead of depending on some target from third_party/mesa/mesa.gyp?That could probably be fixed, though right now mesa.gyp doesn't have a target that would export the path without compiling something. Adding a deps would make us compile osmesa when we don't really need it (see below).Would you be OK with me just adding a target that would set the right include paths? This should avoid the problem with unnecessarily pulling in osmesa, while bringing the code closer to my goal.
By the way, is osmesa used only for testing?
2. What's the purpose of ui/gl/generate_bindings.py?We need to choose the GL implementation at run-time because different systems have different GL support (e.g. native vs ANGLE on windows, GLX vs EGL on linux/Chrome OS etc., osmesa for tests etc.), so we need to dynamically load the GL library.We don't want this fact to leak all over the GPU code, so we generate wrappers around the GL libraries that hide the symbol indirection. That's what generate_bindings.py does.
Got it. When adding option to use system ffmpeg, I've noticed it's easier to just bypass the stubs/bindings completely. Does the above rationale still make sense assuming we know at compile time which GL library we're going to use?
3. Why are symbol names mirroring mesa naming scheme being put into gfx namespace in generated out/Debug/obj/gen/ui/gl/gl_bindings_autogen_osmesa.h ? This results in name clashes like below (when trying system mesa):We reuse GL/GLX/EGL/WGL/MESA names so that the calling code is clear about what it calls.Sorry, I think that doesn't answer the original question. To solve that, you'd probably introduce different prefixes or something, but putting the names in Chrome-specific gfx namespace doesn't seem to address the above issue at all. :-/
out/Debug/obj/gen/ui/gl/gl_bindings_autogen_osmesa.h:40:43: error: previous declaration of ‘GLboolean (* gfx::g_OSMesaGetColorBuffer)(osmesa_context*, GLint*, GLint*, GLint*, void**)’/usr/include/GL/osmesa.h:267:44: error: ‘void (* gfx::g_OSMesaGetProcAddress(const char*))()’ should have been declared inside ‘gfx’/usr/include/GL/osmesa.h:267:44: error: ‘void (* gfx::g_OSMesaGetProcAddress(const char*))()’ redeclared as different kind of symbolout/Debug/obj/gen/ui/gl/gl_bindings_autogen_osmesa.h:41:43: error: previous declaration of ‘void (* (* gfx::g_OSMesaGetProcAddress)(const char*))()’/usr/include/GL/osmesa.h:276:34: error: ‘void gfx::g_OSMesaColorClamp(GLboolean)’ should have been declared inside ‘gfx’/usr/include/GL/osmesa.h:276:34: error: ‘void gfx::g_OSMesaColorClamp(GLboolean)’ redeclared as different kind of symbolout/Debug/obj/gen/ui/gl/gl_bindings_autogen_osmesa.h:42:39: error: previous declaration of ‘void (* gfx::g_OSMesaColorClamp)(GLboolean)’make: *** [out/Debug/obj.target/gl/ui/gl/gl_surface_linux.o] Error 1I suspect some files depend on include order. Ideally we wouldn't need to include osmesa headers at all, however enums are not covered by generate_bindings, so I suspect that's why osmesa.h is still included.I don't think so. I rather think it's having the same symbols declared in both gfx and no namespace. Maybe with your answers to the above questions I'll figure out something more.