hexdump0815 / linux-mainline-mediatek-mt81xx-kernel

linux-mainline-mediatek-mt81xx-kernel
14 stars 7 forks source link

[Request] Look into the gpu driver for the Acer Chromebook R13 that is in chromeos source tree #1

Open LelouBil opened 2 years ago

LelouBil commented 2 years ago

I struggled to install linux on my chromebook and tried compiling my own kernel without success until I stumbled upon your project, so thanks a lot.

During my research I also found this: https://elinux.org/User:Uli/Acer_Chromebook_R13_GPU_test_system Which led me to find the place where the driver is located Here : https://chromium.googlesource.com/chromiumos/third_party/kernel/+/refs/heads/chromeos-5.4/drivers/gpu/drm/img-rogue/ I have no idea how easy/hard it would be to include in your kernel builds, but maybe it is useful to keep for someday.

LelouBil commented 2 years ago

Update : I found this https://git.ti.com/cgit/graphics/ti-img-rogue-driver They have a version for kernel 5.10. I'm not really sure of what i'm doing but I'll try to get it compiling at least

LelouBil commented 2 years ago

Okay, the TI stuff is for another line of gpus from imagination tech, the 8XE, and I need the 6XT which is for sure in the chromeos kernel source but only for 5.4. I'll try compiling the 5.4 chromeos kernel

hexdump0815 commented 2 years ago

@LelouBil - i gave it a try recently, but it will be a lot of effort to get it working: there is a properly compiling img driver for version 1.13 here: https://gitlab.collabora.com/eballetbo/linux/-/tree/topic/chromeos/chromeos-5.15/drivers/gpu/drm/img-rogue ... sadly there is nowhere a 1.13 binary blob available and the 1.10 tree does not compile cleanly (would need the changes from the 1.13 tree i guess) - chromeos comes with the 1.10 blobs, but they are only 32bit ... so all in all it does not look all that good and i have given up on this for now ... please also have a look at the todo file https://github.com/hexdump0815/imagebuilder/blob/main/systems/chromebook_oak/todo.txt which has some more interesting links as well ... please let me know here in case you make any progress or find out anything new

LelouBil commented 2 years ago

Thanks for giving me more places to search ! I'll try this weekend.

LelouBil commented 2 years ago

@hexdump0815 Okay so I compiled and installed the 5.15 kernel you linked here : https://gitlab.collabora.com/eballetbo/linux/-/tree/topic/chromeos/chromeos-5.15/drivers/gpu/drm/img-rogue. And to my surprise, my chromebook rebooted successfully, however the driver is not working.

Why do you want the 1.10 version ? Is it because the 1.13 version doesn't work on this hardware any more ?

Here are the logs if that's helpful :

[    3.244585] PVR_K:  245: Read BVNC 4.40.2.51 from HW device registers
[    3.244779] PVR_K:  245: RGX Device registered with BVNC 4.40.2.51
[    3.245059] pvrsrvkm_1_13 13000000.mfgsys-gpu: Found 6 OPP points.
[    3.245067] pvrsrvkm_1_13 13000000.mfgsys-gpu: opp[1/6]: (253500000 Hz, 1000000 uV)
[    3.245074] pvrsrvkm_1_13 13000000.mfgsys-gpu: opp[2/6]: (299000000 Hz, 1000000 uV)
[    3.245080] pvrsrvkm_1_13 13000000.mfgsys-gpu: opp[3/6]: (396500000 Hz, 1000000 uV)
[    3.245085] pvrsrvkm_1_13 13000000.mfgsys-gpu: opp[4/6]: (455000000 Hz, 1000000 uV)
[    3.245091] pvrsrvkm_1_13 13000000.mfgsys-gpu: opp[5/6]: (494000000 Hz, 1130000 uV)
[    3.245096] pvrsrvkm_1_13 13000000.mfgsys-gpu: opp[6/6]: (598000000 Hz, 1130000 uV)
[    3.245942] [drm] Initialized pvr 1.13.5824814 20170530 for 13000000.mfgsys-gpu on minor 1
[    5.547811] pvrsrvkm_1_13 13000000.mfgsys-gpu: Direct firmware load for rgx.fw.4.40.2.51 failed with error -2
[    5.551289] pvrsrvkm_1_13 13000000.mfgsys-gpu: Falling back to sysfs fallback for: rgx.fw.4.40.2.51
[    5.558636] pvrsrvkm_1_13 13000000.mfgsys-gpu: Direct firmware load for rgx.fw.4.40p.2.51 failed with error -2
[    5.559821] pvrsrvkm_1_13 13000000.mfgsys-gpu: Falling back to sysfs fallback for: rgx.fw.4.40p.2.51
[    5.572187] pvrsrvkm_1_13 13000000.mfgsys-gpu: Direct firmware load for rgx.fw failed with error -2
[    5.573637] pvrsrvkm_1_13 13000000.mfgsys-gpu: Falling back to sysfs fallback for: rgx.fw
[    5.578415] PVR_K:(Fatal):   517: All RGX Firmware image loads failed for 'rgx.fw.4.40.2.51' [1584]
[    5.580497] PVR_K:(Error):   517: RGXInit: InitFirmware failed (4) [1366]
[    5.583611] PVR_K:(Error):   517: RGXInit() failed (PVRSRV_ERROR_INIT_FAILURE) in PVRSRVCommonDeviceInitialise() [2343]
[    5.586812] PVR_K:(Error):   517: PVRSRVDeviceFinalise() failed (PVRSRV_ERROR_NOT_INITIALISED) in PVRSRVCommonDeviceInitialise() [2352]
[    5.588738] PVR_K:(Error):   517: PVRSRVDeviceOpen: Failed to initialise device (PVRSRV_ERROR_NOT_INITIALISED) [461]
[    5.674610] PVR_K:(Error):   517: PVRSRVDeviceOpen: Driver already in bad state. Device open failed. [450]
[    6.393403] PVR_K:(Error):   517: PVRSRVDeviceOpen: Driver already in bad state. Device open failed. [450]
[    6.465375] PVR_K:(Error):   517: PVRSRVDeviceOpen: Driver already in bad state. Device open failed. [450]
[    6.539388] PVR_K:(Error):   517: PVRSRVDeviceOpen: Driver already in bad state. Device open failed. [450]
[    6.606391] PVR_K:(Error):   517: PVRSRVDeviceOpen: Driver already in bad state. Device open failed. [450]
[    6.672692] PVR_K:(Error):   517: PVRSRVDeviceOpen: Driver already in bad state. Device open failed. [450]
[    6.738900] PVR_K:(Error):   517: PVRSRVDeviceOpen: Driver already in bad state. Device open failed. [450]
[    7.391984] PVR_K:(Error):   517: PVRSRVDeviceOpen: Driver already in bad state. Device open failed. [450]
[   16.570388] PVR_K:(Error):  1114: PVRSRVDeviceOpen: Driver already in bad state. Device open failed. [450]
hexdump0815 commented 2 years ago

