All of lore.kernel.org
 help / color / mirror / Atom feed
From: "José Expósito" <jose.exposito89@gmail.com>
To: contact@emersion.fr
Cc: dmitry.baryshkov@linaro.org, maarten.lankhorst@linux.intel.com,
	mripard@kernel.org, tzimmermann@suse.de, airlied@linux.ie,
	daniel@ffwll.ch, jani.nikula@linux.intel.com,
	joonas.lahtinen@linux.intel.com, rodrigo.vivi@intel.com,
	marex@denx.de, stefan@agner.ch, shawnguo@kernel.org,
	s.hauer@pengutronix.de, kernel@pengutronix.de,
	festevam@gmail.com, linux-imx@nxp.com,
	yannick.fertre@foss.st.com, philippe.cornu@foss.st.com,
	benjamin.gaignard@linaro.org, mcoquelin.stm32@gmail.com,
	alexandre.torgue@foss.st.com, dri-devel@lists.freedesktop.org,
	linux-kernel@vger.kernel.org, intel-gfx@lists.freedesktop.org,
	linux-arm-kernel@lists.infradead.org,
	linux-stm32@st-md-mailman.stormreply.com,
	"José Expósito" <jose.exposito89@gmail.com>
Subject: [PATCH v2 1/6] drm/plane: Make format_mod_supported truly optional
Date: Wed, 22 Dec 2021 10:05:47 +0100	[thread overview]
Message-ID: <20211222090552.25972-2-jose.exposito89@gmail.com> (raw)
In-Reply-To: <20211222090552.25972-1-jose.exposito89@gmail.com>

The documentation for "drm_plane_funcs.format_mod_supported" reads:

  This *optional* hook is used for the DRM to determine if the given
  format/modifier combination is valid for the plane. This allows the
  DRM to generate the correct format bitmask (which formats apply to
  which modifier), and to validate modifiers at atomic_check time.

  *If not present*, then any modifier in the plane's modifier
  list is allowed with any of the plane's formats.

However, where the function is not present, an invalid IN_FORMATS blob
property with modifiers but no formats is exposed to user-space.

This breaks the latest Weston [1]. For testing purposes, I extracted the
affected code to a standalone program [2].

Make "create_in_format_blob" behave as documented.

[1] https://gitlab.freedesktop.org/wayland/weston/-/blob/9.0/libweston/backend-drm/kms.c#L431
[2] https://github.com/JoseExposito/drm-sandbox/blob/main/in_formats.c

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
---
 drivers/gpu/drm/drm_plane.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
