Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Arun R Murthy <arun.r.murthy@intel.com>
To: dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org,
	 intel-xe@lists.freedesktop.org
Cc: chaitanya.kumar.borah@intel.com, ville.syrjala@intel.com,
	 Arun R Murthy <arun.r.murthy@intel.com>
Subject: [PATCH v4 2/3] drm/plane: modify create_in_formats to accommodate async
Date: Wed, 05 Feb 2025 15:57:18 +0530	[thread overview]
Message-ID: <20250205-asyn-v4-2-9a5b018e359b@intel.com> (raw)
In-Reply-To: <20250205-asyn-v4-0-9a5b018e359b@intel.com>

create_in_formats creates the list of supported format/modifiers for
synchronous flips, modify the same function so as to take the
format_mod_supported as argument and create list of format/modifier for
async as well.

Signed-off-by: Arun R Murthy <arun.r.murthy@intel.com>
---
 drivers/gpu/drm/drm_plane.c | 40 +++++++++++++++++++++++++++++-----------
 1 file changed, 29 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
index 416818e54ccffcf3d3aada2723e96ce8ccf1dd97..3819fdde985576bd6ba6a08ceb64613bd5e0a663 100644
--- a/drivers/gpu/drm/drm_plane.c
+++ b/drivers/gpu/drm/drm_plane.c
@@ -191,7 +191,11 @@ modifiers_ptr(struct drm_format_modifier_blob *blob)
 	return (struct drm_format_modifier *)(((char *)blob) + blob->modifiers_offset);
 }
 
-static int create_in_format_blob(struct drm_device *dev, struct drm_plane *plane)
+static int create_in_format_blob(struct drm_device *dev, struct drm_plane *plane,
+				 bool (*format_mod_supported)
+						(struct drm_plane *plane,
+						 uint32_t format,
+						 uint64_t modifier))
 {
 	const struct drm_mode_config *config = &dev->mode_config;
 	struct drm_property_blob *blob;
@@ -235,10 +239,10 @@ static int create_in_format_blob(struct drm_device *dev, struct drm_plane *plane
 	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->funcs->format_mod_supported(plane,
-							       plane->format_types[j],
-							       plane->modifiers[i])) {
+			if (!format_mod_supported || format_mod_supported
+							(plane,
+							 plane->format_types[j],
+							 plane->modifiers[i])) {
 				mod->formats |= 1ULL << j;
 			}
 		}
@@ -249,10 +253,7 @@ static int create_in_format_blob(struct drm_device *dev, struct drm_plane *plane
 		mod++;
 	}
 
-	drm_object_attach_property(&plane->base, config->modifiers_property,
-				   blob->base.id);
-
-	return 0;
+	return blob->base.id;
 }
 
 /**
@@ -369,6 +370,7 @@ static int __drm_universal_plane_init(struct drm_device *dev,
 	};
 	unsigned int format_modifier_count = 0;
 	int ret;
+	int blob_id;
 
 	/* plane index is used with 32bit bitmasks */
 	if (WARN_ON(config->num_total_plane >= 32))
@@ -475,8 +477,24 @@ static int __drm_universal_plane_init(struct drm_device *dev,
 		drm_plane_create_hotspot_properties(plane);
 	}
 
-	if (format_modifier_count)
-		create_in_format_blob(dev, plane);
+	if (format_modifier_count) {
+		blob_id = create_in_format_blob(dev, plane,
+						plane->funcs->format_mod_supported);
+		if (blob_id)
+			drm_object_attach_property(&plane->base,
+						   config->modifiers_property,
+						   blob_id);
+	}
+
+	if (plane->funcs->format_mod_supported_async) {
+		blob_id = create_in_format_blob(dev, plane,
+						plane->funcs->format_mod_supported_async);
+		if (blob_id)
+			drm_object_attach_property(&plane->base,
+						   config->async_modifiers_property,
+						   blob_id);
+	}
+
 
 	return 0;
 }

-- 
2.25.1


  parent reply	other threads:[~2025-02-05 10:42 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-05 10:27 [PATCH v4 0/3] Expose modifiers/formats supported by async flips Arun R Murthy
2025-02-05 10:27 ` [PATCH v4 1/3] drm/plane: Add new plane property IN_FORMATS_ASYNC Arun R Murthy
2025-02-12  4:53   ` Borah, Chaitanya Kumar
2025-02-12  5:04     ` Murthy, Arun R
2025-02-05 10:27 ` Arun R Murthy [this message]
2025-02-12  4:53   ` [PATCH v4 2/3] drm/plane: modify create_in_formats to accommodate async Borah, Chaitanya Kumar
2025-02-12  5:24     ` Murthy, Arun R
2025-02-12  5:57       ` Borah, Chaitanya Kumar
2025-02-05 10:27 ` [PATCH v4 3/3] drm/i915/display: Add i915 hook for format_mod_supported_async Arun R Murthy
2025-02-12  7:32   ` Borah, Chaitanya Kumar
2025-02-12 14:59     ` Murthy, Arun R
2025-02-05 11:12 ` ✓ CI.Patch_applied: success for Expose modifiers/formats supported by async flips (rev3) Patchwork
2025-02-05 11:12 ` ✗ CI.checkpatch: warning " Patchwork
2025-02-05 11:13 ` ✓ CI.KUnit: success " Patchwork
2025-02-05 11:30 ` ✓ CI.Build: " Patchwork
2025-02-05 11:32 ` ✗ CI.Hooks: failure " Patchwork
2025-02-05 11:34 ` ✗ CI.checksparse: warning " Patchwork
2025-02-05 11:55 ` ✓ Xe.CI.BAT: success " Patchwork
2025-02-05 14:26 ` ✗ Xe.CI.Full: failure " 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=20250205-asyn-v4-2-9a5b018e359b@intel.com \
    --to=arun.r.murthy@intel.com \
    --cc=chaitanya.kumar.borah@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=ville.syrjala@intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox