Fix glReadPixels when row length != 0

Fixes: 79208762

The pipe encoder assumes the user in the guest side has allocated all
the client memory for glReadPixels including the padding between image
rows (the total pitch determined by GL_PACK_ROW_LENGTH), but that is not
necessarily the case; the guest can have allocated fewer bytes than the
row length would suggest.

This can cause memory corruption.

This CL detects the case when GL_PACK_ROW_LENGTH != 0 and there is a
client buffer for glReadPixels, in which case it takes the pipe buffer
and only writes the pixels, row by row, to the client buffer, discarding
the padding.

this cl does not impact real devices

Change-Id: I6fde6677897f2717c7ac05bc349225ea1e02243e
Merged-In: I6fde6677897f2717c7ac05bc349225ea1e02243e
(cherry picked from commit 372c425bd2d1d67eced350383e6369bca1530b4e)
8 files changed
tree: 7702658bc251d61c377ca798ced6cb3125044b8f
  1. host/
  2. shared/
  3. system/
  4. tests/
  5. Android.mk
  6. common.mk
  7. README