drm/virtio: implement context init: support init ioctl
authorAnthoine Bourgeois <anthoine.bourgeois@gmail.com>
Tue, 21 Sep 2021 23:20:17 +0000 (16:20 -0700)
committerGerd Hoffmann <kraxel@redhat.com>
Wed, 29 Sep 2021 07:22:30 +0000 (09:22 +0200)
commit4fb530e5caf7cb666948db65f245b350ce520436
tree9bff893cf08db023d26b2bf92cb642686b7fed61
parent6198770a1fe01938921f8a383b777ddb881c94b6
drm/virtio: implement context init: support init ioctl

This implements the context initialization ioctl.  A list of params
is passed in by userspace, and kernel driver validates them.  The
only currently supported param is VIRTGPU_CONTEXT_PARAM_CAPSET_ID.

If the context has already been initialized, -EEXIST is returned.
This happens after Linux userspace does dumb_create + followed by
opening the Mesa virgl driver with the same virtgpu instance.

However, for most applications, 3D contexts will be explicitly
initialized when the feature is available.

Signed-off-by: Anthoine Bourgeois <anthoine.bourgeois@gmail.com>
Acked-by: Lingfeng Yang <lfy@google.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20210921232024.817-6-gurchetansingh@chromium.org
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
drivers/gpu/drm/virtio/virtgpu_drv.h
drivers/gpu/drm/virtio/virtgpu_ioctl.c
drivers/gpu/drm/virtio/virtgpu_vq.c