[Mesa-dev] [RFC PATCH 2/2] main/format: skip format conversion if src and dst format are equal
Jason Ekstrand
jason at jlekstrand.net
Mon Aug 28 15:06:54 UTC 2017
On Wed, Aug 16, 2017 at 11:32 AM, Karol Herbst <karolherbst at gmail.com>
wrote:
> Fixes 'KHR-GL45.copy_image.functional' on Nouveau
>
> Signed-off-by: Karol Herbst <karolherbst at gmail.com>
> ---
> src/mesa/main/format_utils.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/src/mesa/main/format_utils.c b/src/mesa/main/format_utils.c
> index d16d69c379..a3ddaebb2e 100644
> --- a/src/mesa/main/format_utils.c
> +++ b/src/mesa/main/format_utils.c
> @@ -485,7 +485,11 @@ _mesa_format_convert(void *void_dst, uint32_t
> dst_format, size_t dst_stride,
>
> assert(src_integer == dst_integer);
>
> - if (src_integer && dst_integer) {
> + /* do a simply memcpy if applicable */
> + if (dst_format == src_format && dst_stride == src_stride &&
> + !dst_format_is_mesa_array_format && !rebase_swizzle) {
> + memcpy(dst, src, src_stride * height);
> + } else if (src_integer && dst_integer) {
>
I think this is the right thing to do in general but I think the code
belongs in a different place. In particular, At the top of the first "if
(!rebase_swizzle) {", we want something like
if ((dst_format_is_mesa_array_format &&
src_format_is_mesa_array_format &&
src_array_format == dst_array_format) ||
src_format == dst_format) {
for (row = 0; row < height; row++) {
memcpy(dst, src, width * format_size);
src += src_stride;
dst += dst_stride;
}
return;
}
> tmp_uint = malloc(width * height * sizeof(*tmp_uint));
>
> /* The [un]packing functions for unsigned datatypes treat the 32-bit
> --
> 2.14.1
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20170828/57973b80/attachment.html>
More information about the mesa-dev
mailing list