My question is: Will the driver perform the (my_projection_mat * my_modelview_mat) calculation for every vertex? Or it will understand that this calculation needs to be done only once?
I think, just to be on the safe side it would be better if you did it yourself and pass it on to the shader. Some compilers might optimize it away but you can’t be too sure.
I would also err on the side of caution and provide my_modelviewprojection_mat. Otherwise, this optimization could be tricky for the compiler. Since “my_projection_mat * my_modelview_mat” is computed independently for each vertex, wouldn’t the compiler have to replace your two uniforms with a single uniform? Then it would need to pretend that both of your uniforms still exist and when you modify one, it would compute the final matrix on the CPU. I don’t know enough about GLSL compilers to say if something like this is common. I kind of doubt it. But I’d be curious to know.