index 82afb854141b..c1186b7215ee 100644
--- a/drivers/gpu/drm/drm_plane.c
+++ b/drivers/gpu/drm/drm_plane.c
@@ -202,17 +202,13 @@ static int create_in_format_blob(struct drm_device *dev, struct drm_plane *plane
 
 	memcpy(formats_ptr(blob_data), plane->format_types, formats_size);
 
-	/* If we can't determine support, just bail */
-	if (!plane->funcs->format_mod_supported)
-		goto done;
-
 	mod = modifiers_ptr(blob_data);
 	for (i = 0; i < plane->modifier_count; i++) {
 		for (j = 0; j < plane->format_count; j++) {
-			if (plane->funcs->format_mod_supported(plane,
+			if (!plane->funcs->format_mod_supported ||
+			    plane->funcs->format_mod_supported(plane,
 							       plane->format_types[j],
 							       plane->modifiers[i])) {
-
 				mod->formats |= 1ULL << j;
 			}
 		}
-- 
2.25.1


WARNING: multiple messages have this Message-ID (diff)
From: "José Expósito" <jose.exposito89@gmail.com>
To: contact@emersion.fr
Cc: airlied@linux.ie, alexandre.torgue@foss.st.com,
	benjamin.gaignard@linaro.org,
	linux-stm32@st-md-mailman.stormreply.com, marex@denx.de,
	linux-imx@nxp.com, intel-gfx@lists.freedesktop.org,
	tzimmermann@suse.de, s.hauer@pengutronix.de,
	rodrigo.vivi@intel.com, kernel@pengutronix.de,
	linux-arm-kernel@lists.infradead.org,
	dri-devel@lists.freedesktop.org, yannick.fertre@foss.st.com,
	linux-kernel@vger.kernel.org, philippe.cornu@foss.st.com,
	mcoquelin.stm32@gmail.com, dmitry.baryshkov@linaro.org,
	"José Expósito" <jose.exposito89@gmail.com>,
	shawnguo@kernel.org
Subject: [PATCH v2 1/6] drm/plane: Make format_mod_supported truly optional
Date: Wed, 22 Dec 2021 10:05:47 +0100	[thread overview]
Message-ID: <20211222090552.25972-2-jose.exposito89@gmail.com> (raw)
In-Reply-To: <20211222090552.25972-1-jose.exposito89@gmail.com>

The documentation for "drm_plane_funcs.format_mod_supported" reads:

  This *optional* hook is used for the DRM to determine if the given
  format/modifier combination is valid for the plane. This allows the
  DRM to generate the correct format bitmask (which formats apply to
  which modifier), and to validate modifiers at atomic_check time.

  *If not present*, then any modifier in the plane's modifier
  list is allowed with any of the plane's formats.

However, where the function is not present, an invalid IN_FORMATS blob
property with modifiers but no formats is exposed to user-space.

This breaks the latest Weston [1]. For testing purposes, I extracted the
affected code to a standalone program [2].

Make "create_in_format_blob" behave as documented.

[1] https://gitlab.freedesktop.org/wayland/weston/-/blob/9.0/libweston/backend-drm/kms.c#L431
[2] https://github.com/JoseExposito/drm-sandbox/blob/main/in_formats.c

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
---
 drivers/gpu/drm/drm_plane.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
index 82afb854141b..c1186b7215ee 100644
--- a/drivers/gpu/drm/drm_plane.c
+++ b/drivers/gpu/drm/drm_plane.c
@@ -202,17 +202,13 @@ static int create_in_format_blob(struct drm_device *dev, struct drm_plane *plane
 
 	memcpy(formats_ptr(blob_data), plane->format_types, formats_size);
 
-	/* If we can't determine support, just bail */
-	if (!plane->funcs->format_mod_supported)
-		goto done;
-
 	mod = modifiers_ptr(blob_data);
 	for (i = 0; i < plane->modifier_count; i++) {
 		for (j = 0; j < plane->format_count; j++) {
-			if (plane->funcs->format_mod_supported(plane,
+			if (!plane->funcs->format_mod_supported ||
+			    plane->funcs->format_mod_supported(plane,
 							       plane->format_types[j],
 							       plane->modifiers[i])) {
-
 				mod->formats |= 1ULL << j;
 			}
 		}
-- 
2.25.1


WARNING: multiple messages have this Message-ID (diff)
From: "José Expósito" <jose.exposito89@gmail.com>
To: contact@emersion.fr
Cc: dmitry.baryshkov@linaro.org, maarten.lankhorst@linux.intel.com,
	mripard@kernel.org, tzimmermann@suse.de, airlied@linux.ie,
	daniel@ffwll.ch, jani.nikula@linux.intel.com,
	joonas.lahtinen@linux.intel.com, rodrigo.vivi@intel.com,
	marex@denx.de, stefan@agner.ch, shawnguo@kernel.org,
	s.hauer@pengutronix.de, kernel@pengutronix.de,
	festevam@gmail.com, linux-imx@nxp.com,
	yannick.fertre@foss.st.com, philippe.cornu@foss.st.com,
	benjamin.gaignard@linaro.org, mcoquelin.stm32@gmail.com,
	alexandre.torgue@foss.st.com, dri-devel@lists.freedesktop.org,
	linux-kernel@vger.kernel.org, intel-gfx@lists.freedesktop.org,
	linux-arm-kernel@lists.infradead.org,
	linux-stm32@st-md-mailman.stormreply.com,
	"José Expósito" <jose.exposito89@gmail.com>
Subject: [PATCH v2 1/6] drm/plane: Make format_mod_supported truly optional
Date: Wed, 22 Dec 2021 10:05:47 +0100	[thread overview]
Message-ID: <20211222090552.25972-2-jose.exposito89@gmail.com> (raw)
In-Reply-To: <20211222090552.25972-1-jose.exposito89@gmail.com>

The documentation for "drm_plane_funcs.format_mod_supported" reads:

  This *optional* hook is used for the DRM to determine if the given
  format/modifier combination is valid for the plane. This allows the
  DRM to generate the correct format bitmask (which formats apply to
  which modifier), and to validate modifiers at atomic_check time.

  *If not present*, then any modifier in the plane's modifier
  list is allowed with any of the plane's formats.

However, where the function is not present, an invalid IN_FORMATS blob
property with modifiers but no formats is exposed to user-space.

This breaks the latest Weston [1]. For testing purposes, I extracted the
affected code to a standalone program [2].

Make "create_in_format_blob" behave as documented.

[1] https://gitlab.freedesktop.org/wayland/weston/-/blob/9.0/libweston/backend-drm/kms.c#L431
[2] https://github.com/JoseExposito/drm-sandbox/blob/main/in_formats.c

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
---
 drivers/gpu/drm/drm_plane.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
index 82afb854141b..c1186b7215ee 100644
--- a/drivers/gpu/drm/drm_plane.c
+++ b/drivers/gpu/drm/drm_plane.c
@@ -202,17 +202,13 @@ static int create_in_format_blob(struct drm_device *dev, struct drm_plane *plane
 
 	memcpy(formats_ptr(blob_data), plane->format_types, formats_size);
 
-	/* If we can't determine support, just bail */
-	if (!plane->funcs->format_mod_supported)
-		goto done;
-
 	mod = modifiers_ptr(blob_data);
 	for (i = 0; i < plane->modifier_count; i++) {
 		for (j = 0; j < plane->format_count; j++) {
-			if (plane->funcs->format_mod_supported(plane,
+			if (!plane->funcs->format_mod_supported ||
+			    plane->funcs->format_mod_supported(plane,
 							       plane->format_types[j],
 							       plane->modifiers[i])) {
-
 				mod->formats |= 1ULL << j;
 			}
 		}
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

WARNING: multiple messages have this Message-ID (diff)
From: "José Expósito" <jose.exposito89@gmail.com>
To: contact@emersion.fr
Cc: airlied@linux.ie, alexandre.torgue@foss.st.com, stefan@agner.ch,
	benjamin.gaignard@linaro.org, festevam@gmail.com,
	linux-stm32@st-md-mailman.stormreply.com, marex@denx.de,
	linux-imx@nxp.com, intel-gfx@lists.freedesktop.org,
	tzimmermann@suse.de, s.hauer@pengutronix.de, mripard@kernel.org,
	kernel@pengutronix.de, linux-arm-kernel@lists.infradead.org,
	dri-devel@lists.freedesktop.org, yannick.fertre@foss.st.com,
	linux-kernel@vger.kernel.org, philippe.cornu@foss.st.com,
	mcoquelin.stm32@gmail.com, dmitry.baryshkov@linaro.org,
	"José Expósito" <jose.exposito89@gmail.com>,
	shawnguo@kernel.org
Subject: [Intel-gfx] [PATCH v2 1/6] drm/plane: Make format_mod_supported truly optional
Date: Wed, 22 Dec 2021 10:05:47 +0100	[thread overview]
Message-ID: <20211222090552.25972-2-jose.exposito89@gmail.com> (raw)
In-Reply-To: <20211222090552.25972-1-jose.exposito89@gmail.com>

The documentation for "drm_plane_funcs.format_mod_supported" reads:

  This *optional* hook is used for the DRM to determine if the given
  format/modifier combination is valid for the plane. This allows the
  DRM to generate the correct format bitmask (which formats apply to
  which modifier), and to validate modifiers at atomic_check time.

  *If not present*, then any modifier in the plane's modifier
  list is allowed with any of the plane's formats.

However, where the function is not present, an invalid IN_FORMATS blob
property with modifiers but no formats is exposed to user-space.

This breaks the latest Weston [1]. For testing purposes, I extracted the
affected code to a standalone program [2].

Make "create_in_format_blob" behave as documented.

[1] https://gitlab.freedesktop.org/wayland/weston/-/blob/9.0/libweston/backend-drm/kms.c#L431
[2] https://github.com/JoseExposito/drm-sandbox/blob/main/in_formats.c

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
---
 drivers/gpu/drm/drm_plane.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
index 82afb854141b..c1186b7215ee 100644
--- a/drivers/gpu/drm/drm_plane.c
+++ b/drivers/gpu/drm/drm_plane.c
@@ -202,17 +202,13 @@ static int create_in_format_blob(struct drm_device *dev, struct drm_plane *plane
 
 	memcpy(formats_ptr(blob_data), plane->format_types, formats_size);
 
-	/* If we can't determine support, just bail */
-	if (!plane->funcs->format_mod_supported)
-		goto done;
-
 	mod = modifiers_ptr(blob_data);
 	for (i = 0; i < plane->modifier_count; i++) {
 		for (j = 0; j < plane->format_count; j++) {
-			if (plane->funcs->format_mod_supported(plane,
+			if (!plane->funcs->format_mod_supported ||
+			    plane->funcs->format_mod_supported(plane,
 							       plane->format_types[j],
 							       plane->modifiers[i])) {
-
 				mod->formats |= 1ULL << j;
 			}
 		}
-- 
2.25.1


  reply	other threads:[~2021-12-22  9:06 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-22  9:05 [PATCH v2 0/6] Add missing format_mod_supported functions José Expósito
2021-12-22  9:05 ` [Intel-gfx] " José Expósito
2021-12-22  9:05 ` José Expósito
2021-12-22  9:05 ` José Expósito
2021-12-22  9:05 ` José Expósito [this message]
2021-12-22  9:05   ` [Intel-gfx] [PATCH v2 1/6] drm/plane: Make format_mod_supported truly optional José Expósito
2021-12-22  9:05   ` José Expósito
2021-12-22  9:05   ` José Expósito
2021-12-22 13:10   ` kernel test robot
2021-12-22 13:10     ` kernel test robot
2021-12-23 10:10   ` Simon Ser
2021-12-23 10:10     ` Simon Ser
2021-12-23 10:10     ` [Intel-gfx] " Simon Ser
2021-12-23 10:10     ` Simon Ser
2021-12-23 11:56   ` Ville Syrjälä
2021-12-23 11:56     ` Ville Syrjälä
2021-12-23 11:56     ` [Intel-gfx] " Ville Syrjälä
2021-12-23 11:56     ` Ville Syrjälä
2021-12-23 13:42     ` Simon Ser
2021-12-23 13:42       ` Simon Ser
2021-12-23 13:42       ` [Intel-gfx] " Simon Ser
2021-12-23 13:42       ` Simon Ser
2021-12-23 15:03       ` Ville Syrjälä
2021-12-23 15:03         ` Ville Syrjälä
2021-12-23 15:03         ` [Intel-gfx] " Ville Syrjälä
2021-12-23 15:03         ` Ville Syrjälä
2021-12-23 16:57         ` José Expósito
2021-12-23 16:57           ` [Intel-gfx] " José Expósito
2021-12-23 16:57           ` José Expósito
2021-12-23 16:57           ` José Expósito
2021-12-22  9:05 ` [PATCH v2 2/6] drm/plane: Fix typo in format_mod_supported documentation José Expósito
2021-12-22  9:05   ` [Intel-gfx] " José Expósito
2021-12-22  9:05   ` José Expósito
2021-12-22  9:05   ` José Expósito
2021-12-23 10:07   ` Simon Ser
2021-12-23 10:07     ` Simon Ser
2021-12-23 10:07     ` [Intel-gfx] " Simon Ser
2021-12-23 10:07     ` Simon Ser
2021-12-22  9:05 ` [PATCH v2 3/6] drm/simple-kms: Drop format_mod_supported function José Expósito
2021-12-22  9:05   ` [Intel-gfx] " José Expósito
2021-12-22  9:05   ` José Expósito
2021-12-22  9:05   ` José Expósito
2021-12-22  9:05 ` [PATCH v2 4/6] drm/i915/display: " José Expósito
2021-12-22  9:05   ` [Intel-gfx] " José Expósito
2021-12-22  9:05   ` José Expósito
2021-12-22  9:05   ` José Expósito
2021-12-22  9:05 ` [PATCH v2 5/6] drm: mxsfb: " José Expósito
2021-12-22  9:05   ` [Intel-gfx] " José Expósito
2021-12-22  9:05   ` José Expósito
2021-12-22  9:05   ` José Expósito
2021-12-22  9:05 ` [PATCH v2 6/6] drm/stm: ltdc: " José Expósito
2021-12-22  9:05   ` [Intel-gfx] " José Expósito
2021-12-22  9:05   ` José Expósito
2021-12-22  9:05   ` José Expósito
2022-01-12  9:44   ` yannick Fertre
2022-01-12  9:44     ` [Intel-gfx] " yannick Fertre
2022-01-12  9:44     ` yannick Fertre
2022-01-12  9:44     ` yannick Fertre
2022-01-12 10:01   ` Jagan Teki
2022-01-12 10:01     ` Jagan Teki
2022-01-12 10:01     ` [Intel-gfx] " Jagan Teki
2022-01-12 10:01     ` Jagan Teki
2022-01-10 19:14 ` [Intel-gfx] ✗ Fi.CI.BUILD: failure for Add missing format_mod_supported functions (rev2) Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211222090552.25972-2-jose.exposito89@gmail.com \
    --to=jose.exposito89@gmail.com \
    --cc=airlied@linux.ie \
    --cc=alexandre.torgue@foss.st.com \
    --cc=benjamin.gaignard@linaro.org \
    --cc=contact@emersion.fr \
    --cc=daniel@ffwll.ch \
    --cc=dmitry.baryshkov@linaro.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=festevam@gmail.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jani.nikula@linux.intel.com \
    --cc=joonas.lahtinen@linux.intel.com \
    --cc=kernel@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-imx@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=marex@denx.de \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=mripard@kernel.org \
    --cc=philippe.cornu@foss.st.com \
    --cc=rodrigo.vivi@intel.com \
    --cc=s.hauer@pengutronix.de \
    --cc=shawnguo@kernel.org \
    --cc=stefan@agner.ch \
    --cc=tzimmermann@suse.de \
    --cc=yannick.fertre@foss.st.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.