diff mbox

[04/25] drm/fb_helper: Create wrappers for blit, copyarea and fillrect funcs

Message ID 1436769501-4105-5-git-send-email-architt@codeaurora.org (mailing list archive)
State Not Applicable, archived
Delegated to: Andy Gross
Headers show

Commit Message

Archit Taneja July 13, 2015, 6:38 a.m. UTC
drm drivers that emulate fbdev populate their fb_fillrect, fb_copyarea
and fb_imageblit fb_ops with the help of cfb_* or sys_* fbdev core
helper functions.

Create drm_fb_helper functions that wrap around these calls.

This is part of an effort to prevent drm drivers from calling fbdev
functions directly, in order to make fbdev emulation a top level drm
option.

Signed-off-by: Archit Taneja <architt@codeaurora.org>
---
 drivers/gpu/drm/Kconfig         |  6 ++++++
 drivers/gpu/drm/drm_fb_helper.c | 48 +++++++++++++++++++++++++++++++++++++++++
 include/drm/drm_fb_helper.h     | 14 ++++++++++++
 3 files changed, 68 insertions(+)

Comments

Daniel Vetter July 13, 2015, 7:40 a.m. UTC | #1
On Mon, Jul 13, 2015 at 12:08:00PM +0530, Archit Taneja wrote:
> drm drivers that emulate fbdev populate their fb_fillrect, fb_copyarea
> and fb_imageblit fb_ops with the help of cfb_* or sys_* fbdev core
> helper functions.
> 
> Create drm_fb_helper functions that wrap around these calls.
> 
> This is part of an effort to prevent drm drivers from calling fbdev
> functions directly, in order to make fbdev emulation a top level drm
> option.
> 
> Signed-off-by: Archit Taneja <architt@codeaurora.org>
> ---
>  drivers/gpu/drm/Kconfig         |  6 ++++++
>  drivers/gpu/drm/drm_fb_helper.c | 48 +++++++++++++++++++++++++++++++++++++++++
>  include/drm/drm_fb_helper.h     | 14 ++++++++++++
>  3 files changed, 68 insertions(+)
> 
> diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
> index b284cdc..e373f8a 100644
> --- a/drivers/gpu/drm/Kconfig
> +++ b/drivers/gpu/drm/Kconfig
> @@ -38,6 +38,12 @@ config DRM_KMS_FB_HELPER
>  	select FRAMEBUFFER_CONSOLE if !EXPERT
>  	select FRAMEBUFFER_CONSOLE_DETECT_PRIMARY if FRAMEBUFFER_CONSOLE
>  	select FB_SYS_FOPS
> +	select FB_SYS_FILLRECT
> +	select FB_SYS_COPYAREA
> +	select FB_SYS_IMAGEBLIT
> +	select FB_CFB_FILLRECT
> +	select FB_CFB_COPYAREA
> +	select FB_CFB_IMAGEBLIT
>  	help
>  	  FBDEV helpers for KMS drivers.
>  
> diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
> index 795547e..55b5212 100644
> --- a/drivers/gpu/drm/drm_fb_helper.c
> +++ b/drivers/gpu/drm/drm_fb_helper.c
> @@ -764,6 +764,54 @@ ssize_t drm_fb_helper_sys_write(struct fb_info *info, const char __user *buf,
>  }
>  EXPORT_SYMBOL(drm_fb_helper_sys_write);
>  
> +void drm_fb_helper_sys_fillrect(struct fb_info *info,
> +		const struct fb_fillrect *rect)

