From patchwork Fri Mar 28 12:45:36 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Arun R Murthy X-Patchwork-Id: 14031894 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 7E09BC36014 for ; Fri, 28 Mar 2025 13:00:27 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 877CA10EA02; Fri, 28 Mar 2025 13:00:24 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="hG+C8mM9"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.11]) by gabe.freedesktop.org (Postfix) with ESMTPS id B804A10EA06; Fri, 28 Mar 2025 13:00:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1743166823; x=1774702823; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=yhViCb+tsh7e5ZKwbOnNx/b0WUEUkcKtzPEBQ2TIwcc=; b=hG+C8mM9SJddVQ3S5T3pJXYCEPCP/WwnbiXQY+urPJFzbZ6PBULlyWds 1QQHpMOkL02lm8AaQp/+WXQblVW2S2O8nQ5beZns8nHDoweS4hBETpdxe QSGEjhNjYoMkoxd6A+gDWjUwv6o1JjWcb0iJ2+qp/ELRS0bR6yGmmJyZ6 6V79UmWILdIST04HtKJXNUFj9bhGVPPp4U52A4sWIZ7+2mDiQ2K10gV9b MTDdwykfUkdY0Em+3V6ejkFyKnGwPLnyeqSoCkIzaabGg4L8hdANBo+q8 jJtW6fsIbWzyDHYXbleqzho5VUzwTTXwX/Wy5tgN8ZqJ8nFfOBAw870w2 g==; X-CSE-ConnectionGUID: wDSrcJYCQ7O+Z1i6DyhaAg== X-CSE-MsgGUID: AVzEZWyETPWz05hicDueLQ== X-IronPort-AV: E=McAfee;i="6700,10204,11387"; a="55186651" X-IronPort-AV: E=Sophos;i="6.14,283,1736841600"; d="scan'208";a="55186651" Received: from orviesa003.jf.intel.com ([10.64.159.143]) by fmvoesa105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Mar 2025 06:00:22 -0700 X-CSE-ConnectionGUID: 2gxs6StvQJqVCi1EuUrpUQ== X-CSE-MsgGUID: BCv4SxJLRna9CZKiwWEMVA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.14,283,1736841600"; d="scan'208";a="130296039" Received: from srr4-3-linux-106-armuthy.iind.intel.com ([10.190.238.56]) by orviesa003.jf.intel.com with ESMTP; 28 Mar 2025 06:00:20 -0700 From: Arun R Murthy Date: Fri, 28 Mar 2025 18:15:36 +0530 Subject: [PATCH v11 2/5] drm/plane: modify create_in_formats to acommodate async MIME-Version: 1.0 Message-Id: <20250328-asyn-v11-2-ecc2d33aac69@intel.com> References: <20250328-asyn-v11-0-ecc2d33aac69@intel.com> In-Reply-To: <20250328-asyn-v11-0-ecc2d33aac69@intel.com> To: dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org Cc: Jani Nikula , chaitanya.kumar.borah@intel.com, ville.syrjala@intel.com, Arun R Murthy , =?utf-8?b?VmlsbGUgU3lyasOkbMOk?= , Naveen Kumar X-Mailer: b4 0.15-dev 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: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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. v5: create_in_formats can return -ve value in failure case, correct the if condition to check the creation of blob Dont add the modifier for which none of the formats is not supported. v6: Remove the code for masking the unsupported modifiers as UMD can leave with it. (Naveen/Chaitanya) v7: Retain the unsupported modifiers, userspace should have no impact, return pointer to blob instead of blob_id(Ville) Signed-off-by: Arun R Murthy Reviewed-by: Chaitanya Kumar Borah Reviewed-by: Ville Syrjälä Tested-by: Naveen Kumar --- drivers/gpu/drm/drm_plane.c | 44 +++++++++++++++++++++++++++++++------------- 1 file changed, 31 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c index fe181c1002171acc68d3054c2d178f9b9f501fe2..04992dfd4c79274ff057961a947f4203a375d275 100644 --- a/drivers/gpu/drm/drm_plane.c +++ b/drivers/gpu/drm/drm_plane.c @@ -193,9 +193,13 @@ 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 struct drm_property_blob *create_in_format_blob(struct drm_device *dev, + struct drm_plane *plane, + bool (*format_mod_supported) + (struct drm_plane *plane, + u32 format, + u64 modifier)) { - const struct drm_mode_config *config = &dev->mode_config; struct drm_property_blob *blob; struct drm_format_modifier *mod; size_t blob_size, formats_size, modifiers_size; @@ -221,7 +225,7 @@ static int create_in_format_blob(struct drm_device *dev, struct drm_plane *plane blob = drm_property_create_blob(dev, blob_size, NULL); if (IS_ERR(blob)) - return -1; + return NULL; blob_data = blob->data; blob_data->version = FORMAT_BLOB_CURRENT; @@ -237,10 +241,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; } } @@ -251,10 +255,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; } /** @@ -366,6 +367,7 @@ static int __drm_universal_plane_init(struct drm_device *dev, const char *name, va_list ap) { struct drm_mode_config *config = &dev->mode_config; + struct drm_property_blob *blob; static const uint64_t default_modifiers[] = { DRM_FORMAT_MOD_LINEAR, }; @@ -477,8 +479,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 = create_in_format_blob(dev, plane, + plane->funcs->format_mod_supported); + if (!IS_ERR(blob)) + drm_object_attach_property(&plane->base, + config->modifiers_property, + blob->base.id); + } + + if (plane->funcs->format_mod_supported_async) { + blob = create_in_format_blob(dev, plane, + plane->funcs->format_mod_supported_async); + if (!IS_ERR(blob)) + drm_object_attach_property(&plane->base, + config->async_modifiers_property, + blob->base.id); + } + return 0; }