[virglrenderer-devel] [PATCH] vrend: correct the stride if the client sends it
Erik Faye-Lund
erik.faye-lund at collabora.com
Fri Jul 27 06:55:41 UTC 2018
On 26. juli 2018 18:57, Gert Wollny wrote:
> If the client sends vrend_transfer_send_readpixels a stride (and vtest does),
> then it is in bytes, but glPixelStorei(GL_PACK_ROW_LENGTH, stride) expects
> the value to be pixels.
>
> Fixes:
> 42e2a4ca7da4604beb377e181aa6b20abf4445e
> vrend: use the row-stride when directly reading back to an IOV
> Signed-off-by: Gert Wollny <gert.wollny at collabora.com>
> ---
> src/vrend_renderer.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c
> index 6536dd8..4bf22ba 100644
> --- a/src/vrend_renderer.c
> +++ b/src/vrend_renderer.c
> @@ -5912,7 +5912,7 @@ static int vrend_transfer_send_readpixels(struct vrend_context *ctx,
> uint32_t h = u_minify(res->base.height0, info->level);
> int elsize = util_format_get_blocksize(res->base.format);
> float depth_scale;
> - int row_stride = info->stride;
> + int row_stride = info->stride / elsize;
>
Just dividing rounds down by default unless info->stride is aligned to
elsize. Is the latter the case? If so, perhaps add
assert(info->stride % elsize == 0);
...to make that assumption clear?
More information about the virglrenderer-devel
mailing list