mesa/readpix: Clip ReadPixels() area to the ReadBuffer's
mesa/readpix: Clip ReadPixels() area to the ReadBuffer's

The fast path for Intel's ReadPixels() unintentionally omits clipping
the specified area to a valid one. Rather than clip in various
corner-cases, perform this operation in the API validation stage.

The bug in intel_readpixels_tiled_memcpy() showed itself when the winsys
ReadBuffer's height was smaller than the one specified by ReadPixels().
yoffset became negative, which was an invalid input for tiled_to_linear().

v2: Move clipping to validation stage (Jason)

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92193
Reported-by: Marta Löfstedt <d284b1e5d144aa8ffd9d3937a966cb84599af26e@intel.com>
Cc: "11.0 11.1" <59f39c0db42d4479a46b02d4d2bc11120e37bb44@lists.freedesktop.org>
Signed-off-by: Nanley Chery <d78cd5d33e98a5581566f188959f731bd0b1c0fd@intel.com>
Reviewed-by: Ian Romanick <2b237cafb16dc45038e85df6c85e74e6d899eba9@intel.com>
Reviewed-by: Brian Paul <3cb4e1df5ec4da2c7c4af7c52cec8cf340a55a10@vmware.com>

metora/MesaGLSLCompiler,metora/MesaGLSLCompiler,metora/MesaGLSLCompiler