window-top-line

window-top-line is a built-in function in `C source code'.

(window-top-line &optional WINDOW)

Return top line of window WINDOW.
This is the distance, in lines, between the top of WINDOW and the top
of the frame's window area. For instance, the return value is 0 if
there is no window above WINDOW.

WINDOW must be a valid window and defaults to the selected one.