Skip to content

Commit 6f0f694

Browse files
committed
fbdev: Add fb_ops init macros for framebuffers in DMA-able memory
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> Reviewed-by: Javier Martinez Canillas <javierm@redhat.com> Acked-by: Maxime Ripard <mripard@kernel.org> Cc: Helge Deller <deller@gmx.de> Link: https://patchwork.freedesktop.org/patch/msgid/20230707083422.18691-2-tzimmermann@suse.de
1 parent e6fa481 commit 6f0f694

2 files changed

Lines changed: 21 additions & 0 deletions

File tree

drivers/video/fbdev/core/Kconfig

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,14 @@ config FB_DEFERRED_IO
136136
bool
137137
depends on FB_CORE
138138

139+
config FB_DMA_HELPERS
140+
bool
141+
depends on FB_CORE
142+
select FB_SYS_COPYAREA
143+
select FB_SYS_FILLRECT
144+
select FB_SYS_FOPS
145+
select FB_SYS_IMAGEBLIT
146+
139147
config FB_IO_HELPERS
140148
bool
141149
depends on FB_CORE

include/linux/fb.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -591,6 +591,19 @@ extern ssize_t fb_sys_write(struct fb_info *info, const char __user *buf,
591591
__FB_DEFAULT_SYS_OPS_DRAW, \
592592
__FB_DEFAULT_SYS_OPS_MMAP
593593

594+
/*
595+
* Helpers for framebuffers in DMA-able memory
596+
*/
597+
598+
#define __FB_DEFAULT_DMA_OPS_RDWR \
599+
.fb_read = fb_sys_read, \
600+
.fb_write = fb_sys_write
601+
602+
#define __FB_DEFAULT_DMA_OPS_DRAW \
603+
.fb_fillrect = sys_fillrect, \
604+
.fb_copyarea = sys_copyarea, \
605+
.fb_imageblit = sys_imageblit
606+
594607
/* drivers/video/fbmem.c */
595608
extern int register_framebuffer(struct fb_info *fb_info);
596609
extern void unregister_framebuffer(struct fb_info *fb_info);

0 commit comments

Comments
 (0)