[v2] linux-dmabuf: clarify DRM_FORMAT_MOD_INVALID

Submitted by Chia-I Wu on April 16, 2019, 5:06 p.m.

Details

Message ID 20190416170643.251377-1-olvaffe@gmail.com
State Superseded
Headers show
Series "linux-dmabuf: clarify DRM_FORMAT_MOD_INVALID" ( rev: 2 ) in Wayland

Not browsing as part of any series.

Commit Message

Chia-I Wu April 16, 2019, 5:06 p.m.
DRM_FORMAT_MOD_INVALID means to derive the modifier from the dmabuf.
It provides legacy support and makes it easier to replace wl_drm.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
---
 .../linux-dmabuf/linux-dmabuf-unstable-v1.xml    | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/unstable/linux-dmabuf/linux-dmabuf-unstable-v1.xml b/unstable/linux-dmabuf/linux-dmabuf-unstable-v1.xml
index 154afe2..e1ac82f 100644
--- a/unstable/linux-dmabuf/linux-dmabuf-unstable-v1.xml
+++ b/unstable/linux-dmabuf/linux-dmabuf-unstable-v1.xml
@@ -28,6 +28,7 @@ 
     <description summary="factory for creating dmabuf-based wl_buffers">
       Following the interfaces from:
       https://www.khronos.org/registry/egl/extensions/EXT/EGL_EXT_image_dma_buf_import.txt
+      https://www.khronos.org/registry/EGL/extensions/EXT/EGL_EXT_image_dma_buf_import_modifiers.txt
       and the Linux DRM sub-system's AddFb2 ioctl.
 
       This interface offers ways to create generic dmabuf-based
@@ -129,8 +130,16 @@ 
         binds to this interface. A roundtrip after binding guarantees that
         the client has received all supported format-modifier pairs.
 
+        For legacy support, DRM_FORMAT_MOD_INVALID (that is, modifier_hi ==
+        0x00ffffff and modifier_lo == 0xffffffff) is considered a valid
+        modifier. It indicates that the server can support the format with an
+        implicit modifier. When a plane has DRM_FORMAT_MOD_INVALID as its
+        modifier, the effective modifier will be derived from the dmabuf
+        rather than the explicitly specified value.
+
         For the definition of the format and modifier codes, see the
-        zwp_linux_buffer_params_v1::create request.
+        zwp_linux_buffer_params_v1::create and zwp_linux_buffer_params_v1::add
+        requests.
       </description>
       <arg name="format" type="uint" summary="DRM_FORMAT code"/>
       <arg name="modifier_hi" type="uint"
@@ -197,6 +206,11 @@ 
         compression, etc. driver-specific modifications to the base format
         defined by the DRM fourcc code.
 
+        Warning: It should be an error if the format/modifier pair was not
+        advertised with the modifier event. This is not enforced yet because
+        some implementations always accept DRM_FORMAT_MOD_INVALID. Also
+        version 2 of this protocol does not have the modifier event.
+
         This request raises the PLANE_IDX error if plane_idx is too large.
         The error PLANE_SET is raised if attempting to set a plane that
         was already set.

Comments

On Tuesday, April 16, 2019 8:06 PM, Chia-I Wu <olvaffe@gmail.com> wrote:
> DRM_FORMAT_MOD_INVALID means to derive the modifier from the dmabuf.
> It provides legacy support and makes it easier to replace wl_drm.
>
> Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
> ---
>  .../linux-dmabuf/linux-dmabuf-unstable-v1.xml    | 16 +++++++++++++++-
>  1 file changed, 15 insertions(+), 1 deletion(-)
>
> diff --git a/unstable/linux-dmabuf/linux-dmabuf-unstable-v1.xml b/unstable/linux-dmabuf/linux-dmabuf-unstable-v1.xml
> index 154afe2..e1ac82f 100644
> --- a/unstable/linux-dmabuf/linux-dmabuf-unstable-v1.xml
> +++ b/unstable/linux-dmabuf/linux-dmabuf-unstable-v1.xml
> @@ -28,6 +28,7 @@
>      <description summary="factory for creating dmabuf-based wl_buffers">
>        Following the interfaces from:
>        https://www.khronos.org/registry/egl/extensions/EXT/EGL_EXT_image_dma_buf_import.txt
> +      https://www.khronos.org/registry/EGL/extensions/EXT/EGL_EXT_image_dma_buf_import_modifiers.txt
>        and the Linux DRM sub-system's AddFb2 ioctl.
>
>        This interface offers ways to create generic dmabuf-based
> @@ -129,8 +130,16 @@
>          binds to this interface. A roundtrip after binding guarantees that
>          the client has received all supported format-modifier pairs.
>
> +        For legacy support, DRM_FORMAT_MOD_INVALID (that is, modifier_hi ==
> +        0x00ffffff and modifier_lo == 0xffffffff) is considered a valid
> +        modifier. It indicates that the server can support the format with an
> +        implicit modifier. When a plane has DRM_FORMAT_MOD_INVALID as its
> +        modifier, the effective modifier will be derived from the dmabuf
> +        rather than the explicitly specified value.

