Mesa (master): llvmpipe: hook draw disk cache up

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Jun 10 22:26:13 UTC 2020


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

Author: Dave Airlie <airlied at redhat.com>
Date:   Wed May 13 13:37:19 2020 +1000

llvmpipe: hook draw disk cache up

Connect the draw callbacks into the llvmpipe code.

Reviewed-by: Roland Scheidegger <sroland at vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5049>

---

 src/gallium/drivers/llvmpipe/lp_context.c | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/llvmpipe/lp_context.c b/src/gallium/drivers/llvmpipe/lp_context.c
index f11d5207a7a..58073f3a7f6 100644
--- a/src/gallium/drivers/llvmpipe/lp_context.c
+++ b/src/gallium/drivers/llvmpipe/lp_context.c
@@ -46,7 +46,7 @@
 #include "lp_surface.h"
 #include "lp_query.h"
 #include "lp_setup.h"
-
+#include "lp_screen.h"
 /* This is only safe if there's just one concurrent context */
 #ifdef EMBEDDED_DEVICE
 #define USE_GLOBAL_LLVM_CONTEXT
@@ -137,6 +137,22 @@ llvmpipe_texture_barrier(struct pipe_context *pipe, unsigned flags)
    llvmpipe_flush(pipe, NULL, __FUNCTION__);
 }
 
+static void lp_draw_disk_cache_find_shader(void *cookie,
+                                           struct lp_cached_code *cache,
+                                           unsigned char ir_sha1_cache_key[20])
+{
+   struct llvmpipe_screen *screen = cookie;
+   lp_disk_cache_find_shader(screen, cache, ir_sha1_cache_key);
+}
+
+static void lp_draw_disk_cache_insert_shader(void *cookie,
+                                             struct lp_cached_code *cache,
+                                             unsigned char ir_sha1_cache_key[20])
+{
+   struct llvmpipe_screen *screen = cookie;
+   lp_disk_cache_insert_shader(screen, cache, ir_sha1_cache_key);
+}
+
 struct pipe_context *
 llvmpipe_create_context(struct pipe_screen *screen, void *priv,
                         unsigned flags)
@@ -202,6 +218,10 @@ llvmpipe_create_context(struct pipe_screen *screen, void *priv,
    if (!llvmpipe->draw)
       goto fail;
 
+   draw_set_disk_cache_callbacks(llvmpipe->draw,
+                                 llvmpipe_screen(screen),
+                                 lp_draw_disk_cache_find_shader,
+                                 lp_draw_disk_cache_insert_shader);
    /* FIXME: devise alternative to draw_texture_samplers */
 
    llvmpipe->setup = lp_setup_create( &llvmpipe->pipe,



More information about the mesa-commit mailing list