All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/virtio: Add execbuf flag to request no fence-event
@ 2022-04-05 17:39 ` Rob Clark
  0 siblings, 0 replies; 9+ messages in thread
From: Rob Clark @ 2022-04-05 17:39 UTC (permalink / raw)
  To: dri-devel
  Cc: Rob Clark, David Airlie, open list, Gurchetan Singh,
	Daniel Vetter, open list:VIRTIO GPU DRIVER, Chia-I Wu

From: Rob Clark <robdclark@chromium.org>

It would have been cleaner to have a flag to *request* the fence event.
But that ship has sailed.  So add a flag so that userspace which doesn't
care about the events can opt-out.

Signed-off-by: Rob Clark <robdclark@chromium.org>
---
 drivers/gpu/drm/virtio/virtgpu_ioctl.c | 8 +++++---
 include/uapi/drm/virtgpu_drm.h         | 2 ++
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/virtio/virtgpu_ioctl.c b/drivers/gpu/drm/virtio/virtgpu_ioctl.c
index 3a8078f2ee27..09f1aa263f91 100644
--- a/drivers/gpu/drm/virtio/virtgpu_ioctl.c
+++ b/drivers/gpu/drm/virtio/virtgpu_ioctl.c
@@ -225,9 +225,11 @@ static int virtio_gpu_execbuffer_ioctl(struct drm_device *dev, void *data,
 		goto out_unresv;
 	}
 
-	ret = virtio_gpu_fence_event_create(dev, file, out_fence, ring_idx);
-	if (ret)
-		goto out_unresv;
+	if (!(exbuf->flags & VIRTGPU_EXECBUF_NO_EVENT)) {
+		ret = virtio_gpu_fence_event_create(dev, file, out_fence, ring_idx);
+		if (ret)
+			goto out_unresv;
+	}
 
 	if (out_fence_fd >= 0) {
 		sync_file = sync_file_create(&out_fence->f);
diff --git a/include/uapi/drm/virtgpu_drm.h b/include/uapi/drm/virtgpu_drm.h
index 0512fde5e697..d06cac3407cc 100644
--- a/include/uapi/drm/virtgpu_drm.h
+++ b/include/uapi/drm/virtgpu_drm.h
@@ -52,10 +52,12 @@ extern "C" {
 #define VIRTGPU_EXECBUF_FENCE_FD_IN	0x01
 #define VIRTGPU_EXECBUF_FENCE_FD_OUT	0x02
 #define VIRTGPU_EXECBUF_RING_IDX	0x04
+#define VIRTGPU_EXECBUF_NO_EVENT	0x08
 #define VIRTGPU_EXECBUF_FLAGS  (\
 		VIRTGPU_EXECBUF_FENCE_FD_IN |\
 		VIRTGPU_EXECBUF_FENCE_FD_OUT |\
 		VIRTGPU_EXECBUF_RING_IDX |\
+		VIRTGPU_EXECBUF_NO_EVENT |\
 		0)
 
 struct drm_virtgpu_map {
-- 
2.35.1

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

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

* [PATCH] drm/virtio: Add execbuf flag to request no fence-event
@ 2022-04-05 17:39 ` Rob Clark
  0 siblings, 0 replies; 9+ messages in thread
From: Rob Clark @ 2022-04-05 17:39 UTC (permalink / raw)
  To: dri-devel
  Cc: Rob Clark, David Airlie, open list, Gurchetan Singh,
	Gerd Hoffmann, open list:VIRTIO GPU DRIVER

From: Rob Clark <robdclark@chromium.org>

It would have been cleaner to have a flag to *request* the fence event.
But that ship has sailed.  So add a flag so that userspace which doesn't
care about the events can opt-out.

Signed-off-by: Rob Clark <robdclark@chromium.org>
---
 drivers/gpu/drm/virtio/virtgpu_ioctl.c | 8 +++++---
 include/uapi/drm/virtgpu_drm.h         | 2 ++
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/virtio/virtgpu_ioctl.c b/drivers/gpu/drm/virtio/virtgpu_ioctl.c
index 3a8078f2ee27..09f1aa263f91 100644
--- a/drivers/gpu/drm/virtio/virtgpu_ioctl.c
+++ b/drivers/gpu/drm/virtio/virtgpu_ioctl.c
@@ -225,9 +225,11 @@ static int virtio_gpu_execbuffer_ioctl(struct drm_device *dev, void *data,
 		goto out_unresv;
 	}
 
-	ret = virtio_gpu_fence_event_create(dev, file, out_fence, ring_idx);
-	if (ret)
-		goto out_unresv;
+	if (!(exbuf->flags & VIRTGPU_EXECBUF_NO_EVENT)) {
+		ret = virtio_gpu_fence_event_create(dev, file, out_fence, ring_idx);
+		if (ret)
+			goto out_unresv;
+	}
 
 	if (out_fence_fd >= 0) {
 		sync_file = sync_file_create(&out_fence->f);
diff --git a/include/uapi/drm/virtgpu_drm.h b/include/uapi/drm/virtgpu_drm.h
index 0512fde5e697..d06cac3407cc 100644
--- a/include/uapi/drm/virtgpu_drm.h
+++ b/include/uapi/drm/virtgpu_drm.h
@@ -52,10 +52,12 @@ extern "C" {
 #define VIRTGPU_EXECBUF_FENCE_FD_IN	0x01
 #define VIRTGPU_EXECBUF_FENCE_FD_OUT	0x02
 #define VIRTGPU_EXECBUF_RING_IDX	0x04
+#define VIRTGPU_EXECBUF_NO_EVENT	0x08
 #define VIRTGPU_EXECBUF_FLAGS  (\
 		VIRTGPU_EXECBUF_FENCE_FD_IN |\
 		VIRTGPU_EXECBUF_FENCE_FD_OUT |\
 		VIRTGPU_EXECBUF_RING_IDX |\
+		VIRTGPU_EXECBUF_NO_EVENT |\
 		0)
 
 struct drm_virtgpu_map {
-- 
2.35.1


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

* [PATCH] drm/virtio: Add execbuf flag to request no fence-event
@ 2022-04-05 17:39 ` Rob Clark
  0 siblings, 0 replies; 9+ messages in thread
From: Rob Clark @ 2022-04-05 17:39 UTC (permalink / raw)
  To: dri-devel
  Cc: Rob Clark, David Airlie, Gerd Hoffmann, Gurchetan Singh,
	Chia-I Wu, Daniel Vetter, open list:VIRTIO GPU DRIVER, open list

From: Rob Clark <robdclark@chromium.org>

It would have been cleaner to have a flag to *request* the fence event.
But that ship has sailed.  So add a flag so that userspace which doesn't
care about the events can opt-out.

Signed-off-by: Rob Clark <robdclark@chromium.org>
---
 drivers/gpu/drm/virtio/virtgpu_ioctl.c | 8 +++++---
 include/uapi/drm/virtgpu_drm.h         | 2 ++
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/virtio/virtgpu_ioctl.c b/drivers/gpu/drm/virtio/virtgpu_ioctl.c
index 3a8078f2ee27..09f1aa263f91 100644
--- a/drivers/gpu/drm/virtio/virtgpu_ioctl.c
+++ b/drivers/gpu/drm/virtio/virtgpu_ioctl.c
@@ -225,9 +225,11 @@ static int virtio_gpu_execbuffer_ioctl(struct drm_device *dev, void *data,
 		goto out_unresv;
 	}
 
-	ret = virtio_gpu_fence_event_create(dev, file, out_fence, ring_idx);
-	if (ret)
-		goto out_unresv;
+	if (!(exbuf->flags & VIRTGPU_EXECBUF_NO_EVENT)) {
+		ret = virtio_gpu_fence_event_create(dev, file, out_fence, ring_idx);
+		if (ret)
+			goto out_unresv;
+	}
 
 	if (out_fence_fd >= 0) {
 		sync_file = sync_file_create(&out_fence->f);
diff --git a/include/uapi/drm/virtgpu_drm.h b/include/uapi/drm/virtgpu_drm.h
index 0512fde5e697..d06cac3407cc 100644
--- a/include/uapi/drm/virtgpu_drm.h
+++ b/include/uapi/drm/virtgpu_drm.h
@@ -52,10 +52,12 @@ extern "C" {
 #define VIRTGPU_EXECBUF_FENCE_FD_IN	0x01
 #define VIRTGPU_EXECBUF_FENCE_FD_OUT	0x02
 #define VIRTGPU_EXECBUF_RING_IDX	0x04
+#define VIRTGPU_EXECBUF_NO_EVENT	0x08
 #define VIRTGPU_EXECBUF_FLAGS  (\
 		VIRTGPU_EXECBUF_FENCE_FD_IN |\
 		VIRTGPU_EXECBUF_FENCE_FD_OUT |\
 		VIRTGPU_EXECBUF_RING_IDX |\
+		VIRTGPU_EXECBUF_NO_EVENT |\
 		0)
 
 struct drm_virtgpu_map {
-- 
2.35.1


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

* Re: [PATCH] drm/virtio: Add execbuf flag to request no fence-event
  2022-04-05 17:39 ` Rob Clark
  (?)
@ 2022-04-05 17:56   ` Chia-I Wu
  -1 siblings, 0 replies; 9+ messages in thread
From: Chia-I Wu @ 2022-04-05 17:56 UTC (permalink / raw)
  To: Rob Clark
  Cc: Rob Clark, David Airlie, open list, ML dri-devel,
	Gurchetan Singh, Daniel Vetter, open list:VIRTIO GPU DRIVER

On Tue, Apr 5, 2022 at 10:38 AM Rob Clark <robdclark@gmail.com> wrote:
>
> From: Rob Clark <robdclark@chromium.org>
>
> It would have been cleaner to have a flag to *request* the fence event.
> But that ship has sailed.  So add a flag so that userspace which doesn't
> care about the events can opt-out.
>
> Signed-off-by: Rob Clark <robdclark@chromium.org>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>

Might want to wait for Gurchetan to chime in as he added the mechanism.

> ---
>  drivers/gpu/drm/virtio/virtgpu_ioctl.c | 8 +++++---
>  include/uapi/drm/virtgpu_drm.h         | 2 ++
>  2 files changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/virtio/virtgpu_ioctl.c b/drivers/gpu/drm/virtio/virtgpu_ioctl.c
> index 3a8078f2ee27..09f1aa263f91 100644
> --- a/drivers/gpu/drm/virtio/virtgpu_ioctl.c
> +++ b/drivers/gpu/drm/virtio/virtgpu_ioctl.c
> @@ -225,9 +225,11 @@ static int virtio_gpu_execbuffer_ioctl(struct drm_device *dev, void *data,
>                 goto out_unresv;
>         }
>
> -       ret = virtio_gpu_fence_event_create(dev, file, out_fence, ring_idx);
> -       if (ret)
> -               goto out_unresv;
> +       if (!(exbuf->flags & VIRTGPU_EXECBUF_NO_EVENT)) {
> +               ret = virtio_gpu_fence_event_create(dev, file, out_fence, ring_idx);
> +               if (ret)
> +                       goto out_unresv;
> +       }
>
>         if (out_fence_fd >= 0) {
>                 sync_file = sync_file_create(&out_fence->f);
> diff --git a/include/uapi/drm/virtgpu_drm.h b/include/uapi/drm/virtgpu_drm.h
> index 0512fde5e697..d06cac3407cc 100644
> --- a/include/uapi/drm/virtgpu_drm.h
> +++ b/include/uapi/drm/virtgpu_drm.h
> @@ -52,10 +52,12 @@ extern "C" {
>  #define VIRTGPU_EXECBUF_FENCE_FD_IN    0x01
>  #define VIRTGPU_EXECBUF_FENCE_FD_OUT   0x02
>  #define VIRTGPU_EXECBUF_RING_IDX       0x04
> +#define VIRTGPU_EXECBUF_NO_EVENT       0x08
>  #define VIRTGPU_EXECBUF_FLAGS  (\
>                 VIRTGPU_EXECBUF_FENCE_FD_IN |\
>                 VIRTGPU_EXECBUF_FENCE_FD_OUT |\
>                 VIRTGPU_EXECBUF_RING_IDX |\
> +               VIRTGPU_EXECBUF_NO_EVENT |\
>                 0)
>
>  struct drm_virtgpu_map {
> --
> 2.35.1
>
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

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

* Re: [PATCH] drm/virtio: Add execbuf flag to request no fence-event
@ 2022-04-05 17:56   ` Chia-I Wu
  0 siblings, 0 replies; 9+ messages in thread
From: Chia-I Wu @ 2022-04-05 17:56 UTC (permalink / raw)
  To: Rob Clark
  Cc: Rob Clark, David Airlie, open list, ML dri-devel,
	Gurchetan Singh, Gerd Hoffmann, open list:VIRTIO GPU DRIVER

On Tue, Apr 5, 2022 at 10:38 AM Rob Clark <robdclark@gmail.com> wrote:
>
> From: Rob Clark <robdclark@chromium.org>
>
> It would have been cleaner to have a flag to *request* the fence event.
> But that ship has sailed.  So add a flag so that userspace which doesn't
> care about the events can opt-out.
>
> Signed-off-by: Rob Clark <robdclark@chromium.org>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>

Might want to wait for Gurchetan to chime in as he added the mechanism.

> ---
>  drivers/gpu/drm/virtio/virtgpu_ioctl.c | 8 +++++---
>  include/uapi/drm/virtgpu_drm.h         | 2 ++
>  2 files changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/virtio/virtgpu_ioctl.c b/drivers/gpu/drm/virtio/virtgpu_ioctl.c
> index 3a8078f2ee27..09f1aa263f91 100644
> --- a/drivers/gpu/drm/virtio/virtgpu_ioctl.c
> +++ b/drivers/gpu/drm/virtio/virtgpu_ioctl.c
> @@ -225,9 +225,11 @@ static int virtio_gpu_execbuffer_ioctl(struct drm_device *dev, void *data,
>                 goto out_unresv;
>         }
>
> -       ret = virtio_gpu_fence_event_create(dev, file, out_fence, ring_idx);
> -       if (ret)
> -               goto out_unresv;
> +       if (!(exbuf->flags & VIRTGPU_EXECBUF_NO_EVENT)) {
> +               ret = virtio_gpu_fence_event_create(dev, file, out_fence, ring_idx);
> +               if (ret)
> +                       goto out_unresv;
> +       }
>
>         if (out_fence_fd >= 0) {
>                 sync_file = sync_file_create(&out_fence->f);
> diff --git a/include/uapi/drm/virtgpu_drm.h b/include/uapi/drm/virtgpu_drm.h
> index 0512fde5e697..d06cac3407cc 100644
> --- a/include/uapi/drm/virtgpu_drm.h
> +++ b/include/uapi/drm/virtgpu_drm.h
> @@ -52,10 +52,12 @@ extern "C" {
>  #define VIRTGPU_EXECBUF_FENCE_FD_IN    0x01
>  #define VIRTGPU_EXECBUF_FENCE_FD_OUT   0x02
>  #define VIRTGPU_EXECBUF_RING_IDX       0x04
> +#define VIRTGPU_EXECBUF_NO_EVENT       0x08
>  #define VIRTGPU_EXECBUF_FLAGS  (\
>                 VIRTGPU_EXECBUF_FENCE_FD_IN |\
>                 VIRTGPU_EXECBUF_FENCE_FD_OUT |\
>                 VIRTGPU_EXECBUF_RING_IDX |\
> +               VIRTGPU_EXECBUF_NO_EVENT |\
>                 0)
>
>  struct drm_virtgpu_map {
> --
> 2.35.1
>

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

* Re: [PATCH] drm/virtio: Add execbuf flag to request no fence-event
@ 2022-04-05 17:56   ` Chia-I Wu
  0 siblings, 0 replies; 9+ messages in thread
From: Chia-I Wu @ 2022-04-05 17:56 UTC (permalink / raw)
  To: Rob Clark
  Cc: ML dri-devel, Rob Clark, David Airlie, Gerd Hoffmann,
	Gurchetan Singh, Daniel Vetter, open list:VIRTIO GPU DRIVER,
	open list

On Tue, Apr 5, 2022 at 10:38 AM Rob Clark <robdclark@gmail.com> wrote:
>
> From: Rob Clark <robdclark@chromium.org>
>
> It would have been cleaner to have a flag to *request* the fence event.
> But that ship has sailed.  So add a flag so that userspace which doesn't
> care about the events can opt-out.
>
> Signed-off-by: Rob Clark <robdclark@chromium.org>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>

Might want to wait for Gurchetan to chime in as he added the mechanism.

> ---
>  drivers/gpu/drm/virtio/virtgpu_ioctl.c | 8 +++++---
>  include/uapi/drm/virtgpu_drm.h         | 2 ++
>  2 files changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/virtio/virtgpu_ioctl.c b/drivers/gpu/drm/virtio/virtgpu_ioctl.c
> index 3a8078f2ee27..09f1aa263f91 100644
> --- a/drivers/gpu/drm/virtio/virtgpu_ioctl.c
> +++ b/drivers/gpu/drm/virtio/virtgpu_ioctl.c
> @@ -225,9 +225,11 @@ static int virtio_gpu_execbuffer_ioctl(struct drm_device *dev, void *data,
>                 goto out_unresv;
>         }
>
> -       ret = virtio_gpu_fence_event_create(dev, file, out_fence, ring_idx);
> -       if (ret)
> -               goto out_unresv;
> +       if (!(exbuf->flags & VIRTGPU_EXECBUF_NO_EVENT)) {
> +               ret = virtio_gpu_fence_event_create(dev, file, out_fence, ring_idx);
> +               if (ret)
> +                       goto out_unresv;
> +       }
>
>         if (out_fence_fd >= 0) {
>                 sync_file = sync_file_create(&out_fence->f);
> diff --git a/include/uapi/drm/virtgpu_drm.h b/include/uapi/drm/virtgpu_drm.h
> index 0512fde5e697..d06cac3407cc 100644
> --- a/include/uapi/drm/virtgpu_drm.h
> +++ b/include/uapi/drm/virtgpu_drm.h
> @@ -52,10 +52,12 @@ extern "C" {
>  #define VIRTGPU_EXECBUF_FENCE_FD_IN    0x01
>  #define VIRTGPU_EXECBUF_FENCE_FD_OUT   0x02
>  #define VIRTGPU_EXECBUF_RING_IDX       0x04
> +#define VIRTGPU_EXECBUF_NO_EVENT       0x08
>  #define VIRTGPU_EXECBUF_FLAGS  (\
>                 VIRTGPU_EXECBUF_FENCE_FD_IN |\
>                 VIRTGPU_EXECBUF_FENCE_FD_OUT |\
>                 VIRTGPU_EXECBUF_RING_IDX |\
> +               VIRTGPU_EXECBUF_NO_EVENT |\
>                 0)
>
>  struct drm_virtgpu_map {
> --
> 2.35.1
>

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

* Re: [PATCH] drm/virtio: Add execbuf flag to request no fence-event
  2022-04-05 17:56   ` Chia-I Wu
  (?)
@ 2022-04-22 21:06     ` Rob Clark
  -1 siblings, 0 replies; 9+ messages in thread
From: Rob Clark @ 2022-04-22 21:06 UTC (permalink / raw)
  To: Chia-I Wu
  Cc: Rob Clark, David Airlie, open list, ML dri-devel,
	Gurchetan Singh, Daniel Vetter, open list:VIRTIO GPU DRIVER

On Tue, Apr 5, 2022 at 10:57 AM Chia-I Wu <olvaffe@gmail.com> wrote:
>
> On Tue, Apr 5, 2022 at 10:38 AM Rob Clark <robdclark@gmail.com> wrote:
> >
> > From: Rob Clark <robdclark@chromium.org>
> >
> > It would have been cleaner to have a flag to *request* the fence event.
> > But that ship has sailed.  So add a flag so that userspace which doesn't
> > care about the events can opt-out.
> >
> > Signed-off-by: Rob Clark <robdclark@chromium.org>
> Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
>
> Might want to wait for Gurchetan to chime in as he added the mechanism.

It turns out this patch is unnecessary.. I can simply not set
VIRTGPU_CONTEXT_PARAM_POLL_RINGS_MASK instead

so self-nak for this patch ;-)

BR,
-R

> > ---
> >  drivers/gpu/drm/virtio/virtgpu_ioctl.c | 8 +++++---
> >  include/uapi/drm/virtgpu_drm.h         | 2 ++
> >  2 files changed, 7 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/virtio/virtgpu_ioctl.c b/drivers/gpu/drm/virtio/virtgpu_ioctl.c
> > index 3a8078f2ee27..09f1aa263f91 100644
> > --- a/drivers/gpu/drm/virtio/virtgpu_ioctl.c
> > +++ b/drivers/gpu/drm/virtio/virtgpu_ioctl.c
> > @@ -225,9 +225,11 @@ static int virtio_gpu_execbuffer_ioctl(struct drm_device *dev, void *data,
> >                 goto out_unresv;
> >         }
> >
> > -       ret = virtio_gpu_fence_event_create(dev, file, out_fence, ring_idx);
> > -       if (ret)
> > -               goto out_unresv;
> > +       if (!(exbuf->flags & VIRTGPU_EXECBUF_NO_EVENT)) {
> > +               ret = virtio_gpu_fence_event_create(dev, file, out_fence, ring_idx);
> > +               if (ret)
> > +                       goto out_unresv;
> > +       }
> >
> >         if (out_fence_fd >= 0) {
> >                 sync_file = sync_file_create(&out_fence->f);
> > diff --git a/include/uapi/drm/virtgpu_drm.h b/include/uapi/drm/virtgpu_drm.h
> > index 0512fde5e697..d06cac3407cc 100644
> > --- a/include/uapi/drm/virtgpu_drm.h
> > +++ b/include/uapi/drm/virtgpu_drm.h
> > @@ -52,10 +52,12 @@ extern "C" {
> >  #define VIRTGPU_EXECBUF_FENCE_FD_IN    0x01
> >  #define VIRTGPU_EXECBUF_FENCE_FD_OUT   0x02
> >  #define VIRTGPU_EXECBUF_RING_IDX       0x04
> > +#define VIRTGPU_EXECBUF_NO_EVENT       0x08
> >  #define VIRTGPU_EXECBUF_FLAGS  (\
> >                 VIRTGPU_EXECBUF_FENCE_FD_IN |\
> >                 VIRTGPU_EXECBUF_FENCE_FD_OUT |\
> >                 VIRTGPU_EXECBUF_RING_IDX |\
> > +               VIRTGPU_EXECBUF_NO_EVENT |\
> >                 0)
> >
> >  struct drm_virtgpu_map {
> > --
> > 2.35.1
> >
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

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

* Re: [PATCH] drm/virtio: Add execbuf flag to request no fence-event
@ 2022-04-22 21:06     ` Rob Clark
  0 siblings, 0 replies; 9+ messages in thread
From: Rob Clark @ 2022-04-22 21:06 UTC (permalink / raw)
  To: Chia-I Wu
  Cc: Rob Clark, David Airlie, open list, ML dri-devel,
	Gurchetan Singh, Gerd Hoffmann, open list:VIRTIO GPU DRIVER

On Tue, Apr 5, 2022 at 10:57 AM Chia-I Wu <olvaffe@gmail.com> wrote:
>
> On Tue, Apr 5, 2022 at 10:38 AM Rob Clark <robdclark@gmail.com> wrote:
> >
> > From: Rob Clark <robdclark@chromium.org>
> >
> > It would have been cleaner to have a flag to *request* the fence event.
> > But that ship has sailed.  So add a flag so that userspace which doesn't
> > care about the events can opt-out.
> >
> > Signed-off-by: Rob Clark <robdclark@chromium.org>
> Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
>
> Might want to wait for Gurchetan to chime in as he added the mechanism.

It turns out this patch is unnecessary.. I can simply not set
VIRTGPU_CONTEXT_PARAM_POLL_RINGS_MASK instead

so self-nak for this patch ;-)

BR,
-R

> > ---
> >  drivers/gpu/drm/virtio/virtgpu_ioctl.c | 8 +++++---
> >  include/uapi/drm/virtgpu_drm.h         | 2 ++
> >  2 files changed, 7 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/virtio/virtgpu_ioctl.c b/drivers/gpu/drm/virtio/virtgpu_ioctl.c
> > index 3a8078f2ee27..09f1aa263f91 100644
> > --- a/drivers/gpu/drm/virtio/virtgpu_ioctl.c
> > +++ b/drivers/gpu/drm/virtio/virtgpu_ioctl.c
> > @@ -225,9 +225,11 @@ static int virtio_gpu_execbuffer_ioctl(struct drm_device *dev, void *data,
> >                 goto out_unresv;
> >         }
> >
> > -       ret = virtio_gpu_fence_event_create(dev, file, out_fence, ring_idx);
> > -       if (ret)
> > -               goto out_unresv;
> > +       if (!(exbuf->flags & VIRTGPU_EXECBUF_NO_EVENT)) {
> > +               ret = virtio_gpu_fence_event_create(dev, file, out_fence, ring_idx);
> > +               if (ret)
> > +                       goto out_unresv;
> > +       }
> >
> >         if (out_fence_fd >= 0) {
> >                 sync_file = sync_file_create(&out_fence->f);
> > diff --git a/include/uapi/drm/virtgpu_drm.h b/include/uapi/drm/virtgpu_drm.h
> > index 0512fde5e697..d06cac3407cc 100644
> > --- a/include/uapi/drm/virtgpu_drm.h
> > +++ b/include/uapi/drm/virtgpu_drm.h
> > @@ -52,10 +52,12 @@ extern "C" {
> >  #define VIRTGPU_EXECBUF_FENCE_FD_IN    0x01
> >  #define VIRTGPU_EXECBUF_FENCE_FD_OUT   0x02
> >  #define VIRTGPU_EXECBUF_RING_IDX       0x04
> > +#define VIRTGPU_EXECBUF_NO_EVENT       0x08
> >  #define VIRTGPU_EXECBUF_FLAGS  (\
> >                 VIRTGPU_EXECBUF_FENCE_FD_IN |\
> >                 VIRTGPU_EXECBUF_FENCE_FD_OUT |\
> >                 VIRTGPU_EXECBUF_RING_IDX |\
> > +               VIRTGPU_EXECBUF_NO_EVENT |\
> >                 0)
> >
> >  struct drm_virtgpu_map {
> > --
> > 2.35.1
> >

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

* Re: [PATCH] drm/virtio: Add execbuf flag to request no fence-event
@ 2022-04-22 21:06     ` Rob Clark
  0 siblings, 0 replies; 9+ messages in thread
From: Rob Clark @ 2022-04-22 21:06 UTC (permalink / raw)
  To: Chia-I Wu
  Cc: ML dri-devel, Rob Clark, David Airlie, Gerd Hoffmann,
	Gurchetan Singh, Daniel Vetter, open list:VIRTIO GPU DRIVER,
	open list

On Tue, Apr 5, 2022 at 10:57 AM Chia-I Wu <olvaffe@gmail.com> wrote:
>
> On Tue, Apr 5, 2022 at 10:38 AM Rob Clark <robdclark@gmail.com> wrote:
> >
> > From: Rob Clark <robdclark@chromium.org>
> >
> > It would have been cleaner to have a flag to *request* the fence event.
> > But that ship has sailed.  So add a flag so that userspace which doesn't
> > care about the events can opt-out.
> >
> > Signed-off-by: Rob Clark <robdclark@chromium.org>
> Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
>
> Might want to wait for Gurchetan to chime in as he added the mechanism.

It turns out this patch is unnecessary.. I can simply not set
VIRTGPU_CONTEXT_PARAM_POLL_RINGS_MASK instead

so self-nak for this patch ;-)

BR,
-R

> > ---
> >  drivers/gpu/drm/virtio/virtgpu_ioctl.c | 8 +++++---
> >  include/uapi/drm/virtgpu_drm.h         | 2 ++
> >  2 files changed, 7 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/virtio/virtgpu_ioctl.c b/drivers/gpu/drm/virtio/virtgpu_ioctl.c
> > index 3a8078f2ee27..09f1aa263f91 100644
> > --- a/drivers/gpu/drm/virtio/virtgpu_ioctl.c
> > +++ b/drivers/gpu/drm/virtio/virtgpu_ioctl.c
> > @@ -225,9 +225,11 @@ static int virtio_gpu_execbuffer_ioctl(struct drm_device *dev, void *data,
> >                 goto out_unresv;
> >         }
> >
> > -       ret = virtio_gpu_fence_event_create(dev, file, out_fence, ring_idx);
> > -       if (ret)
> > -               goto out_unresv;
> > +       if (!(exbuf->flags & VIRTGPU_EXECBUF_NO_EVENT)) {
> > +               ret = virtio_gpu_fence_event_create(dev, file, out_fence, ring_idx);
> > +               if (ret)
> > +                       goto out_unresv;
> > +       }
> >
> >         if (out_fence_fd >= 0) {
> >                 sync_file = sync_file_create(&out_fence->f);
> > diff --git a/include/uapi/drm/virtgpu_drm.h b/include/uapi/drm/virtgpu_drm.h
> > index 0512fde5e697..d06cac3407cc 100644
> > --- a/include/uapi/drm/virtgpu_drm.h
> > +++ b/include/uapi/drm/virtgpu_drm.h
> > @@ -52,10 +52,12 @@ extern "C" {
> >  #define VIRTGPU_EXECBUF_FENCE_FD_IN    0x01
> >  #define VIRTGPU_EXECBUF_FENCE_FD_OUT   0x02
> >  #define VIRTGPU_EXECBUF_RING_IDX       0x04
> > +#define VIRTGPU_EXECBUF_NO_EVENT       0x08
> >  #define VIRTGPU_EXECBUF_FLAGS  (\
> >                 VIRTGPU_EXECBUF_FENCE_FD_IN |\
> >                 VIRTGPU_EXECBUF_FENCE_FD_OUT |\
> >                 VIRTGPU_EXECBUF_RING_IDX |\
> > +               VIRTGPU_EXECBUF_NO_EVENT |\
> >                 0)
> >
> >  struct drm_virtgpu_map {
> > --
> > 2.35.1
> >

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

end of thread, other threads:[~2022-04-22 22:12 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-05 17:39 [PATCH] drm/virtio: Add execbuf flag to request no fence-event Rob Clark
2022-04-05 17:39 ` Rob Clark
2022-04-05 17:39 ` Rob Clark
2022-04-05 17:56 ` Chia-I Wu
2022-04-05 17:56   ` Chia-I Wu
2022-04-05 17:56   ` Chia-I Wu
2022-04-22 21:06   ` Rob Clark
2022-04-22 21:06     ` Rob Clark
2022-04-22 21:06     ` Rob Clark

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.