Module: Mesa
Branch: master
Commit: dac1573a3586565b8b78bd6aab3664921cc1adb1
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=dac1573a3586565b8b78bd6aab3664921cc1adb1

Author: Icecream95 <[email protected]>
Date:   Wed Mar 25 20:01:08 2020 +1300

mesa/format_utils: Add a fast-path for RGBA to BGRA

This is similar to an existing fast-path, but this is for an array
source while the existing one is for an array destination.

Firefox can hit this case for WebGL when GL compositing is not used.
For a WebGL sample on the Panfrost driver, the frame-rate increased
from 19.4 fps to 20.6 fps, which is a 6% gain.

Reviewed-by: Marek Olšák <[email protected]>
Reviewed-by: Alyssa Rosenzweig <[email protected]>
Tested-by: Marge Bot 
<https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4315>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4315>

---

 src/mesa/main/format_utils.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/mesa/main/format_utils.c b/src/mesa/main/format_utils.c
index 2bdb77c34fc..732e2424cbb 100644
--- a/src/mesa/main/format_utils.c
+++ b/src/mesa/main/format_utils.c
@@ -36,6 +36,10 @@ const mesa_array_format RGBA8_UBYTE =
    MESA_ARRAY_FORMAT(MESA_ARRAY_FORMAT_BASE_FORMAT_RGBA_VARIANTS,
                      1, 0, 0, 1, 4, 0, 1, 2, 3);
 
+const mesa_array_format BGRA8_UBYTE =
+   MESA_ARRAY_FORMAT(MESA_ARRAY_FORMAT_BASE_FORMAT_RGBA_VARIANTS,
+                     1, 0, 0, 1, 4, 2, 1, 0, 3);
+
 const mesa_array_format RGBA32_UINT =
    MESA_ARRAY_FORMAT(MESA_ARRAY_FORMAT_BASE_FORMAT_RGBA_VARIANTS,
                      4, 0, 0, 0, 4, 0, 1, 2, 3);
@@ -350,6 +354,11 @@ _mesa_format_convert(void *void_dst, uint32_t dst_format, 
size_t dst_stride,
                dst += dst_stride;
             }
             return;
+         } else if (dst_array_format == BGRA8_UBYTE &&
+                    src_format == MESA_FORMAT_R8G8B8A8_UNORM) {
+             convert_ubyte_rgba_to_bgra(width, height, src, src_stride,
+                                        dst, dst_stride);
+             return;
          } else if (dst_array_format == RGBA32_UINT &&
                     _mesa_is_format_unsigned(src_format)) {
             assert(_mesa_is_format_integer_color(src_format));

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to