diff options
author | Tomeu Vizoso <tomeu.vizoso@collabora.com> | 2019-05-08 08:59:30 +0200 |
---|---|---|
committer | Juan A. Suarez Romero <jasuarez@igalia.com> | 2019-05-10 17:04:58 +0000 |
commit | f8ec40e28b78a775cc048eb466f261fed56f1600 (patch) | |
tree | ede5e76bac3af8bbba369658142962be2aacc34c | |
parent | 5e75803339ab2b2141b059db7021f94736bb9283 (diff) |
panfrost: Only take the fast paths on buffers aligned to block size
As the functions operate on 16-byte blocks.
Fixes this Valgrind error:
Invalid read of size 4
at 0x5857568: swizzle_bpp1_align16 (pan_swizzle.c:85)
by 0x585780F: panfrost_texture_swizzle (pan_swizzle.c:171)
by 0x584F587: panfrost_tile_texture (pan_resource.c:489)
by 0x584F641: panfrost_transfer_unmap (pan_resource.c:525)
by 0x587718D: u_transfer_helper_transfer_unmap (u_transfer_helper.c:516)
by 0x5875D85: pipe_transfer_unmap (u_inlines.h:515)
by 0x5875F13: u_default_texture_subdata (u_transfer.c:80)
by 0x53FFDC3: st_TexSubImage (st_cb_texture.c:1480)
by 0x54005BB: st_TexImage (st_cb_texture.c:1709)
by 0x5391353: teximage (teximage.c:3105)
by 0x5391353: teximage_err (teximage.c:3132)
by 0x5391B9B: _mesa_TexImage2D (teximage.c:3170)
by 0x5097A77: shared_dispatch_stub_183 (glapi_mapi_tmp.h:18833)
Address 0x1e94f1e8 is 0 bytes after a block of size 16 alloc'd
at 0x483F5C8: malloc (vg_replace_malloc.c:299)
by 0x584F47D: panfrost_transfer_map (pan_resource.c:467)
by 0x587694D: u_transfer_helper_transfer_map (u_transfer_helper.c:243)
by 0x5875EA7: u_default_texture_subdata (u_transfer.c:59)
by 0x53FFDC3: st_TexSubImage (st_cb_texture.c:1480)
by 0x54005BB: st_TexImage (st_cb_texture.c:1709)
by 0x5391353: teximage (teximage.c:3105)
by 0x5391353: teximage_err (teximage.c:3132)
by 0x5391B9B: _mesa_TexImage2D (teximage.c:3170)
by 0x5097A77: shared_dispatch_stub_183 (glapi_mapi_tmp.h:18833)
by 0x4DA8AB: glu::CallLogWrapper::glTexImage2D(unsigned int, int, int, int, int, int, unsigned int, unsigned int, void const*) (in /home/tomeu/deqp-build/modules/gles2/deqp-gles2)
Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Cc: 19.1 <mesa-stable@lists.freedesktop.org>
(cherry picked from commit c3538ab5702ceeead284c2b5f9e700f3082c8135)
-rw-r--r-- | src/gallium/drivers/panfrost/pan_swizzle.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/gallium/drivers/panfrost/pan_swizzle.c b/src/gallium/drivers/panfrost/pan_swizzle.c index 52a907ddd55..60f6953443f 100644 --- a/src/gallium/drivers/panfrost/pan_swizzle.c +++ b/src/gallium/drivers/panfrost/pan_swizzle.c @@ -164,10 +164,10 @@ panfrost_texture_swizzle(unsigned off_x, /* Use fast path if available */ if (!(off_x || off_y) && (width == dest_width)) { - if (bytes_per_pixel == 4 /* && (ALIGN(width, 16) == width) */) { + if (bytes_per_pixel == 4 && (ALIGN(width, 16) == width)) { swizzle_bpp4_align16(width, height, source_stride >> 2, (block_pitch * 256 >> 4), (const uint32_t *) pixels, (uint32_t *) ldest); return; - } else if (bytes_per_pixel == 1 /* && (ALIGN(width, 16) == width) */) { + } else if (bytes_per_pixel == 1 && (ALIGN(width, 16) == width)) { swizzle_bpp1_align16(width, height, source_stride, (block_pitch * 256 >> 4), pixels, (uint8_t *) ldest); return; } |