[PATCH v2] drm/ioctl: Add a ioctl to label GEM objects

Rohan Garg rohan.garg at collabora.com
Thu Sep 26 08:49:08 UTC 2019


Hi

On jueves, 19 de septiembre de 2019 16:02:57 (CEST) Thomas Zimmermann wrote:
> Hi
> 
> Am 19.09.19 um 14:53 schrieb Rohan Garg:
> > DRM_IOCTL_BO_SET_LABEL lets you label GEM objects, making it
> > easier to debug issues in userspace applications.
> > 
> > Changes in v2:
> >   - Hoist the IOCTL up into the drm_driver framework
> > 
> > Signed-off-by: Rohan Garg <rohan.garg at collabora.com>
> > ---
> > 
> >  drivers/gpu/drm/drm_gem.c      | 64 ++++++++++++++++++++++++++++++++++
> >  drivers/gpu/drm/drm_internal.h |  4 +++
> >  drivers/gpu/drm/drm_ioctl.c    |  1 +
> >  include/drm/drm_drv.h          | 18 ++++++++++
> >  include/drm/drm_gem.h          |  7 ++++
> >  include/uapi/drm/drm.h         | 20 +++++++++++
> >  6 files changed, 114 insertions(+)
> > 
> > diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c
> > index 6854f5867d51..785ac561619a 100644
> > --- a/drivers/gpu/drm/drm_gem.c
> > +++ b/drivers/gpu/drm/drm_gem.c
> > @@ -941,6 +941,65 @@ drm_gem_release(struct drm_device *dev, struct
> > drm_file *file_private)> 
> >  	idr_destroy(&file_private->object_idr);
> >  
> >  }
> > 
> > +int drm_bo_set_label_ioctl(struct drm_device *dev, void *data,
> > +		       struct drm_file *file_priv)
> > +{
> > +	struct drm_label_object *args = data;
> > +
> > +	if (!args->len || !args->name)
> > +		return -EINVAL;
> > +
> > +	if (dev->driver->label)
> > +		return dev->driver->label(dev, args, file_priv);
> > +
> > +	return -EOPNOTSUPP;
> > +}
> > +
> > +/**
> > + * drm_gem_label - label a given GEM object
> > + * @dev: drm_device for the associated GEM object
> > + * @data: drm_label_bo struct with a label, label length and any relevant
> > flags + * @file_private: drm file-private structure to clean up
> > + */
> > +
> > +int drm_gem_set_label(struct drm_device *dev, struct drm_label_object
> > *args, struct drm_file *file_priv)
> I'd like to set labels for internal GEM objects. Could you split off the
> object update code into something that is easily callable from within
> drivers? Something like
> 
>   // called by ioctl
>   int drm_gem_object_adopt_label(struct drm_gem_object *gem,
>         char *label)
>   {
>         // your object update code goes here
>   }
> 
>   // called by drivers
>   int drm_gem_object_set_label(struct drm_gem_object *gem,
>         const char *label)
>   {
> 	char* new_label = strdup(label)
> 	return drm_gem_object_adopt_label(gem, new_label);
>   }
> 
> 
> We have debugfs support for TTM-based GEM objects at [1]. I think the
> label would be a welcome addition to the output.
> 

Ack, I'll address this in v3.

Cheers
Rohan Garg
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part.
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20190926/347a9882/attachment-0001.sig>


More information about the dri-devel mailing list