After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 728355 - journal debug breaks everything on GLES
journal debug breaks everything on GLES
Status: RESOLVED FIXED
Product: cogl
Classification: Platform
Component: CoglJournal
1.22.x
Other Linux
: Normal normal
: ---
Assigned To: Cogl maintainer(s)
Cogl maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2014-04-16 16:41 UTC by Daniel Stone
Modified: 2015-09-23 12:58 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Journal: Skip journal dumping when unsupported (1.09 KB, patch)
2015-09-23 12:16 UTC, Daniel Stone
committed Details | Review
GLES: Support glMapBufferRange from ES3 (2.04 KB, patch)
2015-09-23 12:16 UTC, Daniel Stone
committed Details | Review

Description Daniel Stone 2014-04-16 16:41:12 UTC
In _cogl_journal_flush_vbo_offsets_and_entries():
  if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_JOURNAL)))
    {
      uint8_t *verts;

      /* Mapping a buffer for read is probably a really bad thing to
         do but this will only happen during debugging so it probably
         doesn't matter */
      verts = ((uint8_t *)_cogl_buffer_map (COGL_BUFFER (state->attribute_buffer),
                                            COGL_BUFFER_ACCESS_READ, 0,
                                            NULL) +
               state->array_offset);

The comment here is somewhat of an understatement, since you can never map a buffer for read access in GLES, regardless of which extensions you have.  So enabling COGL_DEBUG=journal turns a previously working app into one which breaks hard.

Making the call conditional would merely lose information; it would be nice if this were available/cached some other way, so we could still dump everything even though glMapBuffer won't let you do read mappings.
Comment 1 Daniel Stone 2015-09-23 10:21:40 UTC
Still present in 1.22.0.
Comment 2 Emmanuele Bassi (:ebassi) 2015-09-23 10:25:17 UTC
I'd gladly review a patch.
Comment 3 Daniel Stone 2015-09-23 10:34:51 UTC
I don't know enough about the journal to suggest a sensible patch, so the best I could offer would be to add ... && (ctx->driver == COGL_DRIVER_GL || ctx->driver == COGL_DRIVER_GL3) into the conditional. Not sure if that would be seen as OK or not.
Comment 4 Emmanuele Bassi (:ebassi) 2015-09-23 10:52:55 UTC
(In reply to Daniel Stone from comment #3)
> I don't know enough about the journal to suggest a sensible patch, so the
> best I could offer would be to add ... && (ctx->driver == COGL_DRIVER_GL ||
> ctx->driver == COGL_DRIVER_GL3) into the conditional. Not sure if that would
> be seen as OK or not.

Considering that it'd at least be better than just making a mess of the carpet as Cogl is doing now, I'd say it's okay to allow debugging of the journal on desktop GL. If somebody ever adds a client-side debug buffer for attributes then we could still do a driver detection and only use it on GLES anyway.

I'd also add a warning if somebody uses COGL_DEBUG=journal on GLES, to manage expectations.
Comment 5 Daniel Stone 2015-09-23 12:16:30 UTC
Created attachment 311939 [details] [review]
Journal: Skip journal dumping when unsupported

GLES2 does not support passing READ to glMapBuffer; attempting to call
cogl_buffer_map for read on ES2 will bring it down with an assert. Make
sure COGL_DEBUG=journal doesn't do this when it's not possible.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Comment 6 Daniel Stone 2015-09-23 12:16:36 UTC
Created attachment 311940 [details] [review]
GLES: Support glMapBufferRange from ES3

ES3 provides glMapBufferRange as core, with the added bonus that it also
supports read mappings. Use this where possible.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Comment 7 Emmanuele Bassi (:ebassi) 2015-09-23 12:40:28 UTC
Review of attachment 311940 [details] [review]:

ACK.
Comment 8 Emmanuele Bassi (:ebassi) 2015-09-23 12:41:26 UTC
Review of attachment 311939 [details] [review]:

ACK, with a minimal coding style issue; you can fix it while pushing it.

::: cogl/cogl-journal.c
@@ +652,3 @@
 
+  if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_JOURNAL)) &&
+      cogl_has_feature(ctx, COGL_FEATURE_ID_MAP_BUFFER_FOR_READ))

Coding style: missing space between function name and open parenthesis.
Comment 9 Daniel Stone 2015-09-23 12:44:14 UTC
Thanks, but I don't have commit access to GNOME. :)
Comment 10 Emmanuele Bassi (:ebassi) 2015-09-23 12:51:23 UTC
(In reply to Daniel Stone from comment #9)
> Thanks, but I don't have commit access to GNOME. :)

We need to get you one of those. :-P
Comment 11 Emmanuele Bassi (:ebassi) 2015-09-23 12:58:38 UTC
Attachment 311939 [details] pushed as d6f415d - Journal: Skip journal dumping when unsupported
Attachment 311940 [details] pushed as 5253264 - GLES: Support glMapBufferRange from ES3