<div dir="auto">You might also just create the cache unconditionally in screen_create.<div dir="auto"><br></div><div dir="auto">Marek</div><div dir="auto"><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Feb 10, 2017 12:58 PM, "Timothy Arceri" <<a href="mailto:tarceri@itsqueeze.com">tarceri@itsqueeze.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
<br>
On 10/02/17 22:25, Marek Olšák wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I don't see anything radeonsi-specific here. Is there any reason this<br>
has to be in radeonsi?<br>
</blockquote>
<br>
disk_cache_create(r600_get_chi<wbr>p_name(rscreen), mesa_version);<br>
<br>
Is the only AMD specific bit. I did have just have a generic get_gpu_name() function at one point. But I went around in cycles a bit deciding if that was ok. I can have another go at making this more generic.<br>
<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Also, all pipe_screen functions must be thread-safe, so a mutex around<br>
checking and setting disk_shader_cache should be used.<br>
</blockquote>
I was wondering about that thanks :)<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
if _mesa_create_cache_version_str<wbr>ing was in src/util, you wouldn't<br>
have to pass it via the parameter.I'm going to sent a new version<br>
</blockquote>
I'm going to send a new version next week based around [1] rather than mesa string.<br>
<br>
[1] <a href="https://lists.freedesktop.org/archives/mesa-dev/2017-February/143791.html" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>archives/mesa-dev/2017-Februar<wbr>y/143791.html</a><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Marek<br>
<br>
On Tue, Feb 7, 2017 at 4:42 AM, Timothy Arceri <<a href="mailto:tarceri@itsqueeze.com" target="_blank">tarceri@itsqueeze.com</a>> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
---<br>
src/gallium/drivers/radeon/r60<wbr>0_pipe_common.c | 17 +++++++++++++++++<br>
src/gallium/drivers/radeon/r60<wbr>0_pipe_common.h | 2 ++<br>
src/gallium/include/pipe/p_scr<wbr>een.h | 3 +++<br>
src/mesa/state_tracker/st_cont<wbr>ext.c | 6 ++++++<br>
4 files changed, 28 insertions(+)<br>
<br>
diff --git a/src/gallium/drivers/radeon/r<wbr>600_pipe_common.c b/src/gallium/drivers/radeon/r<wbr>600_pipe_common.c<br>
index 95a6a48..d7d5362 100644<br>
--- a/src/gallium/drivers/radeon/r<wbr>600_pipe_common.c<br>
+++ b/src/gallium/drivers/radeon/r<wbr>600_pipe_common.c<br>
@@ -27,6 +27,7 @@<br>
#include "r600_pipe_common.h"<br>
#include "r600_cs.h"<br>
#include "tgsi/tgsi_parse.h"<br>
+#include "util/disk_cache.h"<br>
#include "util/list.h"<br>
#include "util/u_draw_quad.h"<br>
#include "util/u_memory.h"<br>
@@ -772,6 +773,20 @@ static const char* r600_get_chip_name(struct r600_common_screen *rscreen)<br>
}<br>
}<br>
<br>
+static struct disk_cache* r600_create_disk_cache(struct pipe_screen *pscreen,<br>
+ const char *mesa_version)<br>
+{<br>
+ struct r600_common_screen *rscreen = (struct r600_common_screen*)pscreen;<br>
+<br>
+ if (rscreen->disk_shader_cache)<br>
+ return rscreen->disk_shader_cache;<br>
+<br>
+ struct disk_cache *cache = disk_cache_create(r600_get_chi<wbr>p_name(rscreen), mesa_version);<br>
+ rscreen->disk_shader_cache = cache;<br>
+<br>
+ return rscreen->disk_shader_cache;<br>
+}<br>
+<br>
static const char* r600_get_name(struct pipe_screen* pscreen)<br>
{<br>
struct r600_common_screen *rscreen = (struct r600_common_screen*)pscreen;<br>
@@ -1224,6 +1239,7 @@ bool r600_common_screen_init(struct r600_common_screen *rscreen,<br>
rscreen->info.drm_minor, rscreen->info.drm_patchlevel,<br>
kernel_version, llvm_string);<br>
<br>
+ rscreen->b.create_disk_cache = r600_create_disk_cache;<br>
rscreen->b.get_name = r600_get_name;<br>
rscreen->b.get_vendor = r600_get_vendor;<br>
rscreen->b.get_device_vendor = r600_get_device_vendor;<br>
@@ -1314,6 +1330,7 @@ void r600_destroy_common_screen(str<wbr>uct r600_common_screen *rscreen)<br>
pipe_mutex_destroy(rscreen->g<wbr>pu_load_mutex);<br>
pipe_mutex_destroy(rscreen->a<wbr>ux_context_lock);<br>
rscreen->aux_context-><wbr>destroy(rscreen->aux_context);<br>
+ disk_cache_destroy(rscreen->d<wbr>isk_shader_cache);<br>
<br>
slab_destroy_parent(&rscreen-<wbr>>pool_transfers);<br>
<br>
diff --git a/src/gallium/drivers/radeon/r<wbr>600_pipe_common.h b/src/gallium/drivers/radeon/r<wbr>600_pipe_common.h<br>
index 6eff9aa..72c2df9 100644<br>
--- a/src/gallium/drivers/radeon/r<wbr>600_pipe_common.h<br>
+++ b/src/gallium/drivers/radeon/r<wbr>600_pipe_common.h<br>
@@ -400,6 +400,8 @@ struct r600_common_screen {<br>
bool has_cp_dma;<br>
bool has_streamout;<br>
<br>
+ struct disk_cache *disk_shader_cache;<br>
+<br>
struct slab_parent_pool pool_transfers;<br>
<br>
/* Texture filter settings. */<br>
diff --git a/src/gallium/include/pipe/p_s<wbr>creen.h b/src/gallium/include/pipe/p_s<wbr>creen.h<br>
index b6203f1..90f6c93 100644<br>
--- a/src/gallium/include/pipe/p_s<wbr>creen.h<br>
+++ b/src/gallium/include/pipe/p_s<wbr>creen.h<br>
@@ -318,6 +318,9 @@ struct pipe_screen {<br>
const void *(*get_compiler_options)(struc<wbr>t pipe_screen *screen,<br>
enum pipe_shader_ir ir,<br>
unsigned shader);<br>
+<br>
+ struct disk_cache *(*create_disk_cache)(struct pipe_screen *screen,<br>
+ const char *mesa_version);<br>
};<br>
<br>
<br>
diff --git a/src/mesa/state_tracker/st_co<wbr>ntext.c b/src/mesa/state_tracker/st_co<wbr>ntext.c<br>
index 5523734..658faba 100644<br>
--- a/src/mesa/state_tracker/st_co<wbr>ntext.c<br>
+++ b/src/mesa/state_tracker/st_co<wbr>ntext.c<br>
@@ -551,6 +551,12 @@ struct st_context *st_create_context(gl_api api, struct pipe_context *pipe,<br>
return NULL;<br>
}<br>
<br>
+ if (pipe->screen->create_disk_cac<wbr>he) {<br>
+ ctx->Cache =<br>
+ pipe->screen->create_disk_cac<wbr>he(pipe->screen,<br>
+ _mesa_create_cache_version_st<wbr>ring());<br>
+ }<br>
+<br>
st_init_driver_flags(&ctx->Dr<wbr>iverFlags);<br>
<br>
/* XXX: need a capability bit in gallium to query if the pipe<br>
--<br>
2.9.3<br>
<br>
______________________________<wbr>_________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org" target="_blank">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/mesa-dev</a><br>
</blockquote>
______________________________<wbr>_________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org" target="_blank">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/mesa-dev</a><br>
</blockquote>
<br>
</blockquote></div></div>