[PATCH 6/8] drm: Add drm_gem_prime_fd_to_handle_obj

Tvrtko Ursulin tvrtko.ursulin at linux.intel.com
Fri Jun 9 14:12:44 UTC 2023


On 09/06/2023 13:44, Iddamsetty, Aravind wrote:
> On 09-06-2023 17:41, Tvrtko Ursulin wrote:
>> From: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
>>
>> I need a new flavour of the drm_gem_prime_fd_to_handle helper, one which
>> will return a reference to a newly created GEM objects (if created), in
>> order to enable tracking of imported i915 GEM objects in the following
>> patch.
> 
> instead of this what if we implement the open call back in i915
> 
> struct drm_gem_object_funcs {
> 
>          /**
>           * @open:
>           *
>           * Called upon GEM handle creation.
>           *
>           * This callback is optional.
>           */
>          int (*open)(struct drm_gem_object *obj, struct drm_file *file);
> 
> which gets called whenever a handle(drm_gem_handle_create_tail) is
> created and in the open we can check if to_intel_bo(obj)->base.dma_buf
> then it is imported if not it is owned or created by it.

I wanted to track as much memory usage as we have which is buffer object 
backed, including page tables and contexts. And since those are not user 
visible (they don't have handles), they wouldn't be covered by the 
obj->funcs->open() callback.

If we wanted to limit to objects with handles we could simply do what 
Rob proposed and that is to walk the handles idr. But that does not feel 
like the right direction to me. Open for discussion I guess.

Regards,

Tvrtko


More information about the dri-devel mailing list