diff options
author | Chia-I Wu <[email protected]> | 2013-06-19 09:56:05 +0800 |
---|---|---|
committer | Chia-I Wu <[email protected]> | 2013-06-19 16:46:42 +0800 |
commit | cf41fae96b3d796ce80b2d1ad76b5c84a0669314 (patch) | |
tree | 372220327ee720cd763cfcd241ccee4bf846abc7 /src/gallium/drivers/ilo/ilo_shader.h | |
parent | 7f7b05d6b324c15b6573dfe1e90d4d5cf416a59b (diff) |
ilo: rework shader cache
The new code makes the shader cache manages all shaders and be able to upload
all of them to a caller-provided bo as a whole.
Previously, we uploaded only the bound shaders. When a different set of
shaders is bound, we had to allocate a new kernel bo to upload if the current
one is busy.
Diffstat (limited to 'src/gallium/drivers/ilo/ilo_shader.h')
-rw-r--r-- | src/gallium/drivers/ilo/ilo_shader.h | 50 |
1 files changed, 24 insertions, 26 deletions
diff --git a/src/gallium/drivers/ilo/ilo_shader.h b/src/gallium/drivers/ilo/ilo_shader.h index 1ea0b4a0d1d..a19f85e4b35 100644 --- a/src/gallium/drivers/ilo/ilo_shader.h +++ b/src/gallium/drivers/ilo/ilo_shader.h @@ -31,6 +31,8 @@ #include "ilo_common.h" #include "ilo_context.h" +struct ilo_shader_cache; + /* XXX The interface needs to be reworked */ /** @@ -117,6 +119,7 @@ struct ilo_shader { struct list_head list; + /* managed by shader cache */ uint32_t cache_seqno; uint32_t cache_offset; }; @@ -160,17 +163,30 @@ struct ilo_shader_state { int num_variants, total_size; struct ilo_shader *shader; + + /* managed by shader cache */ + struct ilo_shader_cache *cache; + struct list_head list; }; -struct ilo_shader_cache { - struct intel_winsys *winsys; - struct intel_bo *bo; - int cur, size; - bool busy; +struct ilo_shader_cache * +ilo_shader_cache_create(void); - /* starting from 1, incremented whenever a new bo is allocated */ - uint32_t seqno; -}; +void +ilo_shader_cache_destroy(struct ilo_shader_cache *shc); + +void +ilo_shader_cache_add(struct ilo_shader_cache *shc, + struct ilo_shader_state *shader); + +void +ilo_shader_cache_remove(struct ilo_shader_cache *shc, + struct ilo_shader_state *shader); + +int +ilo_shader_cache_upload(struct ilo_shader_cache *shc, + struct intel_bo *bo, unsigned offset, + bool incremental); void ilo_shader_variant_init(struct ilo_shader_variant *variant, @@ -192,24 +208,6 @@ bool ilo_shader_state_use_variant(struct ilo_shader_state *state, const struct ilo_shader_variant *variant); -struct ilo_shader_cache * -ilo_shader_cache_create(struct intel_winsys *winsys); - -void -ilo_shader_cache_destroy(struct ilo_shader_cache *shc); - -void -ilo_shader_cache_set(struct ilo_shader_cache *shc, - struct ilo_shader **shaders, - int num_shaders); - -static inline void -ilo_shader_cache_mark_busy(struct ilo_shader_cache *shc) -{ - if (shc->cur) - shc->busy = true; -} - struct ilo_shader * ilo_shader_compile_vs(const struct ilo_shader_state *state, const struct ilo_shader_variant *variant); |