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 <olvaffe@gmail.com> Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
@ -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;
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 */