[virglrenderer-devel] multiprocess model and GL

Chia-I Wu olvaffe at gmail.com
Thu Feb 13 19:23:50 UTC 2020


On Thu, Feb 13, 2020 at 1:40 AM Gerd Hoffmann <kraxel at redhat.com> wrote:
>
>   Hi,
>
> > > > The kernel will tell virglrenderer the resource id.
> > >
> > > Which implies the resource_create_3d isn't an execbuffer but something
> > > else.  It is not self-contained but depends on the given context,
> > > specifically the resid generated by the kernel.  You can't do the same
> > > via SUBMIT_3D.
> >
> > Typically, virgl_renderer_submit_cmd will take in
> > VIRGL_CMD(ALLOCATE_WITH_OBJ_ID, size) since it needs to establish the
> > [obj_id] --> [struct resource] mapping.
> >
> > virgl_renderer_resource_create_blob(resid, *resource_create_3d, ..)
> > can take in both VIRGL_CMD(ALLOCATE_WITH_OBJ_ID, size) and
> > VIRGL_CMD(ALLOCATE, size) [OpenGL/generic allocation contexts]).
> > Internally, they'll go to the same allocation functions.  User-space
> > will typically choose one or the other.
> >
> > Both VIRGL_CMD(ALLOCATE_WITH_OBJ_ID, size) and VIRGL_CMD(ALLOCATE,
> > size) can be defined in the same header and same protocol namespace,
> > if that's desired.  Does that address your concern about having two
> > different protocols?
>
> No.  IMHO every execbuffer command should be submittable via
> virgl_renderer_submit_cmd().  And ALLOCATE isn't, no matter in which
> header file we define it, because processing it needs additional
> information (the resid) which isn't in the execbuffer.
>
> > > IMHO the workflow should be more like this:
> > >
> > >   (1) VIRTIO_GPU_CMD_CTX_ATTACH_RESOURCE
> >
> > Since resources will now be per context, doesn't
> > VIRTIO_GPU_CMD_RESOURCE_CREATE_BLOB imply
> > VIRTIO_GPU_CMD_CTX_ATTACH_RESOURCE for the creation context (if it's
> > successful)?
>
> Yes (for EXECBUFFER allocations, DUMB resources are a different story of
> course).
>
> > Does it make sense to only call
> > VIRTIO_GPU_CMD_CTX_ATTACH_RESOURCE on importing into another context?
>
> Yes.

It is fine that VIRTIO_GPU_CMD_RESOURCE_CREATE_BLOB implies
VIRTIO_GPU_CMD_CTX_ATTACH_RESOURCE.  But unless the extra command is a
problem, I think it is better for the guest kernel to generate both
commands.  That is, the resource_create_blob ioctl generates
SUBMIT_3D/RESOURCE_CREATE_BLOB/ATTACH_RESOURCE for EXECBUFFER
allocations and generate only RESOURCE_CREATE_BLOB for DUMB
allocations.


> cheers,
>   Gerd
>


More information about the virglrenderer-devel mailing list