Skip to content

Commit c6baad6

Browse files
author
Thomas Zimmermann
committed
drm/fbdev-generic: Implement dedicated fbdev I/O helpers
Implement dedicated fbdev helpers for framebuffer I/O instead of using DRM's helpers. Use an fbdev generator macro for deferred I/O to create the callbacks. Fbdev-generic was the only caller of the DRM helpers, so remove them from the helper module. v4: * generate deferred-I/O helpers * use initializer macros for fb_ops v2: * use FB_SYS_HELPERS_DEFERRED option Signed-off-by: Thomas Zimmermann <[email protected]> Tested-by: Sui Jingfeng <[email protected]> Reviewed-by: Sui Jingfeng <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 4a2262c commit c6baad6

File tree

4 files changed

+6
-159
lines changed

4 files changed

+6
-159
lines changed

drivers/gpu/drm/Kconfig

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ config DRM_KUNIT_TEST
9595
config DRM_KMS_HELPER
9696
tristate
9797
depends on DRM
98+
select FB_SYS_HELPERS_DEFERRED if DRM_FBDEV_EMULATION
9899
help
99100
CRTC helpers for KMS drivers.
100101

@@ -135,11 +136,6 @@ config DRM_FBDEV_EMULATION
135136
select FB_CFB_FILLRECT
136137
select FB_CFB_COPYAREA
137138
select FB_CFB_IMAGEBLIT
138-
select FB_DEFERRED_IO
139-
select FB_SYS_FOPS
140-
select FB_SYS_FILLRECT
141-
select FB_SYS_COPYAREA
142-
select FB_SYS_IMAGEBLIT
143139
select FRAMEBUFFER_CONSOLE if !EXPERT
144140
select FRAMEBUFFER_CONSOLE_DETECT_PRIMARY if FRAMEBUFFER_CONSOLE
145141
default y

drivers/gpu/drm/drm_fb_helper.c

Lines changed: 0 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -736,113 +736,6 @@ void drm_fb_helper_deferred_io(struct fb_info *info, struct list_head *pagerefli
736736
}
737737
EXPORT_SYMBOL(drm_fb_helper_deferred_io);
738738

739-
/**
740-
* drm_fb_helper_sys_read - Implements struct &fb_ops.fb_read for system memory
741-
* @info: fb_info struct pointer
742-
* @buf: userspace buffer to read from framebuffer memory
743-
* @count: number of bytes to read from framebuffer memory
744-
* @ppos: read offset within framebuffer memory
745-
*
746-
* Returns:
747-
* The number of bytes read on success, or an error code otherwise.
748-
*/
749-
ssize_t drm_fb_helper_sys_read(struct fb_info *info, char __user *buf,
750-
size_t count, loff_t *ppos)
751-
{
752-
return fb_sys_read(info, buf, count, ppos);
753-
}
754-
EXPORT_SYMBOL(drm_fb_helper_sys_read);
755-
756-
/**
757-
* drm_fb_helper_sys_write - Implements struct &fb_ops.fb_write for system memory
758-
* @info: fb_info struct pointer
759-
* @buf: userspace buffer to write to framebuffer memory
760-
* @count: number of bytes to write to framebuffer memory
761-
* @ppos: write offset within framebuffer memory
762-
*
763-
* Returns:
764-
* The number of bytes written on success, or an error code otherwise.
765-
*/
766-
ssize_t drm_fb_helper_sys_write(struct fb_info *info, const char __user *buf,
767-
size_t count, loff_t *ppos)
768-
{
769-
struct drm_fb_helper *helper = info->par;
770-
loff_t pos = *ppos;
771-
ssize_t ret;
772-
struct drm_rect damage_area;
773-
774-
ret = fb_sys_write(info, buf, count, ppos);
775-
if (ret <= 0)
776-
return ret;
777-
778-
if (helper->funcs->fb_dirty) {
779-
drm_fb_helper_memory_range_to_clip(info, pos, ret, &damage_area);
780-
drm_fb_helper_damage(helper, damage_area.x1, damage_area.y1,
781-
drm_rect_width(&damage_area),
782-
drm_rect_height(&damage_area));
783-
}
784-
785-
return ret;
786-
}
787-
EXPORT_SYMBOL(drm_fb_helper_sys_write);
788-
789-
/**
790-
* drm_fb_helper_sys_fillrect - wrapper around sys_fillrect
791-
* @info: fbdev registered by the helper
792-
* @rect: info about rectangle to fill
793-
*
794-
* A wrapper around sys_fillrect implemented by fbdev core
795-
*/
796-
void drm_fb_helper_sys_fillrect(struct fb_info *info,
797-
const struct fb_fillrect *rect)
798-
{
799-
struct drm_fb_helper *helper = info->par;
800-
801-
sys_fillrect(info, rect);
802-
803-
if (helper->funcs->fb_dirty)
804-
drm_fb_helper_damage(helper, rect->dx, rect->dy, rect->width, rect->height);
805-
}
806-
EXPORT_SYMBOL(drm_fb_helper_sys_fillrect);
807-
808-
/**
809-
* drm_fb_helper_sys_copyarea - wrapper around sys_copyarea
810-
* @info: fbdev registered by the helper
811-
* @area: info about area to copy
812-
*
813-
* A wrapper around sys_copyarea implemented by fbdev core
814-
*/
815-
void drm_fb_helper_sys_copyarea(struct fb_info *info,
816-
const struct fb_copyarea *area)
817-
{
818-
struct drm_fb_helper *helper = info->par;
819-
820-
sys_copyarea(info, area);
821-
822-
if (helper->funcs->fb_dirty)
823-
drm_fb_helper_damage(helper, area->dx, area->dy, area->width, area->height);
824-
}
825-
EXPORT_SYMBOL(drm_fb_helper_sys_copyarea);
826-
827-
/**
828-
* drm_fb_helper_sys_imageblit - wrapper around sys_imageblit
829-
* @info: fbdev registered by the helper
830-
* @image: info about image to blit
831-
*
832-
* A wrapper around sys_imageblit implemented by fbdev core
833-
*/
834-
void drm_fb_helper_sys_imageblit(struct fb_info *info,
835-
const struct fb_image *image)
836-
{
837-
struct drm_fb_helper *helper = info->par;
838-
839-
sys_imageblit(info, image);
840-
841-
if (helper->funcs->fb_dirty)
842-
drm_fb_helper_damage(helper, image->dx, image->dy, image->width, image->height);
843-
}
844-
EXPORT_SYMBOL(drm_fb_helper_sys_imageblit);
845-
846739
/**
847740
* drm_fb_helper_cfb_read - Implements struct &fb_ops.fb_read for I/O memory
848741
* @info: fb_info struct pointer

drivers/gpu/drm/drm_fbdev_generic.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ static int drm_fbdev_generic_fb_release(struct fb_info *info, int user)
3434
return 0;
3535
}
3636

37+
FB_GEN_DEFAULT_DEFERRED_SYS_OPS(drm_fbdev_generic,
38+
drm_fb_helper_damage_range,
39+
drm_fb_helper_damage_area);
40+
3741
static void drm_fbdev_generic_fb_destroy(struct fb_info *info)
3842
{
3943
struct drm_fb_helper *fb_helper = info->par;
@@ -56,13 +60,8 @@ static const struct fb_ops drm_fbdev_generic_fb_ops = {
5660
.owner = THIS_MODULE,
5761
.fb_open = drm_fbdev_generic_fb_open,
5862
.fb_release = drm_fbdev_generic_fb_release,
59-
.fb_read = drm_fb_helper_sys_read,
60-
.fb_write = drm_fb_helper_sys_write,
63+
FB_DEFAULT_DEFERRED_OPS(drm_fbdev_generic),
6164
DRM_FB_HELPER_DEFAULT_OPS,
62-
.fb_fillrect = drm_fb_helper_sys_fillrect,
63-
.fb_copyarea = drm_fb_helper_sys_copyarea,
64-
.fb_imageblit = drm_fb_helper_sys_imageblit,
65-
.fb_mmap = fb_deferred_io_mmap,
6665
.fb_destroy = drm_fbdev_generic_fb_destroy,
6766
};
6867

include/drm/drm_fb_helper.h

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -258,18 +258,6 @@ void drm_fb_helper_damage_area(struct fb_info *info, u32 x, u32 y, u32 width, u3
258258

259259
void drm_fb_helper_deferred_io(struct fb_info *info, struct list_head *pagereflist);
260260

261-
ssize_t drm_fb_helper_sys_read(struct fb_info *info, char __user *buf,
262-
size_t count, loff_t *ppos);
263-
ssize_t drm_fb_helper_sys_write(struct fb_info *info, const char __user *buf,
264-
size_t count, loff_t *ppos);
265-
266-
void drm_fb_helper_sys_fillrect(struct fb_info *info,
267-
const struct fb_fillrect *rect);
268-
void drm_fb_helper_sys_copyarea(struct fb_info *info,
269-
const struct fb_copyarea *area);
270-
void drm_fb_helper_sys_imageblit(struct fb_info *info,
271-
const struct fb_image *image);
272-
273261
ssize_t drm_fb_helper_cfb_read(struct fb_info *info, char __user *buf,
274262
size_t count, loff_t *ppos);
275263
ssize_t drm_fb_helper_cfb_write(struct fb_info *info, const char __user *buf,
@@ -397,35 +385,6 @@ static inline int drm_fb_helper_defio_init(struct drm_fb_helper *fb_helper)
397385
return -ENODEV;
398386
}
399387

400-
static inline ssize_t drm_fb_helper_sys_read(struct fb_info *info,
401-
char __user *buf, size_t count,
402-
loff_t *ppos)
403-
{
404-
return -ENODEV;
405-
}
406-
407-
static inline ssize_t drm_fb_helper_sys_write(struct fb_info *info,
408-
const char __user *buf,
409-
size_t count, loff_t *ppos)
410-
{
411-
return -ENODEV;
412-
}
413-
414-
static inline void drm_fb_helper_sys_fillrect(struct fb_info *info,
415-
const struct fb_fillrect *rect)
416-
{
417-
}
418-
419-
static inline void drm_fb_helper_sys_copyarea(struct fb_info *info,
420-
const struct fb_copyarea *area)
421-
{
422-
}
423-
424-
static inline void drm_fb_helper_sys_imageblit(struct fb_info *info,
425-
const struct fb_image *image)
426-
{
427-
}
428-
429388
static inline ssize_t drm_fb_helper_cfb_read(struct fb_info *info, char __user *buf,
430389
size_t count, loff_t *ppos)
431390
{

0 commit comments

Comments
 (0)