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

Gert Wollny gert.wollny at collabora.com
Fri Jun 8 09:26:37 UTC 2018


Am Freitag, den 08.06.2018, 10:48 +1000 schrieb Dave Airlie:
> 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.

I'll look into that.  

> 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. 
I'll see what I can do, maybe I can achieve not using most of the
resource allocator by extracting another part of
vrend_renderer_resource_create (the one that actually creates the
texture), but I'd definitly would like to have the resource in a
vrend_resource struct to be able to to use vrend_fb_bind_texture later.

Best,
Gert 

> 
> 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
> 
> _______________________________________________
> 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