diff mbox series

[v2] drm: introduce a capability flag for syncobj timeline support

Message ID 20190416125750.31370-1-lionel.g.landwerlin@intel.com (mailing list archive)
State New, archived
Headers show
Series [v2] drm: introduce a capability flag for syncobj timeline support | expand

Commit Message

Lionel Landwerlin April 16, 2019, 12:57 p.m. UTC
Unfortunately userspace users of this API cannot be publicly disclosed
yet.

This commit effectively disables timeline syncobj ioctls for all
drivers. Each driver wishing to support this feature will need to
expose DRIVER_SYNCOBJ_TIMELINE.

v2: Add uAPI capability check (Christian)

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Christian König <christian.koenig@amd.com> (v1)
Cc: Dave Airlie <airlied@redhat.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Christian König <christian.koenig@amd.com>
Cc: Chunming Zhou <david1.zhou@amd.com>
---
 drivers/gpu/drm/drm_ioctl.c   |  3 +++
 drivers/gpu/drm/drm_syncobj.c | 10 +++++-----
 include/drm/drm_drv.h         |  7 +++++++
 include/uapi/drm/drm.h        |  1 +
 4 files changed, 16 insertions(+), 5 deletions(-)

Comments

Chunming Zhou April 16, 2019, 1:15 p.m. UTC | #1
Reviewed-by: Chunming Zhou <david1.zhou@amd.com> for series.

-------- Original Message --------
Subject: [PATCH v2] drm: introduce a capability flag for syncobj timeline support
From: Lionel Landwerlin
To: dri-devel@lists.freedesktop.org
CC: Lionel Landwerlin ,"Koenig, Christian" ,Dave Airlie ,Daniel Vetter ,"Zhou, David(ChunMing)"

Unfortunately userspace users of this API cannot be publicly disclosed
yet.

This commit effectively disables timeline syncobj ioctls for all
drivers. Each driver wishing to support this feature will need to
expose DRIVER_SYNCOBJ_TIMELINE.

v2: Add uAPI capability check (Christian)

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Christian König <christian.koenig@amd.com> (v1)
Cc: Dave Airlie <airlied@redhat.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Christian König <christian.koenig@amd.com>
Cc: Chunming Zhou <david1.zhou@amd.com>
---
 drivers/gpu/drm/drm_ioctl.c   |  3 +++
 drivers/gpu/drm/drm_syncobj.c | 10 +++++-----
 include/drm/drm_drv.h         |  7 +++++++
 include/uapi/drm/drm.h        |  1 +
 4 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c
index d337f161909c..15ca94338d55 100644
--- a/drivers/gpu/drm/drm_ioctl.c
+++ b/drivers/gpu/drm/drm_ioctl.c
@@ -245,6 +245,9 @@ static int drm_getcap(struct drm_device *dev, void *data, struct drm_file *file_
         case DRM_CAP_SYNCOBJ:
                 req->value = drm_core_check_feature(dev, DRIVER_SYNCOBJ);
                 return 0;
+       case DRM_CAP_SYNCOBJ_TIMELINE:
+               req->value = drm_core_check_feature(dev, DRIVER_SYNCOBJ_TIMELINE);
+               return 0;
         }

         /* Other caps only work with KMS drivers */
diff --git a/drivers/gpu/drm/drm_syncobj.c b/drivers/gpu/drm/drm_syncobj.c
index fb65f13d25cf..72a38ff6e3e4 100644
--- a/drivers/gpu/drm/drm_syncobj.c
+++ b/drivers/gpu/drm/drm_syncobj.c
@@ -755,7 +755,7 @@ drm_syncobj_transfer_ioctl(struct drm_device *dev, void *data,
         struct drm_syncobj_transfer *args = data;
         int ret;

-       if (!drm_core_check_feature(dev, DRIVER_SYNCOBJ))
+       if (!drm_core_check_feature(dev, DRIVER_SYNCOBJ_TIMELINE))
                 return -EOPNOTSUPP;

         if (args->pad)
@@ -1106,7 +1106,7 @@ drm_syncobj_timeline_wait_ioctl(struct drm_device *dev, void *data,
         struct drm_syncobj **syncobjs;
         int ret = 0;

-       if (!drm_core_check_feature(dev, DRIVER_SYNCOBJ))
+       if (!drm_core_check_feature(dev, DRIVER_SYNCOBJ_TIMELINE))
                 return -EOPNOTSUPP;

         if (args->flags & ~(DRM_SYNCOBJ_WAIT_FLAGS_WAIT_ALL |
@@ -1210,7 +1210,7 @@ drm_syncobj_timeline_signal_ioctl(struct drm_device *dev, void *data,
         uint32_t i, j;
         int ret;

-       if (!drm_core_check_feature(dev, DRIVER_SYNCOBJ))
+       if (!drm_core_check_feature(dev, DRIVER_SYNCOBJ_TIMELINE))
                 return -EOPNOTSUPP;

         if (args->pad != 0)
@@ -1281,8 +1281,8 @@ int drm_syncobj_query_ioctl(struct drm_device *dev, void *data,
         uint32_t i;
         int ret;

-       if (!drm_core_check_feature(dev, DRIVER_SYNCOBJ))
-               return -ENODEV;
+       if (!drm_core_check_feature(dev, DRIVER_SYNCOBJ_TIMELINE))
+               return -EOPNOTSUPP;

         if (args->pad != 0)
                 return -EINVAL;
diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
index 5cc7f728ec73..68ca736c548d 100644
--- a/include/drm/drm_drv.h
+++ b/include/drm/drm_drv.h
@@ -91,6 +91,13 @@ enum drm_driver_feature {
          * submission.
          */
         DRIVER_SYNCOBJ                  = BIT(5),
+       /**
+        * @DRIVER_SYNCOBJ_TIMELINE:
+        *
+        * Driver supports the timeline flavor of &drm_syncobj for explicit
+        * synchronization of command submission.
+        */
+       DRIVER_SYNCOBJ_TIMELINE         = BIT(6),

         /* IMPORTANT: Below are all the legacy flags, add new ones above. */

diff --git a/include/uapi/drm/drm.h b/include/uapi/drm/drm.h
index 236b01a1fabf..661d73f9a919 100644
--- a/include/uapi/drm/drm.h
+++ b/include/uapi/drm/drm.h
@@ -649,6 +649,7 @@ struct drm_gem_open {
 #define DRM_CAP_PAGE_FLIP_TARGET        0x11
 #define DRM_CAP_CRTC_IN_VBLANK_EVENT    0x12
 #define DRM_CAP_SYNCOBJ         0x13
+#define DRM_CAP_SYNCOBJ_TIMELINE       0x14

 /** DRM_IOCTL_GET_CAP ioctl argument type */
 struct drm_get_cap {
--
2.21.0.392.gf8f6787159e
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Generator" content="Microsoft Exchange Server">
<!-- converted from text --><style><!-- .EmailQuote { margin-left: 1pt; padding-left: 4pt; border-left: #800000 2px solid; } --></style>
</head>
<body>
<div>Reviewed-by: Chunming Zhou &lt;david1.zhou@amd.com&gt; for series.<br>
<br>
-------- Original Message --------<br>
Subject: [PATCH v2] drm: introduce a capability flag for syncobj timeline support<br>
From: Lionel Landwerlin <br>
To: dri-devel@lists.freedesktop.org<br>
CC: Lionel Landwerlin ,&quot;Koenig, Christian&quot; ,Dave Airlie ,Daniel Vetter ,&quot;Zhou, David(ChunMing)&quot;
<br>
<br>
</div>
<font size="2"><span style="font-size:11pt;">
<div class="PlainText">Unfortunately userspace users of this API cannot be publicly disclosed<br>
yet.<br>
<br>
This commit effectively disables timeline syncobj ioctls for all<br>
drivers. Each driver wishing to support this feature will need to<br>
expose DRIVER_SYNCOBJ_TIMELINE.<br>
<br>
v2: Add uAPI capability check (Christian)<br>
<br>
Signed-off-by: Lionel Landwerlin &lt;lionel.g.landwerlin@intel.com&gt;<br>
Reviewed-by: Christian König &lt;christian.koenig@amd.com&gt; (v1)<br>
Cc: Dave Airlie &lt;airlied@redhat.com&gt;<br>
Cc: Daniel Vetter &lt;daniel.vetter@ffwll.ch&gt;<br>
Cc: Christian König &lt;christian.koenig@amd.com&gt;<br>
Cc: Chunming Zhou &lt;david1.zhou@amd.com&gt;<br>
---<br>
&nbsp;drivers/gpu/drm/drm_ioctl.c&nbsp;&nbsp; |&nbsp; 3 &#43;&#43;&#43;<br>
&nbsp;drivers/gpu/drm/drm_syncobj.c | 10 &#43;&#43;&#43;&#43;&#43;-----<br>
&nbsp;include/drm/drm_drv.h&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |&nbsp; 7 &#43;&#43;&#43;&#43;&#43;&#43;&#43;<br>
&nbsp;include/uapi/drm/drm.h&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |&nbsp; 1 &#43;<br>
&nbsp;4 files changed, 16 insertions(&#43;), 5 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c<br>
index d337f161909c..15ca94338d55 100644<br>
--- a/drivers/gpu/drm/drm_ioctl.c<br>
&#43;&#43;&#43; b/drivers/gpu/drm/drm_ioctl.c<br>
@@ -245,6 &#43;245,9 @@ static int drm_getcap(struct drm_device *dev, void *data, struct drm_file *file_<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; case DRM_CAP_SYNCOBJ:<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; req-&gt;value = drm_core_check_feature(dev, DRIVER_SYNCOBJ);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return 0;<br>
&#43;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; case DRM_CAP_SYNCOBJ_TIMELINE:<br>
&#43;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; req-&gt;value = drm_core_check_feature(dev, DRIVER_SYNCOBJ_TIMELINE);<br>
&#43;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return 0;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* Other caps only work with KMS drivers */<br>
diff --git a/drivers/gpu/drm/drm_syncobj.c b/drivers/gpu/drm/drm_syncobj.c<br>
index fb65f13d25cf..72a38ff6e3e4 100644<br>
--- a/drivers/gpu/drm/drm_syncobj.c<br>
&#43;&#43;&#43; b/drivers/gpu/drm/drm_syncobj.c<br>
@@ -755,7 &#43;755,7 @@ drm_syncobj_transfer_ioctl(struct drm_device *dev, void *data,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; struct drm_syncobj_transfer *args = data;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int ret;<br>
&nbsp;<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (!drm_core_check_feature(dev, DRIVER_SYNCOBJ))<br>
&#43;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (!drm_core_check_feature(dev, DRIVER_SYNCOBJ_TIMELINE))<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return -EOPNOTSUPP;<br>
&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (args-&gt;pad)<br>
@@ -1106,7 &#43;1106,7 @@ drm_syncobj_timeline_wait_ioctl(struct drm_device *dev, void *data,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; struct drm_syncobj **syncobjs;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int ret = 0;<br>
&nbsp;<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (!drm_core_check_feature(dev, DRIVER_SYNCOBJ))<br>
&#43;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (!drm_core_check_feature(dev, DRIVER_SYNCOBJ_TIMELINE))<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return -EOPNOTSUPP;<br>
&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (args-&gt;flags &amp; ~(DRM_SYNCOBJ_WAIT_FLAGS_WAIT_ALL |<br>
@@ -1210,7 &#43;1210,7 @@ drm_syncobj_timeline_signal_ioctl(struct drm_device *dev, void *data,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; uint32_t i, j;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int ret;<br>
&nbsp;<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (!drm_core_check_feature(dev, DRIVER_SYNCOBJ))<br>
&#43;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (!drm_core_check_feature(dev, DRIVER_SYNCOBJ_TIMELINE))<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return -EOPNOTSUPP;<br>
&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (args-&gt;pad != 0)<br>
@@ -1281,8 &#43;1281,8 @@ int drm_syncobj_query_ioctl(struct drm_device *dev, void *data,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; uint32_t i;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int ret;<br>
&nbsp;<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (!drm_core_check_feature(dev, DRIVER_SYNCOBJ))<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return -ENODEV;<br>
&#43;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (!drm_core_check_feature(dev, DRIVER_SYNCOBJ_TIMELINE))<br>
&#43;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return -EOPNOTSUPP;<br>
&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (args-&gt;pad != 0)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return -EINVAL;<br>
diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h<br>
index 5cc7f728ec73..68ca736c548d 100644<br>
--- a/include/drm/drm_drv.h<br>
&#43;&#43;&#43; b/include/drm/drm_drv.h<br>
@@ -91,6 &#43;91,13 @@ enum drm_driver_feature {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * submission.<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; */<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DRIVER_SYNCOBJ&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = BIT(5),<br>
&#43;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /**<br>
&#43;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * @DRIVER_SYNCOBJ_TIMELINE:<br>
&#43;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; *<br>
&#43;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * Driver supports the timeline flavor of &amp;drm_syncobj for explicit<br>
&#43;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * synchronization of command submission.<br>
&#43;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; */<br>
&#43;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DRIVER_SYNCOBJ_TIMELINE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = BIT(6),<br>
&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* IMPORTANT: Below are all the legacy flags, add new ones above. */<br>
&nbsp;<br>
diff --git a/include/uapi/drm/drm.h b/include/uapi/drm/drm.h<br>
index 236b01a1fabf..661d73f9a919 100644<br>
--- a/include/uapi/drm/drm.h<br>
&#43;&#43;&#43; b/include/uapi/drm/drm.h<br>
@@ -649,6 &#43;649,7 @@ struct drm_gem_open {<br>
&nbsp;#define DRM_CAP_PAGE_FLIP_TARGET&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0x11<br>
&nbsp;#define DRM_CAP_CRTC_IN_VBLANK_EVENT&nbsp;&nbsp;&nbsp; 0x12<br>
&nbsp;#define DRM_CAP_SYNCOBJ&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0x13<br>
&#43;#define DRM_CAP_SYNCOBJ_TIMELINE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0x14<br>
&nbsp;<br>
&nbsp;/** DRM_IOCTL_GET_CAP ioctl argument type */<br>
&nbsp;struct drm_get_cap {<br>
-- <br>
2.21.0.392.gf8f6787159e<br>
<br>
</div>
</span></font>
</body>
</html>
Christian König April 16, 2019, 1:47 p.m. UTC | #2
I can't judge if that UAPI is actually sufficient, but the rest still 
looks good to me.

Acked-by: Christian König <christian.koenig@amd.com>

Christian.

Am 16.04.19 um 15:15 schrieb Zhou, David(ChunMing):
> Reviewed-by: Chunming Zhou <david1.zhou@amd.com> for series.
>
> -------- Original Message --------
> Subject: [PATCH v2] drm: introduce a capability flag for syncobj 
> timeline support
> From: Lionel Landwerlin
> To: dri-devel@lists.freedesktop.org
> CC: Lionel Landwerlin ,"Koenig, Christian" ,Dave Airlie ,Daniel Vetter 
> ,"Zhou, David(ChunMing)"
>
> Unfortunately userspace users of this API cannot be publicly disclosed
> yet.
>
> This commit effectively disables timeline syncobj ioctls for all
> drivers. Each driver wishing to support this feature will need to
> expose DRIVER_SYNCOBJ_TIMELINE.
>
> v2: Add uAPI capability check (Christian)
>
> Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
> Reviewed-by: Christian König <christian.koenig@amd.com> (v1)
> Cc: Dave Airlie <airlied@redhat.com>
> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> Cc: Christian König <christian.koenig@amd.com>
> Cc: Chunming Zhou <david1.zhou@amd.com>
> ---
>  drivers/gpu/drm/drm_ioctl.c   |  3 +++
>  drivers/gpu/drm/drm_syncobj.c | 10 +++++-----
>  include/drm/drm_drv.h         |  7 +++++++
>  include/uapi/drm/drm.h        |  1 +
>  4 files changed, 16 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c
> index d337f161909c..15ca94338d55 100644
> --- a/drivers/gpu/drm/drm_ioctl.c
> +++ b/drivers/gpu/drm/drm_ioctl.c
> @@ -245,6 +245,9 @@ static int drm_getcap(struct drm_device *dev, void 
> *data, struct drm_file *file_
>          case DRM_CAP_SYNCOBJ:
>                  req->value = drm_core_check_feature(dev, DRIVER_SYNCOBJ);
>                  return 0;
> +       case DRM_CAP_SYNCOBJ_TIMELINE:
> +               req->value = drm_core_check_feature(dev, 
> DRIVER_SYNCOBJ_TIMELINE);
> +               return 0;
>          }
>
>          /* Other caps only work with KMS drivers */
> diff --git a/drivers/gpu/drm/drm_syncobj.c b/drivers/gpu/drm/drm_syncobj.c
> index fb65f13d25cf..72a38ff6e3e4 100644
> --- a/drivers/gpu/drm/drm_syncobj.c
> +++ b/drivers/gpu/drm/drm_syncobj.c
> @@ -755,7 +755,7 @@ drm_syncobj_transfer_ioctl(struct drm_device *dev, 
> void *data,
>          struct drm_syncobj_transfer *args = data;
>          int ret;
>
> -       if (!drm_core_check_feature(dev, DRIVER_SYNCOBJ))
> +       if (!drm_core_check_feature(dev, DRIVER_SYNCOBJ_TIMELINE))
>                  return -EOPNOTSUPP;
>
>          if (args->pad)
> @@ -1106,7 +1106,7 @@ drm_syncobj_timeline_wait_ioctl(struct 
> drm_device *dev, void *data,
>          struct drm_syncobj **syncobjs;
>          int ret = 0;
>
> -       if (!drm_core_check_feature(dev, DRIVER_SYNCOBJ))
> +       if (!drm_core_check_feature(dev, DRIVER_SYNCOBJ_TIMELINE))
>                  return -EOPNOTSUPP;
>
>          if (args->flags & ~(DRM_SYNCOBJ_WAIT_FLAGS_WAIT_ALL |
> @@ -1210,7 +1210,7 @@ drm_syncobj_timeline_signal_ioctl(struct 
> drm_device *dev, void *data,
>          uint32_t i, j;
>          int ret;
>
> -       if (!drm_core_check_feature(dev, DRIVER_SYNCOBJ))
> +       if (!drm_core_check_feature(dev, DRIVER_SYNCOBJ_TIMELINE))
>                  return -EOPNOTSUPP;
>
>          if (args->pad != 0)
> @@ -1281,8 +1281,8 @@ int drm_syncobj_query_ioctl(struct drm_device 
> *dev, void *data,
>          uint32_t i;
>          int ret;
>
> -       if (!drm_core_check_feature(dev, DRIVER_SYNCOBJ))
> -               return -ENODEV;
> +       if (!drm_core_check_feature(dev, DRIVER_SYNCOBJ_TIMELINE))
> +               return -EOPNOTSUPP;
>
>          if (args->pad != 0)
>                  return -EINVAL;
> diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
> index 5cc7f728ec73..68ca736c548d 100644
> --- a/include/drm/drm_drv.h
> +++ b/include/drm/drm_drv.h
> @@ -91,6 +91,13 @@ enum drm_driver_feature {
>           * submission.
>           */
>          DRIVER_SYNCOBJ                  = BIT(5),
> +       /**
> +        * @DRIVER_SYNCOBJ_TIMELINE:
> +        *
> +        * Driver supports the timeline flavor of &drm_syncobj for 
> explicit
> +        * synchronization of command submission.
> +        */
> +       DRIVER_SYNCOBJ_TIMELINE         = BIT(6),
>
>          /* IMPORTANT: Below are all the legacy flags, add new ones 
> above. */
>
> diff --git a/include/uapi/drm/drm.h b/include/uapi/drm/drm.h
> index 236b01a1fabf..661d73f9a919 100644
> --- a/include/uapi/drm/drm.h
> +++ b/include/uapi/drm/drm.h
> @@ -649,6 +649,7 @@ struct drm_gem_open {
>  #define DRM_CAP_PAGE_FLIP_TARGET        0x11
>  #define DRM_CAP_CRTC_IN_VBLANK_EVENT    0x12
>  #define DRM_CAP_SYNCOBJ         0x13
> +#define DRM_CAP_SYNCOBJ_TIMELINE       0x14
>
>  /** DRM_IOCTL_GET_CAP ioctl argument type */
>  struct drm_get_cap {
> -- 
> 2.21.0.392.gf8f6787159e
>
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html;
      charset=windows-1252">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">I can't judge if that UAPI is actually
      sufficient, but the rest still looks good to me.<br>
      <br>
      Acked-by: Christian König <a class="moz-txt-link-rfc2396E" href="mailto:christian.koenig@amd.com">&lt;christian.koenig@amd.com&gt;</a><br>
      <br>
      Christian.<br>
      <br>
      Am 16.04.19 um 15:15 schrieb Zhou, David(ChunMing):<br>
    </div>
    <blockquote type="cite"
cite="mid:g473ssb6g9in1c36xw9ju8l5wdtvp-gvzol4w0y5mw-vlv3bo-vpqqv0-zerdqu2r22c19rx4b444q5wxby0nnbgied56objhf-84ko14jpv2kg-7irzs22147wm852jmw-8a0k7hka8nozq4k7d5.1555420499452@email.android.com">
      <meta http-equiv="Content-Type" content="text/html;
        charset=windows-1252">
      <meta name="Generator" content="Microsoft Exchange Server">
      <!-- converted from text -->
      <style><!-- .EmailQuote { margin-left: 1pt; padding-left: 4pt; border-left: #800000 2px solid; } --></style>
      <div>Reviewed-by: Chunming Zhou <a class="moz-txt-link-rfc2396E" href="mailto:david1.zhou@amd.com">&lt;david1.zhou@amd.com&gt;</a> for
        series.<br>
        <br>
        -------- Original Message --------<br>
        Subject: [PATCH v2] drm: introduce a capability flag for syncobj
        timeline support<br>
        From: Lionel Landwerlin <br>
        To: <a class="moz-txt-link-abbreviated" href="mailto:dri-devel@lists.freedesktop.org">dri-devel@lists.freedesktop.org</a><br>
        CC: Lionel Landwerlin ,"Koenig, Christian" ,Dave Airlie ,Daniel
        Vetter ,"Zhou, David(ChunMing)"
        <br>
        <br>
      </div>
      <font size="2"><span style="font-size:11pt;">
          <div class="PlainText">Unfortunately userspace users of this
            API cannot be publicly disclosed<br>
            yet.<br>
            <br>
            This commit effectively disables timeline syncobj ioctls for
            all<br>
            drivers. Each driver wishing to support this feature will
            need to<br>
            expose DRIVER_SYNCOBJ_TIMELINE.<br>
            <br>
            v2: Add uAPI capability check (Christian)<br>
            <br>
            Signed-off-by: Lionel Landwerlin
            <a class="moz-txt-link-rfc2396E" href="mailto:lionel.g.landwerlin@intel.com">&lt;lionel.g.landwerlin@intel.com&gt;</a><br>
            Reviewed-by: Christian König
            <a class="moz-txt-link-rfc2396E" href="mailto:christian.koenig@amd.com">&lt;christian.koenig@amd.com&gt;</a> (v1)<br>
            Cc: Dave Airlie <a class="moz-txt-link-rfc2396E" href="mailto:airlied@redhat.com">&lt;airlied@redhat.com&gt;</a><br>
            Cc: Daniel Vetter <a class="moz-txt-link-rfc2396E" href="mailto:daniel.vetter@ffwll.ch">&lt;daniel.vetter@ffwll.ch&gt;</a><br>
            Cc: Christian König <a class="moz-txt-link-rfc2396E" href="mailto:christian.koenig@amd.com">&lt;christian.koenig@amd.com&gt;</a><br>
            Cc: Chunming Zhou <a class="moz-txt-link-rfc2396E" href="mailto:david1.zhou@amd.com">&lt;david1.zhou@amd.com&gt;</a><br>
            ---<br>
             drivers/gpu/drm/drm_ioctl.c   |  3 +++<br>
             drivers/gpu/drm/drm_syncobj.c | 10 +++++-----<br>
             include/drm/drm_drv.h         |  7 +++++++<br>
             include/uapi/drm/drm.h        |  1 +<br>
             4 files changed, 16 insertions(+), 5 deletions(-)<br>
            <br>
            diff --git a/drivers/gpu/drm/drm_ioctl.c
            b/drivers/gpu/drm/drm_ioctl.c<br>
            index d337f161909c..15ca94338d55 100644<br>
            --- a/drivers/gpu/drm/drm_ioctl.c<br>
            +++ b/drivers/gpu/drm/drm_ioctl.c<br>
            @@ -245,6 +245,9 @@ static int drm_getcap(struct drm_device
            *dev, void *data, struct drm_file *file_<br>
                     case DRM_CAP_SYNCOBJ:<br>
                             req-&gt;value = drm_core_check_feature(dev,
            DRIVER_SYNCOBJ);<br>
                             return 0;<br>
            +       case DRM_CAP_SYNCOBJ_TIMELINE:<br>
            +               req-&gt;value = drm_core_check_feature(dev,
            DRIVER_SYNCOBJ_TIMELINE);<br>
            +               return 0;<br>
                     }<br>
             <br>
                     /* Other caps only work with KMS drivers */<br>
            diff --git a/drivers/gpu/drm/drm_syncobj.c
            b/drivers/gpu/drm/drm_syncobj.c<br>
            index fb65f13d25cf..72a38ff6e3e4 100644<br>
            --- a/drivers/gpu/drm/drm_syncobj.c<br>
            +++ b/drivers/gpu/drm/drm_syncobj.c<br>
            @@ -755,7 +755,7 @@ drm_syncobj_transfer_ioctl(struct
            drm_device *dev, void *data,<br>
                     struct drm_syncobj_transfer *args = data;<br>
                     int ret;<br>
             <br>
            -       if (!drm_core_check_feature(dev, DRIVER_SYNCOBJ))<br>
            +       if (!drm_core_check_feature(dev,
            DRIVER_SYNCOBJ_TIMELINE))<br>
                             return -EOPNOTSUPP;<br>
             <br>
                     if (args-&gt;pad)<br>
            @@ -1106,7 +1106,7 @@ drm_syncobj_timeline_wait_ioctl(struct
            drm_device *dev, void *data,<br>
                     struct drm_syncobj **syncobjs;<br>
                     int ret = 0;<br>
             <br>
            -       if (!drm_core_check_feature(dev, DRIVER_SYNCOBJ))<br>
            +       if (!drm_core_check_feature(dev,
            DRIVER_SYNCOBJ_TIMELINE))<br>
                             return -EOPNOTSUPP;<br>
             <br>
                     if (args-&gt;flags &amp;
            ~(DRM_SYNCOBJ_WAIT_FLAGS_WAIT_ALL |<br>
            @@ -1210,7 +1210,7 @@
            drm_syncobj_timeline_signal_ioctl(struct drm_device *dev,
            void *data,<br>
                     uint32_t i, j;<br>
                     int ret;<br>
             <br>
            -       if (!drm_core_check_feature(dev, DRIVER_SYNCOBJ))<br>
            +       if (!drm_core_check_feature(dev,
            DRIVER_SYNCOBJ_TIMELINE))<br>
                             return -EOPNOTSUPP;<br>
             <br>
                     if (args-&gt;pad != 0)<br>
            @@ -1281,8 +1281,8 @@ int drm_syncobj_query_ioctl(struct
            drm_device *dev, void *data,<br>
                     uint32_t i;<br>
                     int ret;<br>
             <br>
            -       if (!drm_core_check_feature(dev, DRIVER_SYNCOBJ))<br>
            -               return -ENODEV;<br>
            +       if (!drm_core_check_feature(dev,
            DRIVER_SYNCOBJ_TIMELINE))<br>
            +               return -EOPNOTSUPP;<br>
             <br>
                     if (args-&gt;pad != 0)<br>
                             return -EINVAL;<br>
            diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h<br>
            index 5cc7f728ec73..68ca736c548d 100644<br>
            --- a/include/drm/drm_drv.h<br>
            +++ b/include/drm/drm_drv.h<br>
            @@ -91,6 +91,13 @@ enum drm_driver_feature {<br>
                      * submission.<br>
                      */<br>
                     DRIVER_SYNCOBJ                  = BIT(5),<br>
            +       /**<br>
            +        * @DRIVER_SYNCOBJ_TIMELINE:<br>
            +        *<br>
            +        * Driver supports the timeline flavor of
            &amp;drm_syncobj for explicit<br>
            +        * synchronization of command submission.<br>
            +        */<br>
            +       DRIVER_SYNCOBJ_TIMELINE         = BIT(6),<br>
             <br>
                     /* IMPORTANT: Below are all the legacy flags, add
            new ones above. */<br>
             <br>
            diff --git a/include/uapi/drm/drm.h b/include/uapi/drm/drm.h<br>
            index 236b01a1fabf..661d73f9a919 100644<br>
            --- a/include/uapi/drm/drm.h<br>
            +++ b/include/uapi/drm/drm.h<br>
            @@ -649,6 +649,7 @@ struct drm_gem_open {<br>
             #define DRM_CAP_PAGE_FLIP_TARGET        0x11<br>
             #define DRM_CAP_CRTC_IN_VBLANK_EVENT    0x12<br>
             #define DRM_CAP_SYNCOBJ         0x13<br>
            +#define DRM_CAP_SYNCOBJ_TIMELINE       0x14<br>
             <br>
             /** DRM_IOCTL_GET_CAP ioctl argument type */<br>
             struct drm_get_cap {<br>
            -- <br>
            2.21.0.392.gf8f6787159e<br>
            <br>
          </div>
        </span></font>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
dri-devel mailing list
<a class="moz-txt-link-abbreviated" href="mailto:dri-devel@lists.freedesktop.org">dri-devel@lists.freedesktop.org</a>
<a class="moz-txt-link-freetext" href="https://lists.freedesktop.org/mailman/listinfo/dri-devel">https://lists.freedesktop.org/mailman/listinfo/dri-devel</a></pre>
    </blockquote>
    <br>
  </body>
</html>
Dave Airlie April 16, 2019, 7:53 p.m. UTC | #3
On Tue, 16 Apr 2019 at 22:58, Lionel Landwerlin
<lionel.g.landwerlin@intel.com> wrote:
>
> Unfortunately userspace users of this API cannot be publicly disclosed
> yet.
>
> This commit effectively disables timeline syncobj ioctls for all
> drivers. Each driver wishing to support this feature will need to
> expose DRIVER_SYNCOBJ_TIMELINE.
>
> v2: Add uAPI capability check (Christian)
>
> Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
> Reviewed-by: Christian König <christian.koenig@amd.com> (v1)
> Cc: Dave Airlie <airlied@redhat.com>
> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> Cc: Christian König <christian.koenig@amd.com>
> Cc: Chunming Zhou <david1.zhou@amd.com>

LGTM,

Reviewed-by: Dave Airlie <airlied@redhat.com>

Not sure if I'm due anymore misc-next pulls, if so would be good to
have it go that way, but otherwise I can pull it into -next when I get
some time.

Dave.
Lionel Landwerlin May 1, 2019, 9 a.m. UTC | #4
On 16/04/2019 20:53, Dave Airlie wrote:
> On Tue, 16 Apr 2019 at 22:58, Lionel Landwerlin
> <lionel.g.landwerlin@intel.com> wrote:
>> Unfortunately userspace users of this API cannot be publicly disclosed
>> yet.
>>
>> This commit effectively disables timeline syncobj ioctls for all
>> drivers. Each driver wishing to support this feature will need to
>> expose DRIVER_SYNCOBJ_TIMELINE.
>>
>> v2: Add uAPI capability check (Christian)
>>
>> Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
>> Reviewed-by: Christian König <christian.koenig@amd.com> (v1)
>> Cc: Dave Airlie <airlied@redhat.com>
>> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
>> Cc: Christian König <christian.koenig@amd.com>
>> Cc: Chunming Zhou <david1.zhou@amd.com>
> LGTM,
>
> Reviewed-by: Dave Airlie <airlied@redhat.com>
>
> Not sure if I'm due anymore misc-next pulls, if so would be good to
> have it go that way, but otherwise I can pull it into -next when I get
> some time.
>
> Dave.
>
Christian, Dave,

Who should pull these patches in?

Thanks,

-Lionel
diff mbox series

Patch

diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c
index d337f161909c..15ca94338d55 100644
--- a/drivers/gpu/drm/drm_ioctl.c
+++ b/drivers/gpu/drm/drm_ioctl.c
@@ -245,6 +245,9 @@  static int drm_getcap(struct drm_device *dev, void *data, struct drm_file *file_
 	case DRM_CAP_SYNCOBJ:
 		req->value = drm_core_check_feature(dev, DRIVER_SYNCOBJ);
 		return 0;
+	case DRM_CAP_SYNCOBJ_TIMELINE:
+		req->value = drm_core_check_feature(dev, DRIVER_SYNCOBJ_TIMELINE);
+		return 0;
 	}
 
 	/* Other caps only work with KMS drivers */
diff --git a/drivers/gpu/drm/drm_syncobj.c b/drivers/gpu/drm/drm_syncobj.c
index fb65f13d25cf..72a38ff6e3e4 100644
--- a/drivers/gpu/drm/drm_syncobj.c
+++ b/drivers/gpu/drm/drm_syncobj.c
@@ -755,7 +755,7 @@  drm_syncobj_transfer_ioctl(struct drm_device *dev, void *data,
 	struct drm_syncobj_transfer *args = data;
 	int ret;
 
-	if (!drm_core_check_feature(dev, DRIVER_SYNCOBJ))
+	if (!drm_core_check_feature(dev, DRIVER_SYNCOBJ_TIMELINE))
 		return -EOPNOTSUPP;
 
 	if (args->pad)
@@ -1106,7 +1106,7 @@  drm_syncobj_timeline_wait_ioctl(struct drm_device *dev, void *data,
 	struct drm_syncobj **syncobjs;
 	int ret = 0;
 
-	if (!drm_core_check_feature(dev, DRIVER_SYNCOBJ))
+	if (!drm_core_check_feature(dev, DRIVER_SYNCOBJ_TIMELINE))
 		return -EOPNOTSUPP;
 
 	if (args->flags & ~(DRM_SYNCOBJ_WAIT_FLAGS_WAIT_ALL |
@@ -1210,7 +1210,7 @@  drm_syncobj_timeline_signal_ioctl(struct drm_device *dev, void *data,
 	uint32_t i, j;
 	int ret;
 
-	if (!drm_core_check_feature(dev, DRIVER_SYNCOBJ))
+	if (!drm_core_check_feature(dev, DRIVER_SYNCOBJ_TIMELINE))
 		return -EOPNOTSUPP;
 
 	if (args->pad != 0)
@@ -1281,8 +1281,8 @@  int drm_syncobj_query_ioctl(struct drm_device *dev, void *data,
 	uint32_t i;
 	int ret;
 
-	if (!drm_core_check_feature(dev, DRIVER_SYNCOBJ))
-		return -ENODEV;
+	if (!drm_core_check_feature(dev, DRIVER_SYNCOBJ_TIMELINE))
+		return -EOPNOTSUPP;
 
 	if (args->pad != 0)
 		return -EINVAL;
diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
index 5cc7f728ec73..68ca736c548d 100644
--- a/include/drm/drm_drv.h
+++ b/include/drm/drm_drv.h
@@ -91,6 +91,13 @@  enum drm_driver_feature {
 	 * submission.
 	 */
 	DRIVER_SYNCOBJ                  = BIT(5),
+	/**
+	 * @DRIVER_SYNCOBJ_TIMELINE:
+	 *
+	 * Driver supports the timeline flavor of &drm_syncobj for explicit
+	 * synchronization of command submission.
+	 */
+	DRIVER_SYNCOBJ_TIMELINE         = BIT(6),
 
 	/* IMPORTANT: Below are all the legacy flags, add new ones above. */
 
diff --git a/include/uapi/drm/drm.h b/include/uapi/drm/drm.h
index 236b01a1fabf..661d73f9a919 100644
--- a/include/uapi/drm/drm.h
+++ b/include/uapi/drm/drm.h
@@ -649,6 +649,7 @@  struct drm_gem_open {
 #define DRM_CAP_PAGE_FLIP_TARGET	0x11
 #define DRM_CAP_CRTC_IN_VBLANK_EVENT	0x12
 #define DRM_CAP_SYNCOBJ		0x13
+#define DRM_CAP_SYNCOBJ_TIMELINE	0x14
 
 /** DRM_IOCTL_GET_CAP ioctl argument type */
 struct drm_get_cap {