From e2884b62ada684b49a45f496d97565c810ff4041 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Thu, 24 Dec 2020 18:06:28 -0800 Subject: [PATCH] vrend: refactor vrend_resource init Add vrend_resource_create helper to allocate and initialize the vrend_resource struct. This is a refactor with no real change. Signed-off-by: Chia-I Wu Reviewed-by: Gert Wollny --- src/vrend_renderer.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c index 4707048..40c3317 100644 --- a/src/vrend_renderer.c +++ b/src/vrend_renderer.c @@ -6868,9 +6868,8 @@ static int vrend_renderer_resource_allocate_texture(struct vrend_resource *gr, return 0; } -struct pipe_resource * -vrend_renderer_resource_create(const struct vrend_renderer_resource_create_args *args, - void *image_oes) +static struct vrend_resource * +vrend_resource_create(const struct vrend_renderer_resource_create_args *args) { struct vrend_resource *gr; int ret; @@ -6894,6 +6893,19 @@ vrend_renderer_resource_create(const struct vrend_renderer_resource_create_args pipe_reference_init(&gr->base.reference, 1); + return gr; +} + +struct pipe_resource * +vrend_renderer_resource_create(const struct vrend_renderer_resource_create_args *args, + void *image_oes) +{ + struct vrend_resource *gr; + + gr = vrend_resource_create(args); + if (!gr) + return NULL; + if (args->target == PIPE_BUFFER) { if (args->bind == VIRGL_BIND_CUSTOM) { /* use iovec directly when attached */