raspberrypi / userland

Source code for ARM side libraries for interfacing to Raspberry Pi GPU.
BSD 3-Clause "New" or "Revised" License
2.05k stars 1.09k forks source link

vcsm_lock_cache not implemented for /dev/vcsm-cma #720

Open cratonica opened 2 years ago

cratonica commented 2 years ago

Describe the bug Calling vcsm_lock_cache on a system without /dev/vcsm (the legacy driver), which therefore uses /dev/vcsm-cma fails to lock shared CPU/GPU memory and prints out:

usrvcsm: [vcsm_lock_cache]: IMPLEMENT ME

This message originates from https://github.com/raspberrypi/userland/blob/master/host_applications/linux/libs/sm/user-vcsm.c#L1463

To reproduce Run a program that attempts to make this call using the noted system configuration. I compiled userland at HEAD this morning.

Expected behaviour It should lock the memory and allow me to access it from the CPU as it does with /dev/vcsm

Actual behaviour It fails saying it is unimplemented

System Copy and paste the results of the raspinfo command in to this section. Alternatively, copy and paste a pastebin link, or add answers to the following questions:

Jan 20 2022 13:59:16 Copyright (c) 2012 Broadcom version bd88f66f8952d34e4e0613a85c7a6d3da49e13e2 (clean) (release) (start_x)

Logs If applicable, add the relevant output from dmesg or similar.

Additional context Add any other relevant context for the problem.

6by9 commented 2 years ago

The vcsm-cma kernel driver doesn't support changing the caching mode, hence the comment. IIRC all mappings are uncached.

The simplest answer is to make it call vcsm_lock, and return a fixed result in cache_result.