From patchwork Wed Jan 8 05:38:59 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arun R Murthy X-Patchwork-Id: 13930125 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 7599CE7719C for ; Wed, 8 Jan 2025 05:53:44 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D103B10E7F0; Wed, 8 Jan 2025 05:53:41 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="MrMQl3PS"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) by gabe.freedesktop.org (Postfix) with ESMTPS id 361C010E346; Wed, 8 Jan 2025 05:53:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1736315621; x=1767851621; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=v2z02sw8WCh8MGp+81ko1v+I8SVVB2M9wtO4n8+AIZI=; b=MrMQl3PSyX/3mm3VgnAKzs2kKtejq9qEoK3PWd6go/f2eiaAU3KQVrl8 8ISdVSTReW3i6Vd2R8fFUyhWYUhLP2t4oEhSmYDUtJbmN7tM9K6KZYaM7 9LMpn267XXk41rzfeCucK4OCEDq/jXQsUyOA4AbEuIN8QDOsT3qCldO8v 9guyWUtTWFbACSGvP+YX4IOOzUUhRlES+RGNDGuXfNaNacaqOqXx9w0Jo 0Iq4TJS9LY0+bk6/7I6d2lrqAGXKl74conefarHQyLPH4sAxo94yFdFnE ydTJP/JnlI66UWn3zJzpxMECQxRWUh8A40NxUHvdaBNvaJjcXwLW8KGHc A==; X-CSE-ConnectionGUID: PxFujtI0S52L3h2RIvPHsQ== X-CSE-MsgGUID: xllhDawcT9G++NAz6PzErA== X-IronPort-AV: E=McAfee;i="6700,10204,11308"; a="61903898" X-IronPort-AV: E=Sophos;i="6.12,297,1728975600"; d="scan'208";a="61903898" Received: from fmviesa003.fm.intel.com ([10.60.135.143]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Jan 2025 21:53:41 -0800 X-CSE-ConnectionGUID: Y5oofFOIQNyK6qSZp2dLPA== X-CSE-MsgGUID: iaQG/FmrSf2IlON4KHjYLQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,224,1728975600"; d="scan'208";a="107024114" Received: from srr4-3-linux-106-armuthy.iind.intel.com ([10.190.238.56]) by fmviesa003.fm.intel.com with ESMTP; 07 Jan 2025 21:53:39 -0800 From: Arun R Murthy Date: Wed, 08 Jan 2025 11:08:59 +0530 Subject: [PATCH v3 1/5] drm/plane: Add new plane property IN_FORMATS_ASYNC MIME-Version: 1.0 Message-Id: <20250108-asyn-v3-1-f4399635eec9@intel.com> References: <20250108-asyn-v3-0-f4399635eec9@intel.com> In-Reply-To: <20250108-asyn-v3-0-f4399635eec9@intel.com> To: dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org Cc: Arun R Murthy 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" There exists a property IN_FORMATS which exposes the plane supported modifiers/formats to the user. In some platforms when asynchronous flips are used all of modifiers/formats mentioned in IN_FORMATS are not supported. This patch adds a new plane property IN_FORMATS_ASYNC to expose the async flips supported modifiers/formats so that user can use this information ahead and done flips with unsupported formats/modifiers. This will save flips failures. Add a new function pointer similar to format_mod_supported specifically for asynchronous flips. v2: Remove async variable from drm_plane (Ville) v3: Add new function pointer for async (Ville) Signed-off-by: Arun R Murthy --- drivers/gpu/drm/drm_mode_config.c | 7 +++++++ drivers/gpu/drm/drm_plane.c | 6 ++++++ include/drm/drm_mode_config.h | 6 ++++++ include/drm/drm_plane.h | 20 ++++++++++++++++++++ 4 files changed, 39 insertions(+) diff --git a/drivers/gpu/drm/drm_mode_config.c b/drivers/gpu/drm/drm_mode_config.c index 8642a2fb25a90116dab975aa0ab6b51deafb4b96..dbbef20753f834a85ae9ded748cff2b3f0e85043 100644 --- a/drivers/gpu/drm/drm_mode_config.c +++ b/drivers/gpu/drm/drm_mode_config.c @@ -388,6 +388,13 @@ static int drm_mode_create_standard_properties(struct drm_device *dev) return -ENOMEM; dev->mode_config.size_hints_property = prop; + prop = drm_property_create(dev, + DRM_MODE_PROP_IMMUTABLE | DRM_MODE_PROP_BLOB, + "IN_FORMATS_ASYNC", 0); + if (!prop) + return -ENOMEM; + dev->mode_config.async_modifiers_property = prop; + return 0; } diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c index a28b22fdd7a41aca82d097d42237851da9a0a79b..416818e54ccffcf3d3aada2723e96ce8ccf1dd97 100644 --- a/drivers/gpu/drm/drm_plane.c +++ b/drivers/gpu/drm/drm_plane.c @@ -141,6 +141,12 @@ * various bugs in this area with inconsistencies between the capability * flag and per-plane properties. * + * IN_FORMATS_ASYNC: + * Blob property which contains the set of buffer format and modifier + * pairs supported by this plane for asynchronous flips. The blob is a struct + * drm_format_modifier_blob. Without this property the plane doesn't + * support buffers with modifiers. Userspace cannot change this property. + * * SIZE_HINTS: * Blob property which contains the set of recommended plane size * which can used for simple "cursor like" use cases (eg. no scaling). diff --git a/include/drm/drm_mode_config.h b/include/drm/drm_mode_config.h index 271765e2e9f2da62aaf0d258828ef4196e14822e..0c116d6dfd277262b1a4c0f097fce2d719f43844 100644 --- a/include/drm/drm_mode_config.h +++ b/include/drm/drm_mode_config.h @@ -936,6 +936,12 @@ struct drm_mode_config { */ struct drm_property *modifiers_property; + /** + * @async_modifiers_property: Plane property to list support modifier/format + * combination for asynchronous flips. + */ + struct drm_property *async_modifiers_property; + /** * @size_hints_property: Plane SIZE_HINTS property. */ diff --git a/include/drm/drm_plane.h b/include/drm/drm_plane.h index dd718c62ac31bf16606f3ee9f025a5b171cd1e67..e8749e6fc3bc0acfc73bbd8401f85c3126e86759 100644 --- a/include/drm/drm_plane.h +++ b/include/drm/drm_plane.h @@ -549,6 +549,26 @@ struct drm_plane_funcs { */ bool (*format_mod_supported)(struct drm_plane *plane, uint32_t format, uint64_t modifier); + /** + * @format_mod_supported_async: + * + * This optional hook is used for the DRM to determine if for + * asychronous flip 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. + * + * Returns: + * + * True if the given modifier is valid for that format on the plane. + * False otherwise. + */ + bool (*format_mod_supported_async)(struct drm_plane *plane, + uint32_t format, uint64_t modifier); + }; /** From patchwork Wed Jan 8 05:39:00 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arun R Murthy X-Patchwork-Id: 13930126 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 9595BE7719A for ; Wed, 8 Jan 2025 05:53:46 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D823D10EB80; Wed, 8 Jan 2025 05:53:43 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="Nl5tPJ5a"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) by gabe.freedesktop.org (Postfix) with ESMTPS id C51E910E7F3; Wed, 8 Jan 2025 05:53:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1736315623; x=1767851623; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=YfdE+tXCtfzMRa9ShE8tlVVWCzVGli3JnImVc4Ureco=; b=Nl5tPJ5aWndJkHMmF1y7jVeLaijDTHMC3YJo9AKeI3PvEDh1rEYpygnO 6VuRZ+vVhiRple61s3lqgo4d8hTw4Hrayr6dV/5egjNj67P/jjm8FOKBd xBj4ojxO49raCpuakWYnnPoFSOxc+xaJQMFBYIjHXm5kSBFk9n6aGM8QI uPG5Xghehx+QW1apHOzomv0Ruex7yld+xNbSrsfqHWx0Je04kLbzUDjkh GZqrYGASriiXkIrkMZp2p37g36hBts+MyD7naOzdsuMcV0VkIP+WhsCjt MllAKj4N1htEkDUXviqBooq+vNraWElAFjTkqc29MUb1qwA7iZ8kc9IQc Q==; X-CSE-ConnectionGUID: wedE8xuhRxqbUEzhF0GH6w== X-CSE-MsgGUID: sOrffXkYS4iBfYruOOUlhA== X-IronPort-AV: E=McAfee;i="6700,10204,11308"; a="61903902" X-IronPort-AV: E=Sophos;i="6.12,297,1728975600"; d="scan'208";a="61903902" Received: from fmviesa003.fm.intel.com ([10.60.135.143]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Jan 2025 21:53:42 -0800 X-CSE-ConnectionGUID: HXxlUrz6QvmnXDEnPkX96A== X-CSE-MsgGUID: Eq5gP1QXSf6V4gUMpCbqSQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,224,1728975600"; d="scan'208";a="107024129" Received: from srr4-3-linux-106-armuthy.iind.intel.com ([10.190.238.56]) by fmviesa003.fm.intel.com with ESMTP; 07 Jan 2025 21:53:41 -0800 From: Arun R Murthy Date: Wed, 08 Jan 2025 11:09:00 +0530 Subject: [PATCH v3 2/5] drm/plane: Expose function to create format/modifier blob MIME-Version: 1.0 Message-Id: <20250108-asyn-v3-2-f4399635eec9@intel.com> References: <20250108-asyn-v3-0-f4399635eec9@intel.com> In-Reply-To: <20250108-asyn-v3-0-f4399635eec9@intel.com> To: dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org Cc: Arun R Murthy 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" Expose drm plane function to create formats/modifiers blob. This function can be used to expose list of supported formats/modifiers for sync/async flips. Signed-off-by: Arun R Murthy --- drivers/gpu/drm/drm_plane.c | 44 +++++++++++++++++++++++++++++--------------- include/drm/drm_plane.h | 4 ++++ 2 files changed, 33 insertions(+), 15 deletions(-) diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c index 416818e54ccffcf3d3aada2723e96ce8ccf1dd97..4f35eec2b7770fcc90c3e07a9068b31c0563a4c0 100644 --- a/drivers/gpu/drm/drm_plane.c +++ b/drivers/gpu/drm/drm_plane.c @@ -191,7 +191,10 @@ 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) +int drm_plane_create_format_blob(struct drm_device *dev, + struct drm_plane *plane, u64 *modifiers, + unsigned int modifier_count, u32 *formats, + unsigned int format_count, bool is_async) { const struct drm_mode_config *config = &dev->mode_config; struct drm_property_blob *blob; @@ -200,14 +203,14 @@ static int create_in_format_blob(struct drm_device *dev, struct drm_plane *plane struct drm_format_modifier_blob *blob_data; unsigned int i, j; - formats_size = sizeof(__u32) * plane->format_count; + formats_size = sizeof(__u32) * format_count; if (WARN_ON(!formats_size)) { /* 0 formats are never expected */ return 0; } modifiers_size = - sizeof(struct drm_format_modifier) * plane->modifier_count; + sizeof(struct drm_format_modifier) * modifier_count; blob_size = sizeof(struct drm_format_modifier_blob); /* Modifiers offset is a pointer to a struct with a 64 bit field so it @@ -223,37 +226,45 @@ static int create_in_format_blob(struct drm_device *dev, struct drm_plane *plane blob_data = blob->data; blob_data->version = FORMAT_BLOB_CURRENT; - blob_data->count_formats = plane->format_count; + blob_data->count_formats = format_count; blob_data->formats_offset = sizeof(struct drm_format_modifier_blob); - blob_data->count_modifiers = plane->modifier_count; + blob_data->count_modifiers = modifier_count; blob_data->modifiers_offset = ALIGN(blob_data->formats_offset + formats_size, 8); - memcpy(formats_ptr(blob_data), plane->format_types, formats_size); + memcpy(formats_ptr(blob_data), formats, formats_size); 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 || + for (i = 0; i < modifier_count; i++) { + for (j = 0; j < format_count; j++) { + if (is_async || + !plane->funcs->format_mod_supported || plane->funcs->format_mod_supported(plane, - plane->format_types[j], - plane->modifiers[i])) { + formats[j], + modifiers[i])) { mod->formats |= 1ULL << j; } } - mod->modifier = plane->modifiers[i]; + mod->modifier = modifiers[i]; mod->offset = 0; mod->pad = 0; mod++; } - drm_object_attach_property(&plane->base, config->modifiers_property, - blob->base.id); + if (is_async) + drm_object_attach_property(&plane->base, + config->async_modifiers_property, + blob->base.id); + else + drm_object_attach_property(&plane->base, + config->modifiers_property, + blob->base.id); return 0; } +EXPORT_SYMBOL(drm_plane_create_format_blob); /** * DOC: hotspot properties @@ -476,7 +487,10 @@ static int __drm_universal_plane_init(struct drm_device *dev, } if (format_modifier_count) - create_in_format_blob(dev, plane); + drm_plane_create_format_blob(dev, plane, plane->modifiers, + format_modifier_count, + plane->format_types, format_count, + false); return 0; } diff --git a/include/drm/drm_plane.h b/include/drm/drm_plane.h index e8749e6fc3bc0acfc73bbd8401f85c3126e86759..eb84830fbb723e39436bfbadf369894a5657cd45 100644 --- a/include/drm/drm_plane.h +++ b/include/drm/drm_plane.h @@ -1008,5 +1008,9 @@ int drm_plane_create_scaling_filter_property(struct drm_plane *plane, int drm_plane_add_size_hints_property(struct drm_plane *plane, const struct drm_plane_size_hint *hints, int num_hints); +int drm_plane_create_format_blob(struct drm_device *dev, + struct drm_plane *plane, u64 *modifiers, + unsigned int modifier_count, u32 *formats, + unsigned int format_count, bool is_async); #endif From patchwork Wed Jan 8 05:39:01 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arun R Murthy X-Patchwork-Id: 13930127 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 A34E6E7719E for ; Wed, 8 Jan 2025 05:53:48 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4FE1E10EB86; Wed, 8 Jan 2025 05:53:46 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="giGYVywO"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) by gabe.freedesktop.org (Postfix) with ESMTPS id B032910EB82; Wed, 8 Jan 2025 05:53:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1736315625; x=1767851625; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=Q1i3g6RNBwkp+C5h4or7IS5/PL3ebdEaHpg1Uuogsc0=; b=giGYVywO06vjx0NwJ2lESkpnn0OT53427/CUds0a5uOcuamQ4ptkTxNZ fAIvS90Uj8U9pJkxZMncjv+FYHNfvoDvSPAFm7rdbC0uVgSJK8CrNXI7H HIBgySM8Y5bjmjnkOOB0H8Z+aQhz0uHvEEL175PsUhOMu7pNQv0n4JQgB nZSZc8RBdvRY6BvQ8tEhiFS7h3VtFmIQzusxEKY7t+ReqccLpifwIQvzv YDfakKyQIoMqGzuKpXwrQ7PiGPWt+4DYe1AbDNqws7KT/3jY+P7yobb0v 5tpq24EvoXa0Tn+W2prgSr/3lDB7O5oewVy7YjBO3lUtGmh6RMrf3dttN Q==; X-CSE-ConnectionGUID: tLp95DFPQDKSSWo4FOEBYQ== X-CSE-MsgGUID: lRpQhSwfR36DwWNDqEbaTA== X-IronPort-AV: E=McAfee;i="6700,10204,11308"; a="61903905" X-IronPort-AV: E=Sophos;i="6.12,297,1728975600"; d="scan'208";a="61903905" Received: from fmviesa003.fm.intel.com ([10.60.135.143]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Jan 2025 21:53:44 -0800 X-CSE-ConnectionGUID: UQRwPUlxQJqmCXuG0w6WXg== X-CSE-MsgGUID: AjT+8Oq9Rdi8uQ9NX+J3kg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,224,1728975600"; d="scan'208";a="107024152" Received: from srr4-3-linux-106-armuthy.iind.intel.com ([10.190.238.56]) by fmviesa003.fm.intel.com with ESMTP; 07 Jan 2025 21:53:43 -0800 From: Arun R Murthy Date: Wed, 08 Jan 2025 11:09:01 +0530 Subject: [PATCH v3 3/5] drm/plane: Function to check async supported modifier/format MIME-Version: 1.0 Message-Id: <20250108-asyn-v3-3-f4399635eec9@intel.com> References: <20250108-asyn-v3-0-f4399635eec9@intel.com> In-Reply-To: <20250108-asyn-v3-0-f4399635eec9@intel.com> To: dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org Cc: Arun R Murthy 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" Seperate function for async flips is to be called in order to check the provided format/modifier support. At present the flag for async flip is stored in crtc_state as async flip is supported on only one plane for a given crtc. The same is being used over here to decide the async function pointer. Signed-off-by: Arun R Murthy --- drivers/gpu/drm/drm_plane.c | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c index 4f35eec2b7770fcc90c3e07a9068b31c0563a4c0..9e08ba4318cf0c07fa0701023659986855e0e98a 100644 --- a/drivers/gpu/drm/drm_plane.c +++ b/drivers/gpu/drm/drm_plane.c @@ -238,12 +238,21 @@ int drm_plane_create_format_blob(struct drm_device *dev, mod = modifiers_ptr(blob_data); for (i = 0; i < modifier_count; i++) { for (j = 0; j < format_count; j++) { - if (is_async || - !plane->funcs->format_mod_supported || - plane->funcs->format_mod_supported(plane, - formats[j], - modifiers[i])) { - mod->formats |= 1ULL << j; + if (is_async) { + if (!plane->funcs->format_mod_supported_async || + plane->funcs->format_mod_supported_async(plane, + formats[j], + modifiers[i])) { + mod->formats |= 1ULL << j; + } + + } else { + if (!plane->funcs->format_mod_supported || + plane->funcs->format_mod_supported(plane, + formats[j], + modifiers[i])) { + mod->formats |= 1ULL << j; + } } } @@ -910,6 +919,7 @@ bool drm_plane_has_format(struct drm_plane *plane, u32 format, u64 modifier) { unsigned int i; + bool is_async = plane->crtc->state->async_flip; for (i = 0; i < plane->format_count; i++) { if (format == plane->format_types[i]) @@ -918,8 +928,12 @@ bool drm_plane_has_format(struct drm_plane *plane, if (i == plane->format_count) return false; - if (plane->funcs->format_mod_supported) { - if (!plane->funcs->format_mod_supported(plane, format, modifier)) + if (is_async ? plane->funcs->format_mod_supported_async : + plane->funcs->format_mod_supported) { + if (!(is_async ? plane->funcs->format_mod_supported_async( + plane, format, modifier) : + plane->funcs->format_mod_supported( + plane, format, modifier))) return false; } else { if (!plane->modifier_count) From patchwork Wed Jan 8 05:39:02 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arun R Murthy X-Patchwork-Id: 13930128 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 3472FE7719A for ; Wed, 8 Jan 2025 05:53:50 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D369710EB87; Wed, 8 Jan 2025 05:53:47 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="X4sH7qtP"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4D8AD10EB85; Wed, 8 Jan 2025 05:53:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1736315626; x=1767851626; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=0vxXH41AFMIcOEnoOnj2WnyAy8VFZMiI/umlcWXii+I=; b=X4sH7qtPNgi/dEZibzwjAAsAu4ozBx9QEjUMHXyHco/BtSAa8gZCu24+ unjfDK4vaO5NB64W4FNCrW0qY8F+/h318+lQGn196Y2E/6KpxudPvfi27 tKcovPJ4YIcgGufSWS5MqKSnTQERbpfDSja/KPhxeIbhNJV2cbu6c+V96 2+ND3LvZqIWBNxC3oC3ORA1bu54QTX2un8OL3I44T6up0KWTy8NG9XWwj NiI10apKVCIe27FXckcXyQWFdmsACRv6FgCqWElivXSYjbGjA3Vhgyzzy HinqsF0XPTyWQGTyxPm7uoAqqjUklx6mQsGwaLkgeW/041s/YUSwX8udL w==; X-CSE-ConnectionGUID: 1vLG+c/JS06l+wX3da27Qg== X-CSE-MsgGUID: Te2tNQF6RC2OR4WaMJZZDw== X-IronPort-AV: E=McAfee;i="6700,10204,11308"; a="61903907" X-IronPort-AV: E=Sophos;i="6.12,297,1728975600"; d="scan'208";a="61903907" Received: from fmviesa003.fm.intel.com ([10.60.135.143]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Jan 2025 21:53:46 -0800 X-CSE-ConnectionGUID: 4lu5OBIqR/aZdq57e7256Q== X-CSE-MsgGUID: qQqcFx/8TuaQa8c6ts+RpQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,224,1728975600"; d="scan'208";a="107024160" Received: from srr4-3-linux-106-armuthy.iind.intel.com ([10.190.238.56]) by fmviesa003.fm.intel.com with ESMTP; 07 Jan 2025 21:53:44 -0800 From: Arun R Murthy Date: Wed, 08 Jan 2025 11:09:02 +0530 Subject: [PATCH v3 4/5] drm/i915/display: Populate list of async supported formats/modifiers MIME-Version: 1.0 Message-Id: <20250108-asyn-v3-4-f4399635eec9@intel.com> References: <20250108-asyn-v3-0-f4399635eec9@intel.com> In-Reply-To: <20250108-asyn-v3-0-f4399635eec9@intel.com> To: dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org Cc: Arun R Murthy 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" Populate the list of formats/modifiers supported by async flip. Register a async property and expose the same to user through blob. Signed-off-by: Arun R Murthy --- drivers/gpu/drm/i915/display/skl_universal_plane.c | 51 ++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/drivers/gpu/drm/i915/display/skl_universal_plane.c b/drivers/gpu/drm/i915/display/skl_universal_plane.c index ff9764cac1e71959e56283f61b5192ea261cec7a..e5e47f2219dae62e76cbde2efb40266b047ab2b2 100644 --- a/drivers/gpu/drm/i915/display/skl_universal_plane.c +++ b/drivers/gpu/drm/i915/display/skl_universal_plane.c @@ -170,6 +170,44 @@ static const u32 icl_hdr_plane_formats[] = { DRM_FORMAT_XVYU16161616, }; +static u64 tgl_asyn_modifiers[] = { + DRM_FORMAT_MOD_LINEAR, + I915_FORMAT_MOD_X_TILED, + I915_FORMAT_MOD_Y_TILED, + I915_FORMAT_MOD_4_TILED, + I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS, + I915_FORMAT_MOD_4_TILED_MTL_RC_CCS, + I915_FORMAT_MOD_4_TILED_DG2_RC_CCS, + I915_FORMAT_MOD_4_TILED_BMG_CCS, + I915_FORMAT_MOD_4_TILED_LNL_CCS, +}; + +static u64 icl_async_modifiers[] = { + I915_FORMAT_MOD_X_TILED, + I915_FORMAT_MOD_Y_TILED, + I915_FORMAT_MOD_Yf_TILED, + I915_FORMAT_MOD_Y_TILED_CCS, + I915_FORMAT_MOD_Yf_TILED_CCS, +}; + +static u64 skl_async_modifiers[] = { + I915_FORMAT_MOD_X_TILED, + I915_FORMAT_MOD_Y_TILED, + I915_FORMAT_MOD_Yf_TILED, +}; + +static u32 intel_async_formats[] = { + DRM_FORMAT_RGB565, + DRM_FORMAT_XRGB8888, + DRM_FORMAT_XBGR8888, + DRM_FORMAT_ARGB8888, + DRM_FORMAT_ABGR8888, + DRM_FORMAT_XRGB2101010, + DRM_FORMAT_XBGR2101010, + DRM_FORMAT_XRGB16161616F, + DRM_FORMAT_XBGR16161616F, +}; + int skl_format_to_fourcc(int format, bool rgb_order, bool alpha) { switch (format) { @@ -2613,6 +2651,7 @@ skl_universal_plane_create(struct drm_i915_private *dev_priv, unsigned int supported_rotations; unsigned int supported_csc; const u64 *modifiers; + u64 *async_modifiers; const u32 *formats; int num_formats; int ret; @@ -2715,6 +2754,18 @@ skl_universal_plane_create(struct drm_i915_private *dev_priv, if (ret) goto fail; + if (DISPLAY_VER(dev_priv) >= 12) + async_modifiers = tgl_asyn_modifiers; + else if (DISPLAY_VER(dev_priv) == 11) + async_modifiers = icl_async_modifiers; + else + async_modifiers = skl_async_modifiers; + + drm_plane_create_format_blob(&dev_priv->drm, &plane->base, + async_modifiers, sizeof(async_modifiers), + intel_async_formats, + sizeof(intel_async_formats), true); + if (DISPLAY_VER(dev_priv) >= 13) supported_rotations = DRM_MODE_ROTATE_0 | DRM_MODE_ROTATE_180; else From patchwork Wed Jan 8 05:39:03 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arun R Murthy X-Patchwork-Id: 13930129 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 5B4A0C02183 for ; Wed, 8 Jan 2025 05:53:51 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C9F5510EB8C; Wed, 8 Jan 2025 05:53:49 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="DGmFY4LN"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1B36A10EB88; Wed, 8 Jan 2025 05:53:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1736315628; x=1767851628; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=ZMDrsQyhi1FM9uO2P0kDVttJ6sdjL8ZEXRkqEbtLnc8=; b=DGmFY4LNBd+N9cIXGcrg/2Lqlgb70Wzh8wPjfBYpMy3yn6sxHYibpFSw yqlsPbT4Ax/EYU+bRz2vhU9QBMYrJxT3dIfvJmMyDtjWKEO5QkKpkRlzo 5NtAzx45xda4hizsX+kMbzJQKULWMGShHATd1TuAFAcCThB0Ysg43pk3/ nkUl7P2ey7RhNh3xNpR/eRl+2vJ5f6hO99pESZI9E4kGrdl386kZ8ClQK GJzLChCStAsiLL8bd2bSSqVvGVcfF2NB4U2lx2nFUHdUIM8oPipRwNavm k53LuabWRT2isMBvohqwy5q0vmukbonjI/YekyaU/ELxLFO7e1ZDFX7iA g==; X-CSE-ConnectionGUID: Dp1bqQ/ZQMmtll1UoeC/Jw== X-CSE-MsgGUID: Z0DeYlg+TQO8M8yNILXHAA== X-IronPort-AV: E=McAfee;i="6700,10204,11308"; a="61903910" X-IronPort-AV: E=Sophos;i="6.12,297,1728975600"; d="scan'208";a="61903910" Received: from fmviesa003.fm.intel.com ([10.60.135.143]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Jan 2025 21:53:48 -0800 X-CSE-ConnectionGUID: NssyhRxVScmowdVGYgzp2g== X-CSE-MsgGUID: rYB53hDsQA+k3pmxE8v1IA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,224,1728975600"; d="scan'208";a="107024172" Received: from srr4-3-linux-106-armuthy.iind.intel.com ([10.190.238.56]) by fmviesa003.fm.intel.com with ESMTP; 07 Jan 2025 21:53:46 -0800 From: Arun R Murthy Date: Wed, 08 Jan 2025 11:09:03 +0530 Subject: [PATCH v3 5/5] drm/i915/display: Add function for format_mod_supported_async MIME-Version: 1.0 Message-Id: <20250108-asyn-v3-5-f4399635eec9@intel.com> References: <20250108-asyn-v3-0-f4399635eec9@intel.com> In-Reply-To: <20250108-asyn-v3-0-f4399635eec9@intel.com> To: dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org Cc: Arun R Murthy 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" Add driver specific function definition for the plane->funcs format_mod_supported_async to check if the provided format/modifier is supported for asynchronous flip. Signed-off-by: Arun R Murthy --- drivers/gpu/drm/i915/display/skl_universal_plane.c | 62 ++++++++++++++++------ 1 file changed, 47 insertions(+), 15 deletions(-) diff --git a/drivers/gpu/drm/i915/display/skl_universal_plane.c b/drivers/gpu/drm/i915/display/skl_universal_plane.c index e5e47f2219dae62e76cbde2efb40266b047ab2b2..00aa254a3b4e992268c9159bc15687e54718dc43 100644 --- a/drivers/gpu/drm/i915/display/skl_universal_plane.c +++ b/drivers/gpu/drm/i915/display/skl_universal_plane.c @@ -2526,30 +2526,62 @@ static bool tgl_plane_format_mod_supported(struct drm_plane *_plane, } } +static bool intel_plane_format_mod_supported_async(struct drm_plane *_plane, + u32 format, u64 modifier) +{ + struct intel_plane *plane = to_intel_plane(_plane); + struct intel_display *display = to_intel_display(plane); + int i, found = false; + u64 *async_modifiers; + + if (plane->id != 1) + return false; + + if (DISPLAY_VER(display) >= 12) + async_modifiers = tgl_asyn_modifiers; + else if (DISPLAY_VER(display) == 11) + async_modifiers = icl_async_modifiers; + else + async_modifiers = skl_async_modifiers; + + for (i = 0; i < sizeof(async_modifiers); i++) { + if (modifier == async_modifiers[i]) + found = true; + } + if (!found) + return false; + + /* Async flip supported only on RGB formats */ + for (i = 0; i < sizeof(intel_async_formats); i++) { + if (format == intel_async_formats[i]) + return true; + } + return false; +} + +#define INTEL_PLANE_FUNCS \ + .update_plane = drm_atomic_helper_update_plane, \ + .disable_plane = drm_atomic_helper_disable_plane, \ + .destroy = intel_plane_destroy, \ + .atomic_duplicate_state = intel_plane_duplicate_state, \ + .atomic_destroy_state = intel_plane_destroy_state, \ + .format_mod_supported_async = intel_plane_format_mod_supported_async + static const struct drm_plane_funcs skl_plane_funcs = { - .update_plane = drm_atomic_helper_update_plane, - .disable_plane = drm_atomic_helper_disable_plane, - .destroy = intel_plane_destroy, - .atomic_duplicate_state = intel_plane_duplicate_state, - .atomic_destroy_state = intel_plane_destroy_state, + INTEL_PLANE_FUNCS, + .format_mod_supported = skl_plane_format_mod_supported, }; static const struct drm_plane_funcs icl_plane_funcs = { - .update_plane = drm_atomic_helper_update_plane, - .disable_plane = drm_atomic_helper_disable_plane, - .destroy = intel_plane_destroy, - .atomic_duplicate_state = intel_plane_duplicate_state, - .atomic_destroy_state = intel_plane_destroy_state, + INTEL_PLANE_FUNCS, + .format_mod_supported = icl_plane_format_mod_supported, }; static const struct drm_plane_funcs tgl_plane_funcs = { - .update_plane = drm_atomic_helper_update_plane, - .disable_plane = drm_atomic_helper_disable_plane, - .destroy = intel_plane_destroy, - .atomic_duplicate_state = intel_plane_duplicate_state, - .atomic_destroy_state = intel_plane_destroy_state, + INTEL_PLANE_FUNCS, + .format_mod_supported = tgl_plane_format_mod_supported, };