[Mesa-dev] [PATCH 2/3] radeonsi: Use util_memcpy_cpu_to_le32()
Marek Olšák
maraeo at gmail.com
Fri Jul 18 17:59:24 PDT 2014
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Marek
On Fri, Jul 18, 2014 at 9:10 PM, Tom Stellard <thomas.stellard at amd.com> wrote:
> ---
> src/gallium/drivers/radeonsi/si_descriptors.c | 4 +---
> src/gallium/drivers/radeonsi/si_shader.c | 8 +-------
> 2 files changed, 2 insertions(+), 10 deletions(-)
>
> diff --git a/src/gallium/drivers/radeonsi/si_descriptors.c b/src/gallium/drivers/radeonsi/si_descriptors.c
> index 38ad077..41c1b67 100644
> --- a/src/gallium/drivers/radeonsi/si_descriptors.c
> +++ b/src/gallium/drivers/radeonsi/si_descriptors.c
> @@ -451,9 +451,7 @@ void si_upload_const_buffer(struct si_context *sctx, struct r600_resource **rbuf
> return;
> }
>
> - for (i = 0; i < size / 4; ++i) {
> - tmpPtr[i] = util_cpu_to_le32(((uint32_t *)ptr)[i]);
> - }
> + util_memcpy_cpu_to_le32(tmpPtr, ptr, size);
>
> u_upload_data(sctx->b.uploader, 0, size, tmpPtr, const_offset,
> (struct pipe_resource**)rbuffer);
> diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c
> index f0650f4..8593bca 100644
> --- a/src/gallium/drivers/radeonsi/si_shader.c
> +++ b/src/gallium/drivers/radeonsi/si_shader.c
> @@ -2559,13 +2559,7 @@ int si_compile_llvm(struct si_context *sctx, struct si_pipe_shader *shader,
> }
>
> ptr = (uint32_t*)sctx->b.ws->buffer_map(shader->bo->cs_buf, sctx->b.rings.gfx.cs, PIPE_TRANSFER_WRITE);
> - if (SI_BIG_ENDIAN) {
> - for (i = 0; i < binary.code_size / 4; ++i) {
> - ptr[i] = util_cpu_to_le32((*(uint32_t*)(binary.code + i*4)));
> - }
> - } else {
> - memcpy(ptr, binary.code, binary.code_size);
> - }
> + util_memcpy_cpu_to_le32(ptr, binary.code, binary.code_size);
> sctx->b.ws->buffer_unmap(shader->bo->cs_buf);
>
> free(binary.code);
> --
> 1.8.1.5
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list