Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • mesa mesa
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 2,878
    • Issues 2,878
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 903
    • Merge requests 903
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Releases
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Mesa
  • mesamesa
  • Issues
  • #2618

Closed
Open
Created Mar 11, 2020 by Alistair Francis@alistair23

Unable to call MapBufferRange with ELF_TLS

When running a libchamplain map with GTK and Cogl the call to MapBufferRange actually calls a noop instead.

Attempting to create a point in the libchamplain map will call clutter_actor_constructor() which eventually calls cogl_buffer_map(). I have attached a full backtrace at the end of this issue.

cogl_buffer_map() will try to call mesa's glMapBufferRange in _cogl_buffer_gl_map_range(). The value of ctx->glMapBufferRange in Cogl is set to: (GLvoid *(*)(GLenum, GLintptr, GLsizeiptr, GLbitfield)) 0xfffff5e90828 <shared_dispatch_stub_682>.

With ELF_TLS enabled (the default in mesa) this will branch to the shared_dispatch_stub_682() function which is located at src/mapi/shared-glapi/glapi_mapi_tmp.h:24432 in the build dir.

This then branches to noop_generic() at src/mapi/table.c:61 which is incorrect. Mesa will then return NULL as it was a noop and Cogl will print errors like the one below. This call shouldn't be a noop, but instead should call the corresponding MapBufferRange function.

Cogl-CRITICAL **: 02:29:39.527: _cogl_buffer_gl_map_range: assertion 'data != ((void *)0)' failed
GLib-CRITICAL **: 02:30:24.806: g_error_free: assertion 'error != NULL' filed
Cogl-CRITICAL **: 02:30:24.807: _cogl_buffer_bind_no_create: assertion 'cx->current_buffer[buffer->last_target] != buffer' failed

With ELF_TLS forcefully disabled (a configure patch is required) the problem no longer occurs and the jump happens correctly.

When ELF_TLS is disabled _cogl_buffer_gl_map_range() jumps to mesa's shared_dispatch_stub_682() but in src/mapi/u_current.h:71 instead of the file mentioned above.

This then calls u_current_get_table() in src/mapi/u_current.h and then calls the shared_dispatch_stub_682() function from build/src/mapi/shared-glapi/glapi_mapi_tmp.h:24432. This correctly jumps to _mesa_MapBufferRange() in src/mesa/main/bufferobj.c:3401 and works as expected.

This happens on Debian and OpenEmbedded distros, on both x86_64 and aarch64 systems. This is using glibc as the libc, so is different to #1503 but maybe somewhat related.

Full Backtrace of the mesa call failing:

#0  shared_dispatch_stub_682 (target=35052, offset=0, length=576, access=3)
    at /usr/src/debug/mesa/2_20.0.1-r0/build/src/mapi/shared-glapi/glapi_mapi_tmp.h:24432  #1  0x0000fffff6dbb994 in _cogl_buffer_gl_map_range (buffer=0xffffe000a340, offset=0,          size=576, access=COGL_BUFFER_ACCESS_READ_WRITE, hints=COGL_BUFFER_MAP_HINT_DISCARD,        error=0xffffe7ffdb58) at ../../cogl-1.22.4/cogl/driver/gl/cogl-buffer-gl.c:288
#2  0x0000fffff6dd2584 in cogl_buffer_map_range (buffer=buffer@entry=0xffffe000a340,
    offset=offset@entry=0, size=576, access=access@entry=COGL_BUFFER_ACCESS_READ_WRITE,        hints=hints@entry=COGL_BUFFER_MAP_HINT_DISCARD, error=error@entry=0xffffe7ffdb58)          at ../../cogl-1.22.4/cogl/cogl-buffer.c:263
#3  0x0000fffff6dd26b0 in cogl_buffer_map (buffer=buffer@entry=0xffffe000a340,
    access=access@entry=COGL_BUFFER_ACCESS_READ_WRITE,
    hints=hints@entry=COGL_BUFFER_MAP_HINT_DISCARD)
    at ../../cogl-1.22.4/cogl/cogl-buffer.c:241
#4  0x0000fffff7e619d0 in clutter_canvas_emit_draw (self=0xaaaaab0f33a0)
    at ../../clutter-1.26.2/clutter/clutter-canvas.c:440
#5  clutter_canvas_invalidate (content=0xaaaaab0f33a0)
    at ../../clutter-1.26.2/clutter/clutter-canvas.c:513
#6  0x0000fffff7e69778 in clutter_content_invalidate (
    content=content@entry=0xaaaaab0f33a0)
    at ../../clutter-1.26.2/clutter/clutter-content.c:176
#7  0x0000fffff7e62104 in clutter_canvas_invalidate_internal (height=12,
    width=<optimized out>, canvas=0xaaaaab0f33a0)
    at ../../clutter-1.26.2/clutter/clutter-canvas.c:595
#8  clutter_canvas_set_size (canvas=0xaaaaab0f33a0, width=<optimized out>, height=12)          at ../../clutter-1.26.2/clutter/clutter-canvas.c:637
#9  0x0000fffff7f8910c in champlain_point_init (point=0xffffe0010470)
    at ../git/champlain/champlain-point.c:286
#10 0x0000fffff71ba7d0 in g_type_create_instance (type=<optimized out>)
    at ../glib-2.62.4/gobject/gtype.c:1867
#11 0x0000fffff719cff0 in g_object_constructor (type=<optimized out>,
    n_construct_properties=0, construct_params=0x0)
    at ../glib-2.62.4/gobject/gobject.c:2178
#12 0x0000fffff7e4900c in clutter_actor_constructor (gtype=<optimized out>,
    n_props=<optimized out>, props=<optimized out>)
    at ../../clutter-1.26.2/clutter/clutter-actor.c:6250
#13 0x0000fffff719dae8 in g_object_new_with_custom_constructor (n_params=0, params=0x0,        class=0xffffe000e4e0) at ../glib-2.62.4/gobject/gobject.c:1745
#14 g_object_new_internal (class=class@entry=0xffffe000e4e0, params=params@entry=0x0,          n_params=n_params@entry=0) at ../glib-2.62.4/gobject/gobject.c:1825
#15 0x0000fffff719eb88 in g_object_new_with_properties (object_type=281474439894256,       --Type <RET> for more, q to quit, c to continue without paging--
    n_properties=0, names=names@entry=0x0, values=values@entry=0x0)
    at ../glib-2.62.4/gobject/gobject.c:1995
#16 0x0000fffff719f410 in g_object_new (object_type=<optimized out>,
    first_property_name=first_property_name@entry=0x0)
    at ../glib-2.62.4/gobject/gobject.c:1667
#17 0x0000fffff7f898a8 in champlain_point_new () at ../git/champlain/champlain-point.c:342 #18 0x0000aaaaaaac1d94 in dashsight::track::record::record_page_run ()
Edited Mar 11, 2020 by Alistair Francis
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking