Skip to content

Commit c3e2850

Browse files
gurchetansinghkraxel
authored andcommitted
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: 72b48ae ("drm/virtio: enqueue virtio_gpu_create_context after the first 3D ioctl") Signed-off-by: Gurchetan Singh <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected] Signed-off-by: Gerd Hoffmann <[email protected]>
1 parent 6f49c25 commit c3e2850

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

drivers/gpu/drm/virtio/virtgpu_drv.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,7 @@ struct virtio_gpu_fpriv {
221221
/* virtio_ioctl.c */
222222
#define DRM_VIRTIO_NUM_IOCTLS 10
223223
extern struct drm_ioctl_desc virtio_gpu_ioctls[DRM_VIRTIO_NUM_IOCTLS];
224+
void virtio_gpu_create_context(struct drm_device *dev, struct drm_file *file);
224225

225226
/* virtio_kms.c */
226227
int virtio_gpu_init(struct drm_device *dev);

drivers/gpu/drm/virtio/virtgpu_gem.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ int virtio_gpu_gem_create(struct drm_file *file,
3939
int ret;
4040
u32 handle;
4141

42+
if (vgdev->has_virgl_3d)
43+
virtio_gpu_create_context(dev, file);
44+
4245
ret = virtio_gpu_object_create(vgdev, params, &obj, NULL);
4346
if (ret < 0)
4447
return ret;

drivers/gpu/drm/virtio/virtgpu_ioctl.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@
3333

3434
#include "virtgpu_drv.h"
3535

36-
static void virtio_gpu_create_context(struct drm_device *dev,
37-
struct drm_file *file)
36+
void virtio_gpu_create_context(struct drm_device *dev, struct drm_file *file)
3837
{
3938
struct virtio_gpu_device *vgdev = dev->dev_private;
4039
struct virtio_gpu_fpriv *vfpriv = file->driver_priv;

0 commit comments

Comments
 (0)