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

Po-Hsien Wang pwang at chromium.org
Thu Jul 19 00:03:14 UTC 2018


Sorry, for spamming but my second patch which freed the caps seems
configured incorrectly from my email client (blank in email's "to" field).

On Wed, Jul 18, 2018 at 4:31 PM Po-Hsien Wang <pwang at chromium.org> wrote:

> 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..4ed3776 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;
>
> @@ -4597,6 +4599,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;
>  }
>
> @@ -4618,6 +4624,7 @@ vrend_renderer_fini(void)
>
>     vrend_state.current_ctx = NULL;
>     vrend_state.current_hw_ctx = NULL;
> +   free(vrend_state.caps);
>     vrend_state.inited = false;
>  }
>
> --
> 2.18.0.233.g985f88cf7e-goog
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/virglrenderer-devel/attachments/20180718/99d03e14/attachment.html>


More information about the virglrenderer-devel mailing list