mesa/readpix: Clip ReadPixels() area to the ReadBuffer's
authorNanley Chery <nanley.g.chery@intel.com>
Sat, 6 Feb 2016 00:21:33 +0000 (16:21 -0800)
committerNanley Chery <nanley.g.chery@intel.com>
Tue, 9 Feb 2016 23:13:07 +0000 (15:13 -0800)
commit605832736a6d9427ad894d403cceeb74a5b18dc1
tree82eef6c48ec62dc165d3dc843007fc3dcc6e58e8
parent55d56d34e0535baa2c7e1e1d8f1be11593a07fa8
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 <marta.lofstedt@intel.com>
Cc: "11.0 11.1" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Nanley Chery <nanley.g.chery@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
src/mesa/main/readpix.c