diff mbox series

[01/10] fbdev: Add fb_ops init macros for framebuffers in DMA-able memory

Message ID 20230704160133.20261-2-tzimmermann@suse.de (mailing list archive)
State New
Headers show
Series drm: Improve fbdev emulation for DMA-able framebuffers | expand

Commit Message

Thomas Zimmermann July 4, 2023, 3:49 p.m. UTC
Add initializer macros for struct fb_ops for framebuffers in DMA-able
memory areas. Also add a corresponding Kconfig token. As of now, this
is equivalent to system framebuffers and mostly useful for labeling
drivers correctly.

A later patch may add a generic DMA-specific mmap operation. Linux
offers a number of dma_mmap_*() helpers for different use cases.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Helge Deller <deller@gmx.de>
---
 drivers/video/fbdev/Kconfig |  8 ++++++++
 include/linux/fb.h          | 13 +++++++++++++
 2 files changed, 21 insertions(+)

Comments

Javier Martinez Canillas July 5, 2023, 8:23 a.m. UTC | #1
Thomas Zimmermann <tzimmermann@suse.de> writes:

Hello Thomas,

> Add initializer macros for struct fb_ops for framebuffers in DMA-able
> memory areas. Also add a corresponding Kconfig token. As of now, this
> is equivalent to system framebuffers and mostly useful for labeling
> drivers correctly.
>
> A later patch may add a generic DMA-specific mmap operation. Linux
> offers a number of dma_mmap_*() helpers for different use cases.
>
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> Cc: Helge Deller <deller@gmx.de>
> ---
>  drivers/video/fbdev/Kconfig |  8 ++++++++
>  include/linux/fb.h          | 13 +++++++++++++
>  2 files changed, 21 insertions(+)
>
> diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig
> index cecf15418632..f14229757311 100644
> --- a/drivers/video/fbdev/Kconfig
> +++ b/drivers/video/fbdev/Kconfig
> @@ -168,6 +168,14 @@ config FB_DEFERRED_IO
>  	bool
>  	depends on FB
>  
> +config FB_DMA_HELPERS
> +	bool
> +	depends on FB
> +	select FB_SYS_COPYAREA
> +	select FB_SYS_FILLRECT
> +	select FB_SYS_FOPS
> +	select FB_SYS_IMAGEBLIT
> +
>  config FB_IO_HELPERS
>  	bool
>  	depends on FB
> diff --git a/include/linux/fb.h b/include/linux/fb.h
> index 1d5c13f34b09..1191a78c5289 100644
> --- a/include/linux/fb.h
> +++ b/include/linux/fb.h
> @@ -594,6 +594,19 @@ extern ssize_t fb_sys_write(struct fb_info *info, const char __user *buf,
>  	__FB_DEFAULT_SYS_OPS_DRAW, \
>  	__FB_DEFAULT_SYS_OPS_MMAP
>  
> +/*
> + * Helpers for framebuffers in DMA-able memory
> + */
> +

The comment for I/O memory helpers says:

/*
 * Initializes struct fb_ops for framebuffers in I/O memory.
 */

I think that would be good to have consistency between these two,
so something like:

/*
 * Initializes struct fb_ops for framebuffers in DMA-able memory.
 */

> +#define __FB_DEFAULT_DMA_OPS_RDWR \
> +	.fb_read	= fb_sys_read, \
> +	.fb_write	= fb_sys_write
> +
> +#define __FB_DEFAULT_DMA_OPS_DRAW \
> +	.fb_fillrect	= sys_fillrect, \
> +	.fb_copyarea	= sys_copyarea, \
> +	.fb_imageblit	= sys_imageblit
> +

Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Thomas Zimmermann July 5, 2023, 9:08 a.m. UTC | #2
Hi Javier

Am 05.07.23 um 10:23 schrieb Javier Martinez Canillas:
> Thomas Zimmermann <tzimmermann@suse.de> writes:
> 
> Hello Thomas,
> 
>> Add initializer macros for struct fb_ops for framebuffers in DMA-able
>> memory areas. Also add a corresponding Kconfig token. As of now, this
>> is equivalent to system framebuffers and mostly useful for labeling
>> drivers correctly.
>>
>> A later patch may add a generic DMA-specific mmap operation. Linux
>> offers a number of dma_mmap_*() helpers for different use cases.
>>
>> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
>> Cc: Helge Deller <deller@gmx.de>
>> ---
>>   drivers/video/fbdev/Kconfig |  8 ++++++++
>>   include/linux/fb.h          | 13 +++++++++++++
>>   2 files changed, 21 insertions(+)
>>
>> diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig
>> index cecf15418632..f14229757311 100644
>> --- a/drivers/video/fbdev/Kconfig
>> +++ b/drivers/video/fbdev/Kconfig
>> @@ -168,6 +168,14 @@ config FB_DEFERRED_IO
>>   	bool
>>   	depends on FB
>>   
>> +config FB_DMA_HELPERS
>> +	bool
>> +	depends on FB
>> +	select FB_SYS_COPYAREA
>> +	select FB_SYS_FILLRECT
>> +	select FB_SYS_FOPS
>> +	select FB_SYS_IMAGEBLIT
>> +
>>   config FB_IO_HELPERS
>>   	bool
>>   	depends on FB
>> diff --git a/include/linux/fb.h b/include/linux/fb.h
>> index 1d5c13f34b09..1191a78c5289 100644
>> --- a/include/linux/fb.h
>> +++ b/include/linux/fb.h
>> @@ -594,6 +594,19 @@ extern ssize_t fb_sys_write(struct fb_info *info, const char __user *buf,
>>   	__FB_DEFAULT_SYS_OPS_DRAW, \
>>   	__FB_DEFAULT_SYS_OPS_MMAP
>>   
>> +/*
>> + * Helpers for framebuffers in DMA-able memory
>> + */
>> +
> 
> The comment for I/O memory helpers says:
> 
> /*
>   * Initializes struct fb_ops for framebuffers in I/O memory.
>   */
> 
> I think that would be good to have consistency between these two,

Sure, I had the same thought. I think I'll rather change the existing 
comments a bit.

Best regards
Thomas


> so something like:
> 
> /*
>   * Initializes struct fb_ops for framebuffers in DMA-able memory.
>   */
> 
>> +#define __FB_DEFAULT_DMA_OPS_RDWR \
>> +	.fb_read	= fb_sys_read, \
>> +	.fb_write	= fb_sys_write
>> +
>> +#define __FB_DEFAULT_DMA_OPS_DRAW \
>> +	.fb_fillrect	= sys_fillrect, \
>> +	.fb_copyarea	= sys_copyarea, \
>> +	.fb_imageblit	= sys_imageblit
>> +
> 
> Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
>
Javier Martinez Canillas July 5, 2023, 9:13 a.m. UTC | #3
Thomas Zimmermann <tzimmermann@suse.de> writes:

[...]

>> 
>> The comment for I/O memory helpers says:
>> 
>> /*
>>   * Initializes struct fb_ops for framebuffers in I/O memory.
>>   */
>> 
>> I think that would be good to have consistency between these two,
>
> Sure, I had the same thought. I think I'll rather change the existing 
> comments a bit.
>

Yes, that works for me too. Thanks!

> Best regards
> Thomas
>
>
diff mbox series

Patch

diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig
index cecf15418632..f14229757311 100644
--- a/drivers/video/fbdev/Kconfig
+++ b/drivers/video/fbdev/Kconfig
@@ -168,6 +168,14 @@  config FB_DEFERRED_IO
 	bool
 	depends on FB
 
+config FB_DMA_HELPERS
+	bool
+	depends on FB
+	select FB_SYS_COPYAREA
+	select FB_SYS_FILLRECT
+	select FB_SYS_FOPS
+	select FB_SYS_IMAGEBLIT
+
 config FB_IO_HELPERS
 	bool
 	depends on FB
diff --git a/include/linux/fb.h b/include/linux/fb.h
index 1d5c13f34b09..1191a78c5289 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -594,6 +594,19 @@  extern ssize_t fb_sys_write(struct fb_info *info, const char __user *buf,
 	__FB_DEFAULT_SYS_OPS_DRAW, \
 	__FB_DEFAULT_SYS_OPS_MMAP
 
+/*
+ * Helpers for framebuffers in DMA-able memory
+ */
+
+#define __FB_DEFAULT_DMA_OPS_RDWR \
+	.fb_read	= fb_sys_read, \
+	.fb_write	= fb_sys_write
+
+#define __FB_DEFAULT_DMA_OPS_DRAW \
+	.fb_fillrect	= sys_fillrect, \
+	.fb_copyarea	= sys_copyarea, \
+	.fb_imageblit	= sys_imageblit
+
 /* drivers/video/fbmem.c */
 extern int register_framebuffer(struct fb_info *fb_info);
 extern void unregister_framebuffer(struct fb_info *fb_info);