Bug 104741

Summary: Graphic corruption for Android apps Telegram and KineMaster
Product: Mesa Reporter: Dmytro Chystiakov <dmytro.chystiakov>
Component: Drivers/DRI/i965Assignee: Jason Ekstrand <jason>
Status: RESOLVED FIXED QA Contact: Intel 3D Bugs Mailing List <intel-3d-bugs>
Severity: normal    
Priority: medium CC: lemody
Version: 17.3   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
i915 platform: i915 features:
Bug Depends on:    
Bug Blocks: 104757    
Attachments: Patch to workaround an issue
KineMaster graphic corruption
Telegram graphic corruption

Description Dmytro Chystiakov 2018-01-22 22:17:10 UTC
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 <jason.ekstrand@intel.com>
Date: Mon, 31 Jul 2017 13:33:45 -0700
Subject: [PATCH 38/39] UPSTREAM: i965: Only call create_for_planar_image for
 multiple planes
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. 

Expected Result
Animated Tutorial Graphics in Telegram should not be corrupted.
Comment 1 Dmytro Chystiakov 2018-01-22 22:18:10 UTC
Created attachment 136907 [details]
KineMaster graphic corruption
Comment 2 Dmytro Chystiakov 2018-01-22 22:18:41 UTC
Created attachment 136908 [details]
Telegram graphic corruption
Comment 3 Tapani Pälli 2018-01-23 09:05:57 UTC
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?
Comment 4 Dmytro Chystiakov 2018-01-23 15:44:06 UTC
Issue is reproducible on ChromeOS and on AndroidIA. Both with 17.3
Comment 5 Emil Velikov 2018-01-25 16:59:35 UTC
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.
Comment 6 Tapani Pälli 2018-01-26 08:37:16 UTC
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.
Comment 7 Dmytro Chystiakov 2018-01-26 20:38:11 UTC
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.
Comment 8 Dmytro Chystiakov 2018-01-30 23:27:34 UTC
Can attached patch be upstreamed before actual solution is in place? Thanks for help!
Comment 9 Emil Velikov 2018-01-31 16:56:49 UTC
> 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 [1]
Tl;Dr - base patch against master and git send-email it.

You want the following (three) tags in the commit message:

Cc: Jason Ekstrand <jason.ekstrand@intel.com>
Fixes: be0e13e49f0 ("i965: Only call create_for_planar_image for multiple planes")
BUgzilla: https://bugs.freedesktop.org/show_bug.cgi?id=104741


[1] https://www.mesa3d.org/submittingpatches.html
Comment 10 Jason Ekstrand 2018-01-31 19:31:28 UTC
(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.
Comment 11 Jason Ekstrand 2018-02-01 01:42:00 UTC
A proper patch is on the list:

Comment 12 Tapani Pälli 2018-02-01 05:49:16 UTC
I *should* get playstore for O today so I will testing if this happens.
Comment 13 Tapani Pälli 2018-02-01 12:38:14 UTC
I've verified that patch in comment #11 fixes this bug and pushed this fix to Android-IA tree.
Comment 14 Jason Ekstrand 2018-02-02 05:47:12 UTC
Fixed by the following commit in master:

commit 2f7205be47bbb730cdfa0a037224b9ebd5224fd1
Author: Jason Ekstrand <jason.ekstrand@intel.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.
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=104741
    Cc: mesa-stable@lists.freedesktop.org
    Reviewed-by: Tapani Pälli <tapani.palli@intel.com>

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.