All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/virtio: make sure context is created in gem open
@ 2021-01-07 21:07 Chia-I Wu
  2021-01-08  1:46 ` Gurchetan Singh
  2021-01-12  8:50 ` Anthoine Bourgeois
  0 siblings, 2 replies; 3+ messages in thread
From: Chia-I Wu @ 2021-01-07 21:07 UTC (permalink / raw)
  To: dri-devel; +Cc: Gerd Hoffmann, Gurchetan Singh

The context might still be missing when DRM_IOCTL_PRIME_FD_TO_HANDLE is
the first ioctl on the drm_file.

Fixes: 72b48ae800da ("drm/virtio: enqueue virtio_gpu_create_context after the first 3D ioctl")
Cc: Gurchetan Singh <gurchetansingh@chromium.org>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
---
 drivers/gpu/drm/virtio/virtgpu_gem.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/virtio/virtgpu_gem.c b/drivers/gpu/drm/virtio/virtgpu_gem.c
index c30c75ee83fc..8502400b2f9c 100644
--- a/drivers/gpu/drm/virtio/virtgpu_gem.c
+++ b/drivers/gpu/drm/virtio/virtgpu_gem.c
@@ -39,9 +39,6 @@ static int virtio_gpu_gem_create(struct drm_file *file,
 	int ret;
 	u32 handle;
 
-	if (vgdev->has_virgl_3d)
-		virtio_gpu_create_context(dev, file);
-
 	ret = virtio_gpu_object_create(vgdev, params, &obj, NULL);
 	if (ret < 0)
 		return ret;
@@ -119,6 +116,11 @@ int virtio_gpu_gem_object_open(struct drm_gem_object *obj,
 	if (!vgdev->has_virgl_3d)
 		goto out_notify;
 
+	/* the context might still be missing when the first ioctl is
+	 * DRM_IOCTL_MODE_CREATE_DUMB or DRM_IOCTL_PRIME_FD_TO_HANDLE
+	 */
+	virtio_gpu_create_context(obj->dev, file);
+
 	objs = virtio_gpu_array_alloc(1);
 	if (!objs)
 		return -ENOMEM;
-- 
2.29.2.729.g45daf8777d-goog

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/virtio: make sure context is created in gem open
  2021-01-07 21:07 [PATCH] drm/virtio: make sure context is created in gem open Chia-I Wu
@ 2021-01-08  1:46 ` Gurchetan Singh
  2021-01-12  8:50 ` Anthoine Bourgeois
  1 sibling, 0 replies; 3+ messages in thread
From: Gurchetan Singh @ 2021-01-08  1:46 UTC (permalink / raw)
  To: Chia-I Wu; +Cc: Gerd Hoffmann, ML dri-devel


[-- Attachment #1.1: Type: text/plain, Size: 1660 bytes --]

On Thu, Jan 7, 2021 at 1:07 PM Chia-I Wu <olvaffe@gmail.com> wrote:

> The context might still be missing when DRM_IOCTL_PRIME_FD_TO_HANDLE is
> the first ioctl on the drm_file.
>
> Fixes: 72b48ae800da ("drm/virtio: enqueue virtio_gpu_create_context after
> the first 3D ioctl")
> Cc: Gurchetan Singh <gurchetansingh@chromium.org>
> Cc: Gerd Hoffmann <kraxel@redhat.com>
> Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
> ---
>  drivers/gpu/drm/virtio/virtgpu_gem.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/virtio/virtgpu_gem.c
> b/drivers/gpu/drm/virtio/virtgpu_gem.c
> index c30c75ee83fc..8502400b2f9c 100644
> --- a/drivers/gpu/drm/virtio/virtgpu_gem.c
> +++ b/drivers/gpu/drm/virtio/virtgpu_gem.c
> @@ -39,9 +39,6 @@ static int virtio_gpu_gem_create(struct drm_file *file,
>         int ret;
>         u32 handle;
>
> -       if (vgdev->has_virgl_3d)
> -               virtio_gpu_create_context(dev, file);
> -
>         ret = virtio_gpu_object_create(vgdev, params, &obj, NULL);
>         if (ret < 0)
>                 return ret;
> @@ -119,6 +116,11 @@ int virtio_gpu_gem_object_open(struct drm_gem_object
> *obj,
>         if (!vgdev->has_virgl_3d)
>                 goto out_notify;
>
> +       /* the context might still be missing when the first ioctl is
> +        * DRM_IOCTL_MODE_CREATE_DUMB or DRM_IOCTL_PRIME_FD_TO_HANDLE
> +        */
> +       virtio_gpu_create_context(obj->dev, file);
> +
>         objs = virtio_gpu_array_alloc(1);
>         if (!objs)
>                 return -ENOMEM;
> --
> 2.29.2.729.g45daf8777d-goog
>
> Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>

[-- Attachment #1.2: Type: text/html, Size: 2463 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/virtio: make sure context is created in gem open
  2021-01-07 21:07 [PATCH] drm/virtio: make sure context is created in gem open Chia-I Wu
  2021-01-08  1:46 ` Gurchetan Singh
@ 2021-01-12  8:50 ` Anthoine Bourgeois
  1 sibling, 0 replies; 3+ messages in thread
From: Anthoine Bourgeois @ 2021-01-12  8:50 UTC (permalink / raw)
  To: Chia-I Wu; +Cc: Gerd Hoffmann, dri-devel, Gurchetan Singh

On Thu, Jan 07, 2021 at 01:07:26PM -0800, Chia-I Wu wrote:
>The context might still be missing when DRM_IOCTL_PRIME_FD_TO_HANDLE is
>the first ioctl on the drm_file.
>
>Fixes: 72b48ae800da ("drm/virtio: enqueue virtio_gpu_create_context after the first 3D ioctl")
>Cc: Gurchetan Singh <gurchetansingh@chromium.org>
>Cc: Gerd Hoffmann <kraxel@redhat.com>
>Signed-off-by: Chia-I Wu <olvaffe@gmail.com>

Reviewed-by: Anthoine Bourgeois <anthoine.bourgeois@gmail.com>

>---
> drivers/gpu/drm/virtio/virtgpu_gem.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
>diff --git a/drivers/gpu/drm/virtio/virtgpu_gem.c b/drivers/gpu/drm/virtio/virtgpu_gem.c
>index c30c75ee83fc..8502400b2f9c 100644
>--- a/drivers/gpu/drm/virtio/virtgpu_gem.c
>+++ b/drivers/gpu/drm/virtio/virtgpu_gem.c
>@@ -39,9 +39,6 @@ static int virtio_gpu_gem_create(struct drm_file *file,
> 	int ret;
> 	u32 handle;
>
>-	if (vgdev->has_virgl_3d)
>-		virtio_gpu_create_context(dev, file);
>-
> 	ret = virtio_gpu_object_create(vgdev, params, &obj, NULL);
> 	if (ret < 0)
> 		return ret;
>@@ -119,6 +116,11 @@ int virtio_gpu_gem_object_open(struct drm_gem_object *obj,
> 	if (!vgdev->has_virgl_3d)
> 		goto out_notify;
>
>+	/* the context might still be missing when the first ioctl is
>+	 * DRM_IOCTL_MODE_CREATE_DUMB or DRM_IOCTL_PRIME_FD_TO_HANDLE
>+	 */
>+	virtio_gpu_create_context(obj->dev, file);
>+
> 	objs = virtio_gpu_array_alloc(1);
> 	if (!objs)
> 		return -ENOMEM;
>-- 
>2.29.2.729.g45daf8777d-goog
>
>_______________________________________________
>dri-devel mailing list
>dri-devel@lists.freedesktop.org
>https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-01-12  8:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-01-07 21:07 [PATCH] drm/virtio: make sure context is created in gem open Chia-I Wu
2021-01-08  1:46 ` Gurchetan Singh
2021-01-12  8:50 ` Anthoine Bourgeois

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.