@LelouBil - you'll have to pair the kernel driver with a user space library blob to make use of it (i.e. to call it from userspace) and this blob is only available in version 1.10 (as part of chromeos and that only for armv7l, i.e. you'll have to run a 32bit userland to make use of it) - usually those versions have to match (at least for the mali drivers it was the case, but might be worth a try even with different versions)

besides the blob the kernel driver also tries to load some firmware file into the gpu i think which it does not find in your case - you can get the chromeos blobs and the firmware from https://commondatastorage.googleapis.com/chromeos-localmirror/distfiles/img-ddk-oak-1.10.5221057_p102.run (its a self unpacking shell script - just have a look at it) ... to make use of the blobs you'll then need to do something like https://github.com/xc-racer99/mesa-pvr (which is for some other soc, but the same idea might work for the mt8173 too, but it might also be that it does not work) ... all in all it might be doable, but a lot of experimentation will be required

good luck and best wishes - hexdump

LelouBil commented 2 years ago

In my search i found this : https://pvrsupport.imgtec.com/downloads/files/view-270 I didn't try it but it looks promising They also have android an android 11 image

LelouBil commented 2 years ago

I checked the library and it's 64 bit in this image so I'll only have to either pickup the kernel module or get the 1.10 to compile with latest kernel and everything should work

LelouBil commented 2 years ago

Okay, so actually the arch image has the kernel driver version 1.9. I'm not sure what to do next, I got the 1.10 to compile by backporting the changes from 1.13. So in theory right now the GPU is useable with 32 bit user space, but since I have the library for driver 1.9 for x64 maybe there's a way to get the 1.10 one too.

hexdump0815 commented 2 years ago

very nice progress - maybe first try to get the 1.10 version with 32bit userland working for some example as the mesa wrapping first has to be done maybe to make it work in xorg or walyand and if you have such a working example a first try might be to simple change the expected version number in the driver to 1.9 - maybe you are lucky and it simply works :) ... another option would be to look through the git history of the chromeos kernel driver - maybe they used 1.9 at some point as well?

good luck and best wishes - hexdump

LelouBil commented 2 years ago

Yeah I'm gonna try all of this, I think there can also be hope to find the source for the DDK 1.10 or 1.13 maybe. I found a few online but either it was for different hardware or I couldn't get it to compile. I'm even thinking about asking imagination tech directly for it trough their support page.

LelouBil commented 2 years ago

Also, regarding the 32 bit user space I'll have to study image builder a bit more because I'm not sure how to have all of the software included as arm instead of arm64

LelouBil commented 2 years ago

I did some more fixes and stuff by comparing the 1.13 and 1.10 version, but I'm currently stuck on this issue :

