[virglrenderer-devel] [PATCH] Generate caps in init

Po-Hsien Wang pwang at chromium.org
Wed Jul 18 23:16:19 UTC 2018


During init phase, we generate all of have_* check for
checking the caps based on similar logic as fill_caps,
which may leads two different path for doing similar things.
This change generate the caps by calling fill_caps inside init.
---
 src/vrend_renderer.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c
index 0938169..5a09dbc 100644
--- a/src/vrend_renderer.c
+++ b/src/vrend_renderer.c
@@ -98,6 +98,7 @@ struct global_renderer_state {
    bool inited;
    bool use_gles;
    bool use_core_profile;
+   union virgl_caps *caps;
 
    bool have_debug_cb;
    bool have_mesa_invert;
@@ -4444,6 +4445,7 @@ int vrend_renderer_init(struct vrend_if_cbs *cbs, uint32_t flags)
 {
    bool gles;
    int gl_ver;
+   uint32_t caps_max_ver, caps_max_size, default_cap_set = VREND_CAP_SET2;
    virgl_gl_context gl_context;
    struct virgl_gl_ctx_param ctx_params;
 
@@ -4464,6 +4466,7 @@ int vrend_renderer_init(struct vrend_if_cbs *cbs, uint32_t flags)
    }
 
    vrend_clicbs->make_current(0, gl_context);
+
    gl_ver = epoxy_gl_version();
 
    /* enable error output as early as possible */
@@ -4597,6 +4600,10 @@ int vrend_renderer_init(struct vrend_if_cbs *cbs, uint32_t flags)
       vrend_renderer_use_threaded_sync();
    }
 
+   vrend_renderer_get_cap_set(default_cap_set, &caps_max_ver, &caps_max_size);
+   vrend_state.caps = malloc(caps_max_size);
+   vrend_renderer_fill_caps(default_cap_set, caps_max_ver, vrend_state.caps);
+
    return 0;
 }
 
-- 
2.18.0.233.g985f88cf7e-goog



More information about the virglrenderer-devel mailing list