<div dir="ltr">Sorry, for spamming but my second patch which freed the caps seems configured incorrectly from my email client (blank in email's "to" field). </div><br><div class="gmail_quote"><div dir="ltr">On Wed, Jul 18, 2018 at 4:31 PM Po-Hsien Wang <<a href="mailto:pwang@chromium.org" target="_blank">pwang@chromium.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">During init phase, we generate all of have_* check for<br>
checking the caps based on similar logic as fill_caps,<br>
which may leads two different path for doing similar things.<br>
This change generate the caps by calling fill_caps inside init.<br>
---<br>
src/vrend_renderer.c | 7 +++++++<br>
1 file changed, 7 insertions(+)<br>
<br>
diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c<br>
index 0938169..4ed3776 100644<br>
--- a/src/vrend_renderer.c<br>
+++ b/src/vrend_renderer.c<br>
@@ -98,6 +98,7 @@ struct global_renderer_state {<br>
bool inited;<br>
bool use_gles;<br>
bool use_core_profile;<br>
+ union virgl_caps *caps;<br>
<br>
bool have_debug_cb;<br>
bool have_mesa_invert;<br>
@@ -4444,6 +4445,7 @@ int vrend_renderer_init(struct vrend_if_cbs *cbs, uint32_t flags)<br>
{<br>
bool gles;<br>
int gl_ver;<br>
+ uint32_t caps_max_ver, caps_max_size, default_cap_set = VREND_CAP_SET2;<br>
virgl_gl_context gl_context;<br>
struct virgl_gl_ctx_param ctx_params;<br>
<br>
@@ -4597,6 +4599,10 @@ int vrend_renderer_init(struct vrend_if_cbs *cbs, uint32_t flags)<br>
vrend_renderer_use_threaded_sync();<br>
}<br>
<br>
+ vrend_renderer_get_cap_set(default_cap_set, &caps_max_ver, &caps_max_size);<br>
+ vrend_state.caps = malloc(caps_max_size);<br>
+ vrend_renderer_fill_caps(default_cap_set, caps_max_ver, vrend_state.caps);<br>
+<br>
return 0;<br>
}<br>
<br>
@@ -4618,6 +4624,7 @@ vrend_renderer_fini(void)<br>
<br>
vrend_state.current_ctx = NULL;<br>
vrend_state.current_hw_ctx = NULL;<br>
+ free(vrend_state.caps);<br>
vrend_state.inited = false;<br>
}<br>
<br>
-- <br>
2.18.0.233.g985f88cf7e-goog<br>
<br>
</blockquote></div>