Re: [PATCH] drm: document expectations for GETFB2 handles

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 15 Feb 2023 12:42:00 +0000
Simon Ser <contact@xxxxxxxxxxx> wrote:

> There are two important details missing from the docs:
> 
> - If the memory object backing the FB already has a GEM handle,
>   it's not re-used, a new one is generated.
> - Aliased planes will return the same GEM handle.
> 
> Signed-off-by: Simon Ser <contact@xxxxxxxxxxx>
> Cc: Daniel Vetter <daniel@xxxxxxxx>
> Cc: Pekka Paalanen <ppaalanen@xxxxxxxxx>
> ---
>  include/uapi/drm/drm.h | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/include/uapi/drm/drm.h b/include/uapi/drm/drm.h
> index 642808520d92..4cb956a52aee 100644
> --- a/include/uapi/drm/drm.h
> +++ b/include/uapi/drm/drm.h
> @@ -1104,8 +1104,13 @@ extern "C" {
>   * struct as the output.
>   *
>   * If the client is DRM master or has &CAP_SYS_ADMIN, &drm_mode_fb_cmd2.handles
> - * will be filled with GEM buffer handles. Planes are valid until one has a
> - * zero handle -- this can be used to compute the number of planes.
> + * will be filled with GEM buffer handles. Fresh new GEM handles are always
> + * returned, even if another GEM handle referring to the same memory object
> + * already exists on the DRM file description. The caller is responsible for
> + * removing the new handles, e.g. via the &DRM_IOCTL_GEM_CLOSE IOCTL. The same
> + * new handle will be returned for multiple planes in case they use the same
> + * memory object. Planes are valid until one has a zero handle -- this can be
> + * used to compute the number of planes.
>   *
>   * Otherwise, &drm_mode_fb_cmd2.handles will be zeroed and planes are valid
>   * until one has a zero &drm_mode_fb_cmd2.pitches.

It is well-written, clear, and a surprise to me.

Acked-by: Pekka Paalanen <pekka.paalanen@xxxxxxxxxxxxx>

I didn't know it was at all possible to have different GEM handles
pointing to the same object. DMABUF import is guaranteed to return the
existing GEM handle, right? Why is GETFB2 different? Why does it not
have the same problem as what forced DMABUF import to return existing
handles?


Thanks,
pq

Attachment: pgpN8ZZSJAkfG.pgp
Description: OpenPGP digital signature


[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux