From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.3 required=3.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,HTML_MESSAGE,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1C06FC433DF for ; Thu, 28 May 2020 15:50:25 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DF9C32053B for ; Thu, 28 May 2020 15:50:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="CKIc32f1" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DF9C32053B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C5D786E563; Thu, 28 May 2020 15:50:23 +0000 (UTC) Received: from mail-pj1-x1042.google.com (mail-pj1-x1042.google.com [IPv6:2607:f8b0:4864:20::1042]) by gabe.freedesktop.org (Postfix) with ESMTPS id BD84B6E563 for ; Thu, 28 May 2020 15:50:22 +0000 (UTC) Received: by mail-pj1-x1042.google.com with SMTP id 5so3275063pjd.0 for ; Thu, 28 May 2020 08:50:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=MpqDAl6DQGsZ1y1jgyrpbeWW+TuMISihNRtJ7vDX0OM=; b=CKIc32f1IxNUshNnB1ZnH5uFGhjUvncdH/SIyuJBtrPqEPepUYHu8g7Hlvunx0q+rl mQ/XnGF8KdiOPXijoYinbv+IYeL4Mtp0Q0GnIZR86WWVcneeaNuWr8VJ8ctvfc3LzeFN w3bszRZ036axNZ89x6Ec3mp1j9oSI7VkhZvFsjmREeKvs3bGofj8/7jncWi5WQ0k1pEI +BCnqN97VRKvnz5IlCuH+ZRTrlZ1dlmV4HiDZ0TUGRZXOaHD7sOz7S+T+hGUbgHuGCbU k781cuyMFSv1PrhA55gApuEd3rHyf8y2DPat7hfYGm9F/CbELYfLw/OjxLFtpOw+DHO8 ienQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=MpqDAl6DQGsZ1y1jgyrpbeWW+TuMISihNRtJ7vDX0OM=; b=U+9uL4cA1fnaD3b/jOJa2/hvLK/NNa8LtGywoPqDoBinKciqkK0I3tUVy7DcRjPc50 9LKUaproPRPvP/eBk5zFH4ZYN2eM4Qm6ORbdcbiLAp/mFdySAA/Hprt821gcYjRlDpD5 0AZlU/ueaubzFqXf2ta/K54xPgwCIyapii5PMgk2Yfrp6G0e5vAiwWawzql2VK8HGxNX D3nJieVrlED5x3mdVeV+a3ZbjCZVK3snZQoCK4I/ql9vVY7DZr5zgWxv9KbQlF0xUVlh 5AA0eTJvqHn6JVx1zrk1JSnzFOEVZHFG5jplXtZ4/jB0qis9AUDj5Z57KU7AvmT/Q3Gw NfZw== X-Gm-Message-State: AOAM530o2x+eEjpRzQadv/xdXSHBMac8iZA6qPWSPJDLKznjvR6UAJLy ete0VswsqgmptRSdnglc2CuN+Ufv/qoLiSFGUfiyJQ== X-Google-Smtp-Source: ABdhPJwct+vz8FKK7KANyni+6D5RN/TqM3eNQWzV363qXEvCmMqzpV4DV3kLqo0hUK071Des53cln2QdvnfxYFaTjS0= X-Received: by 2002:a17:90a:17ed:: with SMTP id q100mr4154592pja.80.1590681022406; Thu, 28 May 2020 08:50:22 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: =?UTF-8?B?TWFyZWsgT2zFocOhaw==?= Date: Thu, 28 May 2020 11:49:46 -0400 Message-ID: Subject: Re: [PATCH v3] drm/fourcc: document modifier uniqueness requirements To: Simon Ser X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Daniel Vetter , dri-devel Content-Type: multipart/mixed; boundary="===============1812494183==" Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" --===============1812494183== Content-Type: multipart/alternative; boundary="0000000000004aa3a405a6b74955" --0000000000004aa3a405a6b74955 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On most hardware, there is a minimum pitch alignment for linear and any greater multiple of the alignment is fine. On Navi, the pitch in bytes for linear must be align(width * bpp / 8, 256). That's because the hw computes the pitch from the width and doesn't allow setting a custom pitch. For that reason, multi-GPU sharing might not be possible if the other GPU doesn't align the pitch in exactly the same way. Marek On Thu, May 28, 2020 at 10:38 AM Simon Ser wrote: > There have suggestions to bake pitch alignment, address alignement, > contiguous memory or other placement (hidden VRAM, GTT/BAR, etc) > constraints into modifiers. Last time this was brought up it seemed > like the consensus was to not allow this. Document this in drm_fourcc.h. > > There are several reasons for this. > > - Encoding all of these constraints in the modifiers would explode the > search space pretty quickly (we only have 64 bits to work with). > - Modifiers need to be unambiguous: a buffer can only have a single > modifier. > - Modifier users aren't expected to parse modifiers. > > v2: add paragraph about aliases (Daniel) > > v3: fix unrelated changes sent with the patch > > Signed-off-by: Simon Ser > Reviewed-by: Daniel Vetter > Cc: Daniel Stone > Cc: Bas Nieuwenhuizen > Cc: Dave Airlie > Cc: Marek Ol=C5=A1=C3=A1k > --- > include/uapi/drm/drm_fourcc.h | 15 +++++++++++++++ > 1 file changed, 15 insertions(+) > > diff --git a/include/uapi/drm/drm_fourcc.h b/include/uapi/drm/drm_fourcc.= h > index 490143500a50..f41fcb1ed63d 100644 > --- a/include/uapi/drm/drm_fourcc.h > +++ b/include/uapi/drm/drm_fourcc.h > @@ -58,6 +58,21 @@ extern "C" { > * may preserve meaning - such as number of planes - from the fourcc cod= e, > * whereas others may not. > * > + * Modifiers must uniquely encode buffer layout. In other words, a buffe= r > must > + * match only a single modifier. A modifier must not be a subset of > layouts of > + * another modifier. For instance, it's incorrect to encode pitch > alignment in > + * a modifier: a buffer may match a 64-pixel aligned modifier and a > 32-pixel > + * aligned modifier. That said, modifiers can have implicit minimal > + * requirements. > + * > + * For modifiers where the combination of fourcc code and modifier can > alias, > + * a canonical pair needs to be defined and used by all drivers. An > example > + * is AFBC, where both ARGB and ABGR have the exact same compressed > layout. > + * > + * Users see modifiers as opaque tokens they can check for equality and > + * intersect. Users musn't need to know to reason about the modifier val= ue > + * (i.e. users are not expected to extract information out of the > modifier). > + * > * Vendors should document their modifier usage in as much detail as > * possible, to ensure maximum compatibility across devices, drivers and > * applications. > -- > 2.26.2 > > > --0000000000004aa3a405a6b74955 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On most hardware, there is a minimum pitch alignment = for linear and any greater multiple of the alignment is fine.
On Navi, the pitch in bytes for linear must be align(width * bp= p / 8, 256). That's because the hw computes the pitch from the width an= d doesn't allow setting a custom pitch. For that reason, multi-GPU shar= ing might not be possible if the other GPU doesn't align the pitch in e= xactly the same way.

Marek

=
On Thu, Ma= y 28, 2020 at 10:38 AM Simon Ser <contact@emersion.fr> wrote:
There have suggestions to bake pitch alignment, address= alignement,
contiguous memory or other placement (hidden VRAM, GTT/BAR, etc)
constraints into modifiers. Last time this was brought up it seemed
like the consensus was to not allow this. Document this in drm_fourcc.h.
There are several reasons for this.

- Encoding all of these constraints in the modifiers would explode the
=C2=A0 search space pretty quickly (we only have 64 bits to work with).
- Modifiers need to be unambiguous: a buffer can only have a single
=C2=A0 modifier.
- Modifier users aren't expected to parse modifiers.

v2: add paragraph about aliases (Daniel)

v3: fix unrelated changes sent with the patch

Signed-off-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Daniel Stone <daniel@fooishbar.org>
Cc: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Cc: Dave Airlie <= airlied@gmail.com>
Cc: Marek Ol=C5=A1=C3=A1k <maraeo@gmail.com>
---
=C2=A0include/uapi/drm/drm_fourcc.h | 15 +++++++++++++++
=C2=A01 file changed, 15 insertions(+)

diff --git a/include/uapi/drm/drm_fourcc.h b/include/uapi/drm/drm_fourcc.h<= br> index 490143500a50..f41fcb1ed63d 100644
--- a/include/uapi/drm/drm_fourcc.h
+++ b/include/uapi/drm/drm_fourcc.h
@@ -58,6 +58,21 @@ extern "C" {
=C2=A0 * may preserve meaning - such as number of planes - from the fourcc = code,
=C2=A0 * whereas others may not.
=C2=A0 *
+ * Modifiers must uniquely encode buffer layout. In other words, a buffer = must
+ * match only a single modifier. A modifier must not be a subset of layout= s of
+ * another modifier. For instance, it's incorrect to encode pitch alig= nment in
+ * a modifier: a buffer may match a 64-pixel aligned modifier and a 32-pix= el
+ * aligned modifier. That said, modifiers can have implicit minimal
+ * requirements.
+ *
+ * For modifiers where the combination of fourcc code and modifier can ali= as,
+ * a canonical pair needs to be defined and used by all drivers. An exampl= e
+ * is AFBC, where both ARGB and ABGR have the exact same compressed layout= .
+ *
+ * Users see modifiers as opaque tokens they can check for equality and + * intersect. Users musn't need to know to reason about the modifier v= alue
+ * (i.e. users are not expected to extract information out of the modifier= ).
+ *
=C2=A0 * Vendors should document their modifier usage in as much detail as<= br> =C2=A0 * possible, to ensure maximum compatibility across devices, drivers = and
=C2=A0 * applications.
--
2.26.2


--0000000000004aa3a405a6b74955-- --===============1812494183== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel --===============1812494183==--