diff mbox series

drm: document that blobs are ref'counted

Message ID HNBtgIoryEkrMD_i_O5qy-HyxoyMYWSziPwHQQn9LYoOL8Ds5o7gvqMqz-Y0v7GZDqcYzBLC3d3KPfO37nRCl1doMWeQjKyHYv_pYFxYZ24=@emersion.fr (mailing list archive)
State New, archived
Headers show
Series drm: document that blobs are ref'counted | expand

Commit Message

Simon Ser Oct. 22, 2020, 9:38 a.m. UTC
User-space doesn't need to keep track of blobs that might be in use by
the kernel. User-space can just destroy blobs as soon as they don't need
them anymore.

Signed-off-by: Simon Ser <contact@emersion.fr>
Cc: Pekka Paalanen <ppaalanen@gmail.com>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Jonas Ådahl <jadahl@gmail.com>
---
 include/uapi/drm/drm_mode.h | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Jonas Ådahl Oct. 22, 2020, 9:53 a.m. UTC | #1
Thanks for this!

I can't review the correctness, but the description looks clear to me
so,

Reviewed-by: Jonas Ådahl <jadahl@gmail.com>


Jonas

On Thu, Oct 22, 2020 at 09:38:05AM +0000, Simon Ser wrote:
> User-space doesn't need to keep track of blobs that might be in use by
> the kernel. User-space can just destroy blobs as soon as they don't need
> them anymore.
> 
> Signed-off-by: Simon Ser <contact@emersion.fr>
> Cc: Pekka Paalanen <ppaalanen@gmail.com>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: Jonas Ådahl <jadahl@gmail.com>
> ---
>  include/uapi/drm/drm_mode.h | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/include/uapi/drm/drm_mode.h b/include/uapi/drm/drm_mode.h
> index 863eda048265..f7c41aa4b5eb 100644
> --- a/include/uapi/drm/drm_mode.h
> +++ b/include/uapi/drm/drm_mode.h
> @@ -924,6 +924,10 @@ struct drm_mode_create_blob {
>   * struct drm_mode_destroy_blob - Destroy user blob
>   * @blob_id: blob_id to destroy
>   * Destroy a user-created blob property.
> + *
> + * Blobs are reference-counted by the kernel, so user-space can destroy them as
> + * soon as they're done with them.  For instance user-space can destroy a blob
> + * used in an atomic commit right after performing the atomic commit ioctl.
>   */
>  struct drm_mode_destroy_blob {
>  	__u32 blob_id;
> -- 
> 2.28.0
> 
>
Simon Ser Nov. 1, 2020, 8:35 p.m. UTC | #2
Daniel, does this patch look good to you?
Daniel Stone Nov. 1, 2020, 9:07 p.m. UTC | #3
Hi,

On Sun, 1 Nov 2020 at 20:35, Simon Ser <contact@emersion.fr> wrote:
> Daniel, does this patch look good to you?

Unsure which Daniel you meant, but I would probably instead say:
'Userspace can release blobs as soon as they do not need to refer to
them by their blob object ID. For instance, if you are using a MODE_ID
blob in an atomic commit and you will not make another commit reusing
the same ID, you can destroy the blob as soon as the commit has been
issued, without waiting for it to complete.'

Cheers,
Daniel
Simon Ser Nov. 4, 2020, 5 p.m. UTC | #4
On Sunday, November 1, 2020 10:07 PM, Daniel Stone <daniel@fooishbar.org> wrote:

> > Daniel, does this patch look good to you?
>
> Unsure which Daniel you meant

I was thinking of Daniel Vetter :P

> but I would probably instead say:
> 'Userspace can release blobs as soon as they do not need to refer to
> them by their blob object ID. For instance, if you are using a MODE_ID
> blob in an atomic commit and you will not make another commit reusing
> the same ID, you can destroy the blob as soon as the commit has been
> issued, without waiting for it to complete.'

But thanks! That sounds much better and avoids using the term
"reference counting" (which is nice because it's an internal detail).

Sending a v2 now.
diff mbox series

Patch

diff --git a/include/uapi/drm/drm_mode.h b/include/uapi/drm/drm_mode.h
index 863eda048265..f7c41aa4b5eb 100644
--- a/include/uapi/drm/drm_mode.h
+++ b/include/uapi/drm/drm_mode.h
@@ -924,6 +924,10 @@  struct drm_mode_create_blob {
  * struct drm_mode_destroy_blob - Destroy user blob
  * @blob_id: blob_id to destroy
  * Destroy a user-created blob property.
+ *
+ * Blobs are reference-counted by the kernel, so user-space can destroy them as
+ * soon as they're done with them.  For instance user-space can destroy a blob
+ * used in an atomic commit right after performing the atomic commit ioctl.
  */
 struct drm_mode_destroy_blob {
 	__u32 blob_id;