Created attachment 136906 [details] [review]
Patch to workaround an issue
Android apps Telegram and KineMaster have graphic corruption when started on AndroidIA/ChromeOS with latest MESA.
Issue was introduced with patch "UPSTREAM: i965: Only call create_for_planar_image for
multiple planes" and can be workarounded by setting mt_create_flags |= MIPTREE_CREATE_NO_AUX for planar images with nplanes == 1
From: Jason Ekstrand <email@example.com>
Date: Mon, 31 Jul 2017 13:33:45 -0700
Subject: [PATCH 38/39] UPSTREAM: i965: Only call create_for_planar_image for
Before, we ended up always calling miptree_create_for_planar_image in
almost all cases because most images have image->planar_format != NULL.
This commit makes us only take that path if we have a multi-planar
Steps to reproduce
1. Install Telegram from the Playstore (https://play.google.com/store/apps/details?id=org.telegram.messenger)
2. Launch Telegram
3. Notice when the Splashscreen/Tutorial screen appears the Animated Graphic is corrupt. If you swipe left to move through the different "tutorial pages" each graphic displayed is corrupt.
Animated Tutorial Graphics in Telegram should not be corrupted.
Created attachment 136907 [details]
KineMaster graphic corruption
Created attachment 136908 [details]
Telegram graphic corruption
That is a very old commit (2017 Jul) while AndroidIA Mesa is rebased currently at top of commit 9ef5b3d (2018 Jan), is this a some chromium Mesa branch? I see that latest ARC branch is arc-17.3.0-rc5, have you tried to reproduce using that one?
Issue is reproducible on ChromeOS and on AndroidIA. Both with 17.3
Jason's AUX series should address most of the issues. Can you rebase/retry on top of current master or df13588d2176dcf4800a882d926f389667772b46 at the very least.
Unfortunately I haven't gotten a compatible version of Playstore so I can't test or even debug this .. but I haven't seen this on Android-IA GL or Vulkan apps.
Just reproduced the issue on AndroidIA with MESA 17.4 and Telegram app.
If you don't have the Play Store you can install it on any x86 Android device, pull apk with adb command and install it manually.
Can attached patch be upstreamed before actual solution is in place? Thanks for help!
> Just reproduced the issue on AndroidIA with MESA 17.4 and Telegram app.
Mesa 17.4 does not exist - that's why I pointed at particular commit.
Make sure your testing is based on it or later commit in the master branch.
> Can attached patch be upstreamed before actual solution is in place? Thanks for help!
Please send patches to the ML - see the instructions for specifics 
Tl;Dr - base patch against master and git send-email it.
You want the following (three) tags in the commit message:
Cc: Jason Ekstrand <firstname.lastname@example.org>
Fixes: be0e13e49f0 ("i965: Only call create_for_planar_image for multiple planes")
(In reply to Dmytro Chystiakov from comment #8)
> Can attached patch be upstreamed before actual solution is in place? Thanks
> for help!
I'd rather not if we can help it. That patch is quite drastic. Once I get done fighting with Android and can test something, I'll take a look and see if we can get a proper solution.
A proper patch is on the list:
I *should* get playstore for O today so I will testing if this happens.
I've verified that patch in comment #11 fixes this bug and pushed this fix to Android-IA tree.
Fixed by the following commit in master:
Author: Jason Ekstrand <email@example.com>
Date: Wed Jan 31 17:31:39 2018 -0800
i965: Call prepare_external after implicit window-system MSAA resolves
This fixes some rendering corruption in a couple of Android apps that
use window-system MSAA.
Reviewed-by: Tapani Pälli <firstname.lastname@example.org>