So, many places will give you clues how to get linear depth from the OpenGL depth buffer, or visualise it, or other things. This, however, is what I believe to be the definitive answer:
This link http://www.songho.ca/opengl/gl_projectionmatrix.html gives a good run-down of the projection matrix, and the link between eye-space Z (z_e
below) and normalised device coordinates (NDC) Z (z_n
below). From there, we have
A = -(zFar + zNear) / (zFar - zNear);
B = -2zFarzNear / (zFar - zNear);