diff mbox series

[3/3] drm: Update documentation and TODO of gem_prime_mmap hook

Message ID 20211108102846.309-4-tzimmermann@suse.de (mailing list archive)
State Accepted
Commit 396d9b9a48723995416a05f0dab80c1dd6c21e80
Headers show
Series drm/{exynos,xen}: Implement gem_prime_mmap with drm_gem_prime_mmap() | expand

Commit Message

Thomas Zimmermann Nov. 8, 2021, 10:28 a.m. UTC
The hook gem_prime_mmap in struct drm_driver is deprecated. Document
the new requirements.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 Documentation/gpu/todo.rst | 11 -----------
 include/drm/drm_drv.h      | 11 +++++++----
 2 files changed, 7 insertions(+), 15 deletions(-)

Comments

Daniel Vetter Nov. 10, 2021, 10:46 a.m. UTC | #1
On Mon, Nov 08, 2021 at 11:28:46AM +0100, Thomas Zimmermann wrote:
> The hook gem_prime_mmap in struct drm_driver is deprecated. Document
> the new requirements.
> 
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

> ---
>  Documentation/gpu/todo.rst | 11 -----------
>  include/drm/drm_drv.h      | 11 +++++++----
>  2 files changed, 7 insertions(+), 15 deletions(-)
> 
> diff --git a/Documentation/gpu/todo.rst b/Documentation/gpu/todo.rst
> index 60d1d7ee0719..6593c4c4006e 100644
> --- a/Documentation/gpu/todo.rst
> +++ b/Documentation/gpu/todo.rst
> @@ -268,17 +268,6 @@ Contact: Daniel Vetter
>  
>  Level: Intermediate
>  
> -Clean up mmap forwarding
> -------------------------
> -
> -A lot of drivers forward gem mmap calls to dma-buf mmap for imported buffers.
> -And also a lot of them forward dma-buf mmap to the gem mmap implementations.
> -There's drm_gem_prime_mmap() for this now, but still needs to be rolled out.
> -
> -Contact: Daniel Vetter
> -
> -Level: Intermediate
> -
>  Generic fbdev defio support
>  ---------------------------
>  
> diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
> index 0cd95953cdf5..a84eb4028e5b 100644
> --- a/include/drm/drm_drv.h
> +++ b/include/drm/drm_drv.h
> @@ -345,11 +345,14 @@ struct drm_driver {
>  	 * mmap hook for GEM drivers, used to implement dma-buf mmap in the
>  	 * PRIME helpers.
>  	 *
> -	 * FIXME: There's way too much duplication going on here, and also moved
> -	 * to &drm_gem_object_funcs.
> +	 * This hook only exists for historical reasons. Drivers must use
> +	 * drm_gem_prime_mmap() to implement it.
> +	 *
> +	 * FIXME: Convert all drivers to implement mmap in struct
> +	 * &drm_gem_object_funcs and inline drm_gem_prime_mmap() into
> +	 * its callers. This hook should be removed afterwards.

I think at least i915 has different semantics between dma-buf mmap and gem
mmap in some cases, so this might be tricky to achieve. But I think
everywhere else this should be solid.
-Daniel

>  	 */
> -	int (*gem_prime_mmap)(struct drm_gem_object *obj,
> -				struct vm_area_struct *vma);
> +	int (*gem_prime_mmap)(struct drm_gem_object *obj, struct vm_area_struct *vma);
>  
>  	/**
>  	 * @dumb_create:
> -- 
> 2.33.1
>
Thomas Zimmermann Nov. 10, 2021, 12:56 p.m. UTC | #2
Hi

Am 10.11.21 um 11:46 schrieb Daniel Vetter:
> On Mon, Nov 08, 2021 at 11:28:46AM +0100, Thomas Zimmermann wrote:
>> The hook gem_prime_mmap in struct drm_driver is deprecated. Document
>> the new requirements.
>>
>> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> 
> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

Thanks a lot!

With the remaining patches merged, all drivers will implement 
gem_prime_mmap via drm_gem_prime_mmap() and use the GEM object's mmap 
callback for specific details.

The next step would be to move all custom implementations of 
file_operations.mmap into the GEM object's mmap and implement the 
file_operations callback with drm_mmap().

Best regards
Thomas

> 
>> ---
>>   Documentation/gpu/todo.rst | 11 -----------
>>   include/drm/drm_drv.h      | 11 +++++++----
>>   2 files changed, 7 insertions(+), 15 deletions(-)
>>
>> diff --git a/Documentation/gpu/todo.rst b/Documentation/gpu/todo.rst
>> index 60d1d7ee0719..6593c4c4006e 100644
>> --- a/Documentation/gpu/todo.rst
>> +++ b/Documentation/gpu/todo.rst
>> @@ -268,17 +268,6 @@ Contact: Daniel Vetter
>>   
>>   Level: Intermediate
>>   
>> -Clean up mmap forwarding
>> -------------------------
>> -
>> -A lot of drivers forward gem mmap calls to dma-buf mmap for imported buffers.
>> -And also a lot of them forward dma-buf mmap to the gem mmap implementations.
>> -There's drm_gem_prime_mmap() for this now, but still needs to be rolled out.
>> -
>> -Contact: Daniel Vetter
>> -
>> -Level: Intermediate
>> -
>>   Generic fbdev defio support
>>   ---------------------------
>>   
>> diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
>> index 0cd95953cdf5..a84eb4028e5b 100644
>> --- a/include/drm/drm_drv.h
>> +++ b/include/drm/drm_drv.h
>> @@ -345,11 +345,14 @@ struct drm_driver {
>>   	 * mmap hook for GEM drivers, used to implement dma-buf mmap in the
>>   	 * PRIME helpers.
>>   	 *
>> -	 * FIXME: There's way too much duplication going on here, and also moved
>> -	 * to &drm_gem_object_funcs.
>> +	 * This hook only exists for historical reasons. Drivers must use
>> +	 * drm_gem_prime_mmap() to implement it.
>> +	 *
>> +	 * FIXME: Convert all drivers to implement mmap in struct
>> +	 * &drm_gem_object_funcs and inline drm_gem_prime_mmap() into
>> +	 * its callers. This hook should be removed afterwards.
> 
> I think at least i915 has different semantics between dma-buf mmap and gem
> mmap in some cases, so this might be tricky to achieve. But I think
> everywhere else this should be solid.
> -Daniel
> 
>>   	 */
>> -	int (*gem_prime_mmap)(struct drm_gem_object *obj,
>> -				struct vm_area_struct *vma);
>> +	int (*gem_prime_mmap)(struct drm_gem_object *obj, struct vm_area_struct *vma);
>>   
>>   	/**
>>   	 * @dumb_create:
>> -- 
>> 2.33.1
>>
>
diff mbox series

Patch

diff --git a/Documentation/gpu/todo.rst b/Documentation/gpu/todo.rst
index 60d1d7ee0719..6593c4c4006e 100644
--- a/Documentation/gpu/todo.rst
+++ b/Documentation/gpu/todo.rst
@@ -268,17 +268,6 @@  Contact: Daniel Vetter
 
 Level: Intermediate
 
-Clean up mmap forwarding
-------------------------
-
-A lot of drivers forward gem mmap calls to dma-buf mmap for imported buffers.
-And also a lot of them forward dma-buf mmap to the gem mmap implementations.
-There's drm_gem_prime_mmap() for this now, but still needs to be rolled out.
-
-Contact: Daniel Vetter
-
-Level: Intermediate
-
 Generic fbdev defio support
 ---------------------------
 
diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
index 0cd95953cdf5..a84eb4028e5b 100644
--- a/include/drm/drm_drv.h
+++ b/include/drm/drm_drv.h
@@ -345,11 +345,14 @@  struct drm_driver {
 	 * mmap hook for GEM drivers, used to implement dma-buf mmap in the
 	 * PRIME helpers.
 	 *
-	 * FIXME: There's way too much duplication going on here, and also moved
-	 * to &drm_gem_object_funcs.
+	 * This hook only exists for historical reasons. Drivers must use
+	 * drm_gem_prime_mmap() to implement it.
+	 *
+	 * FIXME: Convert all drivers to implement mmap in struct
+	 * &drm_gem_object_funcs and inline drm_gem_prime_mmap() into
+	 * its callers. This hook should be removed afterwards.
 	 */
-	int (*gem_prime_mmap)(struct drm_gem_object *obj,
-				struct vm_area_struct *vma);
+	int (*gem_prime_mmap)(struct drm_gem_object *obj, struct vm_area_struct *vma);
 
 	/**
 	 * @dumb_create: