mesa: Fix const correctness of API implementation functions.