Bug 111052

Summary: Raspberry Pi 4 renders textures wrong
Product: Mesa Reporter: Daniel J <djazz>
Component: Drivers/DRI/v3dAssignee: Eric Anholt <eric>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium CC: apinheiro
Version: 19.1   
Hardware: ARM   
OS: Linux (All)   
i915 platform: i915 features:
Attachments: Main screen after game start. It should look like this: https://i.imgur.com/FqkEZlB.png (RPi 3)
apitrace from pi4
Video of the apitrace, what the pi renders
Title screen, two atlas textures overlayed
Title screen frame 800 for reference

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!


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.