[    0.000000] Linux version 5.15.0-rc2-stb-mt7-pvr+ (root@Lelou-Desktop) (aarch64-linux-gnu-gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0, GNU ld (GNU Binutils for Ubuntu) 2.34) #1 SMP PREEMPT Sat Jan 29 18:39:31 CET 2022
[   54.829973] PVR_K:  1255: Reverting to compile time BVNC 4.40.2.51
[   54.829988] PVR_K:  1255: RGX Device initialised with BVNC 4.40.2.51
[   54.830193] pvrsrvkm_1_10 13000000.mfgsys-gpu: opp[1/6]: (253500000 Hz, 1000000 uV)
[   54.830204] pvrsrvkm_1_10 13000000.mfgsys-gpu: opp[2/6]: (299000000 Hz, 1000000 uV)
[   54.830212] pvrsrvkm_1_10 13000000.mfgsys-gpu: opp[3/6]: (396500000 Hz, 1000000 uV)
[   54.830218] pvrsrvkm_1_10 13000000.mfgsys-gpu: opp[4/6]: (455000000 Hz, 1000000 uV)
[   54.830224] pvrsrvkm_1_10 13000000.mfgsys-gpu: opp[5/6]: (494000000 Hz, 1130000 uV)
[   54.830230] pvrsrvkm_1_10 13000000.mfgsys-gpu: opp[6/6]: (598000000 Hz, 1130000 uV)
[   54.831325] [drm] Initialized pvr 1.10.5221057 20170530 for 13000000.mfgsys-gpu on minor 1
[   55.409339] PVR_K:(Error):   512: PollForValueKM: Timeout. Expected 0x1 but found 0x0 (mask 0xffffffff).
[   55.409352] PVR_K:(Error):   512: RGXPostPowerState: Polling for 'FW started' flag failed.
[   55.409358] PVR_K:  512: BIF0 - OK
[   55.409362] PVR_K:  512: BIF1 - OK
[   55.409367] PVR_K:  512: TEXAS_BIF - OK
[   55.409371] PVR_K:  512: RGX FW State: OK (HWRState 0x00000000: )
[   55.409376] PVR_K:  512: RGX FW Power State: RGXFWIF_POW_OFF (APM enabled: 0 ok, 0 denied, 0 non-idle, 0 other, 0 total. Latency: 10 ms)
[   55.409381] PVR_K:  512: RGX DVFS: 0 frequency changes. Current frequency: 253 MHz (sampled at cc88fbcf3)
[   55.409385] PVR_K:  512: RGX FW OS 0 State: 0x00000000 (Active: No, Freelists: Not Ok, Grow Request Pending: No)
[   55.409396] PVR_K:  512: Number of HWR: GP(0/0+0), 2D(0/0+0), TA(0/0+0), 3D(0/0+0), CDM(0/0+0), FALSE(0,0,0,0,0)
[   55.409401] PVR_K:  512: DM 0 (GP)
[   55.409405] PVR_K:  512: DM 1 (HWRflags 0x00000000: working; )
[   55.409408] PVR_K:  512: DM 2 (HWRflags 0x00000000: working; )
[   55.409412] PVR_K:  512: DM 3 (HWRflags 0x00000000: working; )
[   55.409415] PVR_K:  512: DM 4 (HWRflags 0x00000000: working; )
[   55.409418] PVR_K:  512: ------[ RGX registers ]------
[   55.409422] PVR_K:  512: RGX Register Base Address (Linear):   0x00000000a73c10f2
[   55.409425] PVR_K:  512: RGX Register Base Address (Physical): 0x13000000
[   55.409430] PVR_K:  512: CORE_ID                       : 0x011B0233
[   55.409434] PVR_K:  512: CORE_REVISION                 : 0x00042800
[   55.409438] PVR_K:  512: DESIGNER_REV_FIELD1           : 0x00000000
[   55.409441] PVR_K:  512: DESIGNER_REV_FIELD2           : 0x00000000
[   55.409445] PVR_K:  512: CHANGESET_NUMBER              : 0x0000000000000000
[   55.409448] PVR_K:  512: META_SP_MSLVIRQSTATUS         : 0x00000000
[   55.409452] PVR_K:  512: CLK_CTRL                      : 0xAAAAAA002A2AAAAA
[   55.409456] PVR_K:  512: CLK_STATUS                    : 0x0000000000600100
[   55.409459] PVR_K:  512: CLK_CTRL2                     : 0x0000000000000800
[   55.409463] PVR_K:  512: CLK_STATUS2                   : 0x0000000000000000
[   55.409466] PVR_K:  512: EVENT_STATUS                  : 0x00000000
[   55.409470] PVR_K:  512: TIMER                         : 0x0000000000078F01
[   55.409473] PVR_K:  512: BIF_FAULT_BANK0_MMU_STATUS    : 0x00000000
[   55.409477] PVR_K:  512: BIF_FAULT_BANK0_REQ_STATUS    : 0x0000000000000000
[   55.409480] PVR_K:  512: BIF_FAULT_BANK1_MMU_STATUS    : 0x00000000
[   55.409484] PVR_K:  512: BIF_FAULT_BANK1_REQ_STATUS    : 0x0000000000000000
[   55.409487] PVR_K:  512: BIF_MMU_STATUS                : 0x00000000
[   55.409491] PVR_K:  512: BIF_MMU_ENTRY                 : 0x00000000
[   55.409494] PVR_K:  512: BIF_MMU_ENTRY_STATUS          : 0x0000000000000000
[   55.409498] PVR_K:  512: BIFPM_STATUS_MMU              : 0x00000000
[   55.409501] PVR_K:  512: BIFPM_READS_EXT_STATUS        : 0x00000000
[   55.409504] PVR_K:  512: BIFPM_READS_INT_STATUS        : 0x00000000
[   55.409508] PVR_K:  512: BIF_CAT_BASE_INDEX            : 0x0000000000000000
[   55.409512] PVR_K:  512: BIF_CAT_BASE0                 : 0x000000012E550000
[   55.409515] PVR_K:  512: BIF_CAT_BASE1                 : 0x0000000000000000
[   55.409519] PVR_K:  512: BIF_CAT_BASE2                 : 0x0000000000000000
[   55.409522] PVR_K:  512: BIF_CAT_BASE3                 : 0x0000000000000000
[   55.409526] PVR_K:  512: BIF_CAT_BASE4                 : 0x0000000000000000
[   55.409529] PVR_K:  512: BIF_CAT_BASE5                 : 0x0000000000000000
[   55.409533] PVR_K:  512: BIF_CAT_BASE6                 : 0x0000000000000000
[   55.409536] PVR_K:  512: BIF_CAT_BASE7                 : 0x0000000000000000
[   55.409540] PVR_K:  512: BIF_CTRL_INVAL                : 0x00000000
[   55.409543] PVR_K:  512: BIF_CTRL                      : 0x000000C0
[   55.409546] PVR_K:  512: BIF_PM_CAT_BASE_VCE0          : 0x0000000000000000
[   55.409550] PVR_K:  512: BIF_PM_CAT_BASE_TE0           : 0x0000000000000000
[   55.409553] PVR_K:  512: BIF_PM_CAT_BASE_ALIST0        : 0x0000000000000000
[   55.409557] PVR_K:  512: BIF_PM_CAT_BASE_VCE1          : 0x0000000000000000
[   55.409560] PVR_K:  512: BIF_PM_CAT_BASE_TE1           : 0x0000000000000000
[   55.409564] PVR_K:  512: BIF_PM_CAT_BASE_ALIST1        : 0x0000000000000000
[   55.409567] PVR_K:  512: PERF_TA_PHASE                 : 0x00000000
[   55.409570] PVR_K:  512: PERF_TA_CYCLE                 : 0x00000000
[   55.409573] PVR_K:  512: PERF_3D_PHASE                 : 0x00000000
[   55.409577] PVR_K:  512: PERF_3D_CYCLE                 : 0x00000000
[   55.409580] PVR_K:  512: PERF_TA_OR_3D_CYCLE           : 0x00000000
[   55.409584] PVR_K:  512: PERF_TA_AND_3D_CYCLE          : 0x00000000
[   55.409587] PVR_K:  512: PERF_COMPUTE_PHASE            : 0x00000000
[   55.409590] PVR_K:  512: PERF_COMPUTE_CYCLE            : 0x00000000
[   55.409593] PVR_K:  512: PM_PARTIAL_RENDER_ENABLE      : 0x00000000
[   55.409596] PVR_K:  512: ISP_RENDER                    : 0x00000000
[   55.409600] PVR_K:  512: TLA_STATUS                    : 0x0000000000000000
[   55.409603] PVR_K:  512: MCU_FENCE                     : 0x0000000000000000
[   55.409607] PVR_K:  512: VDM_CONTEXT_STORE_STATUS      : 0x00000001
[   55.409610] PVR_K:  512: VDM_CONTEXT_STORE_TASK0       : 0x0000000000000000
[   55.409614] PVR_K:  512: VDM_CONTEXT_STORE_TASK1       : 0x0000000000000000
[   55.409617] PVR_K:  512: VDM_CONTEXT_STORE_TASK2       : 0x0000000000000000
[   55.409621] PVR_K:  512: VDM_CONTEXT_RESUME_TASK0      : 0x0000000000000000
[   55.409624] PVR_K:  512: VDM_CONTEXT_RESUME_TASK1      : 0x0000000000000000
[   55.409628] PVR_K:  512: VDM_CONTEXT_RESUME_TASK2      : 0x0000000000000000
[   55.409631] PVR_K:  512: ISP_CTL                       : 0x00000000
[   55.409634] PVR_K:  512: ISP_STATUS                    : 0x00000000
[   55.409638] PVR_K:  512: MTS_INTCTX                    : 0x00000000
[   55.409641] PVR_K:  512: MTS_BGCTX                     : 0x00000000
[   55.409644] PVR_K:  512: MTS_BGCTX_COUNTED_SCHEDULE    : 0x00000000
[   55.409647] PVR_K:  512: MTS_SCHEDULE                  : 0x00000000
[   55.409650] PVR_K:  512: MTS_GPU_INT_STATUS            : 0x00000000
[   55.409653] PVR_K:  512: CDM_CONTEXT_STORE_STATUS      : 0x00000000
[   55.409657] PVR_K:  512: CDM_CONTEXT_PDS0              : 0x0000000000000000
[   55.409661] PVR_K:  512: CDM_CONTEXT_PDS1              : 0x0000000000000000
[   55.409664] PVR_K:  512: CDM_TERMINATE_PDS             : 0x0000000000000000
[   55.409668] PVR_K:  512: CDM_TERMINATE_PDS1            : 0x0000000000000000
[   55.409671] PVR_K:  512: SIDEKICK_IDLE                 : 0x0000006A
[   55.409674] PVR_K:  512: SLC_IDLE                      : 0x000000F3
[   55.409678] PVR_K:  512: SLC_STATUS0                   : 0x00000000
[   55.409681] PVR_K:  512: SLC_STATUS1                   : 0x0000000000010000
[   55.409684] PVR_K:  512: SLC_CTRL_BYPASS               : 0x00000000
[   55.409688] PVR_K:  512: SLC_CTRL_MISC                 : 0x0000000000200001
[   55.409693] PVR_K:  512: T0 TXENABLE                   : 0x0201C031
[   55.409697] PVR_K:  512: T0 TXSTATUS                   : 0x00020005
[   55.409701] PVR_K:  512: T0 TXDEFR                     : 0x00000000
[   55.409709] PVR_K:  512: T0 PC                         : 0x400021F0
[   55.409716] PVR_K:  512: T0 PCX                        : 0x00000000
[   55.409723] PVR_K:  512: T0 SP                         : 0x8AAAAABF
[   55.409733] PVR_K:(Error):   512: PVRSRVDeviceFinalise: Failed to set device 00000000f2bf958c power state to 'on' (PVRSRV_ERROR_TIMEOUT)
[   55.409739] PVR_K:(Error):   512: PVRSRVDeviceInitialise: Services failed to finalise the device (PVRSRV_ERROR_TIMEOUT)
[   55.409747] PVR_K:(Error):   512: PVRSRVCommonDeviceOpen: Failed to initialise device (PVRSRV_ERROR_TIMEOUT)

Basically the driver loads the firmware into the GPU correctly, but doesn't receive any more info from it, and it shows that the GPU is powered off.

hexdump0815 commented 2 years ago

wow - you are making quite a bit of progress - congratulations!

regarding armv7l userland images for oak/elm/hana: i built some in november just to have them ready in case i find some time to play around with all this and have started uploading them right now - i'll post a link here when the upload finished - maybe you have an extra sd card to put one of them onto to play around with that

here are some notes about linux kernel changes from the linux-mediatek list which seem to be required to get the gpu working - i think i checked and they seem to be in v5.15 meanwhile, but it might be worth to have a look and maybe you can find more such patches on patchwork there ...

enric balletbo had it successfully working i think with mainline, but i think he is/was a contractor for collabora/google and might have had access to more stuff then what is available in public - but maybe its worth to ask him about the problem you are stuck at right now

this might be of interest maybe as well: https://elinux.org/User:Uli/Acer_Chromebook_R13_GPU_test_system and https://github.com/uli/kernel/tree/elm-working (and maybe some more brnaches around it) ... all just in case you did not run across it yourself already :)

hexdump0815 commented 2 years ago

i just looked through my old notes from the #linux-mediatek irc at libera (or maybe even still on freenode at that time) and there enric wrote in july 2021: "I have the mali and the powervr kernel drivers forward ported, one is for MT8173 and the other one for MT8183" and that was in this branch: https://gitlab.collabora.com/eballetbo/linux/-/tree/topic/chromeos/chromeos-5.14 ... there is also one for 5.15 - so it might be a good idea to go through the commits in both branches ... i think shortly after he stopped working on this topic as there is nothing anymore after 5.15 (i guess due to contract changes or so)

hexdump0815 commented 2 years ago

ok - my last november armv7l oak images are now available from here: https://github.com/hexdump0815/imagebuilder/releases/tag/210724-02

LelouBil commented 2 years ago

I actually already built armv7l images using your imagebuilder, that's how i got everything loading.

I am also currently creating a repository with my kernel changes.

hexdump0815 commented 2 years ago

ah - ok - even better, this way you can customize things as you need them ... if you have your repo(s) setup, please put some links to them here as well

hexdump0815 commented 2 years ago

maybe this might be interesting to look through: https://github.com/uli/kernel/tree/elm-gpu - old, but maybe it has something useful in it still ...

LelouBil commented 2 years ago

I looked around the patches you sent, and since I was already using the chromeos-5.15 branch of Enric Balletbo they were already applied.

I'll try asking him.

LelouBil commented 2 years ago

Okay, I had no luck asking him. The email I sent just bouced back.

However, I recompiled the driver with debug logging and I got new info.

[    0.000000] Linux version 5.15.0-rc2-stb-mt7-pvr+ (root@Lelou-Desktop) (aarch64-linux-gnu-gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0, GNU ld (GNU Binutils for Ubuntu) 2.34) #1 SMP PREEMPT Sat Jan 29 18:39:31 CET 2022
[ 2725.985517] PVR_K:  1778: Reverting to compile time BVNC 4.40.2.51
[ 2725.985532] PVR_K:  1778: RGX Device initialised with BVNC 4.40.2.51
[ 2725.985536] PVR_K:  1778: NC:        2
[ 2725.985540] PVR_K:  1778: CSF:       N/A
[ 2725.985544] PVR_K:  1778: FBCDCA:    2
[ 2725.985547] PVR_K:  1778: MCMB:      N/A
[ 2725.985551] PVR_K:  1778: MCMS:      32768
[ 2725.985554] PVR_K:  1778: MDMACnt:   N/A
[ 2725.985557] PVR_K:  1778: NIIP:      8
[ 2725.985560] PVR_K:  1778: PBW:       40
[ 2725.985563] PVR_K:  1778: STEArch:   N/A
[ 2725.985567] PVR_K:  1778: SVCEA:     N/A
[ 2725.985570] PVR_K:  1778: SLCBanks:  N/A
[ 2725.985573] PVR_K:  1778: SLCCLS:    512
[ 2725.985576] PVR_K:  1778: SLCSize:   131072
[ 2725.985580] PVR_K:  1778: VASB:      40
[ 2725.985583] PVR_K:  1778: META:      3
[ 2725.985586] PVR_K:  1778: AXI_ACELITE
[ 2725.985589] PVR_K:  1778: CLUSTER_GROUPING
[ 2725.985592] PVR_K:  1778: COMPUTE
[ 2725.985595] PVR_K:  1778: COMPUTE_MORTON_CAPABLE
[ 2725.985598] PVR_K:  1778: COMPUTE_OVERLAP
[ 2725.985602] PVR_K:  1778: DYNAMIC_DUST_POWER
[ 2725.985605] PVR_K:  1778: GS_RTA_SUPPORT
[ 2725.985608] PVR_K:  1778: PERFBUS
[ 2725.985611] PVR_K:  1778: TLA
[ 2725.985615] PVR_K:  1778: TPU_CEM_DATAMASTER_GLOBAL_REGISTERS
[ 2725.985618] PVR_K:  1778: TPU_FILTERING_MODE_CONTROL
[ 2725.985622] PVR_K:  1778: XT_TOP_INFRASTRUCTURE
[ 2725.985625] PVR_K:  1778: PERF_COUNTER_BATCH
[ 2725.985628] PVR_K:  1778: ERN/BRN : 36400
[ 2725.985631] PVR_K:  1778: ERN/BRN : 42290
[ 2725.985634] PVR_K:  1778: ERN/BRN : 42606
[ 2725.985637] PVR_K:  1778: ERN/BRN : 50767
[ 2725.985640] PVR_K:  1778: ERN/BRN : 54441
[ 2725.985644] PVR_K:  1778: ERN/BRN : 57193
[ 2725.985647] PVR_K:  1778: ERN/BRN : 63142
[ 2725.985826] pvrsrvkm_1_10 13000000.mfgsys-gpu: opp[1/6]: (253500000 Hz, 1000000 uV)
[ 2725.985836] pvrsrvkm_1_10 13000000.mfgsys-gpu: opp[2/6]: (299000000 Hz, 1000000 uV)
[ 2725.985842] pvrsrvkm_1_10 13000000.mfgsys-gpu: opp[3/6]: (396500000 Hz, 1000000 uV)
[ 2725.985847] pvrsrvkm_1_10 13000000.mfgsys-gpu: opp[4/6]: (455000000 Hz, 1000000 uV)
[ 2725.985851] pvrsrvkm_1_10 13000000.mfgsys-gpu: opp[5/6]: (494000000 Hz, 1130000 uV)
[ 2725.985856] pvrsrvkm_1_10 13000000.mfgsys-gpu: opp[6/6]: (598000000 Hz, 1130000 uV)
[ 2725.985902] pvrsrvkm_1_10 13000000.mfgsys-gpu: Freq set to 253500000 Hz
[ 2725.985913] pvrsrvkm_1_10 13000000.mfgsys-gpu: Voltage set to 1000000 uV
[ 2725.985993] PVR: 1778: PVR DVFS activated: 253500000-598000000 Hz, Period: 300ms
[ 2725.987918] [drm] Initialized pvr 1.10.5221057 20170530 for 13000000.mfgsys-gpu on minor 1
[ 2726.114243] PVR: 532: Installing MISR with cookie 00000000d39fb3cf
[ 2726.114445] PVR: 532: Installing MISR with cookie 00000000ab8de436
[ 2726.114596] PVR: 532: Installing MISR with cookie 000000007c0d0aa7
[ 2726.115137] pvrsrvkm_1_10 13000000.mfgsys-gpu: Enabled
[ 2726.615239] PVR_K:(Error):   532: PollForValueKM: Timeout. Expected 0x1 but found 0x0 (mask 0xffffffff). [pvrsrv.c:3053]
[ 2726.615248] PVR_K:(Error):   532: RGXPostPowerState: Polling for 'FW started' flag failed. [rgxpower.c:360]
[ 2726.615253] PVR_K:  532: BIF0 - OK
[ 2726.615258] PVR_K:  532:     BIF1 - FAULT:
[ 2726.615262] PVR_K:  532:       * MMU status (0x0000000000000001): PC = 0, Page Size = 0, MMU data type = 0.
[ 2726.615267] PVR_K:  532:       * Request (0x00049300B81C4450): META (-), Reading from 0x00B81C4450.
[ 2726.615273] PVR_K:  532:     Page fault not applicable to Devmem History
[ 2726.615277] PVR_K:  532: TEXAS_BIF - OK
[ 2726.615281] PVR_K:  532: RGX FW State: OK (HWRState 0x00000000: )
[ 2726.615286] PVR_K:  532: RGX FW Power State: RGXFWIF_POW_OFF (APM enabled: 0 ok, 0 denied, 0 non-idle, 0 other, 0 total. Latency: 10 ms)
[ 2726.615290] PVR_K:  532: RGX DVFS: 0 frequency changes. Current frequency: 253 MHz (sampled at 27ab8d83130)
[ 2726.615294] PVR_K:  532: RGX FW OS 0 State: 0x00000000 (Active: No, Freelists: Not Ok, Grow Request Pending: No)
[ 2726.615303] PVR_K:  532: Number of HWR: GP(0/0+0), 2D(0/0+0), TA(0/0+0), 3D(0/0+0), CDM(0/0+0), FALSE(0,0,0,0,0)
[ 2726.615307] PVR_K:  532: DM 0 (GP)
[ 2726.615311] PVR_K:  532: DM 1 (HWRflags 0x00000000: working; )
[ 2726.615314] PVR_K:  532: DM 2 (HWRflags 0x00000000: working; )
[ 2726.615317] PVR_K:  532: DM 3 (HWRflags 0x00000000: working; )
[ 2726.615321] PVR_K:  532: DM 4 (HWRflags 0x00000000: working; )
[ 2726.615324] PVR_K:  532: ------[ RGX registers ]------
[ 2726.615328] PVR_K:  532: RGX Register Base Address (Linear):   0x0000000052f356c5
[ 2726.615331] PVR_K:  532: RGX Register Base Address (Physical): 0x13000000
[ 2726.615335] PVR_K:  532: CORE_ID                       : 0x011B0233
[ 2726.615339] PVR_K:  532: CORE_REVISION                 : 0x00042800
[ 2726.615342] PVR_K:  532: DESIGNER_REV_FIELD1           : 0x00000000
[ 2726.615345] PVR_K:  532: DESIGNER_REV_FIELD2           : 0x00000000
[ 2726.615349] PVR_K:  532: CHANGESET_NUMBER              : 0x0000000000000000
[ 2726.615352] PVR_K:  532: META_SP_MSLVIRQSTATUS         : 0x00000000
[ 2726.615356] PVR_K:  532: CLK_CTRL                      : 0xAAAAAA002A2AAAAA
[ 2726.615360] PVR_K:  532: CLK_STATUS                    : 0x0000000000600000
[ 2726.615363] PVR_K:  532: CLK_CTRL2                     : 0x0000000000000800
[ 2726.615367] PVR_K:  532: CLK_STATUS2                   : 0x0000000000000000
[ 2726.615370] PVR_K:  532: EVENT_STATUS                  : 0x00000200
[ 2726.615374] PVR_K:  532: TIMER                         : 0x0000000000078EFD
[ 2726.615378] PVR_K:  532: BIF_FAULT_BANK0_MMU_STATUS    : 0x00000000
[ 2726.615381] PVR_K:  532: BIF_FAULT_BANK0_REQ_STATUS    : 0x0000000000000000
[ 2726.615384] PVR_K:  532: BIF_FAULT_BANK1_MMU_STATUS    : 0x00000001
[ 2726.615388] PVR_K:  532: BIF_FAULT_BANK1_REQ_STATUS    : 0x00049300B81C4450
[ 2726.615391] PVR_K:  532: BIF_MMU_STATUS                : 0x00000000
[ 2726.615394] PVR_K:  532: BIF_MMU_ENTRY                 : 0x00000000
[ 2726.615397] PVR_K:  532: BIF_MMU_ENTRY_STATUS          : 0x0000000000000000
[ 2726.615401] PVR_K:  532: BIFPM_STATUS_MMU              : 0x00000000
[ 2726.615405] PVR_K:  532: BIFPM_READS_EXT_STATUS        : 0x00000000
[ 2726.615408] PVR_K:  532: BIFPM_READS_INT_STATUS        : 0x00000000
[ 2726.615412] PVR_K:  532: BIF_CAT_BASE_INDEX            : 0x0000000000000000
[ 2726.615415] PVR_K:  532: BIF_CAT_BASE0                 : 0x000000004331B000
[ 2726.615419] PVR_K:  532: BIF_CAT_BASE1                 : 0x0000000000000000
[ 2726.615422] PVR_K:  532: BIF_CAT_BASE2                 : 0x0000000000000000
[ 2726.615426] PVR_K:  532: BIF_CAT_BASE3                 : 0x0000000000000000
[ 2726.615429] PVR_K:  532: BIF_CAT_BASE4                 : 0x0000000000000000
[ 2726.615433] PVR_K:  532: BIF_CAT_BASE5                 : 0x0000000000000000
[ 2726.615436] PVR_K:  532: BIF_CAT_BASE6                 : 0x0000000000000000
[ 2726.615439] PVR_K:  532: BIF_CAT_BASE7                 : 0x0000000000000000
[ 2726.615443] PVR_K:  532: BIF_CTRL_INVAL                : 0x00000000
[ 2726.615446] PVR_K:  532: BIF_CTRL                      : 0x000000C0
[ 2726.615450] PVR_K:  532: BIF_PM_CAT_BASE_VCE0          : 0x0000000000000000
[ 2726.615453] PVR_K:  532: BIF_PM_CAT_BASE_TE0           : 0x0000000000000000
[ 2726.615457] PVR_K:  532: BIF_PM_CAT_BASE_ALIST0        : 0x0000000000000000
[ 2726.615460] PVR_K:  532: BIF_PM_CAT_BASE_VCE1          : 0x0000000000000000
[ 2726.615464] PVR_K:  532: BIF_PM_CAT_BASE_TE1           : 0x0000000000000000
[ 2726.615468] PVR_K:  532: BIF_PM_CAT_BASE_ALIST1        : 0x0000000000000000
[ 2726.615471] PVR_K:  532: PERF_TA_PHASE                 : 0x00000000
[ 2726.615474] PVR_K:  532: PERF_TA_CYCLE                 : 0x00000000
[ 2726.615477] PVR_K:  532: PERF_3D_PHASE                 : 0x00000000
[ 2726.615480] PVR_K:  532: PERF_3D_CYCLE                 : 0x00000000
[ 2726.615484] PVR_K:  532: PERF_TA_OR_3D_CYCLE           : 0x00000000
[ 2726.615487] PVR_K:  532: PERF_TA_AND_3D_CYCLE          : 0x00000000
[ 2726.615490] PVR_K:  532: PERF_COMPUTE_PHASE            : 0x00000000
[ 2726.615493] PVR_K:  532: PERF_COMPUTE_CYCLE            : 0x00000000
[ 2726.615496] PVR_K:  532: PM_PARTIAL_RENDER_ENABLE      : 0x00000000
[ 2726.615499] PVR_K:  532: ISP_RENDER                    : 0x00000000
[ 2726.615503] PVR_K:  532: TLA_STATUS                    : 0x0000000000000000
[ 2726.615506] PVR_K:  532: MCU_FENCE                     : 0x0000000000000000
[ 2726.615509] PVR_K:  532: VDM_CONTEXT_STORE_STATUS      : 0x00000001
[ 2726.615513] PVR_K:  532: VDM_CONTEXT_STORE_TASK0       : 0x0000000000000000
[ 2726.615516] PVR_K:  532: VDM_CONTEXT_STORE_TASK1       : 0x0000000000000000
[ 2726.615520] PVR_K:  532: VDM_CONTEXT_STORE_TASK2       : 0x0000000000000000
[ 2726.615523] PVR_K:  532: VDM_CONTEXT_RESUME_TASK0      : 0x0000000000000000
[ 2726.615527] PVR_K:  532: VDM_CONTEXT_RESUME_TASK1      : 0x0000000000000000
[ 2726.615530] PVR_K:  532: VDM_CONTEXT_RESUME_TASK2      : 0x0000000000000000
[ 2726.615534] PVR_K:  532: ISP_CTL                       : 0x00000000
[ 2726.615537] PVR_K:  532: ISP_STATUS                    : 0x00000000
[ 2726.615540] PVR_K:  532: MTS_INTCTX                    : 0x00000000
[ 2726.615543] PVR_K:  532: MTS_BGCTX                     : 0x00000000
[ 2726.615546] PVR_K:  532: MTS_BGCTX_COUNTED_SCHEDULE    : 0x00000000
[ 2726.615549] PVR_K:  532: MTS_SCHEDULE                  : 0x00000000
[ 2726.615553] PVR_K:  532: MTS_GPU_INT_STATUS            : 0x00000200
[ 2726.615556] PVR_K:  532: CDM_CONTEXT_STORE_STATUS      : 0x00000000
[ 2726.615559] PVR_K:  532: CDM_CONTEXT_PDS0              : 0x0000000000000000
[ 2726.615563] PVR_K:  532: CDM_CONTEXT_PDS1              : 0x0000000000000000
[ 2726.615566] PVR_K:  532: CDM_TERMINATE_PDS             : 0x0000000000000000
[ 2726.615570] PVR_K:  532: CDM_TERMINATE_PDS1            : 0x0000000000000000
[ 2726.615573] PVR_K:  532: SIDEKICK_IDLE                 : 0x0000006A
[ 2726.615576] PVR_K:  532: SLC_IDLE                      : 0x000000FF
[ 2726.615579] PVR_K:  532: SLC_STATUS0                   : 0x00000000
[ 2726.615583] PVR_K:  532: SLC_STATUS1                   : 0x0000000000000000
[ 2726.615586] PVR_K:  532: SLC_CTRL_BYPASS               : 0x00000000
[ 2726.615590] PVR_K:  532: SLC_CTRL_MISC                 : 0x0000000000200001
[ 2726.615594] PVR_K:  532: T0 TXENABLE                   : 0x00000000
[ 2726.615599] PVR_K:  532: T0 TXSTATUS                   : 0x00000000
[ 2726.615603] PVR_K:  532: T0 TXDEFR                     : 0x00000000
[ 2726.616773] PVR_K:(Error):   532: RGXPollMetaRegThroughSP() failed (PVRSRV_ERROR_RETRY) in RGXReadMetaCoreReg() [rgxdebug.c:358]
[ 2726.616780] PVR_K:(Error):   532: RGXReadMetaCoreReg() failed (PVRSRV_ERROR_RETRY) in RGXDumpRGXRegisters() [4752]
[ 2726.616785] PVR_K:(Error):   532: Dump Slave Port debug information [4909]
[ 2726.616788] PVR_K:  532: META Slave Port extra debug:
[ 2726.616792] PVR_K:  532:   * RGX_CR_META_SP_MSLVCTRL0: 0x0480FFF8
[ 2726.616796] PVR_K:  532:   * RGX_CR_META_SP_MSLVCTRL1: 0x07001000
[ 2726.616799] PVR_K:  532:   * RGX_CR_META_SP_MSLVDATAX: 0x00000000
[ 2726.616803] PVR_K:  532:   * RGX_CR_META_SP_MSLVIRQSTATUS: 0x00000000
[ 2726.616806] PVR_K:  532:   * RGX_CR_META_SP_MSLVIRQENABLE: 0x00000000
[ 2726.616809] PVR_K:  532:   * RGX_CR_META_SP_MSLVIRQLEVEL: 0x00000000
[ 2726.616813] PVR_K:  532:   * 0xA20[0]: 0x01002100
[ 2726.616817] PVR_K:  532:   * 0xA20[1]: 0x8F000E04
[ 2726.616820] PVR_K:  532:   * 0xA20[2]: 0x0160121F
[ 2726.616824] PVR_K:  532:   * 0xA20[3]: 0x8F000E04
[ 2726.616827] PVR_K:  532:   * 0xA28[0]: 0x00020000
[ 2726.616831] PVR_K:  532:   * 0xA28[1]: 0x00000000
[ 2726.616834] PVR_K:  532:   * 0xA30[0]: 0x00000055
[ 2726.616838] PVR_K:  532:   * 0xA30[1]: 0x00300000
[ 2726.616841] PVR_K:  532:   * 0xA38[0]: 0x01000000
[ 2726.616844] PVR_K:  532:   * 0xA38[1]: 0x00001000
[ 2726.616853] PVR_K:(Warn):    532: PVRSRVSetDevicePowerStateKM: Transition to 1 FAILED (PVRSRV_ERROR_TIMEOUT) [power.c:494]
[ 2726.616860] PVR_K:(Error):   532: PVRSRVDeviceFinalise: Failed to set device 0000000048891863 power state to 'on' (PVRSRV_ERROR_TIMEOUT) [pvrsrv.c:2823]
[ 2726.616866] PVR_K:(Error):   532: PVRSRVDeviceInitialise: Services failed to finalise the device (PVRSRV_ERROR_TIMEOUT) [2250]
[ 2726.616911] PVR_K:(Error):   532: PVRSRVCommonDeviceOpen: Failed to initialise device (PVRSRV_ERROR_TIMEOUT) [module_common.c:456]

