mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alessio Belle <Alessio.Belle@imgtec.com>
To: Luigi Santivetti <Luigi.Santivetti@imgtec.com>
Cc: "imagination@lists.freedesktop.org"
	<imagination@lists.freedesktop.org>,
	"tzimmermann@suse.de" <tzimmermann@suse.de>,
	"simona@ffwll.ch" <simona@ffwll.ch>,
	"dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Frank Binns <Frank.Binns@imgtec.com>,
	"maarten.lankhorst@linux.intel.com"
	<maarten.lankhorst@linux.intel.com>,
	Brajesh Gupta <Brajesh.Gupta@imgtec.com>,
	"mripard@kernel.org" <mripard@kernel.org>,
	"airlied@gmail.com" <airlied@gmail.com>
Subject: Re: [PATCH] drm/imagination: improve DRM_PVR_DEV_QUERY_HEAP_INFO_GET documentation
Date: Mon, 16 Nov 2026 13:12:03 +0000	[thread overview]
Message-ID: <a404e000648cd76b221441a78d2acc1914da1be1.camel@imgtec.com> (raw)
In-Reply-To: <20261105-document-drm_pvr_dev_query_heap_info_get-v1-1-b899401606e4@imgtec.com>

On Thu, 2026-11-05 at 12:24 +0000, Luigi Santivetti wrote:
> Add more information about how the array of drm_pvr_heap is filled in and
> set expectations for when userspace and kernel run with a mismatched UAPI
> header.
> 
> Signed-off-by: Luigi Santivetti <luigi.santivetti@imgtec.com>

Reviewed-by: Alessio Belle <alessio.belle@imgtec.com>

Thanks,
Alessio

> ---
>  include/uapi/drm/pvr_drm.h | 31 ++++++++++++++++++++++++-------
>  1 file changed, 24 insertions(+), 7 deletions(-)
> 
> diff --git a/include/uapi/drm/pvr_drm.h b/include/uapi/drm/pvr_drm.h
> index ccf6c2112468..cd85ac257cdb 100644
> --- a/include/uapi/drm/pvr_drm.h
> +++ b/include/uapi/drm/pvr_drm.h
> @@ -258,9 +258,22 @@ struct drm_pvr_dev_query_enhancements {
>   * enum drm_pvr_heap_id - Array index for heap info data returned by
>   * %DRM_PVR_DEV_QUERY_HEAP_INFO_GET.
>   *
> - * For compatibility reasons all indices will be present in the returned array,
> - * however some heaps may not be present. These are indicated where
> - * &struct drm_pvr_heap.size is set to zero.
> + * Userspace and the kernel may have different values for @DRM_PVR_HEAP_COUNT.
> + * In this case:
> + *
> + *  - If KMD(@DRM_PVR_HEAP_COUNT) > UMD(@DRM_PVR_HEAP_COUNT), then userspace
> + *    should either:
> + *
> + *    a. explicitly request a number of heaps by specifying a value less than
> + *       or equal to UMD(@DRM_PVR_HEAP_COUNT) heaps, and the kernel must
> + *       ignore heaps whose ID is greater than or equal to this value, or
> + *    b. ignore heap IDs greater than or equal to UMD(@DRM_PVR_HEAP_COUNT) by,
> + *       e.g. capping the value returned by the kernel.
> + *
> + *  - If KMD(@DRM_PVR_HEAP_COUNT) < UMD(@DRM_PVR_HEAP_COUNT), then the maximum
> + *    number of heaps is capped by the kernel at KMD(@DRM_PVR_HEAP_COUNT) and
> + *    userspace must ignore heaps whose ID is greater than or equal to
> + *    KMD(@DRM_PVR_HEAP_COUNT).
>   */
>  enum drm_pvr_heap_id {
>  	/** @DRM_PVR_HEAP_GENERAL: General purpose heap. */
> @@ -269,7 +282,7 @@ enum drm_pvr_heap_id {
>  	DRM_PVR_HEAP_PDS_CODE_DATA,
>  	/** @DRM_PVR_HEAP_USC_CODE: USC code heap. */
>  	DRM_PVR_HEAP_USC_CODE,
> -	/** @DRM_PVR_HEAP_RGNHDR: Region header heap. Only used if GPU has BRN63142. */
> +	/** @DRM_PVR_HEAP_RGNHDR: Region header heap (optional). Only used if GPU has BRN63142. */
>  	DRM_PVR_HEAP_RGNHDR,
>  	/** @DRM_PVR_HEAP_VIS_TEST: Visibility test heap. */
>  	DRM_PVR_HEAP_VIS_TEST,
> @@ -310,9 +323,13 @@ struct drm_pvr_heap {
>   * struct drm_pvr_dev_query_heap_info - Container used to fetch information
>   * about heaps supported by the device driver.
>   *
> - * Please note all driver-supported heaps will be returned up to &heaps.count.
> - * Some heaps will not be present in all devices, which will be indicated by
> - * &struct drm_pvr_heap.size being set to zero.
> + * Please note that drivers may not need all the heaps that are returned up to
> + * &heaps.count in &heaps.array. Unlike for required heaps, optional heaps are
> + * used on some GPU cores only. The kernel indicates when optional heaps are not
> + * needed by setting &struct drm_pvr_heap.size to zero.
> + *
> + * The kernel copies all requested heaps into &heaps.array matching the order
> + * of heap indices as they are listed in &enum drm_pvr_heap_id.
>   *
>   * When fetching this type &struct drm_pvr_ioctl_dev_query_args.type must be set
>   * to %DRM_PVR_DEV_QUERY_HEAP_INFO_GET.
> 
> ---
> base-commit: 33ed26235db93162935d1719bc6f538c384a2fd8
> change-id: 20261105-document-drm_pvr_dev_query_heap_info_get-6664e9793340
> 
> Best regards,
> --  
> Luigi Santivetti <luigi.santivetti@imgtec.com>
> 


      reply	other threads:[~2026-11-16 13:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-05 12:24 Luigi Santivetti
2026-11-16 13:12 ` Alessio Belle [this message]

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=a404e000648cd76b221441a78d2acc1914da1be1.camel@imgtec.com \
    --to=alessio.belle@imgtec.com \
    --cc=Brajesh.Gupta@imgtec.com \
    --cc=Frank.Binns@imgtec.com \
    --cc=Luigi.Santivetti@imgtec.com \
    --cc=airlied@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=imagination@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=simona@ffwll.ch \
    --cc=tzimmermann@suse.de \
    /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

all inboxes | Powered by JetHome®