Bug 97773 - New Mesa master now results in warnings in glrender (and subsurfaces and simple-egl), black screen
Summary: New Mesa master now results in warnings in glrender (and subsurfaces and simp...
Status: RESOLVED NOTOURBUG
Alias: None
Product: Wayland
Classification: Unclassified
Component: weston (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: Wayland bug list
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-09-12 03:58 UTC by n3rdopolis
Modified: 2016-09-12 15:57 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments

Description n3rdopolis 2016-09-12 03:58:35 UTC
Hi

It seems a new commit in Mesa causes build warnings in glrender
Building weston against Weston Master causes the resulting weston to always show a blank screen on wayland, and drm backends on intel and software rendering


The build warnings are
  CC       shared/libshared_cairo_la-config-parser.lo
libweston/gl-renderer.c: In function ‘triangle_fan_debug’:
libweston/gl-renderer.c:609:2: warning: implicit declaration of function ‘glUseProgram’ [-Wimplicit-function-declaration]
  glUseProgram(gr->solid_shader.program);
  ^
libweston/gl-renderer.c:610:2: warning: implicit declaration of function ‘glUniform4fv’ [-Wimplicit-function-declaration]
  glUniform4fv(gr->solid_shader.color_uniform, 1,
  ^
libweston/gl-renderer.c:612:2: warning: implicit declaration of function ‘glDrawElements’ [-Wimplicit-function-declaration]
  glDrawElements(GL_LINES, nelems, GL_UNSIGNED_SHORT, buffer);
  ^
libweston/gl-renderer.c: In function ‘repaint_region’:
libweston/gl-renderer.c:641:2: warning: implicit declaration of function ‘glVertexAttribPointer’ [-Wimplicit-function-declaration]
  glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 4 * sizeof *v, &v[0]);
  ^
libweston/gl-renderer.c:642:2: warning: implicit declaration of function ‘glEnableVertexAttribArray’ [-Wimplicit-function-declaration]
  glEnableVertexAttribArray(0);
  ^
libweston/gl-renderer.c:649:3: warning: implicit declaration of function ‘glDrawArrays’ [-Wimplicit-function-declaration]
   glDrawArrays(GL_TRIANGLE_FAN, first, vtxcnt[i]);
   ^
libweston/gl-renderer.c:655:2: warning: implicit declaration of function ‘glDisableVertexAttribArray’ [-Wimplicit-function-declaration]
  glDisableVertexAttribArray(1);
  ^
libweston/gl-renderer.c: In function ‘shader_uniforms’:
libweston/gl-renderer.c:718:2: warning: implicit declaration of function ‘glUniformMatrix4fv’ [-Wimplicit-function-declaration]
  glUniformMatrix4fv(shader->proj_uniform,
  ^
libweston/gl-renderer.c:721:2: warning: implicit declaration of function ‘glUniform1f’ [-Wimplicit-function-declaration]
  glUniform1f(shader->alpha_uniform, view->alpha);
  ^
libweston/gl-renderer.c:724:3: warning: implicit declaration of function ‘glUniform1i’ [-Wimplicit-function-declaration]
   glUniform1i(shader->tex_uniforms[i], i);
   ^
libweston/gl-renderer.c: In function ‘draw_view’:
libweston/gl-renderer.c:757:2: warning: implicit declaration of function ‘glBlendFunc’ [-Wimplicit-function-declaration]
  glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
  ^
libweston/gl-renderer.c:774:3: warning: implicit declaration of function ‘glActiveTexture’ [-Wimplicit-function-declaration]
   glActiveTexture(GL_TEXTURE0 + i);
   ^
libweston/gl-renderer.c:775:3: warning: implicit declaration of function ‘glBindTexture’ [-Wimplicit-function-declaration]
   glBindTexture(gs->target, gs->textures[i]);
   ^
libweston/gl-renderer.c:776:3: warning: implicit declaration of function ‘glTexParameteri’ [-Wimplicit-function-declaration]
   glTexParameteri(gs->target, GL_TEXTURE_MIN_FILTER, filter);
   ^
libweston/gl-renderer.c:810:4: warning: implicit declaration of function ‘glEnable’ [-Wimplicit-function-declaration]
    glEnable(GL_BLEND);
    ^
libweston/gl-renderer.c:812:4: warning: implicit declaration of function ‘glDisable’ [-Wimplicit-function-declaration]
    glDisable(GL_BLEND);
    ^
libweston/gl-renderer.c: In function ‘draw_output_border_texture’:
libweston/gl-renderer.c:852:4: warning: implicit declaration of function ‘glDeleteTextures’ [-Wimplicit-function-declaration]
    glDeleteTextures(1, &img->tex);
    ^
libweston/gl-renderer.c:860:3: warning: implicit declaration of function ‘glGenTextures’ [-Wimplicit-function-declaration]
   glGenTextures(1, &img->tex);
   ^
libweston/gl-renderer.c:876:3: warning: implicit declaration of function ‘glPixelStorei’ [-Wimplicit-function-declaration]
   glPixelStorei(GL_UNPACK_ROW_LENGTH_EXT, 0);
   ^
libweston/gl-renderer.c:879:3: warning: implicit declaration of function ‘glTexImage2D’ [-Wimplicit-function-declaration]
   glTexImage2D(GL_TEXTURE_2D, 0, GL_BGRA_EXT,
   ^
libweston/gl-renderer.c: In function ‘draw_output_borders’:
libweston/gl-renderer.c:945:2: warning: implicit declaration of function ‘glViewport’ [-Wimplicit-function-declaration]
  glViewport(0, 0, full_width, full_height);
  ^
libweston/gl-renderer.c: In function ‘gl_renderer_read_pixels’:
libweston/gl-renderer.c:1217:2: warning: implicit declaration of function ‘glReadPixels’ [-Wimplicit-function-declaration]
  glReadPixels(x, y, width, height, gl_format,
  ^
libweston/gl-renderer.c: In function ‘gl_renderer_flush_damage’:
libweston/gl-renderer.c:1296:3: warning: implicit declaration of function ‘glTexSubImage2D’ [-Wimplicit-function-declaration]
   glTexSubImage2D(GL_TEXTURE_2D, 0, r.x1, r.y1,
   ^
libweston/gl-renderer.c: In function ‘gl_renderer_surface_copy_content’:
libweston/gl-renderer.c:2032:2: warning: implicit declaration of function ‘glGenFramebuffers’ [-Wimplicit-function-declaration]
  glGenFramebuffers(1, &fbo);
  ^
libweston/gl-renderer.c:2033:2: warning: implicit declaration of function ‘glBindFramebuffer’ [-Wimplicit-function-declaration]
  glBindFramebuffer(GL_FRAMEBUFFER, fbo);
  ^
libweston/gl-renderer.c:2034:2: warning: implicit declaration of function ‘glFramebufferTexture2D’ [-Wimplicit-function-declaration]
  glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
  ^
libweston/gl-renderer.c:2037:11: warning: implicit declaration of function ‘glCheckFramebufferStatus’ [-Wimplicit-function-declaration]
  status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
           ^
libweston/gl-renderer.c:2040:3: warning: implicit declaration of function ‘glDeleteFramebuffers’ [-Wimplicit-function-declaration]
   glDeleteFramebuffers(1, &fbo);
   ^
libweston/gl-renderer.c: In function ‘compile_shader’:
libweston/gl-renderer.c:2291:6: warning: implicit declaration of function ‘glCreateShader’ [-Wimplicit-function-declaration]
  s = glCreateShader(type);
      ^
libweston/gl-renderer.c:2292:2: warning: implicit declaration of function ‘glShaderSource’ [-Wimplicit-function-declaration]
  glShaderSource(s, count, sources, NULL);
  ^
libweston/gl-renderer.c:2293:2: warning: implicit declaration of function ‘glCompileShader’ [-Wimplicit-function-declaration]
  glCompileShader(s);
  ^
libweston/gl-renderer.c:2294:2: warning: implicit declaration of function ‘glGetShaderiv’ [-Wimplicit-function-declaration]
  glGetShaderiv(s, GL_COMPILE_STATUS, &status);
  ^
libweston/gl-renderer.c:2296:3: warning: implicit declaration of function ‘glGetShaderInfoLog’ [-Wimplicit-function-declaration]
   glGetShaderInfoLog(s, sizeof msg, NULL, msg);
   ^
libweston/gl-renderer.c: In function ‘shader_init’:
libweston/gl-renderer.c:2330:20: warning: implicit declaration of function ‘glCreateProgram’ [-Wimplicit-function-declaration]
  shader->program = glCreateProgram();
                    ^
libweston/gl-renderer.c:2331:2: warning: implicit declaration of function ‘glAttachShader’ [-Wimplicit-function-declaration]
  glAttachShader(shader->program, shader->vertex_shader);
  ^
libweston/gl-renderer.c:2333:2: warning: implicit declaration of function ‘glBindAttribLocation’ [-Wimplicit-function-declaration]
  glBindAttribLocation(shader->program, 0, "position");
  ^
libweston/gl-renderer.c:2336:2: warning: implicit declaration of function ‘glLinkProgram’ [-Wimplicit-function-declaration]
  glLinkProgram(shader->program);
  ^
libweston/gl-renderer.c:2337:2: warning: implicit declaration of function ‘glGetProgramiv’ [-Wimplicit-function-declaration]
  glGetProgramiv(shader->program, GL_LINK_STATUS, &status);
  ^
libweston/gl-renderer.c:2339:3: warning: implicit declaration of function ‘glGetProgramInfoLog’ [-Wimplicit-function-declaration]
   glGetProgramInfoLog(shader->program, sizeof msg, NULL, msg);
   ^
libweston/gl-renderer.c:2344:25: warning: implicit declaration of function ‘glGetUniformLocation’ [-Wimplicit-function-declaration]
  shader->proj_uniform = glGetUniformLocation(shader->program, "proj");
                         ^
libweston/gl-renderer.c: In function ‘shader_release’:
libweston/gl-renderer.c:2357:2: warning: implicit declaration of function ‘glDeleteShader’ [-Wimplicit-function-declaration]
  glDeleteShader(shader->vertex_shader);
  ^
libweston/gl-renderer.c:2359:2: warning: implicit declaration of function ‘glDeleteProgram’ [-Wimplicit-function-declaration]
  glDeleteProgram(shader->program);
  ^
libweston/gl-renderer.c: In function ‘log_egl_gl_info’:
libweston/gl-renderer.c:2406:16: warning: implicit declaration of function ‘glGetString’ [-Wimplicit-function-declaration]
  str = (char *)glGetString(GL_VERSION);
                ^
 

Thanks
Comment 1 Pekka Paalanen 2016-09-12 09:21:23 UTC
Yes, it does. You have to stick to an older Mesa until we fix it in Weston by starting to use libepoxy I believe. But I also heard someone say libepoxy does not build without X11 yet (I have not confirmed), so that would need fixing too.

The reason is, that Khronos decided to stop declaring any OpenGL ES 2 core functions unless GL_GLEXT_PROTOTYPES is defined. IMO that is wrong on multiple levels: "GLEXT" refers to extension functions, not core functions; it breaks existing applications just like in this bug report.

Traditionally using GL_GLEXT_PROTOTYPES means "I do not care about the portability of my program between different GL implementations." Therefore we should not simply use it and it will expose far too much.

My own speculation is, based on what GL_GLEXT_PROTOTYPES used to mean, is that libGLESv2.so will at some point actually stop exporting any GL ES 2.0 core functions. This will break all existing application binaries.

It is probably all part of an attempt to fix the issue that different (GL ES) implementations export different sets of functions. Khronos' decision is one that makes everyone equally unhappy, so at least it's not favouring anyone.

In the end, we need to start getting also the GL ES core functions via eglGetProcAddress(). This is probably easiest to do by relying on libepoxy (Xwayland/glamor already requires it, and I hear recent GTK+ 3.x too). It will only work when EGL_KHR_get_all_proc_addresses extension is supported, so one needs a fallback to dlsym(). It's not too complicated, but very unfruitful to write and maintain ourselves, hence libepoxy.

If you are too bored, there is a related discussion that gives some background here:
https://lists.freedesktop.org/archives/mesa-dev/2016-June/120763.html
Obviously Khronos went its own way, already in March 2015 I hear.

I also hear there are bug reports open at Khronos, so let's see if things change again.
Comment 2 Armin K 2016-09-12 12:04:30 UTC
Until this issue has been resolved, you can use the following patch:

https://lists.freedesktop.org/archives/wayland-devel/2016-September/031027.html

Make sure you install libepoxy first.

https://github.com/anholt/libepoxy
Comment 3 Emil Velikov 2016-09-12 15:57:19 UTC
Should be fixed in mesa with

commit 63faf7de619be093c883318e90b5e317b9cb0eb1
Author: Emil Velikov <emil.velikov@collabora.com>
Date:   Mon Sep 12 13:26:40 2016 +0100

    Remove GL_GLEXT_PROTOTYPES guards from non-ext headers.


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.