"DRM_FORMAT_MOD_INVALID is […] valid […]": the wording is a little weird.

>          For the definition of the format and modifier codes, see the
> -        zwp_linux_buffer_params_v1::create request.
> +        zwp_linux_buffer_params_v1::create and zwp_linux_buffer_params_v1::add
> +        requests.
>        </description>
>        <arg name="format" type="uint" summary="DRM_FORMAT code"/>
>        <arg name="modifier_hi" type="uint"
> @@ -197,6 +206,11 @@
>          compression, etc. driver-specific modifications to the base format
>          defined by the DRM fourcc code.
>
> +        Warning: It should be an error if the format/modifier pair was not
> +        advertised with the modifier event. This is not enforced yet because
> +        some implementations always accept DRM_FORMAT_MOD_INVALID. Also
> +        version 2 of this protocol does not have the modifier event.

I thought the plan was to bump the version to make it a protocol error?

>          This request raises the PLANE_IDX error if plane_idx is too large.
>          The error PLANE_SET is raised if attempting to set a plane that
>          was already set.
> --
> 2.21.0.392.gf8f6787159e-goog
On Tue, Apr 16, 2019 at 11:54 AM Simon Ser <contact@emersion.fr> wrote:
>
> On Tuesday, April 16, 2019 8:06 PM, Chia-I Wu <olvaffe@gmail.com> wrote:
> > DRM_FORMAT_MOD_INVALID means to derive the modifier from the dmabuf.
> > It provides legacy support and makes it easier to replace wl_drm.
> >
> > Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
> > ---
> >  .../linux-dmabuf/linux-dmabuf-unstable-v1.xml    | 16 +++++++++++++++-
> >  1 file changed, 15 insertions(+), 1 deletion(-)
> >
> > diff --git a/unstable/linux-dmabuf/linux-dmabuf-unstable-v1.xml b/unstable/linux-dmabuf/linux-dmabuf-unstable-v1.xml
> > index 154afe2..e1ac82f 100644
> > --- a/unstable/linux-dmabuf/linux-dmabuf-unstable-v1.xml
> > +++ b/unstable/linux-dmabuf/linux-dmabuf-unstable-v1.xml
> > @@ -28,6 +28,7 @@
> >      <description summary="factory for creating dmabuf-based wl_buffers">
> >        Following the interfaces from:
> >        https://www.khronos.org/registry/egl/extensions/EXT/EGL_EXT_image_dma_buf_import.txt
> > +      https://www.khronos.org/registry/EGL/extensions/EXT/EGL_EXT_image_dma_buf_import_modifiers.txt
> >        and the Linux DRM sub-system's AddFb2 ioctl.
> >
> >        This interface offers ways to create generic dmabuf-based
> > @@ -129,8 +130,16 @@
> >          binds to this interface. A roundtrip after binding guarantees that
> >          the client has received all supported format-modifier pairs.
> >
> > +        For legacy support, DRM_FORMAT_MOD_INVALID (that is, modifier_hi ==
> > +        0x00ffffff and modifier_lo == 0xffffffff) is considered a valid
> > +        modifier. It indicates that the server can support the format with an
> > +        implicit modifier. When a plane has DRM_FORMAT_MOD_INVALID as its
> > +        modifier, the effective modifier will be derived from the dmabuf
> > +        rather than the explicitly specified value.
>
> "DRM_FORMAT_MOD_INVALID is […] valid […]": the wording is a little weird.
Done.
>
> >          For the definition of the format and modifier codes, see the
> > -        zwp_linux_buffer_params_v1::create request.
> > +        zwp_linux_buffer_params_v1::create and zwp_linux_buffer_params_v1::add
> > +        requests.
> >        </description>
> >        <arg name="format" type="uint" summary="DRM_FORMAT code"/>
> >        <arg name="modifier_hi" type="uint"
> > @@ -197,6 +206,11 @@
> >          compression, etc. driver-specific modifications to the base format
> >          defined by the DRM fourcc code.
> >
> > +        Warning: It should be an error if the format/modifier pair was not
> > +        advertised with the modifier event. This is not enforced yet because
> > +        some implementations always accept DRM_FORMAT_MOD_INVALID. Also
> > +        version 2 of this protocol does not have the modifier event.
>
> I thought the plan was to bump the version to make it a protocol error?
Done.

