It is based on the vc4 clip plane lowering implementation, and follows the same method as the mali driver.
Mesa does have some built-in partial handling for clip planes in st_program, but to correctly handle enabling and disabling clip planes during runtime, clip plane lowering must be implemented in the backend too.
For the vertex shader in lima, the
load_user_clip_plane intrinsic must be
nir_lower_viewport_transform. Otherwise, it uses the
transformed position which is not what is expected while calculating
clip plane coordinates. This is what took me longer to figure out.