More alignment noise from checkpatch - continuations should align with the
opening (. Since we follow this pretty consistently in drm worth keeping
up imo.
-Daniel

> +{
> +	if (info)
> +		sys_fillrect(info, rect);
> +}
> +EXPORT_SYMBOL(drm_fb_helper_sys_fillrect);
> +
> +void drm_fb_helper_sys_copyarea(struct fb_info *info,
> +		const struct fb_copyarea *area)
> +{
> +	if (info)
> +		sys_copyarea(info, area);
> +}
> +EXPORT_SYMBOL(drm_fb_helper_sys_copyarea);
> +
> +void drm_fb_helper_sys_imageblit(struct fb_info *info,
> +		const struct fb_image *image)
> +{
> +	if (info)
> +		sys_imageblit(info, image);
> +}
> +EXPORT_SYMBOL(drm_fb_helper_sys_imageblit);
> +
> +void drm_fb_helper_cfb_fillrect(struct fb_info *info,
> +		const struct fb_fillrect *rect)
> +{
> +	if (info)
> +		cfb_fillrect(info, rect);
> +}
> +EXPORT_SYMBOL(drm_fb_helper_cfb_fillrect);
> +
> +void drm_fb_helper_cfb_copyarea(struct fb_info *info,
> +		const struct fb_copyarea *area)
> +{
> +	if (info)
> +		cfb_copyarea(info, area);
> +}
> +EXPORT_SYMBOL(drm_fb_helper_cfb_copyarea);
> +
> +void drm_fb_helper_cfb_imageblit(struct fb_info *info,
> +		const struct fb_image *image)
> +{
> +	if (info)
> +		cfb_imageblit(info, image);
> +}
> +EXPORT_SYMBOL(drm_fb_helper_cfb_imageblit);
> +
>  static int setcolreg(struct drm_crtc *crtc, u16 red, u16 green,
>  		     u16 blue, u16 regno, struct fb_info *info)
>  {
> diff --git a/include/drm/drm_fb_helper.h b/include/drm/drm_fb_helper.h
> index f74e59e..aa45837 100644
> --- a/include/drm/drm_fb_helper.h
> +++ b/include/drm/drm_fb_helper.h
> @@ -152,6 +152,20 @@ ssize_t drm_fb_helper_sys_read(struct fb_info *info, char __user *buf,
>  ssize_t drm_fb_helper_sys_write(struct fb_info *info, const char __user *buf,
>  			size_t count, loff_t *ppos);
>  
> +void drm_fb_helper_sys_fillrect(struct fb_info *info,
> +		const struct fb_fillrect *rect);
> +void drm_fb_helper_sys_copyarea(struct fb_info *info,
> +		const struct fb_copyarea *area);
> +void drm_fb_helper_sys_imageblit(struct fb_info *info,
> +		const struct fb_image *image);
> +
> +void drm_fb_helper_cfb_fillrect(struct fb_info *info,
> +		const struct fb_fillrect *rect);
> +void drm_fb_helper_cfb_copyarea(struct fb_info *info,
> +		const struct fb_copyarea *area);
> +void drm_fb_helper_cfb_imageblit(struct fb_info *info,
> +		const struct fb_image *image);
> +
>  int drm_fb_helper_setcmap(struct fb_cmap *cmap, struct fb_info *info);
>  
>  int drm_fb_helper_hotplug_event(struct drm_fb_helper *fb_helper);
> -- 
> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
> hosted by The Linux Foundation
>
diff mbox

Patch

diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
index b284cdc..e373f8a 100644
--- a/drivers/gpu/drm/Kconfig
+++ b/drivers/gpu/drm/Kconfig
@@ -38,6 +38,12 @@  config DRM_KMS_FB_HELPER
 	select FRAMEBUFFER_CONSOLE if !EXPERT
 	select FRAMEBUFFER_CONSOLE_DETECT_PRIMARY if FRAMEBUFFER_CONSOLE
 	select FB_SYS_FOPS
+	select FB_SYS_FILLRECT
+	select FB_SYS_COPYAREA
+	select FB_SYS_IMAGEBLIT
+	select FB_CFB_FILLRECT
+	select FB_CFB_COPYAREA
+	select FB_CFB_IMAGEBLIT
 	help
 	  FBDEV helpers for KMS drivers.
 
diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index 795547e..55b5212 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -764,6 +764,54 @@  ssize_t drm_fb_helper_sys_write(struct fb_info *info, const char __user *buf,
 }
 EXPORT_SYMBOL(drm_fb_helper_sys_write);
 
+void drm_fb_helper_sys_fillrect(struct fb_info *info,
+		const struct fb_fillrect *rect)
+{
+	if (info)
+		sys_fillrect(info, rect);
+}
+EXPORT_SYMBOL(drm_fb_helper_sys_fillrect);
+
+void drm_fb_helper_sys_copyarea(struct fb_info *info,
+		const struct fb_copyarea *area)
+{
+	if (info)
+		sys_copyarea(info, area);
+}
+EXPORT_SYMBOL(drm_fb_helper_sys_copyarea);
+
+void drm_fb_helper_sys_imageblit(struct fb_info *info,
+		const struct fb_image *image)
+{
+	if (info)
+		sys_imageblit(info, image);
+}
+EXPORT_SYMBOL(drm_fb_helper_sys_imageblit);
+
+void drm_fb_helper_cfb_fillrect(struct fb_info *info,
+		const struct fb_fillrect *rect)
+{
+	if (info)
+		cfb_fillrect(info, rect);
+}
+EXPORT_SYMBOL(drm_fb_helper_cfb_fillrect);
+
+void drm_fb_helper_cfb_copyarea(struct fb_info *info,
+		const struct fb_copyarea *area)
+{
+	if (info)
+		cfb_copyarea(info, area);
+}
+EXPORT_SYMBOL(drm_fb_helper_cfb_copyarea);
+
+void drm_fb_helper_cfb_imageblit(struct fb_info *info,
+		const struct fb_image *image)
+{
+	if (info)
+		cfb_imageblit(info, image);
+}
+EXPORT_SYMBOL(drm_fb_helper_cfb_imageblit);
+
 static int setcolreg(struct drm_crtc *crtc, u16 red, u16 green,
 		     u16 blue, u16 regno, struct fb_info *info)
 {
diff --git a/include/drm/drm_fb_helper.h b/include/drm/drm_fb_helper.h
index f74e59e..aa45837 100644
--- a/include/drm/drm_fb_helper.h
+++ b/include/drm/drm_fb_helper.h
@@ -152,6 +152,20 @@  ssize_t drm_fb_helper_sys_read(struct fb_info *info, char __user *buf,
 ssize_t drm_fb_helper_sys_write(struct fb_info *info, const char __user *buf,
 			size_t count, loff_t *ppos);
 
+void drm_fb_helper_sys_fillrect(struct fb_info *info,
+		const struct fb_fillrect *rect);
+void drm_fb_helper_sys_copyarea(struct fb_info *info,
+		const struct fb_copyarea *area);
+void drm_fb_helper_sys_imageblit(struct fb_info *info,
+		const struct fb_image *image);
+
+void drm_fb_helper_cfb_fillrect(struct fb_info *info,
+		const struct fb_fillrect *rect);
+void drm_fb_helper_cfb_copyarea(struct fb_info *info,
+		const struct fb_copyarea *area);
+void drm_fb_helper_cfb_imageblit(struct fb_info *info,
+		const struct fb_image *image);
+
 int drm_fb_helper_setcmap(struct fb_cmap *cmap, struct fb_info *info);
 
 int drm_fb_helper_hotplug_event(struct drm_fb_helper *fb_helper);