From 71df0993664736e2ae1dc549d1a6a6d7854ce709 Mon Sep 17 00:00:00 2001 From: Neil Roberts Date: Sat, 25 Feb 2012 21:55:38 +0000 Subject: [PATCH] intel_read_pixel: Accept alignments that are equivalent to 1 When deciding whether to use the blitter to implement the read pixels, it had a restriction that pack->Alignment must be 1. However it should at least be possible to accept alignments that are equivalent to 1. For example, if the rowLength is 4 for an image with 4 cpp then the rowstride is a multiple of 8 so none of the alignment values will affect the rowstride and they are all equivalent. --- src/mesa/drivers/dri/intel/intel_pixel_read.c | 16 +++++++++++----- 1 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/mesa/drivers/dri/intel/intel_pixel_read.c b/src/mesa/drivers/dri/intel/intel_pixel_read.c index 34fed3d..68ccc60 100644 --- a/src/mesa/drivers/dri/intel/intel_pixel_read.c +++ b/src/mesa/drivers/dri/intel/intel_pixel_read.c @@ -101,16 +101,22 @@ do_blit_readpixels(struct gl_context * ctx, return false; } - if (pack->Alignment != 1 || pack->SwapBytes || pack->LsbFirst) { - DBG("%s: bad packing params\n", __FUNCTION__); - return false; - } - if (pack->RowLength > 0) rowLength = pack->RowLength; else rowLength = width; + /* Check that src->cpp * rowLength is a multiple of the alignment */ + if ((src->cpp * rowLength) & (pack->Alignment - 1)) { + DBG("%s: bad alignment\n", __FUNCTION__); + return false; + } + + if (pack->SwapBytes || pack->LsbFirst) { + DBG("%s: bad packing params\n", __FUNCTION__); + return false; + } + if (pack->Invert) { DBG("%s: MESA_PACK_INVERT not done yet\n", __FUNCTION__); return false; -- 1.7.3.16.g9464b