Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/gem: Update/Polish docs

A bunch of things have been removed meanwhile and docs not fully
brought up to speed. And a few gaps closed where I noticed missing
kerneldoc while reading through the overview sections.

Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1445533889-7661-3-git-send-email-daniel.vetter@ffwll.ch
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>

+36 -32
+4 -29
Documentation/DocBook/gpu.tmpl
··· 615 615 <function>drm_gem_object_init</function>. Storage for private GEM 616 616 objects must be managed by drivers. 617 617 </para> 618 - <para> 619 - Drivers that do not need to extend GEM objects with private information 620 - can call the <function>drm_gem_object_alloc</function> function to 621 - allocate and initialize a struct <structname>drm_gem_object</structname> 622 - instance. The GEM core will call the optional driver 623 - <methodname>gem_init_object</methodname> operation after initializing 624 - the GEM object with <function>drm_gem_object_init</function>. 625 - <synopsis>int (*gem_init_object) (struct drm_gem_object *obj);</synopsis> 626 - </para> 627 - <para> 628 - No alloc-and-init function exists for private GEM objects. 629 - </para> 630 618 </sect3> 631 619 <sect3> 632 620 <title>GEM Objects Lifetime</title> ··· 637 649 </para> 638 650 <para> 639 651 <synopsis>void (*gem_free_object) (struct drm_gem_object *obj);</synopsis> 640 - Drivers are responsible for freeing all GEM object resources, including 641 - the resources created by the GEM core. If an mmap offset has been 642 - created for the object (in which case 643 - <structname>drm_gem_object</structname>::<structfield>map_list</structfield>::<structfield>map</structfield> 644 - is not NULL) it must be freed by a call to 645 - <function>drm_gem_free_mmap_offset</function>. The shmfs backing store 646 - must be released by calling <function>drm_gem_object_release</function> 647 - (that function can safely be called if no shmfs backing store has been 648 - created). 652 + Drivers are responsible for freeing all GEM object resources. This includes 653 + the resources created by the GEM core, which need to be released with 654 + <function>drm_gem_object_release</function>. 649 655 </para> 650 656 </sect3> 651 657 <sect3> ··· 722 740 DRM identifies the GEM object to be mapped by a fake offset passed 723 741 through the mmap offset argument. Prior to being mapped, a GEM object 724 742 must thus be associated with a fake offset. To do so, drivers must call 725 - <function>drm_gem_create_mmap_offset</function> on the object. The 726 - function allocates a fake offset range from a pool and stores the 727 - offset divided by PAGE_SIZE in 728 - <literal>obj-&gt;map_list.hash.key</literal>. Care must be taken not to 729 - call <function>drm_gem_create_mmap_offset</function> if a fake offset 730 - has already been allocated for the object. This can be tested by 731 - <literal>obj-&gt;map_list.map</literal> being non-NULL. 743 + <function>drm_gem_create_mmap_offset</function> on the object. 732 744 </para> 733 745 <para> 734 746 Once allocated, the fake offset value 735 - (<literal>obj-&gt;map_list.hash.key &lt;&lt; PAGE_SHIFT</literal>) 736 747 must be passed to the application in a driver-specific way and can then 737 748 be used as the mmap offset argument. 738 749 </para>
+32 -3
drivers/gpu/drm/drm_gem.c
··· 244 244 * @filp: drm file-private structure to use for the handle look up 245 245 * @handle: userspace handle to delete 246 246 * 247 - * Removes the GEM handle from the @filp lookup table and if this is the last 248 - * handle also cleans up linked resources like GEM names. 247 + * Removes the GEM handle from the @filp lookup table which has been added with 248 + * drm_gem_handle_create(). If this is the last handle also cleans up linked 249 + * resources like GEM names. 249 250 */ 250 251 int 251 252 drm_gem_handle_delete(struct drm_file *filp, u32 handle) ··· 315 314 * This expects the dev->object_name_lock to be held already and will drop it 316 315 * before returning. Used to avoid races in establishing new handles when 317 316 * importing an object from either an flink name or a dma-buf. 317 + * 318 + * Handles must be release again through drm_gem_handle_delete(). This is done 319 + * when userspace closes @file_priv for all attached handles, or through the 320 + * GEM_CLOSE ioctl for individual handles. 318 321 */ 319 322 int 320 323 drm_gem_handle_create_tail(struct drm_file *file_priv, ··· 546 541 } 547 542 EXPORT_SYMBOL(drm_gem_put_pages); 548 543 549 - /** Returns a reference to the object named by the handle. */ 544 + /** 545 + * drm_gem_object_lookup - look up a GEM object from it's handle 546 + * @dev: DRM device 547 + * @filp: DRM file private date 548 + * @handle: userspace handle 549 + * 550 + * Returns: 551 + * 552 + * A reference to the object named by the handle if such exists on @filp, NULL 553 + * otherwise. 554 + */ 550 555 struct drm_gem_object * 551 556 drm_gem_object_lookup(struct drm_device *dev, struct drm_file *filp, 552 557 u32 handle) ··· 789 774 } 790 775 EXPORT_SYMBOL(drm_gem_object_free); 791 776 777 + /** 778 + * drm_gem_vm_open - vma->ops->open implementation for GEM 779 + * @vma: VM area structure 780 + * 781 + * This function implements the #vm_operations_struct open() callback for GEM 782 + * drivers. This must be used together with drm_gem_vm_close(). 783 + */ 792 784 void drm_gem_vm_open(struct vm_area_struct *vma) 793 785 { 794 786 struct drm_gem_object *obj = vma->vm_private_data; ··· 804 782 } 805 783 EXPORT_SYMBOL(drm_gem_vm_open); 806 784 785 + /** 786 + * drm_gem_vm_close - vma->ops->close implementation for GEM 787 + * @vma: VM area structure 788 + * 789 + * This function implements the #vm_operations_struct close() callback for GEM 790 + * drivers. This must be used together with drm_gem_vm_open(). 791 + */ 807 792 void drm_gem_vm_close(struct vm_area_struct *vma) 808 793 { 809 794 struct drm_gem_object *obj = vma->vm_private_data;