I wanted to avoid bumping because DRM_FORMAT_MOD_INVALID is not
defined in v3, and Mesa EGL and XWayland do not use
DRM_FORMAT_MOD_INVALID.  It is more an undocumented extension in
Weston that has few (or no) users.


>
> >          This request raises the PLANE_IDX error if plane_idx is too large.
> >          The error PLANE_SET is raised if attempting to set a plane that
> >          was already set.
> > --
> > 2.21.0.392.gf8f6787159e-goog

On Wednesday, April 17, 2019 1:54 PM, Pekka Paalanen <ppaalanen@gmail.com> wrote:
> > I thought the plan was to bump the version to make it a protocol error?
>
> I didn't think it was. The idea was just to clarify existing protocol,
> not bump the revision to introduce new semantics.
>
> The v2 patch looks fine to me.

Ah, okay. I probably mixed things up.

On Wednesday, April 17, 2019 2:10 PM, Pekka Paalanen <ppaalanen@gmail.com> wrote:
> On Tue, 16 Apr 2019 10:06:43 -0700
> Chia-I Wu <olvaffe@gmail.com> wrote:
>
> > DRM_FORMAT_MOD_INVALID means to derive the modifier from the dmabuf.
> > It provides legacy support and makes it easier to replace wl_drm.
> >
> > Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
> > ---
> >  .../linux-dmabuf/linux-dmabuf-unstable-v1.xml    | 16 +++++++++++++++-
> >  1 file changed, 15 insertions(+), 1 deletion(-)
> >
> > diff --git a/unstable/linux-dmabuf/linux-dmabuf-unstable-v1.xml b/unstable/linux-dmabuf/linux-dmabuf-unstable-v1.xml
> > index 154afe2..e1ac82f 100644
> > --- a/unstable/linux-dmabuf/linux-dmabuf-unstable-v1.xml
> > +++ b/unstable/linux-dmabuf/linux-dmabuf-unstable-v1.xml
> > @@ -28,6 +28,7 @@
> >      <description summary="factory for creating dmabuf-based wl_buffers">
> >        Following the interfaces from:
> >        https://www.khronos.org/registry/egl/extensions/EXT/EGL_EXT_image_dma_buf_import.txt
> > +      https://www.khronos.org/registry/EGL/extensions/EXT/EGL_EXT_image_dma_buf_import_modifiers.txt
> >        and the Linux DRM sub-system's AddFb2 ioctl.
> >
> >        This interface offers ways to create generic dmabuf-based
> > @@ -129,8 +130,16 @@
> >          binds to this interface. A roundtrip after binding guarantees that
> >          the client has received all supported format-modifier pairs.
> >
> > +        For legacy support, DRM_FORMAT_MOD_INVALID (that is, modifier_hi ==
> > +        0x00ffffff and modifier_lo == 0xffffffff) is considered a valid
> > +        modifier. It indicates that the server can support the format with an
> > +        implicit modifier. When a plane has DRM_FORMAT_MOD_INVALID as its
> > +        modifier, the effective modifier will be derived from the dmabuf
> > +        rather than the explicitly specified value.
> > +
> >          For the definition of the format and modifier codes, see the
> > -        zwp_linux_buffer_params_v1::create request.
> > +        zwp_linux_buffer_params_v1::create and zwp_linux_buffer_params_v1::add
> > +        requests.
> >        </description>
> >        <arg name="format" type="uint" summary="DRM_FORMAT code"/>
> >        <arg name="modifier_hi" type="uint"
> > @@ -197,6 +206,11 @@
> >          compression, etc. driver-specific modifications to the base format
> >          defined by the DRM fourcc code.
> >
> > +        Warning: It should be an error if the format/modifier pair was not
> > +        advertised with the modifier event. This is not enforced yet because
> > +        some implementations always accept DRM_FORMAT_MOD_INVALID. Also
> > +        version 2 of this protocol does not have the modifier event.
> > +
> >          This request raises the PLANE_IDX error if plane_idx is too large.
> >          The error PLANE_SET is raised if attempting to set a plane that
> >          was already set.
>
> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.com>
>
> I'm also ok with the patch v3 wording:
>
> +        For legacy support, DRM_FORMAT_MOD_INVALID (that is, modifier_hi ==
> +        0x00ffffff and modifier_lo == 0xffffffff) is allowed in this event.
> +        It indicates that the server can support the format with an implicit
> +        modifier. When a plane has DRM_FORMAT_MOD_INVALID as its modifier, it
> +        is as if no explicit modifier is specified. The effective modifier
> +        will be derived from the dmabuf.

With the wording:

Reviewed-by: Simon Ser <contact@emersion.fr>