[virglrenderer-devel] [PATCH v2 1/2] vrend: extract allocate function from vrend_renderer_resource_create

Dave Airlie airlied at gmail.com
Fri Jun 8 00:48:19 UTC 2018


On 1 June 2018 at 02:49, Gert Wollny <gert.wollny at collabora.com> wrote:
> Because vrend_renderer_resource_create requires a valid handle that is
> requested by the guest, this function can not directly be used to create
> a resource from within virglrenderer.
> Therefore, in order to be able to allocate and delete resources not
> requested by the client a function vrend_renderer_resource_allocate is
> extracted from vrend_renderer_resource_create. This resource is created
> with handle=0 and will not be handled by the virgilrenderer resource
> management.
>
> v2: * make vrend_renderer_resource_allocate static
>     * rebase patch

This introduces some warnings in the build, looks like a bad return value,
and two whitespace below.

btw how hard would it be to just create the GL resource manually
without calling into the resource allocator? I'm not sure if I'd
prefer it or not.

Dave.

> +
> +int vrend_renderer_resource_create(struct vrend_renderer_resource_create_args *args, struct iovec *iov, uint32_t num_iovs)
> +{
> +

^ pointless blank line
> +   struct vrend_resource *gr;
> +   int ret;
> +
> +   ret = check_resource_valid(args);
> +   if (ret)
> +      return EINVAL;
> +
> +   gr = vrend_renderer_resource_allocate(args);
> +

^pointless blank line

> +   if (!gr)
> +      return ENOMEM;
> +
> +   gr->handle = args->handle;
> +   gr->iov = iov;
> +   gr->num_iovs = num_iovs;
>
>     ret = vrend_resource_insert(gr, args->handle);
>     if (ret == 0) {
> --
> 2.17.0
>
> _______________________________________________
> virglrenderer-devel mailing list
> virglrenderer-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/virglrenderer-devel


More information about the virglrenderer-devel mailing list