Bug 111052 - Raspberry Pi 4 renders textures wrong
Summary: Raspberry Pi 4 renders textures wrong
Status: RESOLVED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: Drivers/DRI/v3d (show other bugs)
Version: 19.1
Hardware: ARM Linux (All)
: medium normal
Assignee: Eric Anholt
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-07-03 16:15 UTC by Daniel J
Modified: 2019-08-26 17:49 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
Main screen after game start. It should look like this: https://i.imgur.com/FqkEZlB.png (RPi 3) (204.43 KB, image/png)
2019-07-03 16:15 UTC, Daniel J
Details
apitrace from pi4 (279.63 MB, application/octet-stream)
2019-07-03 16:29 UTC, Daniel J
Details
Video of the apitrace, what the pi renders (27.02 MB, video/mp4)
2019-07-03 17:05 UTC, Daniel J
Details
Title screen, two atlas textures overlayed (331.31 KB, image/png)
2019-07-03 17:43 UTC, Daniel J
Details
Title screen frame 800 for reference (172.82 KB, image/png)
2019-07-03 17:59 UTC, Daniel J
Details

Description Daniel J 2019-07-03 16:15:39 UTC
Created attachment 144691 [details]
Main screen after game start. It should look like this: https://i.imgur.com/FqkEZlB.png (RPi 3)

Raspberry Pi 4B 4 GB arrived so I was eager to try out some FNA games. They run on Raspberry Pi 3B, but with weird texture glitches on the Pi 4, see attachments.
Using apitrace I saw some GL_INVALID_ENUM and GL_INVALID_OPERATION.
Using MESA_DEBUG=verbose I only got "Mesa: User error: GL_INVALID_ENUM in glTexParameter(pname=GL_TEXTURE_MAX_ANISOTROPY)"

I am using the v3d fkms driver (enabled by default on the RPi 4).

To run FNA games on the Raspberry Pi (for example Celeste), mojoshader dynamic lib and FMOD 1.10.10 armhf dynamic libraries must be available in LD_LIBRARY_PATH.

The texture rendering seems to take wrong UV coords and wrong textures completely sometimes, and sometimes you just get garbled data (always the same).

I also tried another game, Dust: An Elysian Tail. It showed the same issues.
Comment 1 Daniel J 2019-07-03 16:29:40 UTC
Created attachment 144692 [details]
apitrace from pi4

add apitrace
Comment 2 Daniel J 2019-07-03 17:05:03 UTC
Created attachment 144693 [details]
Video of the apitrace, what the pi renders
Comment 3 Daniel J 2019-07-03 17:43:41 UTC
Created attachment 144696 [details]
Title screen, two atlas textures overlayed

If I extract two textures, one is the actual one, and the other is the bad one, I see that they coordinates line up exactly where the real one should be. This is from frame 800 in apitrace. Somehow, wrong texture gets rendered instead of the one that should.
Comment 4 Daniel J 2019-07-03 17:59:26 UTC
Created attachment 144697 [details]
Title screen frame 800 for reference

see above comment.
Comment 5 ceb33 2019-07-06 16:31:37 UTC
not sure if realted or not, but i had the same texture switching bug on another project 
the issue was due to uniforms and attributes not being kept
 "Uniforms are program object-specific state. They retain their values once loaded, and their values are restored whenever a program object is used, as long as the program object has not been re-linked"

to solve the issue i had to re-set the uniforsm/attribute value when using the program
i am unsure what the exact specs says regarding this, but the rpi4 does not keep those it seems
Comment 6 Daniel J 2019-08-26 17:49:46 UTC
Compiled latest Mesa and the problem went away. The version of Mesa that Raspbian comes with is too old (from April). Woo!

https://www.youtube.com/watch?v=sTlY_hbe51Y


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.