Mesa (main): gallium: add pipe_screen::is_compute_copy_faster hook

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Nov 18 13:35:18 UTC 2021


Module: Mesa
Branch: main
Commit: 0b30a7a243be8fe44d34b1bc2bd58665618074dd
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=0b30a7a243be8fe44d34b1bc2bd58665618074dd

Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date:   Mon Nov  8 12:30:26 2021 -0500

gallium: add pipe_screen::is_compute_copy_faster hook

this can be used to query whether a driver expects a given texture
copy to be faster as a compute shader or using cpu/gfx transfers

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer at amd.com>
Acked-by: Marek Olšák <marek.olsak at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11984>

---

 src/gallium/include/pipe/p_screen.h | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/src/gallium/include/pipe/p_screen.h b/src/gallium/include/pipe/p_screen.h
index bb0b53764ed..904c7ba03a0 100644
--- a/src/gallium/include/pipe/p_screen.h
+++ b/src/gallium/include/pipe/p_screen.h
@@ -179,6 +179,19 @@ struct pipe_screen {
    struct pipe_context * (*context_create)(struct pipe_screen *screen,
 					   void *priv, unsigned flags);
 
+   /**
+    * Check if the given image copy will be faster on compute
+    * \param cpu If true, this is checking against CPU fallback,
+    *            otherwise the copy will be on GFX
+    */
+   bool (*is_compute_copy_faster)( struct pipe_screen *,
+                                   enum pipe_format src_format,
+                                   enum pipe_format dst_format,
+                                   unsigned width,
+                                   unsigned height,
+                                   unsigned depth,
+                                   bool cpu );
+
    /**
     * Check if the given pipe_format is supported as a texture or
     * drawing surface.



More information about the mesa-commit mailing list