At the top it says that "BIF1" Faulted, I assume it's some sort of register. It also shows the MMU satus as 1, whereas at the end during the dump it's shown that the MMU status for BIF0 which has not faulted is 0.

There's also the request status : 0x00049300B81C4450. I think it can be usefull, but I have no idea what it could mean.

Do you have other firmware versions besides the one you sent me ?

hexdump0815 commented 2 years ago

i just checked my notes and i did not run across anything else ... if one throws the filename of the .run archive file into google then it seems to bring up some chrome-something mirror site, which seems to have a few older versions of it as well - i so far never saw anything newer anywhere yet ... maybe its possible to find a newer email address of enric? i think he is most probably the only person who had it working on mainline so far ...

hexdump0815 commented 2 years ago

i just saw that enric is listed in the maintainers file of the linux kernel - did you mail him at the address given in there?

hexdump0815 commented 2 years ago

i saw from your dmesg that you seem to use the v5.15 tree and on irc he said that he has it working on v5.14 - so maybe its worth to give the v5.14 tree a try? maybe something changed inbetween which broke the pvr support? (just an idea)

hexdump0815 commented 2 years ago

a last wild guess (i'm not really a kernel expert, so its just pure guessing): the gpu seems to be powered by the da9211_vgpu regulator - it might be worth a try to set that regulator (or maybe even any regulator with vgpu in it) to "regulator-always-on" in the dts? or maybe watching out for log lines regarding those regulators in dmesg?

LelouBil commented 2 years ago

I emailed him a week ago and I have no answers for now, I'm going to try with kernel 5.14, but I also found that imaginationtech has an Android 11 image available, with the kernel module for 4.4.

hexdump0815 commented 2 years ago

thanks a lot for the update ... lets hope that there is any way to get this working somehow in the end

LelouBil commented 2 years ago

No news still for Enric, but I contacted Imagination Technologies about the driver, and they told me they do not distribute drivers directly, and I have to contact the manufacturer of the SOC. In the meantime I will try using kernel 4.4 with the android drivers.

hexdump0815 commented 2 years ago

looks like there are some good news (besides all the bad ones nowadays) ... https://www.phoronix.com/scan.php?page=news_item&px=Open-Source-PowerVR-Vulkan

LelouBil commented 2 years ago

Wow, that's great ! It's exactly what is needed, a mesa driver and a new kernel driver !

However, the mesa driver currently is in very early phase and not really usable. For now, I'll hold off from doing any porting of the old stuff, however I don't know when the new driver would be in “working” condition.

hexdump0815 commented 2 years ago

sure, it will take a while until its useable - but its definitely at least something to look forward to :) ... at least a few people are working on it, so maybe there is some initial useable version later rhis year

