* [PATCH v1] drm/virtio: Don't create a context with default param if context_init is supported
@ 2024-10-20 22:47 Dmitry Osipenko
2024-11-06 1:31 ` Rob Clark
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Dmitry Osipenko @ 2024-10-20 22:47 UTC (permalink / raw)
To: David Airlie, Gerd Hoffmann, Gurchetan Singh, Chia-I Wu,
Rob Clark, Pierre-Eric Pelloux-Prayer
Cc: dri-devel, virtualization, linux-kernel, kernel
From: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Xorg context creation fails for native contexts that use
VIRTGPU_CONTEXT_INIT because context is already initialized implicitly
when dumb buffer is created. Fix it by not creating default vrend context
if context_init is supported.
Signed-off-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Signed-off-by: Dmitry Osipenko <dmitry.osipenko@collabora.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 7db48d17ee3a..67f557e058b4 100644
--- a/drivers/gpu/drm/virtio/virtgpu_gem.c
+++ b/drivers/gpu/drm/virtio/virtgpu_gem.c
@@ -127,15 +127,17 @@ int virtio_gpu_gem_object_open(struct drm_gem_object *obj,
/* 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);
+ if (!vgdev->has_context_init)
+ virtio_gpu_create_context(obj->dev, file);
objs = virtio_gpu_array_alloc(1);
if (!objs)
return -ENOMEM;
virtio_gpu_array_add_obj(objs, obj);
- virtio_gpu_cmd_context_attach_resource(vgdev, vfpriv->ctx_id,
- objs);
+ if (vfpriv->ctx_id)
+ virtio_gpu_cmd_context_attach_resource(vgdev, vfpriv->ctx_id, objs);
+
out_notify:
virtio_gpu_notify(vgdev);
return 0;
--
2.47.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v1] drm/virtio: Don't create a context with default param if context_init is supported
2024-10-20 22:47 [PATCH v1] drm/virtio: Don't create a context with default param if context_init is supported Dmitry Osipenko
@ 2024-11-06 1:31 ` Rob Clark
2024-11-17 10:12 ` Dmitry Osipenko
2024-11-19 10:10 ` Dmitry Osipenko
2 siblings, 0 replies; 4+ messages in thread
From: Rob Clark @ 2024-11-06 1:31 UTC (permalink / raw)
To: Dmitry Osipenko
Cc: David Airlie, Gerd Hoffmann, Gurchetan Singh, Chia-I Wu,
Pierre-Eric Pelloux-Prayer, dri-devel, virtualization,
linux-kernel, kernel
On Sun, Oct 20, 2024 at 3:49 PM Dmitry Osipenko
<dmitry.osipenko@collabora.com> wrote:
>
> From: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
>
> Xorg context creation fails for native contexts that use
> VIRTGPU_CONTEXT_INIT because context is already initialized implicitly
> when dumb buffer is created. Fix it by not creating default vrend context
> if context_init is supported.
>
> Signed-off-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
> Signed-off-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
Reviewed-by: Rob Clark <robdclark@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 7db48d17ee3a..67f557e058b4 100644
> --- a/drivers/gpu/drm/virtio/virtgpu_gem.c
> +++ b/drivers/gpu/drm/virtio/virtgpu_gem.c
> @@ -127,15 +127,17 @@ int virtio_gpu_gem_object_open(struct drm_gem_object *obj,
> /* 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);
> + if (!vgdev->has_context_init)
> + virtio_gpu_create_context(obj->dev, file);
>
> objs = virtio_gpu_array_alloc(1);
> if (!objs)
> return -ENOMEM;
> virtio_gpu_array_add_obj(objs, obj);
>
> - virtio_gpu_cmd_context_attach_resource(vgdev, vfpriv->ctx_id,
> - objs);
> + if (vfpriv->ctx_id)
> + virtio_gpu_cmd_context_attach_resource(vgdev, vfpriv->ctx_id, objs);
> +
> out_notify:
> virtio_gpu_notify(vgdev);
> return 0;
> --
> 2.47.0
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v1] drm/virtio: Don't create a context with default param if context_init is supported
2024-10-20 22:47 [PATCH v1] drm/virtio: Don't create a context with default param if context_init is supported Dmitry Osipenko
2024-11-06 1:31 ` Rob Clark
@ 2024-11-17 10:12 ` Dmitry Osipenko
2024-11-19 10:10 ` Dmitry Osipenko
2 siblings, 0 replies; 4+ messages in thread
From: Dmitry Osipenko @ 2024-11-17 10:12 UTC (permalink / raw)
To: David Airlie, Gerd Hoffmann, Gurchetan Singh, Chia-I Wu,
Rob Clark, Pierre-Eric Pelloux-Prayer
Cc: dri-devel, virtualization, linux-kernel, kernel
On 10/21/24 01:47, Dmitry Osipenko wrote:
> From: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
>
> Xorg context creation fails for native contexts that use
> VIRTGPU_CONTEXT_INIT because context is already initialized implicitly
> when dumb buffer is created. Fix it by not creating default vrend context
> if context_init is supported.
>
> Signed-off-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
> Signed-off-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
> ---
> drivers/gpu/drm/virtio/virtgpu_gem.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
I'll apply this patch tomorrow if nobody has more comments to add.
--
Best regards,
Dmitry
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v1] drm/virtio: Don't create a context with default param if context_init is supported
2024-10-20 22:47 [PATCH v1] drm/virtio: Don't create a context with default param if context_init is supported Dmitry Osipenko
2024-11-06 1:31 ` Rob Clark
2024-11-17 10:12 ` Dmitry Osipenko
@ 2024-11-19 10:10 ` Dmitry Osipenko
2 siblings, 0 replies; 4+ messages in thread
From: Dmitry Osipenko @ 2024-11-19 10:10 UTC (permalink / raw)
To: David Airlie, Gerd Hoffmann, Gurchetan Singh, Chia-I Wu,
Rob Clark, Pierre-Eric Pelloux-Prayer
Cc: dri-devel, virtualization, linux-kernel, kernel
On 10/21/24 01:47, Dmitry Osipenko wrote:
> From: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
>
> Xorg context creation fails for native contexts that use
> VIRTGPU_CONTEXT_INIT because context is already initialized implicitly
> when dumb buffer is created. Fix it by not creating default vrend context
> if context_init is supported.
>
> Signed-off-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
> Signed-off-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
> ---
> drivers/gpu/drm/virtio/virtgpu_gem.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
Applied to misc-next
--
Best regards,
Dmitry
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-11-19 10:10 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-10-20 22:47 [PATCH v1] drm/virtio: Don't create a context with default param if context_init is supported Dmitry Osipenko
2024-11-06 1:31 ` Rob Clark
2024-11-17 10:12 ` Dmitry Osipenko
2024-11-19 10:10 ` Dmitry Osipenko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®