Visible corruption in SDL apps (Neverball, Neverputt) on Nexus 4 / Nexus 7.
| Affects | Status | Importance | Assigned to | Milestone | |
|---|---|---|---|---|---|
| | Mir |
Fix Released
|
High
|
Daniel van Vugt | |
| | libsdl2 (Ubuntu) |
High
|
Brandon Schaefer | ||
| | mir (Ubuntu) |
High
|
Unassigned | ||
| | unity8 (Ubuntu) |
High
|
Unassigned | ||
Bug Description
https:/
Install neverball or neverputt from the click store:-
https:/
https:/
Note they work fine on krillin and arale, however there's corruption making the games unusable on Nexus 4 and Nexus 7.
Simpler test cases are provided at the above linked github issue. Attaching them to this bug for persistence.
Related branches
- Robert Carr (community): Approve on 2015-07-07
- Kevin DuBois (community): Approve on 2015-07-07
- PS Jenkins bot: Approve (continuous-integration) on 2015-07-07
- Alexandros Frantzis (community): Approve on 2015-07-07
-
Diff: 58 lines (+21/-2)1 file modifiedexamples/eglapp.c (+21/-2)
- Daniel van Vugt: Needs Information on 2015-07-06
- Alexandros Frantzis (community): Approve on 2015-07-03
- PS Jenkins bot: Approve (continuous-integration) on 2015-07-03
- Kevin DuBois (community): Approve on 2015-07-02
-
Diff: 171 lines (+88/-46)1 file modifiedexamples/eglapp.c (+88/-46)
- PS Jenkins bot: Approve (continuous-integration) on 2015-07-16
- Kevin DuBois (community): Approve on 2015-07-14
- Robert Carr (community): Approve on 2015-07-13
-
Diff: 1191 lines (+556/-130)24 files modifiedexamples/eglapp.c (+50/-23)
examples/image_renderer.cpp (+1/-0)
examples/multiwin.c (+73/-21)
include/common/mir_toolkit/common.h (+39/-15)
playground/demo-shell/typo/typo_glcache.cpp (+1/-0)
src/platform/graphics/pixel_format_utils.cpp (+59/-36)
src/platforms/android/server/android_buffer_allocator.cpp (+2/-1)
src/platforms/android/server/android_format_conversion-inl.h (+6/-2)
src/platforms/mesa/server/common/buffer_allocator.cpp (+23/-17)
src/platforms/mesa/server/common/buffer_allocator.h (+0/-1)
src/platforms/mesa/server/common/gbm_buffer.cpp (+42/-0)
src/platforms/mesa/server/common/shm_buffer.cpp (+76/-4)
src/platforms/mesa/server/common/shm_buffer.h (+2/-0)
src/utils/screencast.cpp (+8/-0)
tests/include/mir/test/doubles/mock_gbm.h (+3/-0)
tests/include/mir/test/doubles/mock_gl.h (+1/-0)
tests/mir_test_doubles/mock_gbm.cpp (+9/-0)
tests/mir_test_doubles/mock_gl.cpp (+6/-0)
tests/unit-tests/graphics/android/test_android_buffer_allocator.cpp (+11/-1)
tests/unit-tests/graphics/android/test_pixel_format.cpp (+6/-3)
tests/unit-tests/graphics/mesa/common/test_buffer_allocator.cpp (+2/-0)
tests/unit-tests/graphics/mesa/common/test_shm_buffer.cpp (+110/-6)
tests/unit-tests/graphics/test_graphics_platform.cpp (+2/-0)
tests/unit-tests/graphics/test_pixel_format_utils.cpp (+24/-0)
- Daniel van Vugt: Approve on 2015-07-23
- PS Jenkins bot: Approve (continuous-integration) on 2015-07-23
- Kevin DuBois (community): Approve on 2015-07-21
- Chris Halse Rogers: Approve on 2015-07-21
- Robert Carr (community): Approve on 2015-07-20
- Alberto Aguirre: Approve on 2015-07-20
-
Diff: 965 lines (+285/-139)39 files modifieddebian/control (+4/-4)
debian/mir-client-platform-android3.install (+1/-1)
debian/mir-client-platform-mesa3.install (+1/-1)
examples/eglapp.c (+26/-71)
examples/scroll.cpp (+30/-27)
include/client/mir_toolkit/mir_connection.h (+11/-0)
src/CMakeLists.txt (+1/-0)
src/client/mir_connection.cpp (+6/-0)
src/client/mir_connection.h (+2/-1)
src/client/mir_connection_api.cpp (+6/-0)
src/client/symbols.map (+1/-0)
src/include/client/mir/client_platform.h (+2/-0)
src/platforms/CMakeLists.txt (+1/-1)
src/platforms/android/client/android_client_platform.cpp (+27/-0)
src/platforms/android/client/android_client_platform.h (+1/-0)
src/platforms/android/client/symbols.map (+1/-1)
src/platforms/android/server/android_alloc_adaptor.cpp (+1/-1)
src/platforms/android/server/buffer.cpp (+1/-1)
src/platforms/android/server/fb_device.cpp (+1/-2)
src/platforms/android/server/gl_context.cpp (+1/-1)
src/platforms/android/server/hwc_blanking_control.cpp (+1/-1)
src/platforms/android/server/hwc_fb_device.cpp (+1/-1)
src/platforms/android/server/server_render_window.cpp (+1/-1)
src/platforms/mesa/client/client_platform.cpp (+47/-0)
src/platforms/mesa/client/client_platform.h (+1/-0)
src/platforms/mesa/client/symbols.map (+1/-1)
tests/acceptance-tests/test_client_library_errors.cpp (+4/-0)
tests/mir_test_framework/stub_client_platform_factory.cpp (+7/-0)
tests/mir_test_framework/symbols-client.map (+1/-1)
tests/unit-tests/CMakeLists.txt (+4/-1)
tests/unit-tests/client/android/test_android_client_platform.cpp (+49/-17)
tests/unit-tests/client/mesa/test_client_platform.cpp (+26/-0)
tests/unit-tests/client/test_client_buffer_stream.cpp (+5/-0)
tests/unit-tests/client/test_client_mir_surface.cpp (+6/-0)
tests/unit-tests/client/test_mir_connection.cpp (+2/-0)
tests/unit-tests/graphics/android/test_display_buffer.cpp (+1/-1)
tests/unit-tests/graphics/android/test_output_builder.cpp (+1/-1)
tests/unit-tests/graphics/android/test_pixel_format.cpp (+1/-1)
tests/unit-tests/shared_library_test.cpp (+1/-1)
Screenshot of neverball running on Nexus 7 2013
| Michael Hall (mhall119) wrote : | #5 |
| Michael Hall (mhall119) wrote : | #6 |
Ill try to reproduce this. Thanks for the bug report!
| Changed in mir: | |
| assignee: | nobody → Brandon Schaefer (brandontschaefer) |
Err you say it works fine for other devices? I wonder if its a mir issue rather then SDL...unassigning my self for now :)
| Changed in mir: | |
| assignee: | Brandon Schaefer (brandontschaefer) → nobody |
| Daniel van Vugt (vanvugt) wrote : | #9 |
The problem could equally be in libsdl2, Unity8 or Mir. So tasks for all until we know which...
| summary: |
- Visible corruption in SDL apps on some devices + Visible corruption in SDL apps (Neverball, Neverputt) on some devices |
| Launchpad Janitor (janitor) wrote : Re: Visible corruption in SDL apps (Neverball, Neverputt) on some devices | #10 |
Status changed to 'Confirmed' because the bug affects multiple users.
| Changed in libsdl2 (Ubuntu): | |
| status: | New → Confirmed |
| Changed in mir (Ubuntu): | |
| status: | New → Confirmed |
| Changed in unity8 (Ubuntu): | |
| status: | New → Confirmed |
| Daniel van Vugt (vanvugt) wrote : | #13 |
Are these frame dropping clients (swap interval zero) by any chance?
| summary: |
- Visible corruption in SDL apps (Neverball, Neverputt) on some devices + Visible corruption in SDL apps (Neverball, Neverputt) on Nexus 4 / Nexus + 7. |
| tags: | added: android nexus4 nexus7 |
| Changed in mir: | |
| importance: | Undecided → High |
| Changed in libsdl2 (Ubuntu): | |
| importance: | Undecided → High |
| Changed in mir (Ubuntu): | |
| importance: | Undecided → High |
| Changed in unity8 (Ubuntu): | |
| importance: | Undecided → High |
| tags: | added: mako |
| Kevin DuBois (kdub) wrote : | #14 |
Could just be an adreno driver bug... does the problem happen on non-adreno platforms?
| Neil McPhail (njmcphail) wrote : | #15 |
I get similar corruption running Baldur's Gate (via GemRB and SDL2) on krillin. The intro videos play well, but when the main menu appears the shell bleeds into it. The picture clears when you begin to swipe. I'll attach some pics as it is hard to explain.
| Neil McPhail (njmcphail) wrote : | #16 |
Begin a right->left swipe and the picture clears
| Laurie Bradshaw (lauriebradshaw) wrote : | #17 |
You can work around alpha issues on krillin by masking the alpha channel and clearing the color buffer bit before swapping buffers.
I'm not sure if it's a separate issue or a different symptom of the same issue, but the workaround doesn't help on nexus devices.
| Daniel van Vugt (vanvugt) wrote : | #18 |
OK, with some fiddling I can confirm the same bugs are visible in Mir's demo servers (from package mir-demos). So Unity8 is not a problem.
I can now also see what the problems are:
1. Seeing double: This is SDL incorrectly telling the app that a 16-bit pixel size is supported. It is not supported in Mir.
2. Wrong colours: This is also SDL incorrectly telling the app that it can use 16-bit colour. Mir only supports 24 or 32-bit colour right now.
From gles:
$ env LD_LIBRARY_
Window requested size 640x480, got 768x1280
INFO: Screen bpp: 24
INFO:
INFO: Vendor : Qualcomm
INFO: Renderer : Adreno (TM) 320
INFO: Version : OpenGL ES-CM 1.1
INFO: Extensions : GL_EXT_debug_marker GL_AMD_
INFO:
INFO: SDL_GL_RED_SIZE: requested 5, got 5
INFO: SDL_GL_GREEN_SIZE: requested 5, got 6
INFO: SDL_GL_BLUE_SIZE: requested 5, got 5
INFO: SDL_GL_DEPTH_SIZE: requested 16, got 16
| Changed in libsdl2 (Ubuntu): | |
| status: | Confirmed → Triaged |
| Changed in mir: | |
| status: | New → Invalid |
| Changed in mir (Ubuntu): | |
| status: | Confirmed → Invalid |
| Changed in unity8 (Ubuntu): | |
| status: | Confirmed → Invalid |
| Daniel van Vugt (vanvugt) wrote : | #19 |
I've logged the relevant enhancement for Mir in --> bug 1469673. Implementing that enhancement is something we do want to do eventually.
However for now this bug is a bug specifically in libSDL2 where it's telling the app it can do something that it really can't (yet).
| Daniel van Vugt (vanvugt) wrote : | #20 |
There is also a third lesser bug: SDL (or the apps themselves?) fails to respond to resize events.
| Daniel van Vugt (vanvugt) wrote : | #21 |
P.S. The weird transparency is the same bug too. That's just misplaced alpha channel values from the SDL pixel format bug making the compositor (Unity8) turn parts of the SDL surface transparent that should not be.
| Changed in libsdl2 (Ubuntu): | |
| assignee: | nobody → Brandon Schaefer (brandontschaefer) |
AFAIK SDL2 should support 24/32 bit colors... I do find that strange since on X11:
INFO: SDL_GL_RED_SIZE: requested 5, got 8
INFO: SDL_GL_GREEN_SIZE: requested 5, got 8
INFO: SDL_GL_BLUE_SIZE: requested 5, got 8
INFO: SDL_GL_DEPTH_SIZE: requested 16, got 24
Im not 100% sure why its failing to get the correct requested size, or rather why mir is not requesting a 24/32bit color. Ill take a look at this! Hopefully that turns out to be the issue. As it seems by default to request a 15/16 bi color
http://
This is where its getting the gl_config (requested size) then setting the bits internal when it create the egl config. (Also note this is not the same code X11 runs! Since it wont be using EGL)
So it looks like mir is getting the correct requested size (for the most parts a 6 instead of a 5). The main issue is why is it requesting a 5? This could be my fault here for not manually forcing the 24/32 bit or the clients fault for not forcing it. Ill take a deeper look.
Cheers
| Daniel van Vugt (vanvugt) wrote : | #23 |
Hmm, it might be an unavoidable feature of the GL driver on these devices actually (inherited from Android).
If the hardware graphics driver is saying OK to 16-bit pixels then I'm not sure what we can do to stop it. We'd just have to avoid asking for less than 8 bits per channel in SDL, or get around to implementing enhancement bug 1469673.
Mir tries to make it very clear that only 8 bits per channel is supported and forces everyone (including SDL) to choose a 24 or 32-bit pixel format. So it sounds like that's not providing a guarantee that the Android GL driver will actually honour the agreed pixel format.
On that note, I have suspected for a while that Mir forcing clients to choose a pixel format independently of choosing a GL config was redundant and could cause confusion like this. If we can remove one of those steps it would help.
| Changed in mir: | |
| status: | Invalid → Triaged |
| Changed in mir (Ubuntu): | |
| status: | Invalid → Triaged |
| Changed in mir: | |
| assignee: | nobody → Daniel van Vugt (vanvugt) |
| milestone: | none → 0.15.0 |
| status: | Triaged → In Progress |
| Daniel van Vugt (vanvugt) wrote : | #24 |
Even simpler: I've attached a Mir branch that replicates the problem (-e5) using just Mir demos. Unfortunately that doesn't relieve SDL from owning the solution to this bug. Because even if Mir added support for 16 bpp formats, SDL would still need to be changed to use it.
I suggest in the shorter term SDL can solve the problem by simply choosing a Mir-compatible EGL config in requesting a minimum of 8 bits per channel:
But feel free to shame Mir for failing to provide stronger API guarantees that the EGL config actually matches the pixel format in use.
| Changed in mir: | |
| milestone: | 0.15.0 → none |
| status: | In Progress → Invalid |
| Changed in mir (Ubuntu): | |
| status: | Triaged → Invalid |
| tags: | added: wrong-colours-on-screen |
| Laurie Bradshaw (lauriebradshaw) wrote : | #25 |
Setting the gl red green, blue and depth sizes from client code (SDL_GL_
| Daniel van Vugt (vanvugt) wrote : | #26 |
You mean the colours look right but you have unexpected transparency? If so, that's not entirely unexpected.
The bug for Mir demo servers doing that is bug 1423462. However I have a hunch that Unity8 has the same bug (which has not been officially reported yet). That would not be surprising as it's actually an OpenGL limitation (the right pixel format does not exist in the OpenGL|ES spec) and is slightly awkward to work around.
So there are two possible solutions to that:
1. Try to make sure your alpha channel (or "x" byte) is always opaque (255) in the app:
e.g. glClearColor(0.0, 0.0, 0.0, 1.0);
2. Get the server fixed. Mir demo servers have bug 1423462 open for this. Unity8 has no bug logged against it yet.
| PS Jenkins bot (ps-jenkins) wrote : | #27 |
Fix committed into lp:mir at revision None, scheduled for release in mir, milestone 0.15.0
| Changed in mir: | |
| status: | Invalid → Fix Committed |
| Changed in mir: | |
| status: | Fix Committed → Invalid |
| Daniel van Vugt (vanvugt) wrote : | #28 |
Change of heart...
Rather than asking SDL to force 24-bit colour, I've attached a branch that adds support for the required 16-bit pixel formats to Mir. However that won't be enough to declare this bug fixed... SDL still needs updating to use mir_pixel_
| Changed in mir: | |
| milestone: | none → 0.15.0 |
| status: | Invalid → In Progress |
| Changed in mir (Ubuntu): | |
| status: | Invalid → Triaged |
Awesome thank you daniel :). This will land in 0.15? Sooo it'll be a bit hard to get *in* until 0.15 is released, since atm im having to do a pretty large ifndef for 0.13 vs 14.04 mir to push changes upstream.
| Daniel van Vugt (vanvugt) wrote : | #30 |
Worth noting: I have not yet solved the messiness of automatically matching an EGLConfig to its correct MirPixelFormat. That's still something we ask the toolkit (SDL) to do. Some graphics drivers honour the pixel format, and some ignore your chosen pixel format instead assuming they know a better answer from the EGLConfig. It's a mess (one we inherited from Mesa/GBM it seems) and unfortunately remains the responsibility of the toolkit to match up, for now.
| Daniel van Vugt (vanvugt) wrote : | #31 |
Comment #30 is also being resolved... Work in progress in the attached egl-pixel-format branch.
| PS Jenkins bot (ps-jenkins) wrote : | #32 |
Fix committed into lp:mir at revision 2751, scheduled for release in mir, milestone 0.15.0
| Changed in mir: | |
| status: | In Progress → Fix Committed |
| PS Jenkins bot (ps-jenkins) wrote : | #33 |
Fix committed into lp:mir at revision None, scheduled for release in mir, milestone 0.15.0
| Launchpad Janitor (janitor) wrote : | #34 |
This bug was fixed in the package mir - 0.15.0+
---------------
mir (0.15.0+
[ Daniel van Vugt ]
* New upstream release 0.15.0 (https:/
- ABI summary: Only servers and graphics drivers need rebuilding;
. Mirclient ABI unchanged at 9
. Mirserver ABI bumped to 33
. Mircommon ABI unchanged at 5
. Mirplatform ABI bumped to 9
- Enhancements:
. Add support for Mir-on-X11.
. Latency reduction optimizations (around ~15ms reduction in total):
Reduced input event resampling latency by 5ms. Reduced output latency
(in system compositors) by around 10ms with the introduction of
"predictive bypass". And we're not finished; future Mir releases
should reduce latency further.
. Introduced a python3-based Mir performance framework.
. Lots of preparation for an architectural overhaul of buffer swapping,
required in the least to support future optimizations like nested
bypass.
. Added a new cursor: crosshair
. Added support for 15/16-bit client pixel formats ("high colour").
. Added a new client function to make picking the right pixel format
for a given EGLConfig super simple: mir_connection_
. Added application-
. Added client API for specifying input region shape.
. Fixed the remaining threading flaws identified by ThreadSanitizer and
turned it on permanently for all continuous integration in future.
. Added support for relative pointer motion events (e.g. for gaming).
- Bug fixes:
. Fix focus issues breaking autopilot tests entering text (LP: #1468029)
. Fix mir tests failure on armhf with GCC5 (LP: #1478213)
. mir_buffer_
. Loading libmirclient.so twice leads to a segfault in libmirprotobuf.so
(LP: #1391976)
. Visible corruption in SDL apps (LP: #1460149)
. MultiThreadedCo
shutdown or display reconfiguration (LP: #1471909)
. ctest/"make test" reports 100% tests pass even when some fail.
(LP: #1472911)
. Mir server crashed - GLib-CRITICAL **: g_source_
(LP: #1473869)
. USC crash on multimonitor unplug [std::exception
hwc prepare()] (LP: #1474891)
. [regression] Input focus delay after switching app back into focus
(LP: #1480654)
. GLibMainLoopTes
GCC 5 in armhf (LP: #1482274)
. [enhancement] Mir lacks relative mouse support (LP: #1276322)
. ShmBuffer ignores pixel_format (LP: #1424909)
. Fullscreen bypassed clients stutter with double buffers when other
clients are running (LP: #1447896)
. [regression] Demo servers crash on start-up if MIR_ENABLE_
(LP: #1439078)
. [regression] The software curs...
| Changed in mir (Ubuntu): | |
| status: | Triaged → Fix Released |
| Changed in mir: | |
| status: | Fix Committed → Fix Released |
Can we close this one? I'm wondering if there is an SDL2 issue left here
| Changed in libsdl2 (Ubuntu): | |
| status: | Triaged → Incomplete |
| Daniel van Vugt (vanvugt) wrote : | #36 |
It appears the required fix is now in xenial (but not in wily) with 2.0.4+dfsg1-
https:/
I haven't tested the new libsdl2 myself, but the source code seems to be doing the right thing now :)
| Changed in libsdl2 (Ubuntu): | |
| status: | Incomplete → Fix Released |
While this is great for Wily, the phones which exhibit this issue are running Vivid, where the issue isn't fixed.
Can the fix please be backported to vivid?
| Daniel van Vugt (vanvugt) wrote : | #38 |
AFAIK, the required Mir bits are in vivid-overlay already. We just need to get the latest libsdl2 into the overlay.
P.S. It's not great for wily at all. The fix is apparently not in wily. Only xenial.

Screenshot of neverputt running on Nexus 7 2013.