hexdump0815 commented 2 years ago

in case you would like to give your current efforts a last try (as you seem to be so close) - it might be worth to have a look if you have this in your kernel: https://gitlab.freedesktop.org/frankbinns/powervr/-/commit/fe53d8b378ac62f70712a9869bd25f8b3935d62f - it sounds a bit like it could be the cause of the problems you saw that the gpu is not powered up properly - might definitely be worth a try and should be a quick test i guess ...

update: i just looked at your tree and it looks like you already have most of this in ...

nvidialinuxuser commented 7 months ago

If any efforts with getting the blobs to work is successful, it'll likely be on Wayland only as to my knowledge, in recent times have PowerVR blobs been Wayland-only. The ChromeOS PowerVR blobs are Wayland-only and chances are they won't work either as from what I understand, these blobs similar to the ARM NVIDIA and Mali blobs that are shipped in ChromeOS, a regular GBM userspace driver does not exist, but rather Google's own MiniGBM? or something.

hexdump0815 commented 7 months ago

i would say the current plan is to wait until the just merged img support in the mainline kernel and mesa will hopefully also support the oak devices at some point and use that then - so far i think the mainline stuff only supports some ti sbc, but i hope that more supported devices will come with time ... also that mainline effort is focussing on vulkan only and the idea is to provide opengl/gles via zink on top of that then

nvidialinuxuser commented 7 months ago

Last I checked, mainline supports this hardware now with the open source PowerVR kernel driver or if not, it's about to be. You may want to check that just to be sure. I know that the user space stuff is already in Mesa. I'm not the most experienced with Xorg setups and whatnot, but I'm going to assume that if it works on Xorg, it'll need Glamour enabled and definitely using Zinc as there are no plans for the driver to support anything apart from Vulkan officially and the stated goal for that driver is to have it work with Vulkan and have OpenGL capability by using Zinc. I'm going to assume that Wayland will work fine and I wouldn't be surprised if that's what is being primarily targeted due to how it's becoming more popular, the fact that the current PowerVR blobs you'll find are Wayland-only as well, and of course the fact that this GPU is most likely a 3D-only GPU just like many other ARM GPUs (which is best supported under Wayland).