Commit c3e2850a authored by Gurchetan Singh's avatar Gurchetan Singh Committed by Gerd Hoffmann

drm/virtio: create context before RESOURCE_CREATE_2D in 3D mode

If 3D is enabled, but userspace requests a dumb buffer, we will
call CTX_ATTACH_RESOURCE before actually creating the context.

Fixes: 72b48ae8 ("drm/virtio: enqueue virtio_gpu_create_context after the first 3D ioctl")
Signed-off-by: default avatarGurchetan Singh <gurchetansingh@chromium.org>
Link: http://patchwork.freedesktop.org/patch/msgid/20200501185557.740-1-gurchetansingh@chromium.orgSigned-off-by: default avatarGerd Hoffmann <kraxel@redhat.com>
parent 6f49c251
...@@ -221,6 +221,7 @@ struct virtio_gpu_fpriv { ...@@ -221,6 +221,7 @@ struct virtio_gpu_fpriv {
/* virtio_ioctl.c */ /* virtio_ioctl.c */
#define DRM_VIRTIO_NUM_IOCTLS 10 #define DRM_VIRTIO_NUM_IOCTLS 10
extern struct drm_ioctl_desc virtio_gpu_ioctls[DRM_VIRTIO_NUM_IOCTLS]; extern struct drm_ioctl_desc virtio_gpu_ioctls[DRM_VIRTIO_NUM_IOCTLS];
void virtio_gpu_create_context(struct drm_device *dev, struct drm_file *file);
/* virtio_kms.c */ /* virtio_kms.c */
int virtio_gpu_init(struct drm_device *dev); int virtio_gpu_init(struct drm_device *dev);
......
...@@ -39,6 +39,9 @@ int virtio_gpu_gem_create(struct drm_file *file, ...@@ -39,6 +39,9 @@ int virtio_gpu_gem_create(struct drm_file *file,
int ret; int ret;
u32 handle; u32 handle;
if (vgdev->has_virgl_3d)
virtio_gpu_create_context(dev, file);
ret = virtio_gpu_object_create(vgdev, params, &obj, NULL); ret = virtio_gpu_object_create(vgdev, params, &obj, NULL);
if (ret < 0) if (ret < 0)
return ret; return ret;
......
...@@ -33,8 +33,7 @@ ...@@ -33,8 +33,7 @@
#include "virtgpu_drv.h" #include "virtgpu_drv.h"
static void virtio_gpu_create_context(struct drm_device *dev, void virtio_gpu_create_context(struct drm_device *dev, struct drm_file *file)
struct drm_file *file)
{ {
struct virtio_gpu_device *vgdev = dev->dev_private; struct virtio_gpu_device *vgdev = dev->dev_private;
struct virtio_gpu_fpriv *vfpriv = file->driver_priv; struct virtio_gpu_fpriv *vfpriv = file->driver_priv;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment